4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-30 19:10:36 +08:00

* 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.
This commit is contained in:
Corinna Vinschen 2004-04-09 19:33:07 +00:00
parent 7aa88267c1
commit 535309a6e3
3 changed files with 27 additions and 2 deletions

View File

@ -1,3 +1,10 @@
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> 2004-04-09 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_base::status): Declare private. * fhandler.h (fhandler_base::status): Declare private.

View File

@ -354,6 +354,9 @@ mkrelpath (char *path)
strcpy (path, "."); strcpy (path, ".");
} }
#define MAX_FS_INFO_CNT 25
fs_info fsinfo[MAX_FS_INFO_CNT];
bool bool
fs_info::update (const char *win32_path) fs_info::update (const char *win32_path)
{ {
@ -368,8 +371,20 @@ fs_info::update (const char *win32_path)
return false; return false;
} }
if (strcmp (tmp_buf, root_dir_storage) == 0) __ino64_t tmp_name_hash = hash_path_name (1, tmp_buf);
return 1; 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); strncpy (root_dir_storage, tmp_buf, CYG_MAX_PATH);
drive_type_storage = GetDriveType (root_dir_storage); 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; 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; return true;
} }

View File

@ -75,6 +75,7 @@ struct fs_info
{ {
char name_storage[CYG_MAX_PATH]; char name_storage[CYG_MAX_PATH];
char root_dir_storage[CYG_MAX_PATH]; char root_dir_storage[CYG_MAX_PATH];
__ino64_t name_hash;
DWORD flags_storage; DWORD flags_storage;
DWORD serial_storage; DWORD serial_storage;
DWORD sym_opt_storage; /* additional options to pass to symlink_info resolver */ DWORD sym_opt_storage; /* additional options to pass to symlink_info resolver */