From patchwork Sat Jan 17 01:14:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1578 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768612580; bh=w6i0rKWnQcSRKEC3Wv9oF1gmdsRRm/kC+o6G9dtUb2c=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=vUFjvrArrWJOIiSupV2dB0QjsBPmkdu8WTTK/5E8mJs4lrnikr+e+P6R4EWwLhqO9 HWxe52weL4z7jCu2XqmGt17XCvIO30FDK1hpTGYhz0J+rMERL5eP56geySLyVKwTOW OSHsvsDT9dWEoN/tJgVvfoTPmwb7TRvPGxy6PQoNPjmumHLKlDDP2YKMzN5Z8wm9EG tRVpimVI9k4MnZQo7z3PD91zgZEq81xH2ULMRmWBaTUrOkBQ9jNSS9U7mZKT9XpEWW LyVB++8cGdnZLimBa5apEgHND0Wu586jVvlrrxhgMQgnHS5D4k6KyL8gBBBPV8eGBw ipCB3LovA8hHg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5CB846913F for ; Fri, 16 Jan 2026 18:16:20 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id VdnDYgaVHYDH for ; Fri, 16 Jan 2026 18:16:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768612580; bh=w6i0rKWnQcSRKEC3Wv9oF1gmdsRRm/kC+o6G9dtUb2c=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=vUFjvrArrWJOIiSupV2dB0QjsBPmkdu8WTTK/5E8mJs4lrnikr+e+P6R4EWwLhqO9 HWxe52weL4z7jCu2XqmGt17XCvIO30FDK1hpTGYhz0J+rMERL5eP56geySLyVKwTOW OSHsvsDT9dWEoN/tJgVvfoTPmwb7TRvPGxy6PQoNPjmumHLKlDDP2YKMzN5Z8wm9EG tRVpimVI9k4MnZQo7z3PD91zgZEq81xH2ULMRmWBaTUrOkBQ9jNSS9U7mZKT9XpEWW LyVB++8cGdnZLimBa5apEgHND0Wu586jVvlrrxhgMQgnHS5D4k6KyL8gBBBPV8eGBw ipCB3LovA8hHg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 46334693D6 for ; Fri, 16 Jan 2026 18:16:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768612577; bh=kwwBdBLKBxCZEniww7/Wm8Mk++Ve3ukdouFR83fB+m0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Niacs6Z/+0pKBr+Og7ktkosAr/FN8Tc132pYVWcYpwPLKeYiOWqK7rbURW3MF3YEl uP2xF3/lWO8qt2slQjeUZkA0+YoZV2DLflSm36jnl/Sokn+eJVS/iJWLlZViDXfnRg DRVUym8NVIoYTZX5HwlbO7G31o4ZDvp6yiMZgtE3Zq4wCqumASKjnvTpXxL6isjpYK ZpDUaKQPLr/y+2nH4Nz2b2cLBCPg5baWjL9gxC8DN4vjDxYA/sTmilnZL8ObdY46JZ uhBLzHa+2GTEXPFXivVZA6Bd0YXxroUK4TEaUxebejHUhbdCZanaysIeJgtRwGQWYD YzjDk9yqCMVbA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C69B469407; Fri, 16 Jan 2026 18:16:17 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id i22IvCMuU8qq; Fri, 16 Jan 2026 18:16:17 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768612572; bh=uM2FH7a+YKg/wB+TCfIIlWrrzYxIJsdJIHClXG7LTu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+RlCK4Ww/18VPJgdcAtxKZKT784uaj2Yrqm/7+GRAC/vwP+vpAZkaEepGuPlPW/w GeG5ieV/PuNhIWv1Izs7f6905XIyPraiMTWlMtDFgxgPTJtW7VD8o67u8IP+zDtfYj jaIF5gClErDsSC7uBw+H6emymuo4CGbx4D5EI1I3R3X/0rukJH2gBkmrDt4NCfBwo1 BpHYhZ6UKvEPUff4VQK3NxuOnk4FO0AQJTKNJrdoGWvz0s63dB0wlLNTzXtG+vQhsK IlvmhLNpu1CWVi8LfZCTHf8u11cTFQfjV2/Huhhq4GmM9ERXqBnF0k9LcCekI49NX3 mt+V7Q5Gs0MYQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 428D2693D6; Fri, 16 Jan 2026 18:16:12 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 18:14:40 -0700 Message-ID: <20260117011448.3007171-19-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117011448.3007171-1-sjg@u-boot.org> References: <20260117011448.3007171-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: S3JD6663GL7HUVUB2UE5ME7KHVW2GEY7 X-Message-ID-Hash: S3JD6663GL7HUVUB2UE5ME7KHVW2GEY7 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 18/19] linux: Add fsmap.h header with filesystem map definitions List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass 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 Signed-off-by: Simon Glass --- 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 /* 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 + +/** + * 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 */