[PATCH RFC 2/3] mnt_idmapping: add struct mnt_idmap to header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The next patch will inline all current helpers for that we need access
to struct mnt_idmap internals from the header. Not my favorite but
whatever.

Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
---
 fs/mnt_idmapping.c             |  6 ------
 include/linux/mnt_idmapping.h  |  7 +++++++
 include/linux/uidgid.h         | 23 ++++++++++++++++++++++-
 include/linux/user_namespace.h | 23 +----------------------
 4 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/fs/mnt_idmapping.c b/fs/mnt_idmapping.c
index 8f7ae908ea16..5c7e1db8fef8 100644
--- a/fs/mnt_idmapping.c
+++ b/fs/mnt_idmapping.c
@@ -17,12 +17,6 @@
 #define VFSUIDT_INIT_RAW(val) (vfsuid_t){ val }
 #define VFSGIDT_INIT_RAW(val) (vfsgid_t){ val }
 
-struct mnt_idmap {
-	struct uid_gid_map uid_map;
-	struct uid_gid_map gid_map;
-	refcount_t count;
-};
-
 /*
  * Carries the initial idmapping of 0:0:4294967295 which is an identity
  * mapping. This means that {g,u}id 0 is mapped to {g,u}id 0, {g,u}id 1 is
diff --git a/include/linux/mnt_idmapping.h b/include/linux/mnt_idmapping.h
index 85553b3a7904..4410672c2828 100644
--- a/include/linux/mnt_idmapping.h
+++ b/include/linux/mnt_idmapping.h
@@ -8,6 +8,13 @@
 struct mnt_idmap;
 struct user_namespace;
 
+/* Don't touch directly! All fields private. */
+struct mnt_idmap {
+	struct uid_gid_map uid_map;
+	struct uid_gid_map gid_map;
+	refcount_t count;
+};
+
 extern struct mnt_idmap nop_mnt_idmap;
 extern struct mnt_idmap invalid_mnt_idmap;
 extern struct user_namespace init_user_ns;
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h
index 2dc767e08f54..5696c870fd0b 100644
--- a/include/linux/uidgid.h
+++ b/include/linux/uidgid.h
@@ -17,7 +17,28 @@
 
 struct user_namespace;
 extern struct user_namespace init_user_ns;
-struct uid_gid_map;
+
+#define UID_GID_MAP_MAX_BASE_EXTENTS 5
+#define UID_GID_MAP_MAX_EXTENTS 340
+
+struct uid_gid_extent {
+	u32 first;
+	u32 lower_first;
+	u32 count;
+};
+
+struct uid_gid_map { /* 64 bytes -- 1 cache line */
+	union {
+		struct {
+			struct uid_gid_extent extent[UID_GID_MAP_MAX_BASE_EXTENTS];
+			u32 nr_extents;
+		};
+		struct {
+			struct uid_gid_extent *forward;
+			struct uid_gid_extent *reverse;
+		};
+	};
+};
 
 #define KUIDT_INIT(value) (kuid_t){ value }
 #define KGIDT_INIT(value) (kgid_t){ value }
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index a0bb6d012137..6feae94c3661 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -12,28 +12,7 @@
 #include <linux/rwsem.h>
 #include <linux/sysctl.h>
 #include <linux/err.h>
-
-#define UID_GID_MAP_MAX_BASE_EXTENTS 5
-#define UID_GID_MAP_MAX_EXTENTS 340
-
-struct uid_gid_extent {
-	u32 first;
-	u32 lower_first;
-	u32 count;
-};
-
-struct uid_gid_map { /* 64 bytes -- 1 cache line */
-	union {
-		struct {
-			struct uid_gid_extent extent[UID_GID_MAP_MAX_BASE_EXTENTS];
-			u32 nr_extents;
-		};
-		struct {
-			struct uid_gid_extent *forward;
-			struct uid_gid_extent *reverse;
-		};
-	};
-};
+#include <linux/uidgid.h>
 
 #define USERNS_SETGROUPS_ALLOWED 1UL
 

-- 
2.47.2





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux