From patchwork Mon Jan 19 21:48:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1667 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=1768859388; bh=5rsVYaRMNQdCujKTuOgLIVAaLX+xaeAlZ9HJdqQ9MC4=; 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=r2cR9zf0w87acSL+4ZrFo8zvlQm8pApobESbh31mgu9xozUMhX6hT/BBAx6E6ZMys VEPu7nPTyRY84/FGp5ab+v8tNkq2zURS4iexA2uUFMhlJwHIMWTzR0EOrTMjQaB2qq dyJjhKWWqNp/6CR++DWQeHfXAt4CwK2RfA8gTiTuLOX75BVE+wQcVxRJFosl44Km9m jvkq3P1tNgJL9ovRv4Xa6Cwf4ynU1R4dXtNbgfUvFqPOp0Wyxj6kGT+LMW6iF6GYAf wKCnrpaGVGcO+RFfX4RbKkgrR07SvuevKNOEDM1zAUh11aCC8Okh7q1MHPgr3wh8j7 +6ubrrfbk1rRg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A430769535 for ; Mon, 19 Jan 2026 14:49: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 10024) with ESMTP id QubNjojC1kYR for ; Mon, 19 Jan 2026 14:49:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768859388; bh=5rsVYaRMNQdCujKTuOgLIVAaLX+xaeAlZ9HJdqQ9MC4=; 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=r2cR9zf0w87acSL+4ZrFo8zvlQm8pApobESbh31mgu9xozUMhX6hT/BBAx6E6ZMys VEPu7nPTyRY84/FGp5ab+v8tNkq2zURS4iexA2uUFMhlJwHIMWTzR0EOrTMjQaB2qq dyJjhKWWqNp/6CR++DWQeHfXAt4CwK2RfA8gTiTuLOX75BVE+wQcVxRJFosl44Km9m jvkq3P1tNgJL9ovRv4Xa6Cwf4ynU1R4dXtNbgfUvFqPOp0Wyxj6kGT+LMW6iF6GYAf wKCnrpaGVGcO+RFfX4RbKkgrR07SvuevKNOEDM1zAUh11aCC8Okh7q1MHPgr3wh8j7 +6ubrrfbk1rRg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8F52A69525 for ; Mon, 19 Jan 2026 14:49:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768859385; bh=HfYCcc0/z824C4h2MbcWelx/uGR8KKh7kFLV6+TAmIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tIP6Tbvih45l8SvEF+SbmfKjD8+KX3nVpvFUFqSeNcQfTLESJMwB7IQfsz1+GXEpl Jn9AJKbgCcCPI/7/MwE1T27zauBnOJnsA0rCZACc4VVPYruno4IGlgdlPvGgLzYCey DNQ4MlTlWGeVZKq7ebMlOUMbZ15ccVbeC526aR2FN+QfN3qwhrHKrzdSpu4eypISWK 8EkCKSX3QMM5Kf2Ylx8QaVNUu+j33n2KD4T9WHwozrCa5tYVjAzunbfyLGCdTTvA95 ZOAs2fzwRgAPOXi+9sf/e4r2e+PGqjHCE5NeaXH+v6nhD24Ko4/IJdoaY7iYTTLL/Q gO4iDRP0TUqJA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AFD9E69520; Mon, 19 Jan 2026 14:49:45 -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 AqjTMEFbAc0a; Mon, 19 Jan 2026 14:49:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768859381; bh=DaLJRYYOT3f54R4+sqypDAT2/ln288V+0p7J2A2rarA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AdMnMMloEyOXCFZYKyk1eLTR5okkQukfv3oLktQPy41Qmgd+hMTOZAWY74+ayFNvk j+K8F4kHew8ySTSapKqvwQX3wXAbDHErScYm02x7f0n9qfY9Z2IxZglEEZ8FAGss1e Yj2dlPm4nQhouTu9Q/E/gpFE//vLonHIJvoPKye3CN1001QK1aTTPU9hPwCfNpHNZW hNJPmUG+1OPmzFj7YGCmJfex3EpZb4efHY5j6U595kkjUG+q8u2wYDSLX+/W6NHNr+ xLfZbE9IfY+f1XpSzs6NHje8V19/Z2MU1e0ndSfESafvrYRd/HUBs4fjU/UG7eEz+a 0hkD0Wgz0ipQQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 686896951A; Mon, 19 Jan 2026 14:49:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 19 Jan 2026 14:48:35 -0700 Message-ID: <20260119214846.3087611-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260119214846.3087611-1-sjg@u-boot.org> References: <20260119214846.3087611-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UA4EWFX7L7PKUC7TVRVOGOMUB4MIG27W X-Message-ID-Hash: UA4EWFX7L7PKUC7TVRVOGOMUB4MIG27W 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/16] ext4l: Add linux/highuid.h and move UID/GID helpers 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 include/linux/highuid.h with the low_16_bits(), high_16_bits(), fs_high2lowuid(), and fs_high2lowgid() macros. These helpers are used for 16/32-bit UID/GID conversion in filesystem code. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 7 ++----- include/linux/highuid.h | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 include/linux/highuid.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 6772fd8328f..69c50d406f7 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -864,11 +864,8 @@ static inline unsigned int i_gid_read(const struct inode *inode) /* Device encoding helpers are now in linux/kdev_t.h */ #include -/* UID/GID bit helpers */ -#define low_16_bits(x) ((x) & 0xFFFF) -#define high_16_bits(x) (((x) >> 16) & 0xFFFF) -#define fs_high2lowuid(uid) ((uid) & 0xFFFF) -#define fs_high2lowgid(gid) ((gid) & 0xFFFF) +/* UID/GID bit helpers - use linux/highuid.h */ +#include /* Inode allocation/state operations */ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); diff --git a/include/linux/highuid.h b/include/linux/highuid.h new file mode 100644 index 00000000000..9bffa16b0aa --- /dev/null +++ b/include/linux/highuid.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * High UID/GID to low UID/GID conversion helpers + * + * Based on Linux highuid.h + */ +#ifndef _LINUX_HIGHUID_H +#define _LINUX_HIGHUID_H + +/* + * U-Boot doesn't support 16-bit UIDs/GIDs overflow handling, + * so these are simplified versions. + */ +#define low_16_bits(x) ((x) & 0xFFFF) +#define high_16_bits(x) (((x) >> 16) & 0xFFFF) +#define fs_high2lowuid(uid) ((uid) & 0xFFFF) +#define fs_high2lowgid(gid) ((gid) & 0xFFFF) + +#endif /* _LINUX_HIGHUID_H */