From: Simon Glass <simon.glass@canonical.com> Move filesystem map (fsmap) structure and constants to a dedicated header file that mirrors the Linux kernel organisation. fsmap.h provides: - struct fsmap - filesystem extent mapping structure - FMR_OWN_FREE, FMR_OWN_UNKNOWN - special owner values - FMR_OWNER() - construct owner from type and code - FMR_OF_SPECIAL_OWNER - flag for special owners - FMH_IF_VALID, FMH_OF_DEV_T - head flags These are used by the ext4l fsmap.c for the FS_IOC_GETFSMAP ioctl. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 19 ++---------------- include/linux/fsmap.h | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 include/linux/fsmap.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 979af9ed22a..a4d863b86e1 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1976,23 +1976,8 @@ int ext4_update_overhead(struct super_block *sb, bool force); * Stubs for fsmap.c */ -/* fsmap.c stubs - struct fsmap from linux/fsmap.h */ -struct fsmap { - __u32 fmr_device; /* device id */ - __u32 fmr_flags; /* mapping flags */ - __u64 fmr_physical; /* device offset of segment */ - __u64 fmr_owner; /* owner id */ - __u64 fmr_offset; /* file offset of segment */ - __u64 fmr_length; /* length of segment */ - __u64 fmr_reserved[3]; /* must be zero */ -}; - -#define FMR_OWN_FREE (-1ULL) -#define FMR_OWN_UNKNOWN (-2ULL) -#define FMR_OWNER(type, code) (((__u64)(type) << 32) | (__u64)(code)) -#define FMR_OF_SPECIAL_OWNER (1 << 0) -#define FMH_IF_VALID 0 -#define FMH_OF_DEV_T (1 << 0) +/* fsmap is now in linux/fsmap.h */ +#include <linux/fsmap.h> /* list_sort and sort stubs for fsmap.c */ #define list_sort(priv, head, cmp) \ diff --git a/include/linux/fsmap.h b/include/linux/fsmap.h new file mode 100644 index 00000000000..6b5ef9e2faa --- /dev/null +++ b/include/linux/fsmap.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Filesystem map definitions for U-Boot + * + * Based on Linux fsmap.h - for FS_IOC_GETFSMAP ioctl. + */ +#ifndef _LINUX_FSMAP_H +#define _LINUX_FSMAP_H + +#include <linux/types.h> + +/** + * struct fsmap - filesystem extent mapping + * @fmr_device: device identifier + * @fmr_flags: mapping flags + * @fmr_physical: physical offset on device + * @fmr_owner: owner identifier + * @fmr_offset: logical offset in file + * @fmr_length: length of the extent + * @fmr_reserved: reserved (must be zero) + */ +struct fsmap { + __u32 fmr_device; + __u32 fmr_flags; + __u64 fmr_physical; + __u64 fmr_owner; + __u64 fmr_offset; + __u64 fmr_length; + __u64 fmr_reserved[3]; +}; + +/* Special owner values */ +#define FMR_OWN_FREE (-1ULL) +#define FMR_OWN_UNKNOWN (-2ULL) + +/* Construct owner value from type and code */ +#define FMR_OWNER(type, code) (((__u64)(type) << 32) | (__u64)(code)) + +/* fsmap flags */ +#define FMR_OF_SPECIAL_OWNER (1 << 0) + +/* fsmap head flags */ +#define FMH_IF_VALID 0 +#define FMH_OF_DEV_T (1 << 0) + +#endif /* _LINUX_FSMAP_H */ -- 2.43.0