Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2004-04-09 23:33:07 +0400
committerCorinna Vinschen <corinna@vinschen.de>2004-04-09 23:33:07 +0400
commit535309a6e303db4a6bf38eb202eee08136efb2cf (patch)
tree3fec56c4b3235f65e94ffd0b008469b4c253a4c4
parent7aa88267c1df43b50cd3236e3e06747e1830d27b (diff)
* path.cc (fsinfo): Global storage for file system information.
(fs_info::update): Store file system information also in fsinfo and short circuit GetVolumeInformation by using alredy stored file system information.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/path.cc21
-rw-r--r--winsup/cygwin/path.h1
3 files changed, 27 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index ff8dfdccf..32070c03a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
2004-04-09 Corinna Vinschen <corinna@vinschen.de>
+ * path.cc (fsinfo): Global storage for file system information.
+ (fs_info::update): Store file system information also in fsinfo and
+ short circuit GetVolumeInformation by using alredy stored file system
+ information.
+
+2004-04-09 Corinna Vinschen <corinna@vinschen.de>
+
* fhandler.h (fhandler_base::status): Declare private.
(fhandler_base::open_status): Ditto.
(class fhandler_socket): Move status bits into private bitfield struct
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 847fbd0c6..9e85f22a2 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -354,6 +354,9 @@ mkrelpath (char *path)
strcpy (path, ".");
}
+#define MAX_FS_INFO_CNT 25
+fs_info fsinfo[MAX_FS_INFO_CNT];
+
bool
fs_info::update (const char *win32_path)
{
@@ -368,8 +371,20 @@ fs_info::update (const char *win32_path)
return false;
}
- if (strcmp (tmp_buf, root_dir_storage) == 0)
- return 1;
+ __ino64_t tmp_name_hash = hash_path_name (1, tmp_buf);
+ if (tmp_name_hash == name_hash)
+ return true;
+ int idx = 0;
+ while (idx < MAX_FS_INFO_CNT && fsinfo[idx].name_hash)
+ {
+ if (tmp_name_hash == fsinfo[idx].name_hash)
+ {
+ *this = fsinfo[idx];
+ return true;
+ }
+ ++idx;
+ }
+ name_hash = tmp_name_hash;
strncpy (root_dir_storage, tmp_buf, CYG_MAX_PATH);
drive_type_storage = GetDriveType (root_dir_storage);
@@ -395,6 +410,8 @@ fs_info::update (const char *win32_path)
*/
sym_opt_storage = (!is_remote_drive_storage && strcmp (name_storage, "NTFS") == 0) ? PC_CHECK_EA : 0;
+ if (idx < MAX_FS_INFO_CNT && drive_type_storage != DRIVE_REMOVABLE)
+ fsinfo[idx] = *this;
return true;
}
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index 56eb0ca81..d3d23d66b 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -75,6 +75,7 @@ struct fs_info
{
char name_storage[CYG_MAX_PATH];
char root_dir_storage[CYG_MAX_PATH];
+ __ino64_t name_hash;
DWORD flags_storage;
DWORD serial_storage;
DWORD sym_opt_storage; /* additional options to pass to symlink_info resolver */