Cygwin: support exFAT and fix remote FAT/FAT32 recognition
Newer FAT32 and exFAT add FILE_SUPPORTS_ENCRYPTION to their flags which wasn't handled by Cygwin yet. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
		| @@ -130,6 +130,7 @@ const int __collate_load_error = 0; | |||||||
|   extern UNICODE_STRING _RDATA ro_u_mtx = _ROU (L"mtx"); |   extern UNICODE_STRING _RDATA ro_u_mtx = _ROU (L"mtx"); | ||||||
|   extern UNICODE_STRING _RDATA ro_u_csc = _ROU (L"CSC-CACHE"); |   extern UNICODE_STRING _RDATA ro_u_csc = _ROU (L"CSC-CACHE"); | ||||||
|   extern UNICODE_STRING _RDATA ro_u_fat = _ROU (L"FAT"); |   extern UNICODE_STRING _RDATA ro_u_fat = _ROU (L"FAT"); | ||||||
|  |   extern UNICODE_STRING _RDATA ro_u_exfat = _ROU (L"exFAT"); | ||||||
|   extern UNICODE_STRING _RDATA ro_u_mvfs = _ROU (L"MVFS"); |   extern UNICODE_STRING _RDATA ro_u_mvfs = _ROU (L"MVFS"); | ||||||
|   extern UNICODE_STRING _RDATA ro_u_nfs = _ROU (L"NFS"); |   extern UNICODE_STRING _RDATA ro_u_nfs = _ROU (L"NFS"); | ||||||
|   extern UNICODE_STRING _RDATA ro_u_ntfs = _ROU (L"NTFS"); |   extern UNICODE_STRING _RDATA ro_u_ntfs = _ROU (L"NTFS"); | ||||||
|   | |||||||
| @@ -343,9 +343,11 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol) | |||||||
| #define FS_IS_WINDOWS_NTFS TEST_GVI(flags () & MINIMAL_WIN_NTFS_FLAGS, \ | #define FS_IS_WINDOWS_NTFS TEST_GVI(flags () & MINIMAL_WIN_NTFS_FLAGS, \ | ||||||
| 				    MINIMAL_WIN_NTFS_FLAGS) | 				    MINIMAL_WIN_NTFS_FLAGS) | ||||||
| /* These are the exact flags of a real Windows FAT/FAT32 filesystem. | /* These are the exact flags of a real Windows FAT/FAT32 filesystem. | ||||||
|  |    Newer FAT32/exFAT support FILE_SUPPORTS_ENCRYPTION as well. | ||||||
|    Anything else is a filesystem faking to be FAT. */ |    Anything else is a filesystem faking to be FAT. */ | ||||||
| #define WIN_FAT_FLAGS (FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK) | #define WIN_FAT_FLAGS (FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK) | ||||||
| #define FS_IS_WINDOWS_FAT  TEST_GVI(flags (), WIN_FAT_FLAGS) | #define FAT_IGNORE (FILE_SUPPORTS_ENCRYPTION) | ||||||
|  | #define FS_IS_WINDOWS_FAT  TEST_GVI(flags () & ~FAT_IGNORE, WIN_FAT_FLAGS) | ||||||
|  |  | ||||||
|       if ((flags () & FILE_SUPPORTS_OBJECT_IDS) |       if ((flags () & FILE_SUPPORTS_OBJECT_IDS) | ||||||
| 	  && NT_SUCCESS (NtQueryVolumeInformationFile (vol, &io, &ffoi, | 	  && NT_SUCCESS (NtQueryVolumeInformationFile (vol, &io, &ffoi, | ||||||
| @@ -379,6 +381,8 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol) | |||||||
| 	is_cifs (!FS_IS_WINDOWS_FAT); | 	is_cifs (!FS_IS_WINDOWS_FAT); | ||||||
|       /* Then check remote filesystems honest about their name. */ |       /* Then check remote filesystems honest about their name. */ | ||||||
|       if (!got_fs () |       if (!got_fs () | ||||||
|  | 	  /* Microsoft exFAT */ | ||||||
|  | 	  && !is_exfat (RtlEqualUnicodeString (&fsname, &ro_u_exfat, FALSE)) | ||||||
| 	  /* Microsoft NFS needs distinct access methods for metadata. */ | 	  /* Microsoft NFS needs distinct access methods for metadata. */ | ||||||
| 	  && !is_nfs (RtlEqualUnicodeString (&fsname, &ro_u_nfs, FALSE)) | 	  && !is_nfs (RtlEqualUnicodeString (&fsname, &ro_u_nfs, FALSE)) | ||||||
| 	  /* MVFS == Rational ClearCase remote filesystem.  Has a couple of | 	  /* MVFS == Rational ClearCase remote filesystem.  Has a couple of | ||||||
| @@ -430,6 +434,7 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol) | |||||||
|   if (!got_fs () |   if (!got_fs () | ||||||
|       && !is_ntfs (RtlEqualUnicodeString (&fsname, &ro_u_ntfs, FALSE)) |       && !is_ntfs (RtlEqualUnicodeString (&fsname, &ro_u_ntfs, FALSE)) | ||||||
|       && !is_fat (RtlEqualUnicodePathPrefix (&fsname, &ro_u_fat, TRUE)) |       && !is_fat (RtlEqualUnicodePathPrefix (&fsname, &ro_u_fat, TRUE)) | ||||||
|  |       && !is_exfat (RtlEqualUnicodeString (&fsname, &ro_u_exfat, FALSE)) | ||||||
|       && !is_refs (RtlEqualUnicodeString (&fsname, &ro_u_refs, FALSE)) |       && !is_refs (RtlEqualUnicodeString (&fsname, &ro_u_refs, FALSE)) | ||||||
|       && !is_csc_cache (RtlEqualUnicodeString (&fsname, &ro_u_csc, FALSE)) |       && !is_csc_cache (RtlEqualUnicodeString (&fsname, &ro_u_csc, FALSE)) | ||||||
|       && is_cdrom (ffdi.DeviceType == FILE_DEVICE_CD_ROM)) |       && is_cdrom (ffdi.DeviceType == FILE_DEVICE_CD_ROM)) | ||||||
| @@ -1553,6 +1558,7 @@ mount_info::del_item (const char *path, unsigned flags) | |||||||
| fs_names_t fs_names[] = { | fs_names_t fs_names[] = { | ||||||
|     { "none", false }, |     { "none", false }, | ||||||
|     { "vfat", true }, |     { "vfat", true }, | ||||||
|  |     { "exfat", true }, | ||||||
|     { "ntfs", true }, |     { "ntfs", true }, | ||||||
|     { "refs", true }, |     { "refs", true }, | ||||||
|     { "smbfs", false }, |     { "smbfs", false }, | ||||||
|   | |||||||
| @@ -31,6 +31,7 @@ enum fs_info_type | |||||||
| { | { | ||||||
|   none = 0, |   none = 0, | ||||||
|   fat, |   fat, | ||||||
|  |   exfat, | ||||||
|   ntfs, |   ntfs, | ||||||
|   refs, |   refs, | ||||||
|   samba, |   samba, | ||||||
| @@ -100,6 +101,7 @@ class fs_info | |||||||
|   IMPLEMENT_STATUS_FLAG (bool, has_buggy_basic_info) |   IMPLEMENT_STATUS_FLAG (bool, has_buggy_basic_info) | ||||||
|   IMPLEMENT_STATUS_FLAG (bool, has_dos_filenames_only) |   IMPLEMENT_STATUS_FLAG (bool, has_dos_filenames_only) | ||||||
|   IMPLEMENT_FS_FLAG (fat) |   IMPLEMENT_FS_FLAG (fat) | ||||||
|  |   IMPLEMENT_FS_FLAG (exfat) | ||||||
|   IMPLEMENT_FS_FLAG (ntfs) |   IMPLEMENT_FS_FLAG (ntfs) | ||||||
|   IMPLEMENT_FS_FLAG (refs) |   IMPLEMENT_FS_FLAG (refs) | ||||||
|   IMPLEMENT_FS_FLAG (samba) |   IMPLEMENT_FS_FLAG (samba) | ||||||
|   | |||||||
| @@ -369,6 +369,8 @@ class path_conv | |||||||
|   DWORD fs_name_len () const {return fs.name_len ();} |   DWORD fs_name_len () const {return fs.name_len ();} | ||||||
|   bool fs_got_fs () const { return fs.got_fs (); } |   bool fs_got_fs () const { return fs.got_fs (); } | ||||||
|   bool fs_is_fat () const {return fs.is_fat ();} |   bool fs_is_fat () const {return fs.is_fat ();} | ||||||
|  |   bool fs_is_exfat () const {return fs.is_exfat ();} | ||||||
|  |   bool fs_is_any_fat () const {return fs.is_fat () || fs.is_exfat ();} | ||||||
|   bool fs_is_ntfs () const {return fs.is_ntfs ();} |   bool fs_is_ntfs () const {return fs.is_ntfs ();} | ||||||
|   bool fs_is_refs () const {return fs.is_refs ();} |   bool fs_is_refs () const {return fs.is_refs ();} | ||||||
|   bool fs_is_samba () const {return fs.is_samba ();} |   bool fs_is_samba () const {return fs.is_samba ();} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user