From patchwork Sun Jan 18 20:37:25 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1582 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=1768768731; bh=753+Zt2IDMLgCKtE++hYUeFBSDjdzAh42SAPhHj9zMY=; 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=gbKF4M5zrwRwco+TOlhJ0iHnx5sAmAkc3sDgxPuBXR8cFiZeP7JPaU8NaYyAX9iYa cjWq0EWDA40Jr0QXjsNlBWoj4QbpqfdKSX6vkS2A6Eux72pLNtKnjxCZBr7szZ+u53 W5T0NW7UqFmDELIABThDslLH6TK87rPskiLcDcx6KPtoFr6YWroIaeb5iib3BDNwrh wwKAcrWP94WIKEZ98xcEBQU4YRKkLdZPeY7d6MXlvV582H7Vp/MJhkRBI28/GrHAhd pQKjZXwry1mh9HmXds5vkLvBoYZMKTfTT8J+UR+iHMfvVOiunnIH5JG8XBeb17Ovtk euUKi6iPa4XbA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7867969487 for ; Sun, 18 Jan 2026 13:38:51 -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 olCpqjbSODeL for ; Sun, 18 Jan 2026 13:38:51 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768731; bh=753+Zt2IDMLgCKtE++hYUeFBSDjdzAh42SAPhHj9zMY=; 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=gbKF4M5zrwRwco+TOlhJ0iHnx5sAmAkc3sDgxPuBXR8cFiZeP7JPaU8NaYyAX9iYa cjWq0EWDA40Jr0QXjsNlBWoj4QbpqfdKSX6vkS2A6Eux72pLNtKnjxCZBr7szZ+u53 W5T0NW7UqFmDELIABThDslLH6TK87rPskiLcDcx6KPtoFr6YWroIaeb5iib3BDNwrh wwKAcrWP94WIKEZ98xcEBQU4YRKkLdZPeY7d6MXlvV582H7Vp/MJhkRBI28/GrHAhd pQKjZXwry1mh9HmXds5vkLvBoYZMKTfTT8J+UR+iHMfvVOiunnIH5JG8XBeb17Ovtk euUKi6iPa4XbA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6526969476 for ; Sun, 18 Jan 2026 13:38:51 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768728; bh=716NsYrxBgLEoAkE4Uir6RvASO4Qq/XOHW+emz9IRBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JQ8ZEIi95agV+r5uV+mVpm4aKnw4KivQrDjiWOaFaCJleVQZDiJdnKLeAFameSKEx 9NdxiFEfNcnwz+akx7O0D4Z4Noz3OGo6oB/SL8BKf8lMZFbdkXufL21YVW1tPoWRlH 9tX2BZ1DRvgozRsiQConPE9Z2AgMiqyvO0zMzb8YHqTuxSQmgYcZ77nVlKA1Q9KCRT 6uPokX5RVy7jdJdy0FZ/20FTiuHBwFddAJ048T/7N1WQ9rwWWSKGyOytHoGUCxCG7k Q8z7wRrK49DytuXy5nEWzvnVhaKvLDK9z+oq/HYi2TEeG0edhpomIjrB6GrjkgKxwt /0idACD6/hQ8A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E6A1969476; Sun, 18 Jan 2026 13:38:48 -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 qXt6tupBlOHz; Sun, 18 Jan 2026 13:38:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768723; bh=Cou5+TAI5u2YzB9bAZaLhjsdZLiG0Hhzz005wAP6JvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UPvHuuLGEkzOKb6kozCiHkbJo2dHaynYg+zjGPpddWEXG2WNHwUDqTAq+QmiLoxDj 7P4K73LUVdaFWurgaz7NhVfajo+e1k9iXAtAXBGh6POXfWdnSmscFfPlfA+2zQzgYb eoBnJFKAU99YPuEshZbW6uj9gxThfBjmQ7MPtXqCbM1HnW2tKZ2zVZM9TamjZcmNUT lItDhIz2n6CFIVUhaWXqMjvHXzEstoCB9K6twFlIgyfxx/TLocAXwFRzPzstLNVppT CGGrwt/oMw24drQeVrtOOOhXaAeYTb5h997arRb2eBTlZWsMrpEbEEA+GGLj1KNpVA AfwUOiszjjaxA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4940869382; Sun, 18 Jan 2026 13:38:43 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:25 -0700 Message-ID: <20260118133734.3.221603564e955443340482460f5f74e084701479@changeid> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260118203739.1974323-1-sjg@u-boot.org> References: <20260118203739.1974323-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 36DTUBFDSXN3JYHNTN77YWGQAKKILONN X-Message-ID-Hash: 36DTUBFDSXN3JYHNTN77YWGQAKKILONN 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 03/12] linux: Add fiemap.h header with extent mapping types 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 Create linux/fiemap.h with FIEMAP extent flags, fiemap_extent_info structure, and fiemap operation stubs. Update ext4_uboot.h to use the new header instead of duplicating these definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 24 +++------------------- include/linux/fiemap.h | 45 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 21 deletions(-) create mode 100644 include/linux/fiemap.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 937c819a3f0..185951ac4c1 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -141,11 +141,8 @@ typedef struct { unsigned int val; } kprojid_t; /* Capabilities - use linux/capability.h */ #include -/* FIEMAP extent flags */ -#define FIEMAP_EXTENT_LAST 0x00000001 -#define FIEMAP_EXTENT_UNKNOWN 0x00000002 -#define FIEMAP_EXTENT_DELALLOC 0x00000004 -#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 +/* FIEMAP types - use linux/fiemap.h */ +#include #define EXT4_FIEMAP_EXTENT_HOLE 0x08000000 /* FALLOC_FL_* flags are in linux/fs.h */ @@ -174,18 +171,6 @@ typedef struct { unsigned int val; } kprojid_t; /* iomap types and structs are in linux/iomap.h */ -/* fiemap types */ -#define FIEMAP_FLAG_SYNC 0x00000001 -#define FIEMAP_FLAG_XATTR 0x00000002 -#define FIEMAP_FLAG_CACHE 0x00000004 - -struct fiemap_extent_info { - unsigned int fi_flags; - unsigned int fi_extents_mapped; - unsigned int fi_extents_max; - void *fi_extents_start; -}; - /* fscrypt_str, qstr are now in ext4_fscrypt.h */ /* percpu rw semaphore is in linux/percpu.h */ @@ -850,10 +835,7 @@ static inline int in_range(unsigned long val, unsigned long start, /* Quota stub */ #define dquot_reclaim_block(i, n) do { } while (0) -/* fiemap stubs */ -#define fiemap_prep(i, fi, s, l, f) ({ (void)(i); (void)(fi); (void)(s); (void)(l); (void)(f); 0; }) -#define fiemap_fill_next_extent(fi, l, p, sz, f) ({ (void)(fi); (void)(l); (void)(p); (void)(sz); (void)(f); 0; }) -#define iomap_fiemap(i, fi, s, l, o) ({ (void)(i); (void)(fi); (void)(s); (void)(l); (void)(o); 0; }) +/* fiemap stubs are now in linux/fiemap.h */ /* Memory retry wait */ #define memalloc_retry_wait(g) do { } while (0) diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h new file mode 100644 index 00000000000..f02080832be --- /dev/null +++ b/include/linux/fiemap.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Fiemap definitions for U-Boot + * + * Based on Linux fiemap.h - extent mapping interface. + */ +#ifndef _LINUX_FIEMAP_H +#define _LINUX_FIEMAP_H + +#include + +/* FIEMAP extent flags */ +#define FIEMAP_EXTENT_LAST 0x00000001 +#define FIEMAP_EXTENT_UNKNOWN 0x00000002 +#define FIEMAP_EXTENT_DELALLOC 0x00000004 +#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 + +/* FIEMAP flags */ +#define FIEMAP_FLAG_SYNC 0x00000001 +#define FIEMAP_FLAG_XATTR 0x00000002 +#define FIEMAP_FLAG_CACHE 0x00000004 + +/** + * struct fiemap_extent_info - fiemap request to a filesystem + * @fi_flags: flags as passed from user + * @fi_extents_mapped: number of mapped extents + * @fi_extents_max: size of fiemap_extent array + * @fi_extents_start: start of fiemap_extent array + */ +struct fiemap_extent_info { + unsigned int fi_flags; + unsigned int fi_extents_mapped; + unsigned int fi_extents_max; + void *fi_extents_start; +}; + +/* Fiemap stubs - fiemap not supported in U-Boot */ +#define fiemap_prep(i, fi, s, l, f) \ + ({ (void)(i); (void)(fi); (void)(s); (void)(l); (void)(f); 0; }) +#define fiemap_fill_next_extent(fi, l, p, sz, f) \ + ({ (void)(fi); (void)(l); (void)(p); (void)(sz); (void)(f); 0; }) +#define iomap_fiemap(i, fi, s, l, o) \ + ({ (void)(i); (void)(fi); (void)(s); (void)(l); (void)(o); 0; }) + +#endif /* _LINUX_FIEMAP_H */