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 */