diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2024-03-08 21:54:58 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2024-03-08 21:54:58 +0100 |
commit | 06aa5a751682118ef1d7f2456f8937b4ac181fac (patch) | |
tree | e1713ac629843aec0d175f2ba379df3324a1e477 /winsup | |
parent | 2100c6ef0dee120c316b7bea42bf5e93c281e808 (diff) | |
download | newlib-06aa5a751682118ef1d7f2456f8937b4ac181fac.zip newlib-06aa5a751682118ef1d7f2456f8937b4ac181fac.tar.gz newlib-06aa5a751682118ef1d7f2456f8937b4ac181fac.tar.bz2 |
Cygwin: FS_IOC_[GS]ETFLAGS: handle pinned and unpinned attributes
Add FS_PINNED_FL and FS_UNPINNED_FL flags and handle them with
mode bits 'p' and 'u' in chattr(1) and lsattr(1).
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/fhandler/disk_file.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/fs.h | 6 | ||||
-rw-r--r-- | winsup/doc/utils.xml | 6 | ||||
-rw-r--r-- | winsup/utils/chattr.c | 8 | ||||
-rw-r--r-- | winsup/utils/lsattr.c | 6 |
5 files changed, 23 insertions, 7 deletions
diff --git a/winsup/cygwin/fhandler/disk_file.cc b/winsup/cygwin/fhandler/disk_file.cc index f359214..9aadbb5 100644 --- a/winsup/cygwin/fhandler/disk_file.cc +++ b/winsup/cygwin/fhandler/disk_file.cc @@ -2763,7 +2763,9 @@ fhandler_disk_file::fs_ioc_getflags () | FS_SYSTEM_FL \ | FS_ARCHIVE_FL \ | FS_TEMP_FL \ - | FS_NOTINDEXED_FL) + | FS_NOTINDEXED_FL\ + | FS_PINNED_FL \ + | FS_UNPINNED_FL) int fhandler_disk_file::fs_ioc_setflags (uint64_t flags) diff --git a/winsup/cygwin/include/cygwin/fs.h b/winsup/cygwin/include/cygwin/fs.h index 9b4baf3..76d9245 100644 --- a/winsup/cygwin/include/cygwin/fs.h +++ b/winsup/cygwin/include/cygwin/fs.h @@ -41,10 +41,12 @@ details. */ #define FS_OFFLINE_FL 0x000001000ULL /* DOS Offline */ #define FS_NOTINDEXED_FL 0x000002000ULL /* DOS Not context indexed */ #define FS_ENCRYPT_FL 0x000004000ULL /* Encrypted file */ +#define FS_PINNED_FL 0x000080000ULL /* Pinned file */ +#define FS_UNPINNED_FL 0x000100000ULL /* Unpinned file */ #define FS_CASESENS_FL 0x100000000ULL /* Case sensitive dir */ -#define FS_FL_USER_VISIBLE 0x100007f27ULL /* User visible flags */ -#define FS_FL_USER_MODIFIABLE 0x100006b27ULL /* User modifiable flags */ +#define FS_FL_USER_VISIBLE 0x100187f27ULL /* User visible flags */ +#define FS_FL_USER_MODIFIABLE 0x100186b27ULL /* User modifiable flags */ /* Flags for renameat2, from /usr/include/linux/fs.h. For now we support only RENAME_NOREPLACE. */ diff --git a/winsup/doc/utils.xml b/winsup/doc/utils.xml index b93671b..fbb39f5 100644 --- a/winsup/doc/utils.xml +++ b/winsup/doc/utils.xml @@ -68,7 +68,7 @@ case sensitivity. </para> - <para>The format of 'mode' is {+-=}[acCehnrsSt]</para> + <para>The format of 'mode' is {+-=}[acCehnprsStu]</para> <para>The operator '+' causes the selected attributes to be added to the existing attributes of the files; '-' causes them to be removed; and @@ -88,6 +88,8 @@ 'n', 'Notindexed': file or directory is not to be indexed by the content indexing service 'e', 'Encrypted': file is encrypted + 'p', 'Pinned': file is pinned + 'u', 'Unpinned': file is unpinned 'C', 'Casesensitive': directory is handled case sensitive </screen> </refsect1> @@ -1448,6 +1450,8 @@ bash$ locale noexpr 'n', 'Notindexed': file or directory is not to be indexed by the content indexing service 'e', 'Encrypted': file is encrypted + 'p', 'Pinned': file is pinned + 'u', 'Unpinned': file is unpinned 'C', 'Casesensitive': directory is handled case sensitive (Windows 10 1803 or later, local NTFS only, WSL must be installed) diff --git a/winsup/utils/chattr.c b/winsup/utils/chattr.c index 4b07413..4ba9771 100644 --- a/winsup/utils/chattr.c +++ b/winsup/utils/chattr.c @@ -53,10 +53,12 @@ struct { FS_OFFLINE_FL, 'o', NULL }, { FS_NOTINDEXED_FL, 'n', "Notindexed" }, { FS_ENCRYPT_FL, 'e', "Encrypted" }, + { FS_PINNED_FL, 'p', "Pinned" }, + { FS_UNPINNED_FL, 'u', "Unpinned" }, { FS_CASESENS_FL, 'C', "Casesensitive" }, { 0, '\0', NULL }, }; -const char *supp_list = "rhsatSrconeC"; +const char *supp_list = "rhsatSrconepuC"; void print_flags (uint64_t flags) @@ -245,7 +247,7 @@ usage (FILE *stream) " -H, --help this help text\n" " -v, --version display the program version\n" "\n" - "The format of 'mode' is {+-=}[acCehnrsSt]\n" + "The format of 'mode' is {+-=}[acCehnprsStu]\n" "\n" "The operator '+' causes the selected attributes to be added to the\n" "existing attributes of the files; '-' causes them to be removed; and\n" @@ -264,6 +266,8 @@ usage (FILE *stream) " 'n', 'Notindexed': file or directory is not to be indexed by the\n" " content indexing service\n" " 'e', 'Encrypted': file is encrypted\n" + " 'p', 'Pinned': file is pinned\n" + " 'u', 'Unpinned': file is unpinned\n" " 'C', 'Casesensitive': directory is handled case sensitive\n"); exit (stream == stdout ? 0 : 1); } diff --git a/winsup/utils/lsattr.c b/winsup/utils/lsattr.c index 7002280..50935f6 100644 --- a/winsup/utils/lsattr.c +++ b/winsup/utils/lsattr.c @@ -53,6 +53,8 @@ struct { FS_OFFLINE_FL, 'o', "Offline" }, { FS_NOTINDEXED_FL, 'n', "Notindexed" }, { FS_ENCRYPT_FL, 'e', "Encrypted" }, + { FS_PINNED_FL, 'p', "Pinned" }, + { FS_UNPINNED_FL, 'u', "Unpinned" }, { FS_CASESENS_FL, 'C', "Casesensitive" }, { 0, '\0', NULL }, }; @@ -218,6 +220,8 @@ usage (FILE *stream) " 'n', 'Notindexed': file or directory is not to be indexed by the\n" " content indexing service\n" " 'e', 'Encrypted': file is encrypted\n" + " 'p', 'Pinned': file is pinned\n" + " 'u', 'Unpinned': file is unpinned\n" " 'C', 'Casesensitive': directory is handled case sensitive\n" " (Windows 10 1803 or later, local NTFS only,\n" " WSL must be installed)\n"); @@ -284,7 +288,7 @@ main (int argc, char **argv) ret = 1; } else if (lsattr (argv[optind])) - ret = 1; + ret = 1; } return ret; } |