From 077560c53953d0c5762535778f1b9e0dd050719a Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Thu, 24 Apr 2025 14:53:23 -0700 Subject: [PATCH] xfs_io: redefine what statx -m all does 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 Reviewed-by: Andrey Albershteyn Reviewed-by: Christoph Hellwig Reviewed-by: John Garry --- io/stat.c | 7 ++++--- io/statx.h | 8 +++++++- man/man8/xfs_io.8 | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/io/stat.c b/io/stat.c index b37b1a12..52e2d330 100644 --- 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) { diff --git a/io/statx.h b/io/statx.h index 273644f5..f7ef1d27 100644 --- a/io/statx.h +++ b/io/statx.h @@ -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 * diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8 index 726e25af..19821510 100644 --- a/man/man8/xfs_io.8 +++ b/man/man8/xfs_io.8 @@ -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 Specify a numeric field mask for the statx call. -- 2.47.2