From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Zorro Lang <zlang@kernel.org>,
fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/5] statx.h: update to latest kernel UAPI
Date: Tue, 13 Aug 2024 22:12:03 -0700 [thread overview]
Message-ID: <20240814051203.GB865349@frogsfrogsfrogs> (raw)
In-Reply-To: <20240814045232.21189-2-hch@lst.de>
On Wed, Aug 14, 2024 at 06:52:10AM +0200, Christoph Hellwig wrote:
> Update the localy provided statx definition to the latest kernel UAPI,
> and use it unconditionally instead only if no kernel version is provided.
>
> This allows using more recent additions than provided in the system
> headers.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks good to me,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> src/statx.h | 38 ++++++++++++++++++++++++++++++++------
> 1 file changed, 32 insertions(+), 6 deletions(-)
>
> diff --git a/src/statx.h b/src/statx.h
> index 3f239d791..bae1c86f6 100644
> --- a/src/statx.h
> +++ b/src/statx.h
> @@ -5,6 +5,14 @@
> #include <sys/syscall.h>
> #include <linux/types.h>
>
> +/*
> + * Swizzle the symbol namespace so that we can provide our own version
> + * overriding the system one that might now have all the latest fields
> + * under the standard names even when <sys/stat.h> is included.
> + */
> +#define statx_timestamp statx_timestamp_fstests
> +#define statx statx_fstests
> +
> #ifndef AT_STATX_SYNC_TYPE
> #define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */
> #define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */
> @@ -28,8 +36,6 @@
> # endif
> #endif
>
> -#ifndef STATX_TYPE
> -
> /*
> * Timestamp structure for the timestamps in struct statx.
> *
> @@ -102,7 +108,8 @@ struct statx {
> __u64 stx_ino; /* Inode number */
> __u64 stx_size; /* File size */
> __u64 stx_blocks; /* Number of 512-byte blocks allocated */
> - __u64 __spare1[1];
> + __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
> +
> /* 0x40 */
> struct statx_timestamp stx_atime; /* Last access time */
> struct statx_timestamp stx_btime; /* File creation time */
> @@ -114,7 +121,18 @@ struct statx {
> __u32 stx_dev_major; /* ID of device containing file [uncond] */
> __u32 stx_dev_minor;
> /* 0x90 */
> - __u64 __spare2[14]; /* Spare space for future expansion */
> + __u64 stx_mnt_id;
> + __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
> + __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
> + /* 0xa0 */
> + __u64 stx_subvol; /* Subvolume identifier */
> + __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */
> + __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */
> + /* 0xb0 */
> + __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */
> + __u32 __spare1[1];
> + /* 0xb8 */
> + __u64 __spare3[9]; /* Spare space for future expansion */
> /* 0x100 */
> };
>
> @@ -139,6 +157,12 @@ 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_MNT_ID 0x00001000U /* Got stx_mnt_id */
> +#define STATX_DIOALIGN 0x00002000U /* Want/got direct I/O alignment info */
> +#define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
> +#define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */
> +#define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */
> +
> #define STATX_ALL 0x00000fffU /* All currently supported flags */
>
> /*
> @@ -157,9 +181,11 @@ struct statx {
> #define STATX_ATTR_APPEND 0x00000020 /* [I] File is append-only */
> #define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */
> #define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */
> -
> #define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */
> -#endif /* STATX_TYPE */
> +#define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */
> +#define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */
> +#define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */
> +#define STATX_ATTR_WRITE_ATOMIC 0x00400000 /* File supports atomic write operations */
>
> static inline
> int xfstests_statx(int dfd, const char *filename, unsigned flags,
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2024-08-14 5:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 4:52 improve minalign handling v2 Christoph Hellwig
2024-08-14 4:52 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
2024-08-14 5:12 ` Darrick J. Wong [this message]
2024-08-14 4:52 ` [PATCH 2/5] add a new min_dio_alignment helper Christoph Hellwig
2024-08-14 5:12 ` Darrick J. Wong
2024-09-10 17:09 ` Eric Biggers
2024-08-14 4:52 ` [PATCH 3/5] xfs/424: don't use _min_dio_alignment Christoph Hellwig
2024-08-14 4:52 ` [PATCH 4/5] generic: don't use _min_dio_alignment without a device argument Christoph Hellwig
2024-08-14 4:52 ` [PATCH 5/5] replace _min_dio_alignment with calls to src/min_dio_alignment Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2024-08-13 7:34 improve minalign handling Christoph Hellwig
2024-08-13 7:35 ` [PATCH 1/5] statx.h: update to latest kernel UAPI Christoph Hellwig
2024-08-13 14:37 ` Darrick J. Wong
2024-08-13 14:54 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240814051203.GB865349@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
--cc=zlang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox