From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 8936A3858C74; Mon, 20 Mar 2023 11:58:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8936A3858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679313509; bh=3AsYkWUz6Q94nGQTkjCcBYZ73pE4IE7+kyVU5APtND4=; h=From:To:Subject:Date:From; b=P6K5mEmUtdzsetLQlADL+UrZ13f4oOUD/EAPXxQRLeSzGf2G/LnFVqpFcLdUVbllQ Q0oVSOHdfzO7X9MSM/XR/kBTgsgQdCKLpwQdnKSPBIkAwyo89BIXE/c9tTQD4WdBah Qwe9dv1dPCEI/uIJ6gI8+9IvBnWbhCUjsxSIAGuo= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: fs_info: update filesystem flags and check Windows 7 flags X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: 5da71b6059956a8f20a6be02e82867aa28aa3880 X-Git-Newrev: fcccdc4021ffbe86c5ea6bb3b5c64b95c98f4ed4 Message-Id: <20230320115829.8936A3858C74@sourceware.org> Date: Mon, 20 Mar 2023 11:58:29 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dfcccdc4021f= fbe86c5ea6bb3b5c64b95c98f4ed4 commit fcccdc4021ffbe86c5ea6bb3b5c64b95c98f4ed4 Author: Corinna Vinschen AuthorDate: Mon Mar 20 12:22:07 2023 +0100 Commit: Corinna Vinschen CommitDate: Mon Mar 20 12:55:30 2023 +0100 Cygwin: fs_info: update filesystem flags and check Windows 7 flags =20 Update the list of filesystem flags to the flags supported since Windows 7. Make sure to use the new flags only with Windows filesystems, not with 3rd party filesystems. =20 Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/local_includes/winlean.h | 23 +++++++++++++ winsup/cygwin/mount.cc | 60 +++++++++++++++++++++++++++++-= ---- 2 files changed, 74 insertions(+), 9 deletions(-) diff --git a/winsup/cygwin/local_includes/winlean.h b/winsup/cygwin/local_i= ncludes/winlean.h index 9b30b6557c4f..113b2c6b0d3f 100644 --- a/winsup/cygwin/local_includes/winlean.h +++ b/winsup/cygwin/local_includes/winlean.h @@ -74,6 +74,29 @@ details. */ #undef CRITICAL #endif =20 +/* Filesystem flags not yet supported by Mingw-w64 headers. */ +#ifndef FILE_RETURNS_CLEANUP_RESULT_INFO +#define FILE_RETURNS_CLEANUP_RESULT_INFO 0x00000200 +#endif +#ifndef FILE_SUPPORTS_POSIX_UNLINK_RENAME +#define FILE_SUPPORTS_POSIX_UNLINK_RENAME 0x00000400 +#endif +#ifndef FILE_SUPPORTS_INTEGRITY_STREAMS +#define FILE_SUPPORTS_INTEGRITY_STREAMS 0x04000000 +#endif +#ifndef FILE_SUPPORTS_BLOCK_REFCOUNTING +#define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000 +#endif +#ifndef FILE_SUPPORTS_SPARSE_VDL +#define FILE_SUPPORTS_SPARSE_VDL 0x10000000 +#endif +#ifndef FILE_DAX_VOLUME +#define FILE_DAX_VOLUME 0x20000000 +#endif +#ifndef FILE_SUPPORTS_GHOSTING +#define FILE_SUPPORTS_GHOSTING 0x40000000 +#endif + /* So-called "Microsoft Account" SIDs (S-1-11-...) have a netbios domain n= ame "MicrosoftAccounts". The new "Application Container SIDs" (S-1-15-...) have a netbios domain name "APPLICATION PACKAGE AUTHORITY" diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index b44d60e1e3eb..627d120059a3 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -319,12 +319,49 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol) to Windows 11. The important point here is to test only flags indicati= ng capabilities and to ignore flags indicating a specific state of this volume. At present these flags to ignore are FILE_VOLUME_IS_COMPRESSED, - FILE_READ_ONLY_VOLUME, and FILE_SEQUENTIAL_WRITE_ONCE. The additional - filesystem flags supported since Windows 7 are also ignored for now. - They add information only for filesystems also supporting these flags, - right now only NTFS. */ -#define GETVOLINFO_VALID_MASK (0x002701ffUL) + FILE_READ_ONLY_VOLUME, FILE_SEQUENTIAL_WRITE_ONCE and FILE_DAX_VOLUME. = */ +#define GETVOLINFO_VALID_MASK (FILE_CASE_SENSITIVE_SEARCH \ + | FILE_CASE_PRESERVED_NAMES \ + | FILE_UNICODE_ON_DISK \ + | FILE_PERSISTENT_ACLS \ + | FILE_FILE_COMPRESSION \ + | FILE_VOLUME_QUOTAS \ + | FILE_SUPPORTS_SPARSE_FILES \ + | FILE_SUPPORTS_REPARSE_POINTS \ + | FILE_SUPPORTS_REMOTE_STORAGE \ + | FILE_RETURNS_CLEANUP_RESULT_INFO \ + | FILE_SUPPORTS_POSIX_UNLINK_RENAME \ + | FILE_SUPPORTS_OBJECT_IDS \ + | FILE_SUPPORTS_ENCRYPTION \ + | FILE_NAMED_STREAMS \ + | FILE_SUPPORTS_TRANSACTIONS \ + | FILE_SUPPORTS_HARD_LINKS \ + | FILE_SUPPORTS_EXTENDED_ATTRIBUTES \ + | FILE_SUPPORTS_OPEN_BY_FILE_ID \ + | FILE_SUPPORTS_USN_JOURNAL \ + | FILE_SUPPORTS_INTEGRITY_STREAMS \ + | FILE_SUPPORTS_BLOCK_REFCOUNTING \ + | FILE_SUPPORTS_SPARSE_VDL \ + | FILE_SUPPORTS_GHOSTING) +/* This is the pre-Win7 mask used to recognize 3rd-party drivers. We'll n= ever + learn in time when those drivers start to support the new (har har) Win= 7 FS + flags. */ +#define GETVOLINFO_NON_WIN_MASK (FILE_CASE_SENSITIVE_SEARCH \ + | FILE_CASE_PRESERVED_NAMES \ + | FILE_UNICODE_ON_DISK \ + | FILE_PERSISTENT_ACLS \ + | FILE_FILE_COMPRESSION \ + | FILE_VOLUME_QUOTAS \ + | FILE_SUPPORTS_SPARSE_FILES \ + | FILE_SUPPORTS_REPARSE_POINTS \ + | FILE_SUPPORTS_REMOTE_STORAGE \ + | FILE_SUPPORTS_OBJECT_IDS \ + | FILE_SUPPORTS_ENCRYPTION \ + | FILE_NAMED_STREAMS \ + | FILE_SUPPORTS_TRANSACTIONS) + #define TEST_GVI(f,m) (((f) & GETVOLINFO_VALID_MASK) =3D=3D (m)) +#define TEST_GVI_NON_WIN(f,m) (((f) & GETVOLINFO_NON_WIN_MASK) =3D=3D (m)) =20 /* FIXME: This flag twist is getting awkward. There should really be some other method. Maybe we need mount flags to allow the user to fix file @@ -335,7 +372,7 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol) #define SAMBA_IGNORE (FILE_VOLUME_QUOTAS \ | FILE_SUPPORTS_OBJECT_IDS \ | FILE_UNICODE_ON_DISK) -#define FS_IS_SAMBA TEST_GVI(flags () & ~SAMBA_IGNORE, \ +#define FS_IS_SAMBA TEST_GVI_NON_WIN(flags () & ~SAMBA_IGNORE, \ FILE_CASE_SENSITIVE_SEARCH \ | FILE_CASE_PRESERVED_NAMES \ | FILE_PERSISTENT_ACLS) @@ -343,12 +380,12 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol) #define NETAPP_IGNORE (FILE_SUPPORTS_SPARSE_FILES \ | FILE_SUPPORTS_REPARSE_POINTS \ | FILE_PERSISTENT_ACLS) -#define FS_IS_NETAPP_DATAONTAP TEST_GVI(flags () & ~NETAPP_IGNORE, \ +#define FS_IS_NETAPP_DATAONTAP TEST_GVI_NON_WIN(flags () & ~NETAPP_IGNORE,= \ FILE_CASE_SENSITIVE_SEARCH \ | FILE_CASE_PRESERVED_NAMES \ | FILE_UNICODE_ON_DISK \ | FILE_NAMED_STREAMS) -/* These are the minimal flags supported by NTFS since Windows 2000. Every +/* These are the minimal flags supported by NTFS since Windows 7. Every filesystem not supporting these flags is not a native NTFS. We subsume them under the filesystem type "cifs". */ #define MINIMAL_WIN_NTFS_FLAGS (FILE_CASE_SENSITIVE_SEARCH \ @@ -361,7 +398,12 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol) | FILE_SUPPORTS_REPARSE_POINTS \ | FILE_SUPPORTS_OBJECT_IDS \ | FILE_SUPPORTS_ENCRYPTION \ - | FILE_NAMED_STREAMS) + | FILE_NAMED_STREAMS \ + | FILE_SUPPORTS_TRANSACTIONS \ + | FILE_SUPPORTS_HARD_LINKS \ + | FILE_SUPPORTS_EXTENDED_ATTRIBUTES \ + | FILE_SUPPORTS_OPEN_BY_FILE_ID \ + | FILE_SUPPORTS_USN_JOURNAL) #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.