[Concept,10/12] linux: Add projid.h and mnt_idmapping.h headers
Commit Message
From: Simon Glass <simon.glass@canonical.com>
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 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
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
@@ -105,12 +105,8 @@
#include <linux/percpu_counter.h>
#include <linux/percpu.h>
-/* 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 <linux/projid.h>
/* kobject is now in linux/kobject.h */
#include <linux/kobject.h>
@@ -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 <linux/mnt_idmapping.h>
/* 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
new file mode 100644
@@ -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 */
new file mode 100644
@@ -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 */