From 98e103aac96bad385e6082c40681c76c1f37181c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 11 Apr 2005 21:54:54 +0000 Subject: [PATCH] Revert previous patch. * autoload.cc (GetVolumePathNamesForVolumeNameA): Remove. * autoload.cc (GetVolumeNameForVolumeMountPointA): Add. * syscalls.cc (sync): Rewrite guid case to skip floppies also on Windows 2000. --- winsup/cygwin/ChangeLog | 8 ++++++++ winsup/cygwin/autoload.cc | 2 +- winsup/cygwin/syscalls.cc | 28 ++++++++++++++-------------- winsup/cygwin/wincap.cc | 24 ++++++++++++------------ winsup/cygwin/wincap.h | 4 ++-- 5 files changed, 37 insertions(+), 29 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b87a1e6f0..345f252fe 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2005-04-11 Corinna Vinschen + + Revert previous patch. + * autoload.cc (GetVolumePathNamesForVolumeNameA): Remove. + * autoload.cc (GetVolumeNameForVolumeMountPointA): Add. + * syscalls.cc (sync): Rewrite guid case to skip floppies also on + Windows 2000. + 2005-04-11 Corinna Vinschen * syscalls.cc (sync): Use renamed has_get_volume_pathnames wincap. diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index 9ca88db98..f0180160b 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -517,7 +517,7 @@ LoadDLLfuncEx (GetConsoleWindow, 0, kernel32, 1) LoadDLLfuncEx (GetDiskFreeSpaceEx, 16, kernel32, 1) LoadDLLfuncEx (GetNativeSystemInfo, 4, kernel32, 1) LoadDLLfuncEx (GetSystemTimes, 12, kernel32, 1) -LoadDLLfuncEx (GetVolumePathNamesForVolumeNameA, 16, kernel32, 1) +LoadDLLfuncEx (GetVolumeNameForVolumeMountPointA, 12, kernel32, 1) LoadDLLfuncEx2 (IsDebuggerPresent, 0, kernel32, 1, 1) LoadDLLfunc (IsProcessorFeaturePresent, 4, kernel32); LoadDLLfuncEx (IsWow64Process, 8, kernel32, 1); diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index b49b82445..b3e7eb04f 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -939,28 +939,28 @@ sync () { char vol[CYG_MAX_PATH]; - if (wincap.has_get_volume_pathnames ()) /* Win2k and newer */ + if (wincap.has_guid_volumes ()) /* Win2k and newer */ { + char a_drive[CYG_MAX_PATH] = {0}; + char b_drive[CYG_MAX_PATH] = {0}; + + if (is_floppy ("A:")) + GetVolumeNameForVolumeMountPointA ("A:\\", a_drive, CYG_MAX_PATH); + if (is_floppy ("B:")) + GetVolumeNameForVolumeMountPointA ("B:\\", a_drive, CYG_MAX_PATH); + HANDLE sh = FindFirstVolumeA (vol, CYG_MAX_PATH); if (sh != INVALID_HANDLE_VALUE) { do { - char pvol[CYG_MAX_PATH]; - DWORD len; - if (GetVolumePathNamesForVolumeNameA (vol, pvol, CYG_MAX_PATH, - &len)) - debug_printf ("Try volume %s (GUID: %s)", pvol, vol); - else - debug_printf ("Try volume %s", vol); + debug_printf ("Try volume %s", vol); - /* Check pvol for being a floppy on A: or B:. Skip them. */ - if (strncasematch (pvol, "A:", 2) - || strncasematch (pvol, "B:", 2)) + /* Check vol for being a floppy on A: or B:. Skip them. */ + if (strcasematch (vol, a_drive) || strcasematch (vol, b_drive)) { - pvol[2] = '\0'; - if (is_floppy (pvol)) - continue; + debug_printf ("Is floppy, don't sync"); + continue; } /* Eliminate trailing backslash. */ diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index bec5278b2..9a790b087 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -57,7 +57,7 @@ static NO_COPY wincaps wincap_unknown = { has_ioctl_storage_get_media_types_ex:false, start_proc_suspended:true, has_extended_priority_class:false, - has_get_volume_pathnames:false + has_guid_volumes:false }; static NO_COPY wincaps wincap_95 = { @@ -106,7 +106,7 @@ static NO_COPY wincaps wincap_95 = { has_ioctl_storage_get_media_types_ex:false, start_proc_suspended:true, has_extended_priority_class:false, - has_get_volume_pathnames:false + has_guid_volumes:false }; static NO_COPY wincaps wincap_95osr2 = { @@ -155,7 +155,7 @@ static NO_COPY wincaps wincap_95osr2 = { has_ioctl_storage_get_media_types_ex:false, start_proc_suspended:true, has_extended_priority_class:false, - has_get_volume_pathnames:false + has_guid_volumes:false }; static NO_COPY wincaps wincap_98 = { @@ -204,7 +204,7 @@ static NO_COPY wincaps wincap_98 = { has_ioctl_storage_get_media_types_ex:false, start_proc_suspended:true, has_extended_priority_class:false, - has_get_volume_pathnames:false + has_guid_volumes:false }; static NO_COPY wincaps wincap_98se = { @@ -253,7 +253,7 @@ static NO_COPY wincaps wincap_98se = { has_ioctl_storage_get_media_types_ex:false, start_proc_suspended:true, has_extended_priority_class:false, - has_get_volume_pathnames:false + has_guid_volumes:false }; static NO_COPY wincaps wincap_me = { @@ -302,7 +302,7 @@ static NO_COPY wincaps wincap_me = { has_ioctl_storage_get_media_types_ex:false, start_proc_suspended:true, has_extended_priority_class:false, - has_get_volume_pathnames:false + has_guid_volumes:false }; static NO_COPY wincaps wincap_nt3 = { @@ -351,7 +351,7 @@ static NO_COPY wincaps wincap_nt3 = { has_ioctl_storage_get_media_types_ex:false, start_proc_suspended:false, has_extended_priority_class:false, - has_get_volume_pathnames:false + has_guid_volumes:false }; static NO_COPY wincaps wincap_nt4 = { @@ -400,7 +400,7 @@ static NO_COPY wincaps wincap_nt4 = { has_ioctl_storage_get_media_types_ex:false, start_proc_suspended:false, has_extended_priority_class:false, - has_get_volume_pathnames:false + has_guid_volumes:false }; static NO_COPY wincaps wincap_nt4sp4 = { @@ -449,7 +449,7 @@ static NO_COPY wincaps wincap_nt4sp4 = { has_ioctl_storage_get_media_types_ex:false, start_proc_suspended:false, has_extended_priority_class:false, - has_get_volume_pathnames:false + has_guid_volumes:false }; static NO_COPY wincaps wincap_2000 = { @@ -498,7 +498,7 @@ static NO_COPY wincaps wincap_2000 = { has_ioctl_storage_get_media_types_ex:false, start_proc_suspended:false, has_extended_priority_class:true, - has_get_volume_pathnames:false + has_guid_volumes:true }; static NO_COPY wincaps wincap_xp = { @@ -547,7 +547,7 @@ static NO_COPY wincaps wincap_xp = { has_ioctl_storage_get_media_types_ex:true, start_proc_suspended:false, has_extended_priority_class:true, - has_get_volume_pathnames:true + has_guid_volumes:true }; static NO_COPY wincaps wincap_2003 = { @@ -596,7 +596,7 @@ static NO_COPY wincaps wincap_2003 = { has_ioctl_storage_get_media_types_ex:true, start_proc_suspended:false, has_extended_priority_class:true, - has_get_volume_pathnames:true + has_guid_volumes:true }; wincapc wincap; diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h index 52c208534..6d7d63ec9 100644 --- a/winsup/cygwin/wincap.h +++ b/winsup/cygwin/wincap.h @@ -58,7 +58,7 @@ struct wincaps unsigned has_ioctl_storage_get_media_types_ex : 1; unsigned start_proc_suspended : 1; unsigned has_extended_priority_class : 1; - unsigned has_get_volume_pathnames : 1; + unsigned has_guid_volumes : 1; }; class wincapc @@ -121,7 +121,7 @@ public: bool IMPLEMENT (has_ioctl_storage_get_media_types_ex) bool IMPLEMENT (start_proc_suspended) bool IMPLEMENT (has_extended_priority_class) - bool IMPLEMENT (has_get_volume_pathnames) + bool IMPLEMENT (has_guid_volumes) #undef IMPLEMENT }; -- 2.43.5