From patchwork Sat Jan 17 01:14:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1574 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=1768612563; bh=SbBr+q6Pmh4GrDXQz944gJt+VeYZx7x2JSsk0nozlis=; 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=iFGpq8qiZwgL6G6Iu2+OTPHXVkkEdCMvH7b1dsS9FR6DpVHiL99OfRlYUnKqwkKRj zZyK+kw/AHYznjRJmNE7Fn7gDfV7I2ZZ5B/4SH273eSjyG9JPMIV/jMPFNSXnyNLKr NfnG6NF6LH7hT+nL3EwL4ZuVvhDE2E3ZFs+ToKD5Cdy1YaauA/eJ3yK+5xpj+gvEo4 bEnJ0JHUuRg+qaGUicp6hlZj9W0iy66l2ZFhP2YlUCYv1Qf87w/GtOtxp9tZXkY46s 8ix6Kn/c5VIW5ZOPpUBylDltlWbXXCkEpgvQ9yprcGSAhM5/97qkkYY9puo0xfuJNX 2QDkO20Zn4yng== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AA1A4693D6 for ; Fri, 16 Jan 2026 18:16:03 -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 Qq9JGYwM4gg3 for ; Fri, 16 Jan 2026 18:16:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768612563; bh=SbBr+q6Pmh4GrDXQz944gJt+VeYZx7x2JSsk0nozlis=; 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=iFGpq8qiZwgL6G6Iu2+OTPHXVkkEdCMvH7b1dsS9FR6DpVHiL99OfRlYUnKqwkKRj zZyK+kw/AHYznjRJmNE7Fn7gDfV7I2ZZ5B/4SH273eSjyG9JPMIV/jMPFNSXnyNLKr NfnG6NF6LH7hT+nL3EwL4ZuVvhDE2E3ZFs+ToKD5Cdy1YaauA/eJ3yK+5xpj+gvEo4 bEnJ0JHUuRg+qaGUicp6hlZj9W0iy66l2ZFhP2YlUCYv1Qf87w/GtOtxp9tZXkY46s 8ix6Kn/c5VIW5ZOPpUBylDltlWbXXCkEpgvQ9yprcGSAhM5/97qkkYY9puo0xfuJNX 2QDkO20Zn4yng== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 90A426913F for ; Fri, 16 Jan 2026 18:16:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768612561; bh=5RiNDTN/uy0ObyJF+2TPkLwOJi/te83NikmWuoVjEj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O0xaUSbISeTby9IQrVCDChoS4nGOymtvrRIcsumEPuvYy7PsY4aeFeKvv96Y7idjo BGxXijtkli0CVT44vwl3UCyA7IFqb+RBdjH3fDRsFLJa/vBSX6b1lKCsczgClEpffr X6s+yFfxMHztQbXcICMbOiQ2bnLNCN2CplJ+YWdZ3jF5KWZGHspJdmS/2CYaJKMQaE rQdQYMzh/ZudO//gM9xe74cYRK4HWk9vp9CdNgCfzZosiF1glct/hfUvwV+BdiD8QS ZhoC2Rx9lsF2/tU5OSbyI84dzebJT9RaDQ8D8p1OGe4Al37tLAfGNoekv9Qp/okQAU +zSGwAruPUY/g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F234A6913F; Fri, 16 Jan 2026 18:16:01 -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 neJLBX__nyRX; Fri, 16 Jan 2026 18:16:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768612557; bh=of1k7yeoC702CHZIQxIBie2HAK+yI2HhE/GQS/GVNmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l5jkLd4noxClt4M+JmM7h3+DwG3VoNjiPRNceN8/yPF3mE5p9f/Gj7zwBRGrPyMnK 7J+PpopOiWEXXCA8uN2t+6DM439a+sd82XUEUMv6k29jsIYUZ6jWzzviZpVKCH/rOb 6vlrClEc/rEp8gVZzP8qjdPbaBr+Of327/tA8s9GxJuu48/tRO2EGE+5hjeMZWzN2o oF/WDPrgxWshM/LQ2ADhkaIbpX0qh+JCgE2UFN6tN+CP1Oe5KortCSVGxQOUdKW/bG X4g31gngFKkEfe2jlvGx+0ALhQxnKKfCFYzdE5uFoQM1OrYwxIfy82FgInQ0rXZUP+ GD2Z0VSyBvpwQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A8497693D6; Fri, 16 Jan 2026 18:15:57 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 18:14:36 -0700 Message-ID: <20260117011448.3007171-15-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: 2VLYCYXY5STUIXBV2Q5RSYK3KSNCSJ64 X-Message-ID-Hash: 2VLYCYXY5STUIXBV2Q5RSYK3KSNCSJ64 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 14/19] linux: Add xarray.h header with XArray stubs 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 XArray type and operation stubs to a dedicated header file that mirrors the Linux kernel organisation. xarray.h provides: - xa_mark_t type for XArray marks - struct xarray (empty stub) - xa_init(), xa_destroy() - initialisation stubs - xa_load(), xa_erase(), xa_insert() - access stubs - xa_empty() - always returns true - xa_for_each(), xa_for_each_range() - iteration macros (iterate zero times) These are stubs since U-Boot doesn't use the XArray data structure. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 26 +++------------------- include/linux/xarray.h | 50 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 23 deletions(-) create mode 100644 include/linux/xarray.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 655d64398d5..97bcc48d922 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -915,10 +915,9 @@ static inline int in_range(unsigned long val, unsigned long start, /* folio and pagemap - use linux/pagemap.h */ #include +#include -/* xa_mark_t - xarray mark type */ -typedef unsigned int xa_mark_t; - +/* wbc_to_tag - convert writeback control to pagecache tag */ static inline xa_mark_t wbc_to_tag(struct writeback_control *wbc) { if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) @@ -1673,28 +1672,9 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned * Stubs for mballoc.c */ -/* XArray stub structure */ -struct xarray { - int dummy; -}; - +/* XArray is now in linux/xarray.h */ /* Per-CPU stubs are in linux/percpu.h */ -/* XArray function stubs */ -#define xa_init(xa) do { } while (0) -#define xa_destroy(xa) do { } while (0) -#define xa_load(xa, index) ((void *)NULL) -#define xa_erase(xa, index) do { (void)(xa); (void)(index); } while (0) -#define xa_insert(xa, index, entry, gfp) ({ (void)(xa); (void)(index); (void)(entry); (void)(gfp); 0; }) -#define xa_empty(xa) ({ (void)(xa); 1; }) - -/* XArray iteration stubs - iterate zero times */ -#define xa_for_each(xa, index, entry) \ - for ((index) = 0, (entry) = NULL; 0; ) - -#define xa_for_each_range(xa, index, entry, start, end) \ - for ((index) = (start), (entry) = NULL; 0; ) - /* Bit operations for little-endian bitmaps */ #define __clear_bit_le(bit, addr) clear_bit_le(bit, addr) diff --git a/include/linux/xarray.h b/include/linux/xarray.h new file mode 100644 index 00000000000..49c00ed9380 --- /dev/null +++ b/include/linux/xarray.h @@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * XArray stubs for U-Boot + * + * U-Boot doesn't have the XArray data structure, so these are stubs. + */ +#ifndef _LINUX_XARRAY_H +#define _LINUX_XARRAY_H + +#include + +/** + * typedef xa_mark_t - XArray mark type + * + * Used to tag entries in an XArray. + */ +typedef unsigned int xa_mark_t; + +/** + * struct xarray - XArray data structure + * + * U-Boot stub - the XArray is not used. + */ +struct xarray { + int dummy; +}; + +/* XArray initialisation/destruction stubs */ +#define xa_init(xa) do { } while (0) +#define xa_destroy(xa) do { } while (0) + +/* XArray lookup stubs - always return NULL */ +#define xa_load(xa, index) ((void *)NULL) + +/* XArray modification stubs */ +#define xa_erase(xa, index) do { (void)(xa); (void)(index); } while (0) +#define xa_insert(xa, index, entry, gfp) \ + ({ (void)(xa); (void)(index); (void)(entry); (void)(gfp); 0; }) + +/* XArray query stubs - always empty */ +#define xa_empty(xa) ({ (void)(xa); 1; }) + +/* XArray iteration stubs - iterate zero times */ +#define xa_for_each(xa, index, entry) \ + for ((index) = 0, (entry) = NULL; 0; ) + +#define xa_for_each_range(xa, index, entry, start, end) \ + for ((index) = (start), (entry) = NULL; 0; ) + +#endif /* _LINUX_XARRAY_H */