From patchwork Wed Jan 14 22:56:15 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1519 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=1768431521; bh=qI70Qs8hmtr1o1WRFf3joZYyp4DRrBoaAwrESdxl2wk=; 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=Az48Bm8HGhvkK2KWe8ZRCU1XMqFfZ7fzrHwcGAPYgGBcMt4SeIqxeBGzqLUDbqZ5k xoZI3efRRfI82b2k7GRi6zU5c2nJYIYCbbcDOSvGbX08t/CuEpPduJr2uUpJJD0Af+ 8Ed5AZZKvOE2B7+0EV76ZbmVN9CnMs7U7g+aoo/Han4fvWmzgu76DkYwbdlIWL5HK3 xE7LvKHWOyAnJsAz0bggp1xMN1cA4VJtZ5TsKj8l/0fiQmhla4Udw5vgUk8jgkzOto LyedVZV5uTnDna4xxJNBYkcf01ksRoBSvwlcMccNdO7oT+bOQWwKlXLeZswkqw9edr ItumDWrtPegLQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C5A0069360 for ; Wed, 14 Jan 2026 15:58:41 -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 R_Bw0tzqFDlS for ; Wed, 14 Jan 2026 15:58:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768431521; bh=qI70Qs8hmtr1o1WRFf3joZYyp4DRrBoaAwrESdxl2wk=; 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=Az48Bm8HGhvkK2KWe8ZRCU1XMqFfZ7fzrHwcGAPYgGBcMt4SeIqxeBGzqLUDbqZ5k xoZI3efRRfI82b2k7GRi6zU5c2nJYIYCbbcDOSvGbX08t/CuEpPduJr2uUpJJD0Af+ 8Ed5AZZKvOE2B7+0EV76ZbmVN9CnMs7U7g+aoo/Han4fvWmzgu76DkYwbdlIWL5HK3 xE7LvKHWOyAnJsAz0bggp1xMN1cA4VJtZ5TsKj8l/0fiQmhla4Udw5vgUk8jgkzOto LyedVZV5uTnDna4xxJNBYkcf01ksRoBSvwlcMccNdO7oT+bOQWwKlXLeZswkqw9edr ItumDWrtPegLQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B4F026934D for ; Wed, 14 Jan 2026 15:58:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768431520; bh=Sy6jh+y7PsgcM79R5aEcg+uSn/r+azI5XMJAKRWnrHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cBObL+B6/CdjmnK4FUv+VUHnDaveko+0AZrWS7eY0ljwqtw0gq7bwUAcHlN9RVk5q 19laf6+o7GNaeK7z0sweLXCt04QvdMHhaHH3LuAZEXfrxD3GT/2dY4LRI475WaS5/p 6n54QPZnVMdGuwaQd2KBGGjkD7n5b06avcujhYogz3QTtfeyEKq4Wo5hFoMNYarWJn wxV7+TqChWJLm3ES0ykSY6Dgc+GXKy3dCMMGX/4pHr3/4cDNDIfdzZ2dj04ecnJht5 elpWHhhLO9oHvaJMyiDZpEe5SpNIiUNvsDipwXGG2+DAL5lNAAGet/N2qkZ45SghaP rB0kqk4aHATRQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 166436913F; Wed, 14 Jan 2026 15:58:40 -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 rWSyVICmCvYh; Wed, 14 Jan 2026 15:58:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768431516; bh=+4L6qWPc/0T0pGsIh3HasoWt2IDe39CXwEUyXuqJWm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OnBLWZDUaCJUPFYH8HaDeo5cOEaghQ/Rr47Uqh6c4X5HwK+iaUzGUju7Y1jsPQhh4 yCEt6hNJdx4nrUvJk7EGg+HbKu27hhBfO1kIKrR2OpY/ayyfnr3dNXKysuHrhkQCMW D3Kw4aXmth5CXGPG0lrLf8jgOg8/f+U+LLjMCQODuyiVUBm9O5a4Sfx0BgCLQvcDYX qFE6jQYWx6DjQTshP28ygfwPNGUUBSDpxnfmHYiDpl1QAO1vQ4YLdyq/ICJa9P3T4u jSM3+G3/Vqm8DjpbKQVwv8c16SmQasgonslnOMgOtezd2x5+avrxYrgTZi9Y64t7qj xTz0GQwN1b4CA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id AEDDB692EF; Wed, 14 Jan 2026 15:58:35 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 14 Jan 2026 15:56:15 -0700 Message-ID: <20260114225635.3407989-26-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260114225635.3407989-1-sjg@u-boot.org> References: <20260114225635.3407989-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: WQXGQG3UJ5HXCEUXVVCAJU4XNM6PENWD X-Message-ID-Hash: WQXGQG3UJ5HXCEUXVVCAJU4XNM6PENWD 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 25/34] ext4l: Move struct dir_context to linux/fs.h List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Move the directory iteration types and helpers from ext4_uboot.h to linux/fs.h where they belong as part of the VFS interface: - struct dir_context: context for directory iteration - filldir_t: callback type for directory entry emission - dir_emit(): helper to emit a directory entry - dir_relax_shared(): lock relaxation macro (no-op in U-Boot) This makes these types available for other filesystem implementations. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 17 ++--------------- include/linux/fs.h | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 4b342089489..4cb9b23a8c7 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -198,14 +198,7 @@ struct kiocb { /* __counted_by attribute - not available in U-Boot */ #define __counted_by(x) -/* dir_context for directory iteration */ -struct dir_context; -typedef int (*filldir_t)(struct dir_context *, const char *, int, loff_t, u64, unsigned); - -struct dir_context { - filldir_t actor; - loff_t pos; -}; +/* dir_context, filldir_t are in linux/fs.h */ /* iomap types and structs are in linux/iomap.h */ @@ -1545,13 +1538,7 @@ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); #define inode_eq_iversion(i, v) ({ (void)(i); (void)(v); 1; }) #define inode_query_iversion(i) ({ (void)(i); 0ULL; }) -/* Directory context operations - call the actor callback */ -static inline bool dir_emit(struct dir_context *ctx, const char *name, int len, - u64 ino, unsigned int type) -{ - return ctx->actor(ctx, name, len, ctx->pos, ino, type) == 0; -} -#define dir_relax_shared(i) ({ (void)(i); 1; }) +/* dir_emit, dir_relax_shared are in linux/fs.h */ /* File llseek */ #define generic_file_llseek_size(f, o, w, m, e) ({ (void)(f); (void)(o); (void)(w); (void)(m); (void)(e); 0LL; }) diff --git a/include/linux/fs.h b/include/linux/fs.h index 049033c0cd7..af9cf21692b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -173,4 +173,23 @@ static inline void inode_init_once(struct inode *inode) /* S_ISDIR, etc. - already in linux/stat.h */ #include +/* Directory context for readdir iteration */ +struct dir_context; +typedef int (*filldir_t)(struct dir_context *, const char *, int, loff_t, + u64, unsigned); + +struct dir_context { + filldir_t actor; + loff_t pos; +}; + +/* dir_emit - emit a directory entry to the context callback */ +static inline bool dir_emit(struct dir_context *ctx, const char *name, int len, + u64 ino, unsigned int type) +{ + return ctx->actor(ctx, name, len, ctx->pos, ino, type) == 0; +} + +#define dir_relax_shared(i) ({ (void)(i); 1; }) + #endif /* _LINUX_FS_H */