[Concept,10/16] ext4l: Add linux/highuid.h and move UID/GID helpers
Commit Message
From: Simon Glass <simon.glass@canonical.com>
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 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
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
@@ -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 <linux/kdev_t.h>
-/* 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 <linux/highuid.h>
/* Inode allocation/state operations */
extern struct inode *iget_locked(struct super_block *sb, unsigned long ino);
new file mode 100644
@@ -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 */