From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.69 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796524490; b=5Rkgshn3vErzy5qbRbammv0Kux5gePkuMOPYSqPJxB55CkCDFqgbZn6HOwMyRXCrWXSd VwcBmW8dZsl6w5b1qSXN42h3kCYoPXcBu7hhPJ8fLzmD42QG2kIxYUX+Oo0Q1xxXgVWCm SKoZ7+LepKHoSCrQt/bY6iifo2eWk2SqZDx3zMZggF1eNRUVHk+IGOqtPgKUn9pyry0z3 vlwsZNiwZ1S34TcSmEMRbYzBWCL64I2SsF9Kz+48JaKS3s3WZySR7hv7xw8xRwhRlwKc9 r0MOXLTyJ+jx2xgAWnsnBKEJliTUJhDx+G9dqZBex67HXlU728/nNdt3Hx+rwLhTD8A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796524490; 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=TzZfkvCSFIRl3REjbDQs6eNoCwe66w0L+pivALxo24JkMgPNLG6B5qq2dY8QXz4gctLg 4bUfURzkbJ8LxstMlKmc+9BGf1t9J6m1vwd0Q4sWBc1cA/bBorw0E8FP3nFkaujwdbGtS BVV5qSednyrsDlKrK++9peJ72vt0xC1D+REWZ+pmwjQStR/I3bUVu6O4lTuGU4gMAyjms MQdjL7fjqat4+kRtYPGwZSNBDb2AhQgxQ54YtkyAW8U/yCPVkozEya5YjTqtG3orKxIlK JRJT1FX7Z6e+eVRaFM6zWSfntFTBd+GEPCyHDt5Yv9AnMCAxfC6KqpZOOVlT3qU1GfQ== 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="M/9juVUe"; arc=none smtp.remote-ip=74.125.82.69 Received: from mail-dl1-f69.google.com (mail-dl1-f69.google.com [74.125.82.69]) (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 94F22606A332 for ; Sun, 6 Dec 2026 02:34:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 94F22606A332 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=M/9juVUe Received: by mail-dl1-f69.google.com with SMTP id a92af1059eb24-1b56c696405so6841596c88.1 for ; Sat, 05 Dec 2026 18:34:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796524489; x=1797129289; 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=M/9juVUerDWUuIP324l+wq1VXVIQENQ8DVFiKxTh/xqxFjkcMKFqZIFgpDpuoZrY/M i47vSXMyK24ATrB+K1l5hwBIeHsg7FnFcDYIS4dclnN9s+H/EwX74qhAmHed6eGD3Rwh iiUFK/CPdL+E3kZC3kp+B3ygRLeMNLgYcyuCvzr+ec/1TlLOivixmAXRqJUjCLPQniDz r0D/MGWxC5KGTql1VhQXyXOeROi7DQV7ukvEitkIG7fUdC8tDUbUlfYs0NMqlgleDFt5 8yE8vFs+Hhe+0jJBYqllzZXZanbRRi1OyyqRTS8M/CkoeaCzLuOORmjvvB7RCJzVbUt1 dgbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796524489; x=1797129289; 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=uD7MmVGoSJbauiWKIHW8tyqKrt9u5ixs28cu3KGHswDftT/nhoSWUy/ZqrnoKbyy/n r9F0DU499JIkK1DceDNqYbyGEl8kS5KoIdFJooKdH6hLT2svFKxZ22x1Ees+TYBsXx2f zXlPabB3A/gHKs/VCHPuqOaefQR48zvN1dxvmYuljgNhaltuc9bi7xE0HaQhaxy0TFCC m53V3ZMWS3Nf840UfRSyuoOXfnUyfq0Hz0sVPiAxm5/oZlZWcaS/JExJ05Mz6dEDnI46 9cI0AOvVnavUYeQPVyX0oRiBlCbr6BqTIXWfDvxfNgH9lPjs7DC8FnSigk5b68hRlvwA MN5w== X-Gm-Message-State: APuU4Z9MTmFOHc57pkUeFsg9ij5B+XVyECgunperq27kZk7RUp+2N8Ct myniMeivPAZW6CD4Z5tGCBtUwIz43LMLscz+M7jrrdA1U71LV94YH+tuIrBpb4Z2gyZYamNreIj NIHiW2EJpug== X-Received: from dlgx29-n1.prod.google.com ([2002:a05:701a:ccdd:10b0:1a2:e6ba:5856]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:701a:ccd4:10b0:1b5:d483:8351 with SMTP id a92af1059eb24-1b5d70d1a20mr6782870c88.14.1796524488298; Sat, 05 Dec 2026 18:34:48 -0800 (PST) Date: Sat, 5 Dec 2026 18:34:10 -0800 In-Reply-To: <20261206023413.3078292-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: <20261206023413.3078292-1-irogers@google.com> X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog Message-ID: <20261206023413.3078292-5-irogers@google.com> Subject: [PATCH v5 4/7] tools headers UAPI: Synchronize linux/fs.h with the kernel sources From: Ian Rogers To: linux-perf-users@vger.kernel.org, acme@kernel.org, namhyung@kernel.org Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, 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