From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.70 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796365421; b=T8PEFW3xu5a72mC1DZ6tFd5EHtP9uZkn+h7sVrhaVJDI6Fd392q8LLatNShfUwvZpUoS n/1GAWY73it/4Z2+mAx/Qwqb6bsQ9ryf9aMlHwS5DTLeCUIwLgDjfukJZMPuXb75EX+Td NTpgh+75uRfVacb3uvpPubCg7yNiPm0CbTc4uJKOuXqTdU3Xlkp2w+TVBmLdETWVCmcon lnU9gP3qUUsL7iVjn70BM3bRByekd9pdSrJo5EMuDh2fmgY9oxwyR4NHzxe/OK8H6pJXX l5NDrBzZHAZVz/wcwIGbFD2f13tTWnBDfb/SDKSuFjOTItfE6tlsK2Yj05hW4+0PuJg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796365421; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Received:Date:In-Reply-To:Mime-Version: References:X-Mailer:Message-ID:Subject:From:To:Cc:Content-Type; bh=MHfCVegf92FsPurn7i2mFibIKc1rSuUWaxtpnPaMGa4=; b=ZEsk/5svpK0yZBaENuSCHPh1tFuE3bP8U8WvAlVeA9h2B9YGhedNKu4oUZ5ipyIUHBJ7 VTw6MhkRMmW8CfaOHNxRmVr5DvRdj/9Sn6/ZFb3u5Wrp7o2tMQVo3Rt0rHTXl8XNryHvr NNPF7rdIz2Pz2upTVd9BJgNC8aFWHmVCoEO6UMFFtHMvpLVcbT6eZiInj+NCvlzVeyt5k ZXGE/0M6LSEzKFpcqKFAXmZeN5EXIokKU54OeSsL5x8E66LkuF0SUJzF2AtjMlS6QCc1i ixuddlKqQlVKDCaN7tvg7xXAWD9OV+fpc5vhZ3dGhlg+gdU+7e5LsWmDKZJKCEsIKog== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=etvbzhLN; arc=none smtp.remote-ip=209.85.160.70 Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6ABF606A68D for ; Fri, 4 Dec 2026 06:23:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E6ABF606A68D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=etvbzhLN Received: by mail-oa1-f70.google.com with SMTP id 586e51a60fabf-45e6091d8a1so441139fac.1 for ; Thu, 03 Dec 2026 22:23:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796365420; x=1796970220; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=MHfCVegf92FsPurn7i2mFibIKc1rSuUWaxtpnPaMGa4=; b=etvbzhLNw/PQgzGPzwbAL6CKWib3ly/7jIzZjvHufl9nEaaps8ml//f1KGvSj9wawD QIKWX13juUu1MF9ZnA3vXDLJGdpSuUgPUwv4kMDWcAMzvP64hQ/5CT5bMNabFQMhu24l rYNYXdc3Kl//0rVv9g44mNXiNBkQd54uLIHXvOq8++qhVumHd2sCPYyscj6URh2xxaf8 pDnNiT2PMkfQ3vVeX2hgNx9ltQg0HIUzZZifcDgIcLfROUwEIx1/YNilYc8wRcKZp62X 5lExd2svS7tyEHd628MkwXvPeylekasPu6lTSK9H2ViEntHMWxebnMsyIq9Qyft47Ov6 72VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796365420; x=1796970220; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=MHfCVegf92FsPurn7i2mFibIKc1rSuUWaxtpnPaMGa4=; b=LV2U4T+beX3MOlC3ThnPDr9PVZV+Vc5rXIc2pmjNf2EdMOwb0KsXr5EHpmFt9L6w0O c4TEoBbjMss+dk2Lcp8lmjwN6VOh2b28+OhMASIo/f2qtu20t9KKhZUfVyBruCv3zG0C sCc7SG/GmI4T8Sq3RDXOMhSBZdRQ2wznaaFjfdeCtL/RyovZodOV5wEqynPAvcO9LII5 KIaeURyBOOvm1ynnL2HPlonbss7bBm8fGyHXzlU5htpxBPwlsEw5UeZ8yatZRbgyPeDI YObmob2S4DOUy22oWOa0uMfFrFSS7eME1/mV5nMxFUIcuFjWNNWpcdvQFSyDSuN6CmNf qFXw== X-Gm-Message-State: APuU4Z+82KGzMS8eKjuWU0EZVVPCTzFwYw3xNUow3reZ3xfVlR8j3r1u Lv2LhZRINZeisYxcaMflec2JFo99ZxWj6Q8xcY/nyYSN9HjIbrcDlvIsmqwDSwYDIbpSy0Y0+WX ngjawYdPuWeicb9IFDQFuwHa5JMATBpeSL5fXkZuKzj82dMJXcHDt9KktAtSXLrt6APWIbqe4Dz 3m6e7xDfZCGOG2HGf4seQ3imjOPSa2vaJnn0/UrWQmpGQQg5nKmbhrUPo= X-Received: from oacka10.prod.google.com ([2002:a05:6871:ba0a:b0:4a6:98a5:8dea]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6870:702c:b0:457:4470:96e2 with SMTP id 586e51a60fabf-4e3d5e2f95emr842528fac.12.1796365419730; Thu, 03 Dec 2026 22:23:39 -0800 (PST) Date: Thu, 3 Dec 2026 22:23:25 -0800 In-Reply-To: <20261204062328.2508164-1-irogers@google.com> X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261204062328.2508164-1-irogers@google.com> X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog Message-ID: <20261204062328.2508164-5-irogers@google.com> Subject: [PATCH v3 4/7] tools headers UAPI: Synchronize linux/fs.h with the kernel sources From: Ian Rogers To: linux-perf-users@vger.kernel.org Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com, james.clark@linaro.org, dsahern@gmail.com, andrii@kernel.org, Ian Rogers Content-Type: text/plain; charset="UTF-8" Synchronize tools/include/uapi/linux/fs.h with include/uapi/linux/fs.h and add it to FILES in tools/perf/check-headers.sh so future changes are tracked alongside the trace beauty copy. Upcoming perf PROCMAP_QUERY synthesis code compiles directly against tools/include/uapi/linux/fs.h. Signed-off-by: Ian Rogers --- Notes: This change was developed with the help of an AI coding assistant (Gemini in Jetski), which wrote the initial code, tests and changelog; it was reviewed, built and tested by the author. tools/include/uapi/linux/fs.h | 137 +++++++++++++++++++++++++++++++--- tools/perf/check-headers.sh | 1 + 2 files changed, 129 insertions(+), 9 deletions(-) diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h index f0a26309b6d5..a46c33692aa2 100644 --- a/tools/include/uapi/linux/fs.h +++ b/tools/include/uapi/linux/fs.h @@ -28,8 +28,8 @@ * nr_file rlimit, so it's safe to set up a ridiculously high absolute * upper limit on files-per-process. * - * Some programs (notably those using select()) may have to be - * recompiled to take full advantage of the new limits.. + * Some programs (notably those using select()) may have to be + * recompiled to take full advantage of the new limits.. */ /* Fixed constants first: */ @@ -60,6 +60,17 @@ #define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */ #define RENAME_WHITEOUT (1 << 2) /* Whiteout source */ +/* + * The root inode of procfs is guaranteed to always have the same inode number. + * For programs that make heavy use of procfs, verifying that the root is a + * real procfs root and using openat2(RESOLVE_{NO_{XDEV,MAGICLINKS},BENEATH}) + * will allow you to make sure you are never tricked into operating on the + * wrong procfs file. + */ +enum procfs_ino { + PROCFS_ROOT_INO = 1, +}; + struct file_clone_range { __s64 src_fd; __u64 src_offset; @@ -77,7 +88,7 @@ struct fstrim_range { * We include a length field because some filesystems (vfat) have an identifier * that we do want to expose as a UUID, but doesn't have the standard length. * - * We use a fixed size buffer beacuse this interface will, by fiat, never + * We use a fixed size buffer because this interface will, by fiat, never * support "UUIDs" longer than 16 bytes; we don't want to force all downstream * users to have to deal with that. */ @@ -91,6 +102,63 @@ struct fs_sysfs_path { __u8 name[128]; }; +/* Protection info capability flags */ +#define LBMD_PI_CAP_INTEGRITY (1 << 0) +#define LBMD_PI_CAP_REFTAG (1 << 1) + +/* Checksum types for Protection Information */ +#define LBMD_PI_CSUM_NONE 0 +#define LBMD_PI_CSUM_IP 1 +#define LBMD_PI_CSUM_CRC16_T10DIF 2 +#define LBMD_PI_CSUM_CRC64_NVME 4 + +/* sizeof first published struct */ +#define LBMD_SIZE_VER0 16 + +/* + * Logical block metadata capability descriptor + * If the device does not support metadata, all the fields will be zero. + * Applications must check lbmd_flags to determine whether metadata is + * supported or not. + */ +struct logical_block_metadata_cap { + /* Bitmask of logical block metadata capability flags */ + __u32 lbmd_flags; + /* + * The amount of data described by each unit of logical block + * metadata + */ + __u16 lbmd_interval; + /* + * Size in bytes of the logical block metadata associated with each + * interval + */ + __u8 lbmd_size; + /* + * Size in bytes of the opaque block tag associated with each + * interval + */ + __u8 lbmd_opaque_size; + /* + * Offset in bytes of the opaque block tag within the logical block + * metadata + */ + __u8 lbmd_opaque_offset; + /* Size in bytes of the T10 PI tuple associated with each interval */ + __u8 lbmd_pi_size; + /* Offset in bytes of T10 PI tuple within the logical block metadata */ + __u8 lbmd_pi_offset; + /* T10 PI guard tag type */ + __u8 lbmd_guard_tag_type; + /* Size in bytes of the T10 PI application tag */ + __u8 lbmd_app_tag_size; + /* Size in bytes of the T10 PI reference tag */ + __u8 lbmd_ref_tag_size; + /* Size in bytes of the T10 PI storage tag */ + __u8 lbmd_storage_tag_size; + __u8 pad; +}; + /* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */ #define FILE_DEDUPE_RANGE_SAME 0 #define FILE_DEDUPE_RANGE_DIFFERS 1 @@ -148,6 +216,24 @@ struct fsxattr { unsigned char fsx_pad[8]; }; +/* + * Variable size structure for file_[sg]et_attr(). + * + * Note. This is alternative to the structure 'struct file_kattr'/'struct fsxattr'. + * As this structure is passed to/from userspace with its size, this can + * be versioned based on the size. + */ +struct file_attr { + __u64 fa_xflags; /* xflags field value (get/set) */ + __u32 fa_extsize; /* extsize field value (get/set)*/ + __u32 fa_nextents; /* nextents field value (get) */ + __u32 fa_projid; /* project identifier (get/set) */ + __u32 fa_cowextsize; /* CoW extsize field value (get/set) */ +}; + +#define FILE_ATTR_SIZE_VER0 24 +#define FILE_ATTR_SIZE_LATEST FILE_ATTR_SIZE_VER0 + /* * Flags for the fsx_xflags field */ @@ -167,6 +253,14 @@ struct fsxattr { #define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ #define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */ #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */ +#define FS_XFLAG_VERITY 0x00020000 /* fs-verity enabled */ +/* + * Case handling flags (read-only, cannot be set via ioctl). + * Default (neither set) indicates POSIX semantics: case-sensitive + * lookups and case-preserving storage. + */ +#define FS_XFLAG_CASEFOLD 0x00040000 /* case-insensitive lookups */ +#define FS_XFLAG_CASENONPRESERVING 0x00080000 /* case not preserved */ #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ /* the read-only stuff doesn't really belong here, but any other place is @@ -212,10 +306,9 @@ struct fsxattr { #define BLKROTATIONAL _IO(0x12,126) #define BLKZEROOUT _IO(0x12,127) #define BLKGETDISKSEQ _IOR(0x12,128,__u64) -/* - * A jump here: 130-136 are reserved for zoned block devices - * (see uapi/linux/blkzoned.h) - */ +/* 130-136 and 142 are used by zoned block device ioctls (uapi/linux/blkzoned.h) */ +/* 137-141 are used by blk-crypto ioctls (uapi/linux/blk-crypto.h) */ +#define BLKTRACESETUP2 _IOWR(0x12, 142, struct blk_user_trace_setup2) #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ #define FIBMAP _IO(0x00,1) /* bmap access */ @@ -249,6 +342,8 @@ struct fsxattr { * also /sys/kernel/debug/ for filesystems with debugfs exports */ #define FS_IOC_GETFSSYSFSPATH _IOR(0x15, 1, struct fs_sysfs_path) +/* Get logical block metadata capability details */ +#define FS_IOC_GETLBMD_CAP _IOWR(0x15, 2, struct logical_block_metadata_cap) /* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) @@ -300,7 +395,16 @@ struct fsxattr { #define FS_DAX_FL 0x02000000 /* Inode is DAX */ #define FS_INLINE_DATA_FL 0x10000000 /* Reserved for ext4 */ #define FS_PROJINHERIT_FL 0x20000000 /* Create with parents projid */ -#define FS_CASEFOLD_FL 0x40000000 /* Folder is case insensitive */ +/* + * FS_CASEFOLD_FL indicates case-insensitive name lookup. The + * bit is most often reported on directories, where it controls + * lookups of entries within. Filesystems that derive + * case-insensitivity from mount or volume state may also report + * it on non-directory inodes; userspace must not assume the bit + * is directory-only. FS_XFLAG_CASEFOLD reports the same + * information read-only via FS_IOC_FSGETXATTR. + */ +#define FS_CASEFOLD_FL 0x40000000 #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ @@ -344,10 +448,13 @@ typedef int __bitwise __kernel_rwf_t; /* buffered IO that drops the cache after reading or writing data */ #define RWF_DONTCACHE ((__force __kernel_rwf_t)0x00000080) +/* prevent pipe and socket writes from raising SIGPIPE */ +#define RWF_NOSIGNAL ((__force __kernel_rwf_t)0x00000100) + /* mask of flags supported by the kernel */ #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\ RWF_APPEND | RWF_NOAPPEND | RWF_ATOMIC |\ - RWF_DONTCACHE) + RWF_DONTCACHE | RWF_NOSIGNAL) #define PROCFS_IOCTL_MAGIC 'f' @@ -567,4 +674,16 @@ struct procmap_query { __u64 build_id_addr; /* in */ }; +/* + * Shutdown the filesystem. + */ +#define FS_IOC_SHUTDOWN _IOR('X', 125, __u32) + +/* + * Flags for FS_IOC_SHUTDOWN + */ +#define FS_SHUTDOWN_FLAGS_DEFAULT 0x0 +#define FS_SHUTDOWN_FLAGS_LOGFLUSH 0x1 /* flush log but not data*/ +#define FS_SHUTDOWN_FLAGS_NOLOGFLUSH 0x2 /* don't flush log nor data */ + #endif /* _UAPI_LINUX_FS_H */ diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh index caa7ab26968c..790abfe9f929 100755 --- a/tools/perf/check-headers.sh +++ b/tools/perf/check-headers.sh @@ -7,6 +7,7 @@ NC='\033[0m' # No Color declare -a FILES=( "include/uapi/linux/const.h" "include/uapi/linux/bits.h" + "include/uapi/linux/fs.h" "include/uapi/linux/fscrypt.h" "include/uapi/linux/genetlink.h" "include/uapi/linux/if_addr.h" -- 2.56.1.915.g69d5ec7298-goog