From patchwork Sun Jan 18 20:37:23 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1580 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=1768768724; bh=OZwQ2UQQD+rtO0adTHHqdua1SFqPHzhVzLBTXfRB5T0=; 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=wFr8aV/BszUoDARZ1B/2Np9FTF/jke4s+X26qIKjEavKL3mYS5Z2Cr+Uq46Ipm8zT xUCsfCox0vRYFNoj7wbov4wr13ARprVMO32KEBRh+2QgHCDe7WvzX8wqyLoEdcwPiM 5udhHxcs3hWiys/DC0HqeUBl97utidcuvdReD2uhuzRFGW4mJVUdwG6K6gNzJ2PbR6 YEUegqyZAoiIp/lVtGIYOJfhsGxS/Z/t50cYrSiI6b/TVT8CdgmVQYfgoTLeM5Zzow 5yHkJ7Fh50r3xI2pko6AZVhfdD8YEhi/LY3+ps82y1v4vY38XA6GX+UpDFt/x/9o3o LvlASvL4nHO8w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1614B6948C for ; Sun, 18 Jan 2026 13:38:44 -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 kOAG3zjgl1op for ; Sun, 18 Jan 2026 13:38:44 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768723; bh=OZwQ2UQQD+rtO0adTHHqdua1SFqPHzhVzLBTXfRB5T0=; 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=vO3WSC0dLuDzX+1oGrYsnHtQQmQu6huIbaUe/LSeWWU/jqrPGHH9xJO59OBEYbASt CHDWxBMJK61dP+mjZ/8Vp1TsTyzmOcrC+Kg5yuR93Z82WFqCnwqHnT9Ml3gjJOHltz XMXbhk312UgQoeOJrIiF37sfFDXaz7DQa6xuKyNPwMvFrGGB7OQUkA1h/BGfHIASz4 Y/MgS0rtMM5STMsk/jrdM3p2NrfOKE3+6ZBMsV13JOymNywTGX63A6gCABXrjKsIgb SNr+Y4yGITv6jI+tu7FPhdkXtY7LV4cgKz/1aK2lLlWYP+X8szKtTkMyTmWU/ZeNYm rZWUtDXrcneDg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F253069487 for ; Sun, 18 Jan 2026 13:38:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768722; bh=ZXeGdI3RhTNdCaWU+x4GdwQLzEd+xddIk2QRYh3tVhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bxyhDnHooSRri6QthYcOlnCRTVZPRhi56SzwNx+WwNW6EJyE/a5QarthLzJ/lVB7Z C/JDKCPLTq6WfeYHTFM7WQjTxZ5HP7jix5FJis4VQcX5FmvoNAvfUO9ru6LQgIsF2c 90J5DpQZ8FkdJjht0a/FEqv0D4wpjvQAim3RM0zWh1cSnXhlSVIpHHfJidrXg/cIz2 Kp2hD7/lfhpBZElbYoviKDuIgBN6/7Sna9SEheaktqvuqKDGZK5qcNkxEQwOKBPFX4 j23FghJoENvtg7ph4qILG0VCURmBx7ROVs3GziKNcA6Fy0/rjHK3eaZrBuVeP7Q1T6 Q1zFZ8ylGkc+g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0E04569485; Sun, 18 Jan 2026 13:38:42 -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 tG4EwJQKv0WJ; Sun, 18 Jan 2026 13:38:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768721; bh=3Zso0zR7Baj2V9vIyoCAd3J7htlygcNEMDarfqS6G1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FpbR5P1YC7doGWEKCPwHUdYe7Q3N0bS7myXDpBwUpE8cJkcA3KnxhYP1SAN8eLrFM B8m8VuYdCGgkF0sYjtQi2hlA3jGpGnHbfizWYY6eFs6PAC61B29bdb69UFXiGglJpg 2Y4YnwOH2k248yTCFiaEnJ+PyR2Y1PvOD2RnuXC7NODPZeIwlc7KgZ1HUNDe79dw16 mjH4lpYtPfruv040vsDYsZy1LWNluBBf43CX8NFNt71H5TTWXoVtjwLU0qAuRf/pWB /PZYtGTrGt47xVszliHqkR/MHZOvkifjfr+F63AanlDn8RldfHYaR0kCtr7GbjiEMf vjRAGs2e9dqHw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5FEAB6919C; Sun, 18 Jan 2026 13:38:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:23 -0700 Message-ID: <20260118133734.1.43fe56acdae41c342827df414f82a1d09f6b393c@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: NNOUKNH23OVHZDVU2K62PQ3W5E3UNOPP X-Message-ID-Hash: NNOUKNH23OVHZDVU2K62PQ3W5E3UNOPP 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 01/12] linux: capability: Add CAP_SYS_ADMIN constant 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 Add CAP_SYS_ADMIN to capability.h and update ext4_uboot.h to use the header instead of duplicating the capability definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 8 +++----- include/linux/capability.h | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index a4baac6fc86..80a1c5c6bc9 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -138,6 +138,9 @@ typedef struct { unsigned int val; } kprojid_t; #define __GFP_MOVABLE 0 #define __GFP_FS 0 +/* Capabilities - use linux/capability.h */ +#include + /* FIEMAP extent flags */ #define FIEMAP_EXTENT_LAST 0x00000001 #define FIEMAP_EXTENT_UNKNOWN 0x00000002 @@ -198,11 +201,6 @@ struct fiemap_extent_info { void *fi_extents_start; }; -/* Capabilities - stubs (always allow) */ -#define CAP_SYS_ADMIN 0 -#define CAP_SYS_RESOURCE 0 -#define capable(cap) (1) - /* fscrypt_str, qstr are now in ext4_fscrypt.h */ /* percpu rw semaphore is in linux/percpu.h */ diff --git a/include/linux/capability.h b/include/linux/capability.h index 1192c8a4033..5f402de52e9 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -12,6 +12,7 @@ #ifndef _LINUX_CAPABILITY_H #define _LINUX_CAPABILITY_H +#define CAP_SYS_ADMIN 21 #define CAP_SYS_RESOURCE 24 static inline bool capable(int cap) From patchwork Sun Jan 18 20:37:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1581 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=1768768726; bh=mD9h/ALesj0qTJJ/r208V+n+I1Iw5GQgcODW/cM+rBM=; 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=q0Vbb6fbrwr3hRpgdUz/GARQS+27NM2vSz4beCvFW2E/zEhGSltGGW/gEFVAK1UlE buKxkz1gFMnOGt5sn7lvlHgfsgmBSBKkdDbzoGiR8bVqdzq3vr4W8PZDXa2TujbCRO 5bwu2zi0XapiirtBwkZPnjZ2zHWDkXrTNIxPYidnv+KI5PgfVMZ/m/8tQ9kTjNIEqa ON1ukc3dXVw8G8w7IxitW+xTKiFkHvQ1HppbYN7OHnrd3o6Z3fLET+6l1jiHFwCS91 ZOXmuqe9FbG3TcWN94bwFATNjuzuB36uC4RZR+cUy9VVSSdWgfRh3NEyYrwL/SaOsI ZDyUtstZ/TJUQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 804E369487 for ; Sun, 18 Jan 2026 13:38:46 -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 SRIEp_m7wPMQ for ; Sun, 18 Jan 2026 13:38:46 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768725; bh=mD9h/ALesj0qTJJ/r208V+n+I1Iw5GQgcODW/cM+rBM=; 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=w0mXR+QjhW6V4Cxbzj/QCi+8bzE/MCg1UlVc3T/Z+ym5UdyEgyFcUmQmYy7fzO82Q 4Hh87QzViXpRNzpbClSvTmfTdX8oQsVJw6zWzToe0+6jePtTLqWlyLcaMa6inSjZdx Ew1zHJanHrrNoz7dYrcKEOebYXRtxOP8l3FFPnm3ZGRlHVKad7R3z9/MzL2L6VXhLr kqA2yuCmTmx+6KF0MpzJWlNRNcrUg45LFbYnrYFEH8D+SH/5Z6/mAGpl9Rox3zU6c3 CpEhjr8+u12u7Jgp+kYYdYGx7O2FernuueOzBfN7zyq73u3+QdXrero4AiHkUYq4bG iS3mpmsJk6ZYQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 81AE369485 for ; Sun, 18 Jan 2026 13:38:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768723; bh=dfDMXWPCajcGuJr9dXbWK8Q2QKha1dUIfEj2ZxKwMYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H8rXGIogYaB79OETHnoquhNMTxPyNtW05w7VOE8e7OeJEAuSyYQhqnmuBbMXEeVHx Qq9yUlY0vLq48ZDBfMLtPyRHRSGvsAzyNlN1tVUPJ86NTb8F3HE2O5zKLVWBks8kpW Dt75d63jXgb7FESU+G4Tf0FU8wW5C3XhIC2E0O2sjMFb1A1oELA2wboCb/O2DWVTL6 nnGZSPRrfMnYXTRsxu8yG2wq+t+uCtNNWftjBLzds+kOQzSXM/3mRbYa6ojIHdFtKj zUzAxm56GOtpe75YEy/XFVyLCRoI4nXyoB1MI9CNKMJjq+6M3Px+wqIOpBOlW4Rj+0 sriq7K/VPwgrQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0274A69487; Sun, 18 Jan 2026 13:38:43 -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 8cJnZchGVuq8; Sun, 18 Jan 2026 13:38:42 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768722; bh=pS9WtZLknrwx2JyGFldaGaeCp9o0pzH7k0o+F/2tlR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pL2byDa9yqVC8aVPIAEewJTSJUlJd17PJ84QacrnU8WyzzoNpDcu+cHAwiw+NgyQY VvyTeGBMW21S9fmxLu9IvfbWi5RvmgIQD5/WIYCn3WTsPO0egCP4TRbwN5vx02NUBg 83NUP5hDw0BC3fKHJsO1OQH0khgvTpr/lvTxE6OdpvFxNUFn3Ga/Y//EFaEmEaKeIb UdtZ9BZr/qTYLwPbr7WW0CtOOHzGK7F78QwGQxgxpgYv6ejdUTziaRYeN/CAK0YIgv qm+3LMG+ALchrJPe7UjiRYt8sko6AbLtuzj3P/GZ3r8H04V0RvQGwKfwlKouvOAdwx ZwhIOLEh1HpUQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 512C769382; Sun, 18 Jan 2026 13:38:42 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:24 -0700 Message-ID: <20260118133734.2.861096498c0facf7fca51f6e79e6cd37a9c5e73d@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: X3TCDSY4OILRKMVG3NWAHDBYZ4C7DVDY X-Message-ID-Hash: X3TCDSY4OILRKMVG3NWAHDBYZ4C7DVDY 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 02/12] linux: uio: Add kiocb struct and IOCB_* flags 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 Add the kernel I/O control block (kiocb) structure and associated flags to uio.h, and update ext4_uboot.h to use the header instead of duplicating these definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 19 ++----------------- include/linux/uio.h | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 80a1c5c6bc9..937c819a3f0 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -164,23 +164,8 @@ typedef struct { unsigned int val; } kprojid_t; /* struct file is defined in linux/fs.h */ -/* kiocb - kernel I/O control block */ -struct iov_iter; - -struct kiocb { - int ki_flags; - struct file *ki_filp; - loff_t ki_pos; -}; - -#define IOCB_DIRECT 0x0001 -#define IOCB_NOWAIT 0x0002 -#define IOCB_ATOMIC 0x0004 - -/* iov_iter stubs */ -#define iov_iter_truncate(i, count) do { } while (0) -#define iov_iter_count(i) 0 -#define iov_iter_alignment(iter) 0 +/* kiocb, iov_iter - use linux/uio.h */ +#include /* __counted_by attribute - not available in U-Boot */ #define __counted_by(x) diff --git a/include/linux/uio.h b/include/linux/uio.h index cb050705597..e347d318c60 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -63,4 +63,23 @@ static inline size_t iov_iter_alignment(const struct iov_iter *i) return 0; /* Stub - assume aligned */ } +/** + * struct kiocb - kernel I/O control block + * @ki_flags: I/O flags + * @ki_filp: file pointer + * @ki_pos: file position + * + * U-Boot stub for asynchronous I/O control. + */ +struct kiocb { + int ki_flags; + struct file *ki_filp; + loff_t ki_pos; +}; + +/* kiocb flags */ +#define IOCB_DIRECT 0x0001 +#define IOCB_NOWAIT 0x0002 +#define IOCB_ATOMIC 0x0004 + #endif /* __LINUX_UIO_H */ 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 */ From patchwork Sun Jan 18 20:37:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1583 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=1768768737; bh=LVyJV7XCboQAyRA5SwMaiWVzYErFKEJL5IohykzCojY=; 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=MpJrffG93IiN1Mnyy4MvHzO4fSe7Sf7pb52qLOQ87Zpsi+17m0iuuXyXOLA6z+ek/ I9wPXiVICJLvinrboBDP2QIPB5+K994Q2umNxTnHxDahk+GD3UQKFrjWiCvtf790Z6 aFvphA26o+qvAaUGsWlYH8CW9dG0quEWBzq5rh1pViqiik3hWVTDfyb3Cx388oBC2m vx2uJ9A6vK/LjcLu/GJuCO7TCN2OC9loeglIsKzaAKHLmyvCfY/zsgIA7rUaYY5o7g Ee+OsqMRC42EN3fC/vQ4e86NhoGC4/MeBnEzHiTebpDNuy3FmoUKriKGEqXsfJXTLd 7iZdlunl42cIA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9F4CC69489 for ; Sun, 18 Jan 2026 13:38:57 -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 DZbYIY9mEJV1 for ; Sun, 18 Jan 2026 13:38:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768737; bh=LVyJV7XCboQAyRA5SwMaiWVzYErFKEJL5IohykzCojY=; 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=MpJrffG93IiN1Mnyy4MvHzO4fSe7Sf7pb52qLOQ87Zpsi+17m0iuuXyXOLA6z+ek/ I9wPXiVICJLvinrboBDP2QIPB5+K994Q2umNxTnHxDahk+GD3UQKFrjWiCvtf790Z6 aFvphA26o+qvAaUGsWlYH8CW9dG0quEWBzq5rh1pViqiik3hWVTDfyb3Cx388oBC2m vx2uJ9A6vK/LjcLu/GJuCO7TCN2OC9loeglIsKzaAKHLmyvCfY/zsgIA7rUaYY5o7g Ee+OsqMRC42EN3fC/vQ4e86NhoGC4/MeBnEzHiTebpDNuy3FmoUKriKGEqXsfJXTLd 7iZdlunl42cIA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7236769487 for ; Sun, 18 Jan 2026 13:38:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768734; bh=salPETtqg1yDUvZ1ASWXu0V4TPJFWMQZC1duC+56Kxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nc4iH3bfHm9hAYEw6hwvUU0oL7MhNO0nzXgnZIzd+zbJde6x6DD6HU+fljJsj5bDr BLu3TKGOnL0g2dNEh4yXo/1H5sQLkCPoeEKdxbR1Emy13jSRblGlxBd72X4b5JuNTs MdAFfBsPnoPYWwqj4+yKLDno3mlBjCO1gBJRUZPXWcHQB+TbOrX3Slrq1FvnT+G1YU oRXpMQki1sAZgcryrw2zwMCH8D7EqG3A8PS5W8gSjNk174Qv44IN4MyZ4BfUmwlUC5 N2UDcnXkD9MbfnlgJiMuBEn2wGIuY/++wGTPFO3LDmkn1xxvm5mfVYrfR1sWdrwc+f In678m5HpnkJA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0057C69476; Sun, 18 Jan 2026 13:38:54 -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 HIOxjY42TqZP; Sun, 18 Jan 2026 13:38:53 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768728; bh=CFT0ZWjQFKpKdVq0BiOXMr2IvCX/51e2jOlHOazdwOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2EY/HrzApkMbm26S+k/QXynf7mxh476rfiLGAgDTFopxxAbVWjqE8G16s+oPQIgO 7g6eMdRUcikFyiVv80mjYa5oqdT1VSqsunx4XDGVOHvOWwF3I7m2mCNTSH7jut54Uj +txHU4knI02KHamNYVsx97osK9dbUK+YXXSNlvKG1J6qeiMEmkqEcuH7h5cLhzATpi LeKFIqsFKm7KvR1WWeCnnheDExD+EzHh9wrDbfX++23SSsDGFG1HxMzGRDf+Au4XVT lAATBY2M/y94xWelF5qdhip1CRKahgCH2sP1VyiejpZghYDWeMwihSLtkYjktAG1bd +dY9x0a1eCCOw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CF49A6919C; Sun, 18 Jan 2026 13:38:47 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:26 -0700 Message-ID: <20260118133734.4.796271526d07541b732e7b97de733563613fa131@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: 4LPNYQIF2WAY4RZVH5EZC3HIRPCJX67L X-Message-ID-Hash: 4LPNYQIF2WAY4RZVH5EZC3HIRPCJX67L 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 04/12] linux: Add statfs.h header with kstatfs struct 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/statfs.h with the kstatfs structure for filesystem statistics reporting. Update ext4_uboot.h to use the new header instead of duplicating the structure definition. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 17 ++--------------- include/linux/statfs.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 include/linux/statfs.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 185951ac4c1..f686364a761 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1300,21 +1300,8 @@ static inline __kernel_fsid_t uuid_to_fsid(const u8 *uuid) return fsid; } -/* kstatfs for statfs */ -struct kstatfs { - long f_type; - long f_bsize; - u64 f_blocks; - u64 f_bfree; - u64 f_bavail; - u64 f_files; - u64 f_ffree; - __kernel_fsid_t f_fsid; - long f_namelen; - long f_frsize; - long f_flags; - long f_spare[4]; -}; +/* kstatfs - use linux/statfs.h */ +#include /* struct seq_file is in linux/seq_file.h */ diff --git a/include/linux/statfs.h b/include/linux/statfs.h new file mode 100644 index 00000000000..bdc3f9b9e87 --- /dev/null +++ b/include/linux/statfs.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Filesystem statistics definitions for U-Boot + * + * Based on Linux statfs.h + */ +#ifndef _LINUX_STATFS_H +#define _LINUX_STATFS_H + +#include + +/** + * struct kstatfs - kernel filesystem statistics + * @f_type: filesystem type + * @f_bsize: optimal transfer block size + * @f_blocks: total data blocks in filesystem + * @f_bfree: free blocks in filesystem + * @f_bavail: free blocks available to unprivileged user + * @f_files: total file nodes in filesystem + * @f_ffree: free file nodes in filesystem + * @f_fsid: filesystem ID + * @f_namelen: maximum length of filenames + * @f_frsize: fragment size + * @f_flags: mount flags + * @f_spare: spare for later + */ +struct kstatfs { + long f_type; + long f_bsize; + u64 f_blocks; + u64 f_bfree; + u64 f_bavail; + u64 f_files; + u64 f_ffree; + __kernel_fsid_t f_fsid; + long f_namelen; + long f_frsize; + long f_flags; + long f_spare[4]; +}; + +#endif /* _LINUX_STATFS_H */ From patchwork Sun Jan 18 20:37:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1584 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=1768768741; bh=IY5Vj1VkKus/HhCb4pglnAcUHyCl+jvgMLCgNMejdGA=; 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=ugXgkvxjSOWobf5j7H3es0yOwVKkcqBedOqfCb82PSo/8/+rHsCHs0KgcATsLitg+ 8xabUIjMl+vIcI5GgQktZrzSud3ZESrF/gPUUStZBzZ3EkU0j9cTlH/waRYvrFaZTU bYC+j3pRvzuubLkShAZM1DWJpR0+15/Rog6hOXA7GQLDMlCTf2/g3ZLVUWkJ4RaVrn bsWtvm1eKLwhGcqufDt2P9ahiM9qp0o0eHKg8+OtLfC4SZ/bqzZt5PqYadHhNKo7w7 lW5KPHehp/DIJ2WPWqD2mDAJtkWqnWhoPfCKtcFnuYPJIoFHeJtiTALl+QJygq5IKm Ydh9Grc+gePHw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0E0C069487 for ; Sun, 18 Jan 2026 13:39: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 10024) with ESMTP id fUUp0lastHxT for ; Sun, 18 Jan 2026 13:39:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768740; bh=IY5Vj1VkKus/HhCb4pglnAcUHyCl+jvgMLCgNMejdGA=; 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=OBTxjj5sfzA0jgmcNzMiqNpsttitFHWfpP64VNkv/DEGzl1tNS8GKMFgmjjNPWqWL eIMKXC+pRRNuwOwxsHGAsJqh6zT2P3+F9s4ZvoQTn5/LtSfsfGe7WnogAUoaB4PvQs 1PLbX3CRAZ3Ai/j3ZWin7QpaPVSq0e1bqL5CurFi8aSDH7h9TovSm8oeZoea4dKJgp q7S8feuSaowEHxspWbo7E6AC4G3mxDOoAYUF8kZ3WPrJtxD8F4gARa3dXAe0t6XQld CuWveVUhcyY71OtmpLRNXW76WajPvdI9JM6nraZmVTj3+0Hhwjyph4ISxn08Iq86If 9noo1bAnOY1pg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D80B46919C for ; Sun, 18 Jan 2026 13:39:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768737; bh=I1cDlLQ+yRSMhLHt7DSbBH9mnEZYbbMXEUID7xrqY6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MZ291TQ8KWSYPVkfl3MTvzet2mDUJ7rJFma24vRr0M2q5SkSwDroqNCCbpTy4xkL9 nx4iRCNeezyvFh2xHN7bBWEGs6nfLBEfyEC1TbOekDq6VxDnSUHPB6/rmu/O7IfWDD nzGRti/ojj4g4U+vW4QQqJbvtp547PpRwfqOhDWF+QHWsyRHoy669WVmRcVC0vN75t 5DyXZHUIoJ4SKvBcX50QoLJD1WGNrwyKPna5eaaMy3cOyHR/38wzcCDNh3RtnFSiyq hkC1gScuzEXhb9zPDq/t2nLe2QUnCGB9PqSQCLozRP6uZ/Uhr4K+k+OqL9qFz3ATpl y/vt0r8BLHJ/g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DCAC969487; Sun, 18 Jan 2026 13:38:57 -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 WKIvCFPrQk1s; Sun, 18 Jan 2026 13:38:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768732; bh=wERFdBeyE3ue9naFCnM//aCs1jGbEj3grmMgEO/tJqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FiPiwF5Q85I4vT+l1drI91pLycL9bgO7xMbFLjedpie2nyLAjQdQWqUMiqhg7+Bhj kTCy5D6DEpIbl/O2T00AxszYlRcXaqN5D5TMqwh7jCJH3JKXAMF2xijCwJYYOjYXiH 4ooAAeBLS30G7WKLbTjSXjETlFcE0C2+/llKFyQvgQa8MhCvy+8ENkSL+/pOwJF/Av Xw6OhxvI/ryMXR3eBSzSSydUtV0H9F0Wn2s3KQa9pnLKceJaFAw5N11v/zxw3fvYVZ 40SyyyiBlqB6NYYqBeSimoD8fhO7TVv2JSUjFGlKI8qjQzO6lQQIGmHFf5d9xY/yaV JD5tq55S/PqnA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6CFE069382; Sun, 18 Jan 2026 13:38:52 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:27 -0700 Message-ID: <20260118133734.5.c5c8169071840a982d4d49530e8c4f4927c9b209@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: IRXS4MC3EXXBPQBAJVSL7ABWATKTB2DC X-Message-ID-Hash: IRXS4MC3EXXBPQBAJVSL7ABWATKTB2DC 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 05/12] linux: Add exportfs.h header with NFS export operations 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/exportfs.h with struct fid, export_operations, and generic file handle encoder/decoder declarations for NFS export support. 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 | 38 ++------------------ include/linux/exportfs.h | 78 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 35 deletions(-) create mode 100644 include/linux/exportfs.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index f686364a761..b6744894169 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1259,34 +1259,8 @@ struct super_operations { struct dentry *(*get_dquots)(struct inode *); }; -/* export_operations for NFS */ -struct export_operations { - int (*encode_fh)(struct inode *, __u32 *, int *, struct inode *); - struct dentry *(*fh_to_dentry)(struct super_block *, struct fid *, int, int); - struct dentry *(*fh_to_parent)(struct super_block *, struct fid *, int, int); - struct dentry *(*get_parent)(struct dentry *); - int (*commit_metadata)(struct inode *); -}; - -/* Generic file handle encoder for NFS exports - stub */ -static inline int generic_encode_ino32_fh(struct inode *inode, __u32 *fh, - int *max_len, struct inode *parent) -{ - return 0; -} - -/* fid for export_operations */ -struct fid { - union { - struct { - u32 ino; - u32 gen; - u32 parent_ino; - u32 parent_gen; - } i32; - __u32 raw[0]; - }; -}; +/* export_operations and fid - use linux/exportfs.h */ +#include /* uuid_to_fsid - convert UUID to fsid */ static inline __kernel_fsid_t uuid_to_fsid(const u8 *uuid) @@ -1433,13 +1407,7 @@ int inode_generic_drop(struct inode *inode); /* fsverity stubs (fscrypt macros are in ext4_fscrypt.h) */ #define fsverity_cleanup_inode(i) do { } while (0) -/* NFS export helpers - declarations for stub.c */ -struct dentry *generic_fh_to_dentry(struct super_block *sb, struct fid *fid, - int fh_len, int fh_type, - struct inode *(*get_inode)(struct super_block *, u64, u32)); -struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid, - int fh_len, int fh_type, - struct inode *(*get_inode)(struct super_block *, u64, u32)); +/* NFS export helpers are now in linux/exportfs.h */ /* Path operations */ #define path_put(p) do { } while (0) diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h new file mode 100644 index 00000000000..d42b9f63d15 --- /dev/null +++ b/include/linux/exportfs.h @@ -0,0 +1,78 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * NFS export operations for U-Boot + * + * Based on Linux exportfs.h - filesystem export support for NFS. + */ +#ifndef _LINUX_EXPORTFS_H +#define _LINUX_EXPORTFS_H + +#include + +struct super_block; +struct dentry; +struct inode; + +/** + * struct fid - NFS file handle + * + * Flexible file handle for NFS export. + */ +struct fid { + union { + struct { + u32 ino; + u32 gen; + u32 parent_ino; + u32 parent_gen; + } i32; + __u32 raw[0]; + }; +}; + +/** + * struct export_operations - NFS export operations + * @encode_fh: encode file handle + * @fh_to_dentry: decode file handle to dentry + * @fh_to_parent: decode file handle to parent dentry + * @get_parent: get parent directory + * @commit_metadata: commit metadata changes + * + * Operations for NFS export support. + */ +struct export_operations { + int (*encode_fh)(struct inode *, __u32 *, int *, struct inode *); + struct dentry *(*fh_to_dentry)(struct super_block *, struct fid *, + int, int); + struct dentry *(*fh_to_parent)(struct super_block *, struct fid *, + int, int); + struct dentry *(*get_parent)(struct dentry *); + int (*commit_metadata)(struct inode *); +}; + +/** + * generic_encode_ino32_fh() - generic file handle encoder + * @inode: inode to encode + * @fh: file handle buffer + * @max_len: maximum length of buffer + * @parent: parent inode (may be NULL) + * + * U-Boot stub - returns 0. + */ +static inline int generic_encode_ino32_fh(struct inode *inode, __u32 *fh, + int *max_len, struct inode *parent) +{ + return 0; +} + +/* NFS export helpers - stubs for U-Boot */ +struct dentry *generic_fh_to_dentry(struct super_block *sb, struct fid *fid, + int fh_len, int fh_type, + struct inode *(*get_inode)(struct super_block *, + u64, u32)); +struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid, + int fh_len, int fh_type, + struct inode *(*get_inode)(struct super_block *, + u64, u32)); + +#endif /* _LINUX_EXPORTFS_H */ From patchwork Sun Jan 18 20:37:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1585 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=1768768751; bh=8ql9vViCYotS1OsDm+vbA2nPBJzBC5dcs7lnj7iCY7w=; 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=uUcig9loQ8ovvvyidEiY7Y9CofkRxsHFS3aYyxERQrJuEhJv8YnwlUZuH650ZsN1D c+fyweGo6FzsIUuULqnofG7jTcph2H3sDMUupYD260PA85XuBiY0UegRiQxSEHfbwH itJmjFN/mVKuLC7MUJq2AZIRWULlIR4sSG20oHB0gXvUnKpqxkjT31t60IqUHZvbZ1 geNVcFu95aK+6TNXeLCfhKOseaJ9cXpmF96fok13l66cGhIuaqonkoaZ3fpFGE98oW M+dTV5H4aI3saWWMzE2CWxwQQfQ2ePh3L+SWBwG01yS37A2sHKU/DFxAqhWiDoYLxI bVMFhK1kfz4NQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 504FF69476 for ; Sun, 18 Jan 2026 13:39:11 -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 FQHLaSdtPOiu for ; Sun, 18 Jan 2026 13:39:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768751; bh=8ql9vViCYotS1OsDm+vbA2nPBJzBC5dcs7lnj7iCY7w=; 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=uUcig9loQ8ovvvyidEiY7Y9CofkRxsHFS3aYyxERQrJuEhJv8YnwlUZuH650ZsN1D c+fyweGo6FzsIUuULqnofG7jTcph2H3sDMUupYD260PA85XuBiY0UegRiQxSEHfbwH itJmjFN/mVKuLC7MUJq2AZIRWULlIR4sSG20oHB0gXvUnKpqxkjT31t60IqUHZvbZ1 geNVcFu95aK+6TNXeLCfhKOseaJ9cXpmF96fok13l66cGhIuaqonkoaZ3fpFGE98oW M+dTV5H4aI3saWWMzE2CWxwQQfQ2ePh3L+SWBwG01yS37A2sHKU/DFxAqhWiDoYLxI bVMFhK1kfz4NQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2A0E26919C for ; Sun, 18 Jan 2026 13:39:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768746; bh=Dwxyo4XoLEfUIS7wpl5RksZ5+tzWPpUY/vK78bQ+RRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cBJowGPaekPkuAfInz+yn2sN5LI/cp3hBZpNzeVU4MlIbN9SluYV8IwA5wYFdadBv lN5DgRGKvfS1h6P4kvxQuhSEXDbOV5K8X38cdWsI38jaUp4eeFWZCFs2T7VZN74/5e cDX0za3Af8NS2/DuKva9iN/rqqT6NysjrdfziVlE3rNWjq6w5IbSBzN9k4PkMbGWvl Nc41ckRhU0wBA2MTwPsLf/Gk42k7snlEQJfpItP8TZI9cLiyRHmtXzYCO6gG2O8/cS mO5DpeObDeaaTKWMsKwnKBBdGZJSpShThf6Bvf6xzPLyEkMxqEp9YS5tG5QfHMD7yq 7gxiTbpdilkVw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6C9906919C; Sun, 18 Jan 2026 13:39:06 -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 h6kuyYaLCXZX; Sun, 18 Jan 2026 13:39:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768738; bh=UqGBIgzPEw3NXk8buF5Y1Ig/yVh6/6c3DZJGRHyck0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=opw5yT3NgNsC38AP0Kv+sDNliqH3ovQ/RsFoFyQjd0PHvLAta3wXF2B/B1xJrCcfI k72bXnQVjNFcqNTncGQK/+NlQomEKqsyxL/zl0LRBsOGVJyfnbWxCQghjUDTdhZLkr H0P6t/p4u7xQRV/sahPRN1vkXnU5dMZfQsZZt1Evoi/OyKIM2GBxdIJKLCL+cm62b1 NiZYNlcv+UOqXRc9Hz+bW3Ivvmo5II5YJevHuXrPvOs4h7RDYIp8T7xr/dh5C5E7C0 J3Ria8NXm+YQgmA8DKIeRa9xgreoaS4cCo8GOPs7rnJ3FdlxP2hLEvwL3ML+zr26/q VctCLxEpeoOdg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 39EDF6948B; Sun, 18 Jan 2026 13:38:58 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:28 -0700 Message-ID: <20260118133734.6.986fa9e239675f821c683f38d325bfb4a4c31183@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: RGMFVDCI6UUMCWYKP36VNF3TG7664EER X-Message-ID-Hash: RGMFVDCI6UUMCWYKP36VNF3TG7664EER 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 06/12] linux: Add mbcache.h header with metadata cache 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 Create linux/mbcache.h with mb_cache structure and cache operation stubs. Metadata block caching is not supported in U-Boot. 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 | 29 ++------------------ include/linux/mbcache.h | 60 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 27 deletions(-) create mode 100644 include/linux/mbcache.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index b6744894169..ba90cce3e67 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1477,33 +1477,8 @@ static inline void super_set_uuid(struct super_block *sb, const u8 *uuid, /* super_set_sysfs_name_bdev is now in linux/kobject.h */ -/* - * mb_cache - metadata block cache stubs for xattr.c - * Not supported in U-Boot - xattr caching disabled - */ -struct mb_cache { - int dummy; -}; - -struct mb_cache_entry { - u64 e_value; - unsigned long e_flags; -}; - -/* MB cache flags */ -#define MBE_REUSABLE_B 0 - -#define mb_cache_create(bits) kzalloc(sizeof(struct mb_cache), GFP_KERNEL) -#define mb_cache_destroy(cache) do { kfree(cache); } while (0) -#define mb_cache_entry_find_first(c, h) ((struct mb_cache_entry *)NULL) -#define mb_cache_entry_find_next(c, e) ((struct mb_cache_entry *)NULL) -#define mb_cache_entry_delete_or_get(c, k, v) ((struct mb_cache_entry *)NULL) -#define mb_cache_entry_get(c, k, v) ((struct mb_cache_entry *)NULL) -#define mb_cache_entry_put(c, e) do { (void)(c); (void)(e); } while (0) -#define mb_cache_entry_create(c, f, k, v, r) ({ (void)(c); (void)(f); (void)(k); (void)(v); (void)(r); 0; }) -#define mb_cache_entry_delete(c, k, v) do { (void)(c); (void)(k); (void)(v); } while (0) -#define mb_cache_entry_touch(c, e) do { (void)(c); (void)(e); } while (0) -#define mb_cache_entry_wait_unused(e) do { (void)(e); } while (0) +/* mb_cache - use linux/mbcache.h */ +#include /* xattr helper stubs for xattr.c */ #define xattr_handler_can_list(h, d) ({ (void)(h); (void)(d); 0; }) diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h new file mode 100644 index 00000000000..b2383891211 --- /dev/null +++ b/include/linux/mbcache.h @@ -0,0 +1,60 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Metadata block cache definitions for U-Boot + * + * Based on Linux mbcache.h - cache for filesystem metadata blocks. + * U-Boot stubs - metadata caching is not supported. + */ +#ifndef _LINUX_MBCACHE_H +#define _LINUX_MBCACHE_H + +#include +#include + +/** + * struct mb_cache - metadata block cache + * + * U-Boot stub - caching not supported. + */ +struct mb_cache { + int dummy; +}; + +/** + * struct mb_cache_entry - cache entry + * @e_value: cached value + * @e_flags: entry flags + */ +struct mb_cache_entry { + u64 e_value; + unsigned long e_flags; +}; + +/* MB cache flags */ +#define MBE_REUSABLE_B 0 + +/* MB cache operations - all stubbed as no-ops */ +#define mb_cache_create(bits) \ + kzalloc(sizeof(struct mb_cache), GFP_KERNEL) +#define mb_cache_destroy(cache) \ + do { kfree(cache); } while (0) +#define mb_cache_entry_find_first(c, h) \ + ((struct mb_cache_entry *)NULL) +#define mb_cache_entry_find_next(c, e) \ + ((struct mb_cache_entry *)NULL) +#define mb_cache_entry_delete_or_get(c, k, v) \ + ((struct mb_cache_entry *)NULL) +#define mb_cache_entry_get(c, k, v) \ + ((struct mb_cache_entry *)NULL) +#define mb_cache_entry_put(c, e) \ + do { (void)(c); (void)(e); } while (0) +#define mb_cache_entry_create(c, f, k, v, r) \ + ({ (void)(c); (void)(f); (void)(k); (void)(v); (void)(r); 0; }) +#define mb_cache_entry_delete(c, k, v) \ + do { (void)(c); (void)(k); (void)(v); } while (0) +#define mb_cache_entry_touch(c, e) \ + do { (void)(c); (void)(e); } while (0) +#define mb_cache_entry_wait_unused(e) \ + do { (void)(e); } while (0) + +#endif /* _LINUX_MBCACHE_H */ From patchwork Sun Jan 18 20:37:29 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1586 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=1768768755; bh=v2FyVoUiSd9qerqIpILR/QQRj0lbhbWBn25ZlnORitM=; 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=EBdhfGB9A9qjrrJ6vNOb2pLvKUC2oRkNB5fslP2oKER27yt9K1nZk2RKKvcwQt/ID qN2npRr4Rurv7xn31oghBjXTuvpd77LFnWxXiqzZQk9fYBfm4Qj8jC+q4RmBGGHPr0 ZzmZl2skAT6HLbXILQCTxk44N/uIsrxqhO3JYqxWtBY+VDM0ofjy7vFxBcXagMZ304 nlCUKLvZ9ID1RCLK2joT3Qj6s2envouVmFY/HtSoFCee3Z6bapt15arA3qdn5A5ziP EEQKUFPgxmJtW2DIHPNOhUlQ+Lk8ZgM2oPZbRYSCEmqa6/ztRaalZpw9Vm3xuo4s9Z fFvJamGJ2vdcQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 10893693A2 for ; Sun, 18 Jan 2026 13:39:15 -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 kMk79Eom2UoP for ; Sun, 18 Jan 2026 13:39:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768754; bh=v2FyVoUiSd9qerqIpILR/QQRj0lbhbWBn25ZlnORitM=; 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=ub0M5ktdSrnYXrIpqbI6Ybz7+QheXjFzbjhp8RsZck/JesoiLsGF6dPotqhFRRUef LqNS66D2L0TQzxsiqIBVsN0nc9H3TatUjPNihG5RhkNyOBDgq8QQYrbKWA4j9qjEU/ E/oQ0EarBE829TRdSyWO631+J5b5MDBUCobTV3pqtdaPoSKuJYhdmqEFLf/4PkYkyi tQ4gFG31/VRWXxIq+so/sKe57lcHqB+qv5uKVbhYQwYBmReSALlj1A5zwMf8hsZGFL PWa+kBRvT59KC5BDS1p6GMliGbsZCNkFVeu4SUkeLfa0X5hqpaKX5W8241QVV9a+nz KOJ5XMnZdA1jQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E21EC6919C for ; Sun, 18 Jan 2026 13:39:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768751; bh=o6uHWXmhnaOTI6uQv1QzC1YwO0G3+cycRlB/Z+oHwBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZ5ALV2zoBMvfjuxIxpsapblrDXdYd0qbQVcQ8Bi2t2ET80ci+4KaVm+16LBnJYxc HC4CikcEu9nh9i7YBtQubusxh59ZNT0SjKZZv/gWE/otJs+XetUe7d/saF7GyREo1J ddW5vuh/pL5pwMRp8RpVEuZRN9TOloDO/7eMP9iUSOiFxmuHW8eqgvBBvZa8kMTJoi 9ohiGn8lEX/J2wF8YZ6c7MBqV/OCAHjcFqRGkcI2+teftOyGf9fMUkInyhdRsZYlV4 STHu8GhhHHSz8NYb99RC15EYbIxiKpFuYjeToHfpsyGYZrjd7Tq3oDIHds18Rff4b6 rP5k8E0F3A7mw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 93A046919C; Sun, 18 Jan 2026 13:39:11 -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 sVOcWV_-uIx5; Sun, 18 Jan 2026 13:39:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768747; bh=NSjFZusQZPptT0nE+k66Mjacb7gUFduza2ZSEUZFd80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A1cbXUr02eYAocT4Fa83L6Rq21TrCRxRD7d135jL/ZpcEp7zvi3Ahn7rksvFvcUD9 Nxwa6f+B663TgvcxnNruZ3l0RBbkFoZlFKimzuWIcpiLLw6TaUfaLedG8UMF+pE5Qk 07uVf3TTXHbG5S5QmvehNdbf+0S55ZkOtnU5F2vpW3Y5IjbLrLPcSP+mFHiGcxY4oT Z94YVoOoG1Mci3F3Uqv8VeolLhPs92+ixcoHUMXacObiQpZapQZmNzAn1ovV2acngA bdBDn4gXvfU6G/xPpqnVaqV8TKGsd1PAHJeLrg7TUwZZZ2XjFrauoiLrQyi8uZKjmp RQl+kwe928xpw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id AF3CB69382; Sun, 18 Jan 2026 13:39:06 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:29 -0700 Message-ID: <20260118133734.7.73f5317cb9c72a1edf9cb4a73f3e67d5f1d94382@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: HSA566SXHGMHMMF4KTWV4L3ESIP4KHYF X-Message-ID-Hash: HSA566SXHGMHMMF4KTWV4L3ESIP4KHYF 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 07/12] linux: Add wait_bit.h header with wait bit 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 Create linux/wait_bit.h with wait_bit_entry structure and wait bit operation stubs. These are no-ops in U-Boot's single-threaded environment. 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 | 21 ++++-------------- include/linux/wait_bit.h | 47 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 include/linux/wait_bit.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index ba90cce3e67..102f03fe002 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -213,7 +213,7 @@ extern struct user_namespace init_user_ns; #define mark_buffer_dirty_inode(bh, i) sync_dirty_buffer(bh) #define mark_buffer_dirty(bh) sync_dirty_buffer(bh) struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); -#define wait_on_bit_io(addr, bit, mode) do { (void)(addr); (void)(bit); (void)(mode); } while (0) +/* wait_on_bit_io is now in linux/wait_bit.h */ /* inode_needs_sync - stub */ #define inode_needs_sync(inode) (0) @@ -1685,20 +1685,8 @@ bool __folio_start_writeback(struct folio *folio, bool keep_write); * Stubs for fast_commit.c */ -/* Wait bit operations - stubbed for single-threaded U-Boot */ -struct wait_bit_entry { - struct list_head wq_entry; -}; -#define DEFINE_WAIT_BIT(name, word, bit) \ - struct wait_bit_entry name = { } -#define bit_waitqueue(word, bit) \ - ({ (void)(word); (void)(bit); (wait_queue_head_t *)NULL; }) -#define prepare_to_wait(wq, wait, state) \ - do { (void)(wq); (void)(wait); (void)(state); } while (0) -#define prepare_to_wait_exclusive(wq, wait, state) \ - do { (void)(wq); (void)(wait); (void)(state); } while (0) -#define finish_wait(wq, wait) \ - do { (void)(wq); (void)(wait); } while (0) +/* Wait bit operations - use linux/wait_bit.h */ +#include /* Dentry name snapshot operations are now in linux/dcache.h */ @@ -1708,8 +1696,7 @@ struct wait_bit_entry { #define REQ_IDLE 0 #define REQ_PREFLUSH 0 -/* wake_up_bit - wake up threads waiting on a bit */ -#define wake_up_bit(word, bit) do { (void)(word); (void)(bit); } while (0) +/* wake_up_bit is now in linux/wait_bit.h */ /* d_alloc, d_drop are now in linux/dcache.h */ diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h new file mode 100644 index 00000000000..ace3fbc1763 --- /dev/null +++ b/include/linux/wait_bit.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Wait bit definitions for U-Boot + * + * Based on Linux wait_bit.h - wait on a bit to be cleared/set. + * U-Boot stubs for single-threaded environment. + */ +#ifndef _LINUX_WAIT_BIT_H +#define _LINUX_WAIT_BIT_H + +#include +#include +#include + +/** + * struct wait_bit_entry - wait queue entry for bit waits + * @wq_entry: wait queue list entry + * + * U-Boot stub - bit waiting not needed in single-threaded environment. + */ +struct wait_bit_entry { + struct list_head wq_entry; +}; + +/* Wait bit macros - all no-ops in single-threaded U-Boot */ +#define DEFINE_WAIT_BIT(name, word, bit) \ + struct wait_bit_entry name = { } + +#define bit_waitqueue(word, bit) \ + ({ (void)(word); (void)(bit); (wait_queue_head_t *)NULL; }) + +#define prepare_to_wait(wq, wait, state) \ + do { (void)(wq); (void)(wait); (void)(state); } while (0) + +#define prepare_to_wait_exclusive(wq, wait, state) \ + do { (void)(wq); (void)(wait); (void)(state); } while (0) + +#define finish_wait(wq, wait) \ + do { (void)(wq); (void)(wait); } while (0) + +#define wake_up_bit(word, bit) \ + do { (void)(word); (void)(bit); } while (0) + +#define wait_on_bit_io(addr, bit, mode) \ + do { (void)(addr); (void)(bit); (void)(mode); } while (0) + +#endif /* _LINUX_WAIT_BIT_H */ From patchwork Sun Jan 18 20:37:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1587 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=1768768760; bh=dhC/aMVXeANPe2X7yFGoAyj7e0KTMOwl6fmc69DcCzs=; 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=h8gQD8XbNf62r62ZYi2LC557QJYpPxtPWtNdg5NfittBWEi99LS1T/o0e9SicjDu5 kxR1EipXDac14dzl0HI2xp640apI48mBGm1lRvK0lezAn/q5BydQYjUc6U7e1t5bO8 uq/YnVbTZ49it134DIeF77pdd7rUqRIeEhzmStSbMd/w7Y3GgBDJqRXj7DaRihGGN1 a26g3CSn8yGmXKPd8Ibh4Qdq4syNdfFb6NVc83AvTwildwyZ6A+/mJzOrmEpZrxnJy CJ7s+zTLonaXFb+tLwk1LK9LHNDkzxBATTL91hy+zL9Zx9G9EUvVNygx4XgF2p/pVm hwbQrySoR7Zog== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4268D69494 for ; Sun, 18 Jan 2026 13:39: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 EzN-hX7-Puhz for ; Sun, 18 Jan 2026 13:39:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768760; bh=dhC/aMVXeANPe2X7yFGoAyj7e0KTMOwl6fmc69DcCzs=; 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=h8gQD8XbNf62r62ZYi2LC557QJYpPxtPWtNdg5NfittBWEi99LS1T/o0e9SicjDu5 kxR1EipXDac14dzl0HI2xp640apI48mBGm1lRvK0lezAn/q5BydQYjUc6U7e1t5bO8 uq/YnVbTZ49it134DIeF77pdd7rUqRIeEhzmStSbMd/w7Y3GgBDJqRXj7DaRihGGN1 a26g3CSn8yGmXKPd8Ibh4Qdq4syNdfFb6NVc83AvTwildwyZ6A+/mJzOrmEpZrxnJy CJ7s+zTLonaXFb+tLwk1LK9LHNDkzxBATTL91hy+zL9Zx9G9EUvVNygx4XgF2p/pVm hwbQrySoR7Zog== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2E7BE693A2 for ; Sun, 18 Jan 2026 13:39:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768757; bh=YFnGfKuFtTWCn4jeW/kcb80Uw4oMg4C8uLqouzCP+mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fi01HWndb/hA1CHdfB/jmU73FNq+peXLqGpIIvAkjdoNnXKsVpegbcMiYerLIv2zf bUVQrFx4+yYlQ4nxrDl8FQqjrVnEPU47eAJ/ZUAiUnSuCQ6S9A9XSLqi9EnBrOqD4o nvHXHFWkw9YPLAGUOfKgLl5ecYuQpEx5XpSoCsYedzFbEhFT5QVgCzetiy7p7zNUrw Zy/xVKwZf4yDbQVpc8f7E2f3LVon+wgo5HZ3DDjbX956pqUK3POrWcvPhjrAJs1Djz jKSSYnTemPPkMw1bJ/jEbt/nNs1g8AH2jWIELNMMs/wQc1CQaWUYj7hYcWwUfs8opW eSpXH5pmpKE7w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F1A8A69496; Sun, 18 Jan 2026 13:39: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 s-s6I54o2Zmn; Sun, 18 Jan 2026 13:39:17 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768751; bh=7E7gaZEAB7otNYf0KWf2QCStMBo0xNqyTyJS5Nu/1/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ACoBJOOaOXgTMuxI/Cy1eJX0e0vloNU/QZaf557cLYs3PU8gKmLpLktfF4mq1UwUh BSqiu4iNxulfWCYkiZBb/ErJ6EzHnutzeCKKx9EeftIVUK1vXgvfzHq5M0SyBDVkZ9 ahLm1ynKmMNEic0yaMEFzkd7ipmVSL9udZHoaVB2q3ccnqYNI4P0EVomt3PGp0U0ih 6usXkii1xfhFAi2XdBkZvNQjPRoSC+6lrcQEUHASaLd1YG6Dg6xMeiELOHQmodutjJ GEn07USH/hlEl4yq4CAWrwl/l19zsnm2L31kPX1Xx614iDuL1nqzbpm3k0YwMTmry4 xN4eq8TUm8sBg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A88BD69491; Sun, 18 Jan 2026 13:39:11 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:30 -0700 Message-ID: <20260118133734.8.44e6459f58d96077c114c70af004835ed34c6be8@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: QMK253W6KAMHYD6YA2DQVS3TBKHVAYVR X-Message-ID-Hash: QMK253W6KAMHYD6YA2DQVS3TBKHVAYVR 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 08/12] linux: Add ratelimit.h header with rate limiting 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 Create linux/ratelimit.h with ratelimit_state structure and rate limiting operation stubs. Rate limiting is not needed in U-Boot. 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 | 19 +++++-------------- include/linux/ratelimit.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 include/linux/ratelimit.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 102f03fe002..f6883d888f4 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -384,10 +384,8 @@ typedef int (get_block_t)(struct inode *inode, sector_t iblock, /* crc32c - from linux/crc32c.h */ #include -/* ratelimit_state - stub */ -struct ratelimit_state { - int dummy; -}; +/* ratelimit_state - use linux/ratelimit.h */ +#include /* fscrypt_dummy_policy and qstr are now in ext4_fscrypt.h */ @@ -869,12 +867,7 @@ static inline int in_range(unsigned long val, unsigned long start, /* percpu_counter_init/destroy are in linux/percpu_counter.h */ -/* ratelimit macros */ -#define DEFAULT_RATELIMIT_INTERVAL (5 * 1000) -#define DEFAULT_RATELIMIT_BURST 10 -#define DEFINE_RATELIMIT_STATE(name, interval, burst) \ - int name __attribute__((unused)) = 0 -#define __ratelimit(state) ({ (void)(state); 1; }) +/* ratelimit macros are now in linux/ratelimit.h */ /* SEQ_START_TOKEN is in linux/seq_file.h */ @@ -1364,8 +1357,7 @@ int trylock_buffer(struct buffer_head *bh); /* Trace stubs for super.c - declaration for stub.c implementation */ void trace_ext4_error(struct super_block *sb, const char *func, unsigned int line); -/* Ratelimiting - declaration for stub.c */ -int ___ratelimit(struct ratelimit_state *rs, const char *func); +/* ___ratelimit is now in linux/ratelimit.h */ /* Filesystem notification - declaration for stub.c */ void fsnotify_sb_error(struct super_block *sb, struct inode *inode, int error); @@ -1502,8 +1494,7 @@ static inline void super_set_uuid(struct super_block *sb, const u8 *uuid, /* strreplace is in linux/string.h */ -/* Ratelimit - declaration for stub.c */ -void ratelimit_state_init(void *rs, int interval, int burst); +/* ratelimit_state_init is now in linux/ratelimit.h */ /* Block device operations - declarations for stub.c */ void bdev_fput(void *file); diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h new file mode 100644 index 00000000000..319f794f059 --- /dev/null +++ b/include/linux/ratelimit.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Rate limit definitions for U-Boot + * + * Based on Linux ratelimit.h - rate limiting for messages. + * U-Boot stubs - rate limiting not needed. + */ +#ifndef _LINUX_RATELIMIT_H +#define _LINUX_RATELIMIT_H + +/** + * struct ratelimit_state - rate limiter state + * + * U-Boot stub - rate limiting not supported. + */ +struct ratelimit_state { + int dummy; +}; + +/* Default rate limit parameters */ +#define DEFAULT_RATELIMIT_INTERVAL (5 * 1000) +#define DEFAULT_RATELIMIT_BURST 10 + +/* Define a rate limit state variable */ +#define DEFINE_RATELIMIT_STATE(name, interval, burst) \ + int name __attribute__((unused)) = 0 + +/* Rate limiting operations - all return true (allow) */ +#define __ratelimit(state) ({ (void)(state); 1; }) + +/* Rate limit functions - implemented in stub.c */ +int ___ratelimit(struct ratelimit_state *rs, const char *func); +void ratelimit_state_init(void *rs, int interval, int burst); + +#endif /* _LINUX_RATELIMIT_H */ From patchwork Sun Jan 18 20:37:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1588 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=1768768762; bh=6YLs85oc4ot+nuUp4zZ0zM6sc2dhM3QW64Vp6Pff6HY=; 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=Bl02lWtCs4mSt/n9fu3Tj6mEYo2kr3WPcjmy9aVesyD9Fr0r4ocioU1AR+fmDGlHy DS82jHtnhn3yV83HyL+w9g7qhdiwbCoNeG3ihSI0V/VTRwKByVrkUgHBbOwCQ0keNK Z+HkU+K2Ur4jMA1L1KN6QfmGhqjWFfZKaAzV0D0Za/NgdP40ESil5rzP6xaSxheSkR XrAPE04MyGl9XQR6KB3GC5Wu9B6eSwGL13Ek/Akmd07ySvaoXMxg1GzkiKufcbpM9e pSdR3D0obuASbLoW5ChwMLtsFqEgxdnwCbjPvloWy/z8U5DOGFglL/Uvt3r/HBptm7 S1JN9e799BrEw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 27A816949E for ; Sun, 18 Jan 2026 13:39:22 -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 Y81xkj67-1Wu for ; Sun, 18 Jan 2026 13:39:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768761; bh=6YLs85oc4ot+nuUp4zZ0zM6sc2dhM3QW64Vp6Pff6HY=; 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=OxLRZUoQS9JuCvSgip2srOJSCOZdpUQMxi9nFFEbHtE7qC4pF7tdG9tu/UvMMbcr+ FBgfpVvIBrYaTnFrwz/CpO7qFgBhG0vBn7vaJL2iFLZdJkIfEiYnizXDE3IpKSMNxb V66yNJBDg6Um7LF4JyxRWJFUbaNUKgnOol9cVvAY+wEkGFBCVLooaSdEqsUxsm/DVe 7a6Q21yGEJSDbtbbmzMAcMEiboe8FKVD8JP9T9SnqUZlsW0BffawyEH2ZI63anbeQc vAl5VANtqJbT9wETOXdb2uxBjQnB6DioK2rUe5Oiw80Qvxz1yjXBGO4u9VPS0I94ju V2IoRMjRWOEOA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 14CA2693A2 for ; Sun, 18 Jan 2026 13:39:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768758; bh=QYJa9dBLMEPvBDn7XInwcCa5RHJAprjDOn3LMqCosIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cbd8l746WI2SFFAwJoTAQGSTrRcJux6ND6A3LBrZ2D1G+hlrzAOk+jb3/SmLjJX4M 8HBDBzy6j5/Q98gYSM5rz8rZFTSU5mDhRnodVoiE2pmo7vnAXPGhDNOA9whzkRErvC t8NClcT8pTWq2uTE/uiXLY2nU/j1f739twDR+QRrKkXbRDsTu7V7L+dWidPMFWUro2 v1xDX3JTr5jeGPoSv6NjgvgDWgcChk/cvdzfrPxZOHRyy3bTfm53KeeIcd2sv/Elhz 6UYYVIbHC7+tM9JfRaS/T+s+bxOgwq0d9QgCu/lNgF1gAijQvMQMEcYJfu3jCDsqj1 TRHLqBY0UdyYg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 04BBA69491; Sun, 18 Jan 2026 13:39:18 -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 7fkAdKmo2KkU; Sun, 18 Jan 2026 13:39:17 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768756; bh=SWg5Blcj9znlkj0MSONOzZX/uj/xigKy1yDGqwxdR+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XUXs2MIlyNBcSiUv/TVo4O7Tu2nW6yp2jbdgNrdXj4s6JNQFMpDOC7J6Hz6jl5at1 5vsaLUq1rQwcx4Sf3UddrQUs0zY6zX9btR11Erohtkk+yWqIkLtuMH9EJ4ypVK3MaR sveVPVynAvLS9IgYGdpKdQSch0Lu4vrjoOl1GiUhnHjmgtH9ikUyZ74nBsVAuEun2r jxAHLVrllA2pmp9vwk0HLtc5Rjt5en5vRGp2zU2fgmZHUqyvoT6DoA66LMI8NYAW46 IiUXV6gjYO6sFmjfad5o7RDNu1kAzoeL1R+UoyMXAYE9gPp3O0zfx7P20MUvdxX0WT M6JCpfc1FbDNg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A420E693A2; Sun, 18 Jan 2026 13:39:16 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:31 -0700 Message-ID: <20260118133734.9.b9bfc3ba68fe6c9c3796ed08e6ea7fa78ab96f2d@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: Y3CIIVQCT6SGBJYJWXPELUU7MGC7CLAJ X-Message-ID-Hash: Y3CIIVQCT6SGBJYJWXPELUU7MGC7CLAJ 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 09/12] linux: utsname/proc_fs: Add init_utsname() and proc_ops 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 Add init_utsname() function to utsname.h for getting the system name. Add proc_ops structure and procfs operation stubs to proc_fs.h. Update ext4_uboot.h to use these headers instead of duplicating the definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 26 +++++--------------------- include/linux/proc_fs.h | 25 +++++++++++++++++++++++++ include/linux/utsname.h | 12 ++++++++++++ 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index f6883d888f4..b5df747b963 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1742,13 +1742,8 @@ int bmap(struct inode *inode, sector_t *block); #define seq_open(f, ops) ({ (void)(f); (void)(ops); 0; }) #define seq_release(i, f) ({ (void)(i); (void)(f); 0; }) -/* proc_ops structure for journal.c */ -struct proc_ops { - int (*proc_open)(struct inode *, struct file *); - ssize_t (*proc_read)(struct file *, char *, size_t, loff_t *); - loff_t (*proc_lseek)(struct file *, loff_t, int); - int (*proc_release)(struct inode *, struct file *); -}; +/* proc_ops - use linux/proc_fs.h */ +#include /* seq_read and seq_lseek declarations (defined in stub.c) */ ssize_t seq_read(struct file *f, char *b, size_t s, loff_t *p); @@ -1756,11 +1751,7 @@ loff_t seq_lseek(struct file *f, loff_t o, int w); /* S_IRUGO is in linux/fs.h */ -/* procfs stubs */ -#define proc_mkdir(name, parent) ({ (void)(name); (void)(parent); (struct proc_dir_entry *)NULL; }) -#define proc_create_data(n, m, p, ops, d) \ - ({ (void)(n); (void)(m); (void)(p); (void)(ops); (void)(d); (struct proc_dir_entry *)NULL; }) -#define remove_proc_entry(n, p) do { (void)(n); (void)(p); } while (0) +/* procfs stubs are now in linux/proc_fs.h */ /* lockdep_init_map and lock_class_key are in linux/lockdep.h */ @@ -1790,15 +1781,8 @@ int bh_read(struct buffer_head *bh, int flags); * Stubs for mmp.c */ -/* init_utsname - returns pointer to system name structure */ -struct new_utsname { - char nodename[65]; -}; -static inline struct new_utsname *init_utsname(void) -{ - static struct new_utsname uts = { .nodename = "u-boot" }; - return &uts; -} +/* init_utsname - use linux/utsname.h */ +#include /* * Stubs for move_extent.c diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 838321f62bc..ba674440c44 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -9,5 +9,30 @@ /* proc_fs is not used in U-Boot - provide empty stubs */ struct proc_dir_entry; +struct inode; +struct file; + +/** + * struct proc_ops - proc file operations + * @proc_open: open callback + * @proc_read: read callback + * @proc_lseek: seek callback + * @proc_release: release callback + */ +struct proc_ops { + int (*proc_open)(struct inode *, struct file *); + ssize_t (*proc_read)(struct file *, char *, size_t, loff_t *); + loff_t (*proc_lseek)(struct file *, loff_t, int); + int (*proc_release)(struct inode *, struct file *); +}; + +/* procfs stubs - not supported in U-Boot */ +#define proc_mkdir(name, parent) \ + ({ (void)(name); (void)(parent); (struct proc_dir_entry *)NULL; }) +#define proc_create_data(n, m, p, ops, d) \ + ({ (void)(n); (void)(m); (void)(p); (void)(ops); (void)(d); \ + (struct proc_dir_entry *)NULL; }) +#define remove_proc_entry(n, p) \ + do { (void)(n); (void)(p); } while (0) #endif /* _LINUX_PROC_FS_H */ diff --git a/include/linux/utsname.h b/include/linux/utsname.h index 4e1c712ee56..7f77e7e9511 100644 --- a/include/linux/utsname.h +++ b/include/linux/utsname.h @@ -18,4 +18,16 @@ struct uts_namespace { extern struct uts_namespace init_uts_ns; +/** + * init_utsname() - get initial UTS name structure + * + * Return: pointer to static utsname structure + */ +static inline struct new_utsname *init_utsname(void) +{ + static struct new_utsname uts = { .nodename = "u-boot" }; + + return &uts; +} + #endif /* _LINUX_UTSNAME_H */ From patchwork Sun Jan 18 20:37:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1589 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=1768768765; bh=JLQivxf06imC4d4qsVZYk2QrmiY75/Bt6mRLcktXIWw=; 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=Y9GbErGC1UqqejglkZahJob0mgkoGxYaOMOdF1xqHNWIi9bXXe91UBNktxx7i+bUc DhBZHgB3bGG1pgSPLYhTwXOuso9ybO9Xz4OlaMqkPqfKZtxEuFmo5Y4VPIhTWPlZqd Whe9y1Tp5oe+IFlYzITVJXLeqI2zSstD8AzhpnQ9ceGqwuhFSeDYDzedMbawPT+B0n WLLMc5nxAtLDMVbNHci2RutogdY8JaVPzGGSirUpzNe/9taaRmJLXlTQOiATaOpD47 7PU3h73V6UQyRshNZWOdkG8O1noAeN79bR72oHeY35m9dkpMP01NKKOZ7VpLmka4pm OFtOmqu4Aa5xg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9F67C6948C for ; Sun, 18 Jan 2026 13:39:25 -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 Zpj2NpL2V4Sg for ; Sun, 18 Jan 2026 13:39:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768765; bh=JLQivxf06imC4d4qsVZYk2QrmiY75/Bt6mRLcktXIWw=; 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=Y9GbErGC1UqqejglkZahJob0mgkoGxYaOMOdF1xqHNWIi9bXXe91UBNktxx7i+bUc DhBZHgB3bGG1pgSPLYhTwXOuso9ybO9Xz4OlaMqkPqfKZtxEuFmo5Y4VPIhTWPlZqd Whe9y1Tp5oe+IFlYzITVJXLeqI2zSstD8AzhpnQ9ceGqwuhFSeDYDzedMbawPT+B0n WLLMc5nxAtLDMVbNHci2RutogdY8JaVPzGGSirUpzNe/9taaRmJLXlTQOiATaOpD47 7PU3h73V6UQyRshNZWOdkG8O1noAeN79bR72oHeY35m9dkpMP01NKKOZ7VpLmka4pm OFtOmqu4Aa5xg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 878F4693A2 for ; Sun, 18 Jan 2026 13:39:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768764; bh=elCunPi9SEc0VtlIVpg/jsZS0KBUrN21GEDbtziUfP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pW855cvInY3+69jyv0vT5Hrbl9QjmCW96vSicHil53QHgiBSU3kCxMkP8H1ycmYGv Q8Vqob+9f1zIQ9SSKNPrZoBYYfKvkFF/EQ2VNm7RgR7wFEStjO4LoyQWd4Wvjjea3l BcPeaCO/5c0WOQV1QuMzP+JRAGedBMPwHvNmNtFtPOSJasxci6t2aiB0VBwJQ10aHK eq1lgCJyElLgbsj8Qpjon1rgjNQfjB2ij7oouxjVE41l6XtO2s0CALskZhTiGG8Un3 TbDK6B3fq5cC2QYmnCs6kT99Mp+1bIKtbf2nLTa57gWlePWQ/+glpJqVmrMyJ1IQsi 6lOQ9j7qOG4hg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 67C9B693A2; Sun, 18 Jan 2026 13:39:24 -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 z1VuIeVhVwR7; Sun, 18 Jan 2026 13:39:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768757; bh=jTjgGtpafFNHALE4TDt4OeFSBJR+2kUIdDNLyel7+ok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dFVgXddl/LjjndvupUk6R/nn46CPURhAnrK7nydNehqNZpKW7wM6/vfxEEKTvCs4N Rb4Ccyam/y65o8hp/7jJofKemn9L+Fbv9ZhxDg1AU8r6qPAnh6Kec2rFJ3GuEBeSiX Nt+m6pAUDDhc2T8kCq8KvgN+abSRbWh3TSpAo3sGPii2iqFmeoI+1xTFbFW1d/gNRz U8Af1n8bTXC7Hrl6+a3+8sfMEl7BXPN+SUAtdtYkmdvg2LAu6NmkU+v0ZXYiZAgWYw cOl1VOhJJ6TUPitfBOYI4UFUq9WELwbx4W3jCPMhSWtxTk8wNQFyDRVMqXXMYnzSH7 n2+uG1j7UKB3g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7D1AA69382; Sun, 18 Jan 2026 13:39:17 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:32 -0700 Message-ID: <20260118133734.10.a7895a8044577cfe3ec8c1f0b62bce647fcf53e0@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: G5IXIZMATCSDGC3LZFTTXXWUDGCVWWKW X-Message-ID-Hash: G5IXIZMATCSDGC3LZFTTXXWUDGCVWWKW 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 10/12] linux: Add projid.h and mnt_idmapping.h headers 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/projid.h with kprojid_t type definition and INVALID_PROJID constant for filesystem project quotas. Create linux/mnt_idmapping.h with mnt_idmap structure stub for mount ID mapping. U-Boot does not support ID mapping, so this provides only the nop_mnt_idmap reference. Update ext4_uboot.h to use these headers instead of duplicating the definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 18 ++++----------- include/linux/mnt_idmapping.h | 23 +++++++++++++++++++ include/linux/projid.h | 43 +++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 include/linux/mnt_idmapping.h create mode 100644 include/linux/projid.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index b5df747b963..4bc25b73f76 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -105,12 +105,8 @@ #include #include -/* Project ID type */ -typedef struct { unsigned int val; } kprojid_t; - -#define make_kprojid(ns, id) ((kprojid_t){ .val = (id) }) -#define from_kprojid(ns, kprojid) ((kprojid).val) -#define projid_eq(a, b) ((a).val == (b).val) +/* Project ID type - use linux/projid.h */ +#include /* kobject is now in linux/kobject.h */ #include @@ -421,11 +417,8 @@ typedef long long qsize_t; /* DT_* directory entry types are in linux/fs.h */ -/* mnt_idmap - stub */ -struct mnt_idmap { - int dummy; -}; -extern struct mnt_idmap nop_mnt_idmap; +/* mnt_idmap - use linux/mnt_idmapping.h */ +#include /* fstrim_range - stub */ struct fstrim_range { @@ -900,8 +893,7 @@ void folio_put(struct folio *folio); void folio_get(struct folio *folio); void mapping_clear_folio_cache(struct address_space *mapping); -/* projid_t - project ID type */ -typedef unsigned int projid_t; +/* projid_t is now in linux/projid.h */ /* * Additional stubs for inode.c diff --git a/include/linux/mnt_idmapping.h b/include/linux/mnt_idmapping.h new file mode 100644 index 00000000000..3f4e35951da --- /dev/null +++ b/include/linux/mnt_idmapping.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Mount ID mapping definitions for U-Boot + * + * Based on Linux mnt_idmapping.h - user ID mapping for mounts. + * U-Boot stub - ID mapping not supported. + */ +#ifndef _LINUX_MNT_IDMAPPING_H +#define _LINUX_MNT_IDMAPPING_H + +/** + * struct mnt_idmap - mount ID mapping + * + * U-Boot stub - ID mapping not used. + */ +struct mnt_idmap { + int dummy; +}; + +/* Global no-op ID map */ +extern struct mnt_idmap nop_mnt_idmap; + +#endif /* _LINUX_MNT_IDMAPPING_H */ diff --git a/include/linux/projid.h b/include/linux/projid.h new file mode 100644 index 00000000000..d736630a957 --- /dev/null +++ b/include/linux/projid.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Project ID definitions for U-Boot + * + * Based on Linux projid.h - filesystem project IDs for quotas. + */ +#ifndef _LINUX_PROJID_H +#define _LINUX_PROJID_H + +/** + * typedef kprojid_t - kernel project ID + * + * Wrapper type for project IDs used in filesystem quotas. + */ +typedef struct { unsigned int val; } kprojid_t; + +/** + * typedef projid_t - user-space project ID + */ +typedef unsigned int projid_t; + +/** + * make_kprojid() - create a kernel project ID + * @ns: user namespace (ignored in U-Boot) + * @id: project ID value + */ +#define make_kprojid(ns, id) ((kprojid_t){ .val = (id) }) + +/** + * from_kprojid() - extract project ID value + * @ns: user namespace (ignored in U-Boot) + * @kprojid: kernel project ID + */ +#define from_kprojid(ns, kprojid) ((kprojid).val) + +/** + * projid_eq() - compare two project IDs + * @a: first project ID + * @b: second project ID + */ +#define projid_eq(a, b) ((a).val == (b).val) + +#endif /* _LINUX_PROJID_H */ From patchwork Sun Jan 18 20:37:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1590 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=1768768769; bh=MApekY38i1w8tpLAqkiAu060z5TOlrrPmOFHOnoamY0=; 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=fEQaTf3ZfAfngtUGXIEQwuwa0bal8ufwZS7ss+DndXOJtgq+4JRyDcSO7bnLiXu+t AD9olKe1AsAvs/UgbNVQq9Ya3uRU1VbVYpfNPnjo9eFJ8UxZh+aLF2dN8ORNJ4JsRn Gh9+TPhE+tnNvG+1Q04p45CalcnvXFY0wIY/bvgj1tSJa91dENka8+NqtqOFPElXIF fWq+Zpj7kfLwiw0xnGmLyPH4SUcLJITIvwLSufTt6gdmoNKOQqsHsVGw4GR7FuxBSB qlNBgLI3z9mlb5chR7iJHmJl9551D3Yu4TJEvjrjQamot/QzAx/ow8R4LE54YLeqEo FhFivSgunaCDw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2A680693A2 for ; Sun, 18 Jan 2026 13:39:29 -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 pmRhyZ4lUuTN for ; Sun, 18 Jan 2026 13:39:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768769; bh=MApekY38i1w8tpLAqkiAu060z5TOlrrPmOFHOnoamY0=; 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=fEQaTf3ZfAfngtUGXIEQwuwa0bal8ufwZS7ss+DndXOJtgq+4JRyDcSO7bnLiXu+t AD9olKe1AsAvs/UgbNVQq9Ya3uRU1VbVYpfNPnjo9eFJ8UxZh+aLF2dN8ORNJ4JsRn Gh9+TPhE+tnNvG+1Q04p45CalcnvXFY0wIY/bvgj1tSJa91dENka8+NqtqOFPElXIF fWq+Zpj7kfLwiw0xnGmLyPH4SUcLJITIvwLSufTt6gdmoNKOQqsHsVGw4GR7FuxBSB qlNBgLI3z9mlb5chR7iJHmJl9551D3Yu4TJEvjrjQamot/QzAx/ow8R4LE54YLeqEo FhFivSgunaCDw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0117A6948C for ; Sun, 18 Jan 2026 13:39:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768767; bh=jwBF+B4RL08VOLS3+PgZPRoXL4POeTZ9hYGfHPzId8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lDpG0xF3F8FQnqDpsLhAPnoZkewikWoNkH7U4T1m7m1TKkAMaE87hyEABrGkC8CU7 Njs7EMpks+YyAbIft2udmlvHulUQ7r3INC4n3mId+W6qJZU1FKfqTM2MllfOOGsiVs ndJFbxibUQy+4vIG8NIkKzNZWZUDzRlUG99jmG2Ws8SCuhXQ/x5LD4vOWfIyTOWIdO EGNmtJeNWMbEwI+8Wfs0/uML6yOZ2hn6LJ15SkwwRj1kus54dh1uj4dw7xjVx3929a VWVJ0iomUI18AK6703jXoJqvnvlPpvsXey481Q03Y++l1ptwHrvMawU9W6NWGPA4e3 xd19nB4CgV/nw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8A046693A2; Sun, 18 Jan 2026 13:39:27 -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 q2zxzZipFD87; Sun, 18 Jan 2026 13:39:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768762; bh=CrUyAhnNlG6DmS/rUvWzaZrl36qGSfDSMvOmpY5HfVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tMzWid3Gj1kg3OWIbsYRmQPG4sc++gdJNdi0bGI0o1LVUFmEb6/kyYILLLZiCltaQ 3HwR29tzkrozrnKNH4+x4l6h5qspL9O1tde5zu/L6qPJT5UCVMIrLWnarH7dlFE72/ mkEDSnQtYNsNX4JJCOK/VL6sQhmzdu3NQJ2QKx/VsEeolJkq3hzmSt9BMLix7eL9yL OCAJZkLZEKFlNG+ttQ67Pn6MvEA9aK4e+s/8Rw7QdcAnd4XTtFtHQxW1l5euq09dJM ilk+WvX8DXfPNKtgOEvH3OPa8H67+mjK7xBjGf8JjlNoStYLVwgPSGsLrEUImSzxD1 4B1cf2WCwjLhw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2061269499; Sun, 18 Jan 2026 13:39:22 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:33 -0700 Message-ID: <20260118133734.11.397d736c6788ee2e24a276a8634e9d22d18dd84d@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: XNWGXZUY4DHIY6FYZTXQZCHRO2CLR4U5 X-Message-ID-Hash: XNWGXZUY4DHIY6FYZTXQZCHRO2CLR4U5 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 11/12] linux: Add hash.h header with hash_64 function 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/hash.h with hash_64() and hash_32() hash functions. Update ext4_uboot.h to use the new header instead of duplicating the hash_64 definition. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 6 +++--- include/linux/hash.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 include/linux/hash.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 4bc25b73f76..b861079bf48 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -901,8 +901,8 @@ void mapping_clear_folio_cache(struct address_space *mapping); /* try_cmpxchg is now in asm-generic/atomic.h */ -/* hash_64 - simple 64-bit hash */ -#define hash_64(val, bits) ((unsigned long)((val) >> (64 - (bits)))) +/* hash_64 - use linux/hash.h */ +#include /* Dentry operations are now in linux/dcache.h */ #define finish_open_simple(f, e) (e) @@ -1820,7 +1820,7 @@ int ext4_update_overhead(struct super_block *sb, bool force); /* fsmap is now in linux/fsmap.h */ #include -/* list_sort and sort stubs for fsmap.c */ +/* list_sort and sort stubs for fsmap.c - not used in U-Boot */ #define list_sort(priv, head, cmp) \ do { (void)(priv); (void)(head); (void)(cmp); } while (0) #define sort(base, num, size, cmp, swap) \ diff --git a/include/linux/hash.h b/include/linux/hash.h new file mode 100644 index 00000000000..276619ca310 --- /dev/null +++ b/include/linux/hash.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Hash functions for U-Boot + * + * Based on Linux hash.h - fast hashing routines. + */ +#ifndef _LINUX_HASH_H +#define _LINUX_HASH_H + +#include + +/** + * hash_64() - 64-bit hash function + * @val: value to hash + * @bits: number of bits in result + * + * Simple hash by shifting. In Linux this uses multiplication by a + * golden ratio constant, but for U-Boot a simple shift suffices. + * + * Return: hash value with @bits significant bits + */ +#define hash_64(val, bits) ((unsigned long)((val) >> (64 - (bits)))) + +/** + * hash_32() - 32-bit hash function + * @val: value to hash + * @bits: number of bits in result + * + * Return: hash value with @bits significant bits + */ +#define hash_32(val, bits) ((unsigned int)((val) >> (32 - (bits)))) + +#endif /* _LINUX_HASH_H */ From patchwork Sun Jan 18 20:37:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1591 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=1768768775; bh=/NKbpqD+B1ME/MoFOzB0cF/TwkOKZi0nZ5bAvNSbbNQ=; 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=REvZJRmivd8mhz+Qio4qJx9Ae90o7b55rHp8RPKN1ot4r8TLeAdTFfnrzxZ+iSFCO Ga7by7X1Z3VIYQ1xL5oFqZ9TM8HrmvBufckShcW6uTfToXZJqIK5AW0qirlKRG6znW zoI56Dp8NXJ4Wq+5MHepIKqgsX+8ME7I2dyZju1aeQCP1/tjXxKNvb+TLnSAot7uJf xh8ACvn595Qa1pH9WmEg6zwZp0Hrzagp4eJ3jluEFwnwg3eFd0be5+sTv7RkxakO3n J0POb5lJvouMrCJ/eKtlOFyCi23lqNNZE2iHBAv+16n+9EMdcyTLVEI22MAPMTdL+9 TROrzl5R90o6w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 34DA269497 for ; Sun, 18 Jan 2026 13:39:35 -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 PN7ZFD9DW2WT for ; Sun, 18 Jan 2026 13:39:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768775; bh=/NKbpqD+B1ME/MoFOzB0cF/TwkOKZi0nZ5bAvNSbbNQ=; 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=REvZJRmivd8mhz+Qio4qJx9Ae90o7b55rHp8RPKN1ot4r8TLeAdTFfnrzxZ+iSFCO Ga7by7X1Z3VIYQ1xL5oFqZ9TM8HrmvBufckShcW6uTfToXZJqIK5AW0qirlKRG6znW zoI56Dp8NXJ4Wq+5MHepIKqgsX+8ME7I2dyZju1aeQCP1/tjXxKNvb+TLnSAot7uJf xh8ACvn595Qa1pH9WmEg6zwZp0Hrzagp4eJ3jluEFwnwg3eFd0be5+sTv7RkxakO3n J0POb5lJvouMrCJ/eKtlOFyCi23lqNNZE2iHBAv+16n+9EMdcyTLVEI22MAPMTdL+9 TROrzl5R90o6w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0ABF9693A2 for ; Sun, 18 Jan 2026 13:39:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768772; bh=n1Xl+qo3vPt0aA0QVWu98OwozQwfUNCDnfaBftfmVyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DJvcS3wHg4X94XXTtSaKMpAxoJVnSS423B7K0CLTQ8EE1bQz0B+gOIAl6SKbKBwbT lKAX3KKElq+d5CRvHM3WkRqNQpwqnHR9fwwmqq+S9MfmFAGoclw5ZIl26hBh26RnPm pEZWocbmy7vTv2vxSs6RooGRLABkK4GCHLmc22Rk2G81Hoxqjr0BaHP771umIkzV3d WL1A7+/DS2AOvUw7ICk/tytogDoadrIIl+xGVgKJEDdIYoxav+d6ilxtc+r3Cv4+ML CWE7fqQQAfFO5AMDhnZjMPNcTqgcICm/t49fG6aD13MDDhexkaH55IClIA+NscJntA 8mJtXlKTsu8vQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 548CE693A2; Sun, 18 Jan 2026 13:39:32 -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 ihmbWzjgHwgt; Sun, 18 Jan 2026 13:39:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768768; bh=WBI2jWR1tbQZ9TWcJoLCb7FXFrmv4zOfNsf2q2BgpCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aADd2HbT/52MmErSDrW0OYao8mLnxZ989+bl5bRV0dmayKRM0dpYoLnYg9oSXNag8 DLNC6Uag3AwNUABimT+Fd1CX8BL2NjmrHt9MzPICHY6QN5C3cxQiLIv3lpIlYYc/VG RXIhr43ylU6W5b0HqzMCCIdIb3uo1QfmHngcmhWqtPnSFNM7JBooWZB12FH0Pofcg9 3PCo58XXKVY/wXmRZL5zDVlTN6IZu1X+SPJ0Q45BJZ/zP4EayaIYPqibrBUNPb5Yjx AR9UHSnlKU1nNgpoXoI0BxSRDLRa7b3YCc4Oa7gB8y+WuehWYaFq+WePaMkq6ERf8D kgNWjFWZFTGBQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C9F0969382; Sun, 18 Jan 2026 13:39:27 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:34 -0700 Message-ID: <20260118203739.1974323-2-sjg@u-boot.org> 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: IVSM7KGMA2LLJ2LUVOPSBEISXTTJTEZE X-Message-ID-Hash: IVSM7KGMA2LLJ2LUVOPSBEISXTTJTEZE 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 12/12] linux: Add blockgroup_lock.h and delayed_call.h headers 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/blockgroup_lock.h with blockgroup_lock structure and lock operation stubs. Create linux/delayed_call.h with delayed_call structure and set_delayed_call() macro for deferred function calls. Update ext4_uboot.h to use these headers instead of duplicating the definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 25 ++++----------- include/linux/blockgroup_lock.h | 25 +++++++++++++++ include/linux/delayed_call.h | 56 +++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 19 deletions(-) create mode 100644 include/linux/blockgroup_lock.h create mode 100644 include/linux/delayed_call.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index b861079bf48..3c6b3ca5507 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -305,8 +305,7 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, /* atomic_add_unless is now in asm-generic/atomic.h */ -/* Block group lock - stub */ -#define bgl_lock_ptr(lock, group) NULL +/* bgl_lock_ptr is now in linux/blockgroup_lock.h */ /* RCU stubs - use linux/rcupdate.h */ #include @@ -1107,17 +1106,8 @@ struct file_operations { int (*release)(struct inode *, struct file *); }; -/* delayed_call - for delayed freeing of symlink data */ -typedef void (*delayed_call_func_t)(const void *); -struct delayed_call { - delayed_call_func_t fn; - const void *arg; -}; - -#define set_delayed_call(dc, func, data) do { \ - (dc)->fn = (func); \ - (dc)->arg = (data); \ -} while (0) +/* delayed_call - use linux/delayed_call.h */ +#include #define kfree_link kfree @@ -1335,10 +1325,8 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate); /* Max file size for large files */ #define MAX_LFS_FILESIZE ((loff_t)LLONG_MAX) -/* blockgroup_lock for per-group locking */ -struct blockgroup_lock { - int num_locks; /* U-Boot doesn't need real locking */ -}; +/* blockgroup_lock - use linux/blockgroup_lock.h */ +#include /* Buffer submission stubs - declarations for stub.c implementations */ int submit_bh(int op_flags, struct buffer_head *bh); @@ -1444,8 +1432,7 @@ int generic_check_addressable(unsigned int blocksize_bits, u64 num_blocks); u64 sb_bdev_nr_blocks(struct super_block *sb); unsigned int bdev_max_discard_sectors(struct block_device *bdev); -/* Blockgroup lock init - stub */ -#define bgl_lock_init(lock) do { } while (0) +/* bgl_lock_init is now in linux/blockgroup_lock.h */ /* Task I/O priority - declaration for stub.c */ void set_task_ioprio(void *task, int ioprio); diff --git a/include/linux/blockgroup_lock.h b/include/linux/blockgroup_lock.h new file mode 100644 index 00000000000..13b51ba0e57 --- /dev/null +++ b/include/linux/blockgroup_lock.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Block group lock definitions for U-Boot + * + * Based on Linux blockgroup_lock.h - per-block-group locking. + * U-Boot stub - locking not needed in single-threaded environment. + */ +#ifndef _LINUX_BLOCKGROUP_LOCK_H +#define _LINUX_BLOCKGROUP_LOCK_H + +/** + * struct blockgroup_lock - per-block-group lock + * @num_locks: number of locks (unused in U-Boot) + * + * U-Boot stub - real locking not needed. + */ +struct blockgroup_lock { + int num_locks; +}; + +/* Block group lock operations - all no-ops */ +#define bgl_lock_init(lock) do { } while (0) +#define bgl_lock_ptr(lock, group) ((spinlock_t *)NULL) + +#endif /* _LINUX_BLOCKGROUP_LOCK_H */ diff --git a/include/linux/delayed_call.h b/include/linux/delayed_call.h new file mode 100644 index 00000000000..d4248dce742 --- /dev/null +++ b/include/linux/delayed_call.h @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Delayed call definitions for U-Boot + * + * Based on Linux delayed_call.h - deferred function calls. + */ +#ifndef _LINUX_DELAYED_CALL_H +#define _LINUX_DELAYED_CALL_H + +/** + * typedef delayed_call_func_t - delayed call function type + */ +typedef void (*delayed_call_func_t)(const void *); + +/** + * struct delayed_call - delayed function call + * @fn: function to call + * @arg: argument to pass to function + */ +struct delayed_call { + delayed_call_func_t fn; + const void *arg; +}; + +/** + * set_delayed_call() - set up a delayed call + * @dc: delayed call structure + * @func: function to call + * @data: data to pass to function + */ +#define set_delayed_call(dc, func, data) do { \ + (dc)->fn = (func); \ + (dc)->arg = (data); \ +} while (0) + +/** + * do_delayed_call() - execute a delayed call + * @dc: delayed call structure + */ +static inline void do_delayed_call(struct delayed_call *dc) +{ + if (dc->fn) + dc->fn(dc->arg); +} + +/** + * clear_delayed_call() - clear a delayed call + * @dc: delayed call structure + */ +static inline void clear_delayed_call(struct delayed_call *dc) +{ + dc->fn = NULL; + dc->arg = NULL; +} + +#endif /* _LINUX_DELAYED_CALL_H */