[CRIU] [PATCH v1 08/17] ns: Rename and export userns_id()

Kirill Tkhai ktkhai at virtuozzo.com
Thu Jan 12 09:53:29 PST 2017


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/include/namespaces.h |    1 +
 criu/namespaces.c         |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h
index 32b2223a9..f89ef22ba 100644
--- a/criu/include/namespaces.h
+++ b/criu/include/namespaces.h
@@ -125,6 +125,7 @@ extern struct ns_id *ns_ids;
 	}
 
 extern bool check_ns_proc(struct fd_link *link);
+extern unsigned int child_userns_xid(unsigned int xid, UidGidExtent **map, int n);
 
 extern struct ns_desc pid_ns_desc;
 extern struct ns_desc user_ns_desc;
diff --git a/criu/namespaces.c b/criu/namespaces.c
index 0a1fdf0a5..c33746413 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -730,7 +730,7 @@ int populate_ns_hierarhy(void)
 static UsernsEntry *userns_entry;
 #define INVALID_ID (~0U)
 
-static unsigned int userns_id(unsigned int id, UidGidExtent **map, int n)
+unsigned int child_userns_xid(unsigned int id, UidGidExtent **map, int n)
 {
 	int i;
 
@@ -776,7 +776,7 @@ uid_t userns_uid(uid_t uid)
 	if (!(root_ns_mask & CLONE_NEWUSER) || !e)
 		return uid;
 
-	return userns_id(uid, e->uid_map, e->n_uid_map);
+	return child_userns_xid(uid, e->uid_map, e->n_uid_map);
 }
 
 gid_t userns_gid(gid_t gid)
@@ -786,7 +786,7 @@ gid_t userns_gid(gid_t gid)
 	if (!(root_ns_mask & CLONE_NEWUSER) || !e)
 		return gid;
 
-	return userns_id(gid, e->gid_map, e->n_gid_map);
+	return child_userns_xid(gid, e->gid_map, e->n_gid_map);
 }
 
 static int parse_id_map(pid_t pid, char *name, UidGidExtent ***pb_exts)



More information about the CRIU mailing list