From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.198 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796417951; b=SPblEZcB7gA+dg254c90ItVK+pWQWvAFlPpgXzEYEi9klkrQGSbu+MzPaHkqqFTHzWXP aTn2VW+N0NUgo4hJZiXiZ67fjY4w35UHbh649ZzNNnT+p5ULtlxcOEmeCYC+bmXjHH2q6 1fUeAEVtLpmZF4GbM1d3aCOkhx0qr3mHxXnjU6MLQwH+LxAaDFlovTB5FNRQ9iScrnT9d N0RxgIUE1wqC0NPhlo/nUligJrtw86BY0K/FFTXl3o3Hc9R03yiI6G0mXmETJHT4tqRC2 9M9x9kAJWicchO3Q1QrqmZzjdqxilDwaM7UUSVHpBIoJainqd3hLS88zsRfEAqtTHpg== 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=MlxktjR/vVEVtp2fhXALNp8WX6Nzk4WnxWoQiNn+n5UzyIIfXjGo3qJMxZ1YJNWyEhVa VglK+L1Wr7EjqYldv0qSaY+IH3WynLIi8Y5fXIVEdQHbGNE08NAW/wp682fvhfpWR1gNo RNtZGXUDd87Ry4QgqBjdUmVnTe3Akwcx6ds4maz2NIUW1bTjjZ8YO+MMU3RzbcDhqphh5 4UYpOYxhgdxaUX9nAwHrzzAs8NEV7ztXNlob+mFIQmZCWZWxQwzpJGiArNIXGGMSdy8MA MDW/rW9VJuxxROuUW2FQ7lPac90CZ3xnc/xVNQ9ePjKwvGcMsJMTSUFBBikYagIwtqg== 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.198 Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) (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 B9D79606A6A6 for ; Fri, 4 Dec 2026 20:59:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B9D79606A6A6 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-f198.google.com with SMTP id 5a478bee46e88-386a65fca25so2630693eec.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=oRSVeYLAvpJ4J8LaX3f26prpveFkjI6jziKDk0aLliYyuqfH4KsHYBpc6H8gX7N5c0 UwslsxN1o/xjLJcHRzGgZnqMHd63Yb3E+e/nXBkjXnVnEVvLTRR9iLOCVNB31XYPbDft uULpwL2B8IFGzQewdDzB4p6gyOV83FRJwcGn7gxO2YFWFR/zrR9qE2XNeuPk34xoEBXF R14CMqtdybXZpHI2sNH8yg6gMDju4I2YPc/Tj7EzxhO3YL8AF0P159KEooPCNhrNsQKt pILlt28Z/8rTgmbwV4ZY3rgc0KzaE2K2Me0FjGahAQqDdsz4FMKmbblDSYOHAR0HM4HU VP7w== X-Gm-Message-State: AB4q+uF2q/LzWe/mAq0IIbcyWHCyVdK/VGRPDvn1lGwED9NO0NBuWLvo Ci/4f38PeO9SdbsnXH3Jy1scd6SuK+wqKc47TO/cBJ85jycWYvCLiN9b2yu+s1+7u0Wv1408Ty+ ZXJA/7L0uEg== 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-kernel@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