From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.200 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796417951; b=t+TQfGi3NZjK2z5GfndQ9Jof32zWmk5iJ6hRqt3/kFannWqUdtCwsVwTkR1FROBHY/ve sMMJpV5JhkdFFup8rlBXcyAl/xOrCqGwHER3OhVJTu2jbELNyjyf5cv8iaoNfv+t8n0by +HUjtrO6wFij+ABYS93pkAygp86yimg3eYHVZhHRmaXQamHk/WzpQUZYz0pXr5iALJpaX Z0zMCXNMFtIrKdIXwUMJgNqiz56Foom06q4dkIPCyRRXzMImYqnx0UkBmIyYVNQeUoZAU +x8iHkVwYkH888w0V1W91SZzeRHN88WThTGq6Vawsn3r0vLFAmLNkS0Anq3to4qgcDw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796417951; 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=x8VeM+E1ZkvCbCpUcNFRCQWKjWV/BvC39wWdM/UJDmM=; b=wVEI8j8L/nIjMoP5GTpBYq7gRelMV96KGA7NfsixQNQJRKwMHMAYJZnVzNZhT6AszzQM 6yO6LGrDpV2NLhsW/KH2wkndXO9a8HM9511MPCuCgA4NF/a4YgKSEssGqOXIiuHzzDuHX 9nabj81anvE24yitV4okOV3y6u/bs/BTKEZ3BMW1hxJN2wr1gf6jYE6Ex9U0KrTZK5wri mWu6DtIuzDm68oxzBg7zmTEP9hzDXSzm/SfQFRdzLVKTp9h3ePhsN4g+2RWTwnJ1lzPwp MOI++Y2N4jm7jgyoQ2W/Byv2RLSn4IxRnOKgsd/Wl2vDRRJzZ19IFp48ROaHYcBmjDw== 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=bb7pLXw+; arc=none smtp.remote-ip=74.125.82.200 Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) (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 B507A606A6A4 for ; Fri, 4 Dec 2026 20:59:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B507A606A6A4 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=bb7pLXw+ Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-386a65fca25so2630701eec.0 for ; Fri, 04 Dec 2026 12:59:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796417950; x=1797022750; 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=x8VeM+E1ZkvCbCpUcNFRCQWKjWV/BvC39wWdM/UJDmM=; b=bb7pLXw+GDX2aCfbq5uhxZOFPF4rs5sGxtvmuFbp+NrlDADzu1gEkLvXgcTGyxjlve 9t48UUtZqyJFYFglC/2zTAs9Qb1z972CBoRdUqq95rSkRh1CCzh9zRMrSu+uZMD+/M/A xColLArCQw40fOz1aHeuUk6aJ8rOTx9t5GpbDUvAv63wRXg5nb05fFONHK0H3jrExT9P G6Ownrfr2UUXGzGiAe3hwexaBJQDxpSO0caxKhNPiHP28jSrPuaSgQiQ174qqsg5M7+B dPlRPgnA9I/2ep6pKUr/H0pEAIDgXXZ1ZkuIhSYUjx5L8lYwjHaY+XApKWun5KfLztCn kTLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796417950; x=1797022750; 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=x8VeM+E1ZkvCbCpUcNFRCQWKjWV/BvC39wWdM/UJDmM=; b=tjhRTWxgZi6bbxxXpM59OvwFhD2wSul1DZ5l5tAoLt9y0WopYivwWB1HV2y3v3pa6K HM5GupObn501thj0zy77ptVZ/AsLm6xduaychzy7ZQgu3JsuGxWixwmQxWq5NfrC5gqD 1XIbiVtOR7NVYbNIzYvE+JcgN4gV2OkQhIXkRE3i+VP96+OoAuTEiAprtwRyNmEvVBeD uSSCmE4TPz/rEm0Z0n31Kc1xLSLXAiZZCu+RdNXuvCfJuN/JOgZQNlDxg67P5d5SZ2Wq pQUWBC4KMRk9HYkg5V+UIF54T+k7IYITCyK1Fy5WQmVSXS8K7Hy2v6FWQh3vfA8RDMlo 4bpQ== X-Gm-Message-State: AB4q+uEZxxEcClpc3JCHNPBATgKzDj9vVVlzpeh6tyHnoWs6Jc0z6VWI z98SdfkNscUrygpsJCAJkl2rOCGcTokeIaiLrst4ZjFgRXBTcy3JEAec/d5Kwm1dPcrIknFRU0I QAuxj6WaTscgKyWe3F08dbi3eH3iC9n7uuwvLUu4TcGw1b5OX8myYNdx4unTnE/a0+VIgZWH88X vWHrtMM/a+taiyewJdyfRbc7ywyMJzrVgqhGFGfmZfEnoeKtlufqy91MI= X-Received: from dycuf14.prod.google.com ([2002:a05:7300:10e:b0:37b:806f:5de2]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:693c:42dc:b0:386:d2a2:135b with SMTP id 5a478bee46e88-387521c81c3mr2751878eec.39.1796417949487; Fri, 04 Dec 2026 12:59:09 -0800 (PST) Date: Fri, 4 Dec 2026 12:58:50 -0800 In-Reply-To: <20261204205854.3973609-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: <20261204205854.3973609-1-irogers@google.com> X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog Message-ID: <20261204205854.3973609-5-irogers@google.com> Subject: [PATCH v4 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 --- 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