]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_io: redefine what statx -m all does
authorDarrick J. Wong <djwong@kernel.org>
Thu, 24 Apr 2025 21:53:23 +0000 (14:53 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Mon, 28 Apr 2025 10:56:58 +0000 (12:56 +0200)
As of kernel commit 581701b7efd60b ("uapi: deprecate STATX_ALL"),
STATX_ALL is deprecated and has been withdrawn from the kernel codebase.
The symbol still exists for userspace to avoid compilation breakage, but
we're all suppose to stop using it.

Therefore, redefine statx -m all to set all the bits except for the
reserved bit since it's pretty silly that "all" doesn't actually get you
all the fields.

Update the STATX_ALL definition in io/statx.h so people stop using it.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: John Garry <john.g.garry@oracle.com>
io/stat.c
io/statx.h
man/man8/xfs_io.8

index b37b1a12b8b2fdd5beb2d4fe900e797f0c68879c..52e2d33010a99a2f4853288b880fa2f68818efb7 100644 (file)
--- a/io/stat.c
+++ b/io/stat.c
@@ -332,7 +332,8 @@ statx_help(void)
 " -v -- More verbose output\n"
 " -r -- Print raw statx structure fields\n"
 " -m mask -- Specify the field mask for the statx call\n"
-"            (can also be 'basic' or 'all'; default STATX_ALL)\n"
+"            (can also be 'basic' or 'all'; defaults to\n"
+"             STATX_BASIC_STATS | STATX_BTIME)\n"
 " -D -- Don't sync attributes with the server\n"
 " -F -- Force the attributes to be sync'd with the server\n"
 "\n"));
@@ -391,7 +392,7 @@ statx_f(
        char            *p;
        struct statx    stx;
        int             atflag = 0;
-       unsigned int    mask = STATX_ALL;
+       unsigned int    mask = STATX_BASIC_STATS | STATX_BTIME;
 
        while ((c = getopt(argc, argv, "m:rvFD")) != EOF) {
                switch (c) {
@@ -399,7 +400,7 @@ statx_f(
                        if (strcmp(optarg, "basic") == 0)
                                mask = STATX_BASIC_STATS;
                        else if (strcmp(optarg, "all") == 0)
-                               mask = STATX_ALL;
+                               mask = ~STATX__RESERVED;
                        else {
                                mask = strtoul(optarg, &p, 0);
                                if (!p || p == optarg) {
index 273644f53cf1c4bceb1342e37d2de71ebc7d8c00..f7ef1d2784a2a965354f58fc6025d4e1bfdee002 100644 (file)
@@ -170,9 +170,15 @@ struct statx {
 #define STATX_BLOCKS           0x00000400U     /* Want/got stx_blocks */
 #define STATX_BASIC_STATS      0x000007ffU     /* The stuff in the normal stat struct */
 #define STATX_BTIME            0x00000800U     /* Want/got stx_btime */
-#define STATX_ALL              0x00000fffU     /* All currently supported flags */
 #define STATX__RESERVED                0x80000000U     /* Reserved for future struct statx expansion */
 
+/*
+ * This is deprecated, and shall remain the same value in the future.  To avoid
+ * confusion please use the equivalent (STATX_BASIC_STATS | STATX_BTIME)
+ * instead.
+ */
+#define STATX_ALL              0x00000fffU
+
 /*
  * Attributes to be found in stx_attributes
  *
index 726e25af27224293d69196fcf70d537d660ba5ef..198215103812c6b39f0bac5513974f9c5de55d22 100644 (file)
@@ -994,7 +994,8 @@ Dump raw statx structure values.
 Set the field mask for the statx call to STATX_BASIC_STATS.
 .TP
 .B \-m all
-Set the the field mask for the statx call to STATX_ALL (default).
+Set all bits in the field mask for the statx call except for STATX__RESERVED.
+The default is to set STATX_BASIC_STATS and STATX_BTIME.
 .TP
 .B \-m <mask>
 Specify a numeric field mask for the statx call.