Lines Matching refs:idmap
79 vfsuid_t make_vfsuid(struct mnt_idmap *idmap, in make_vfsuid() argument
85 if (idmap == &nop_mnt_idmap) in make_vfsuid()
87 if (idmap == &invalid_mnt_idmap) in make_vfsuid()
95 return VFSUIDT_INIT_RAW(map_id_down(&idmap->uid_map, uid)); in make_vfsuid()
119 vfsgid_t make_vfsgid(struct mnt_idmap *idmap, in make_vfsgid() argument
124 if (idmap == &nop_mnt_idmap) in make_vfsgid()
126 if (idmap == &invalid_mnt_idmap) in make_vfsgid()
134 return VFSGIDT_INIT_RAW(map_id_down(&idmap->gid_map, gid)); in make_vfsgid()
149 kuid_t from_vfsuid(struct mnt_idmap *idmap, in from_vfsuid() argument
154 if (idmap == &nop_mnt_idmap) in from_vfsuid()
156 if (idmap == &invalid_mnt_idmap) in from_vfsuid()
158 uid = map_id_up(&idmap->uid_map, __vfsuid_val(vfsuid)); in from_vfsuid()
178 kgid_t from_vfsgid(struct mnt_idmap *idmap, in from_vfsgid() argument
183 if (idmap == &nop_mnt_idmap) in from_vfsgid()
185 if (idmap == &invalid_mnt_idmap) in from_vfsgid()
187 gid = map_id_up(&idmap->gid_map, __vfsgid_val(vfsgid)); in from_vfsgid()
273 static void free_mnt_idmap(struct mnt_idmap *idmap) in free_mnt_idmap() argument
275 if (idmap->uid_map.nr_extents > UID_GID_MAP_MAX_BASE_EXTENTS) { in free_mnt_idmap()
276 kfree(idmap->uid_map.forward); in free_mnt_idmap()
277 kfree(idmap->uid_map.reverse); in free_mnt_idmap()
279 if (idmap->gid_map.nr_extents > UID_GID_MAP_MAX_BASE_EXTENTS) { in free_mnt_idmap()
280 kfree(idmap->gid_map.forward); in free_mnt_idmap()
281 kfree(idmap->gid_map.reverse); in free_mnt_idmap()
283 kfree(idmap); in free_mnt_idmap()
288 struct mnt_idmap *idmap; in alloc_mnt_idmap() local
291 idmap = kzalloc(sizeof(struct mnt_idmap), GFP_KERNEL_ACCOUNT); in alloc_mnt_idmap()
292 if (!idmap) in alloc_mnt_idmap()
295 refcount_set(&idmap->count, 1); in alloc_mnt_idmap()
296 ret = copy_mnt_idmap(&mnt_userns->uid_map, &idmap->uid_map); in alloc_mnt_idmap()
298 ret = copy_mnt_idmap(&mnt_userns->gid_map, &idmap->gid_map); in alloc_mnt_idmap()
300 free_mnt_idmap(idmap); in alloc_mnt_idmap()
301 idmap = ERR_PTR(ret); in alloc_mnt_idmap()
303 return idmap; in alloc_mnt_idmap()
314 struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap) in mnt_idmap_get() argument
316 if (idmap != &nop_mnt_idmap && idmap != &invalid_mnt_idmap) in mnt_idmap_get()
317 refcount_inc(&idmap->count); in mnt_idmap_get()
319 return idmap; in mnt_idmap_get()
330 void mnt_idmap_put(struct mnt_idmap *idmap) in mnt_idmap_put() argument
332 if (idmap != &nop_mnt_idmap && idmap != &invalid_mnt_idmap && in mnt_idmap_put()
333 refcount_dec_and_test(&idmap->count)) in mnt_idmap_put()
334 free_mnt_idmap(idmap); in mnt_idmap_put()