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:
Corinna Vinschen 2018-12-23 17:53:55 +01:00
parent 092a768885
commit 0c25ca40ce
4 changed files with 12 additions and 1 deletions

View File

@ -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_csc = _ROU (L"CSC-CACHE");
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_nfs = _ROU (L"NFS");
extern UNICODE_STRING _RDATA ro_u_ntfs = _ROU (L"NTFS");

View File

@ -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, \
MINIMAL_WIN_NTFS_FLAGS)
/* 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. */
#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)
&& 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);
/* Then check remote filesystems honest about their name. */
if (!got_fs ()
/* Microsoft exFAT */
&& !is_exfat (RtlEqualUnicodeString (&fsname, &ro_u_exfat, FALSE))
/* Microsoft NFS needs distinct access methods for metadata. */
&& !is_nfs (RtlEqualUnicodeString (&fsname, &ro_u_nfs, FALSE))
/* 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 ()
&& !is_ntfs (RtlEqualUnicodeString (&fsname, &ro_u_ntfs, FALSE))
&& !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_csc_cache (RtlEqualUnicodeString (&fsname, &ro_u_csc, FALSE))
&& 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[] = {
{ "none", false },
{ "vfat", true },
{ "exfat", true },
{ "ntfs", true },
{ "refs", true },
{ "smbfs", false },

View File

@ -31,6 +31,7 @@ enum fs_info_type
{
none = 0,
fat,
exfat,
ntfs,
refs,
samba,
@ -100,6 +101,7 @@ class fs_info
IMPLEMENT_STATUS_FLAG (bool, has_buggy_basic_info)
IMPLEMENT_STATUS_FLAG (bool, has_dos_filenames_only)
IMPLEMENT_FS_FLAG (fat)
IMPLEMENT_FS_FLAG (exfat)
IMPLEMENT_FS_FLAG (ntfs)
IMPLEMENT_FS_FLAG (refs)
IMPLEMENT_FS_FLAG (samba)

View File

@ -369,6 +369,8 @@ class path_conv
DWORD fs_name_len () const {return fs.name_len ();}
bool fs_got_fs () const { return fs.got_fs (); }
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_refs () const {return fs.is_refs ();}
bool fs_is_samba () const {return fs.is_samba ();}