Lines Matching refs:idmap

80 vfsuid_t make_vfsuid(struct mnt_idmap *idmap,  in make_vfsuid()  argument
86 if (idmap == &nop_mnt_idmap) in make_vfsuid()
88 if (idmap == &invalid_mnt_idmap) in make_vfsuid()
96 return VFSUIDT_INIT_RAW(map_id_down(&idmap->uid_map, uid)); in make_vfsuid()
120 vfsgid_t make_vfsgid(struct mnt_idmap *idmap, in make_vfsgid() argument
125 if (idmap == &nop_mnt_idmap) in make_vfsgid()
127 if (idmap == &invalid_mnt_idmap) in make_vfsgid()
135 return VFSGIDT_INIT_RAW(map_id_down(&idmap->gid_map, gid)); in make_vfsgid()
150 kuid_t from_vfsuid(struct mnt_idmap *idmap, in from_vfsuid() argument
155 if (idmap == &nop_mnt_idmap) in from_vfsuid()
157 if (idmap == &invalid_mnt_idmap) in from_vfsuid()
159 uid = map_id_up(&idmap->uid_map, __vfsuid_val(vfsuid)); in from_vfsuid()
179 kgid_t from_vfsgid(struct mnt_idmap *idmap, in from_vfsgid() argument
184 if (idmap == &nop_mnt_idmap) in from_vfsgid()
186 if (idmap == &invalid_mnt_idmap) in from_vfsgid()
188 gid = map_id_up(&idmap->gid_map, __vfsgid_val(vfsgid)); in from_vfsgid()
274 static void free_mnt_idmap(struct mnt_idmap *idmap) in free_mnt_idmap() argument
276 if (idmap->uid_map.nr_extents > UID_GID_MAP_MAX_BASE_EXTENTS) { in free_mnt_idmap()
277 kfree(idmap->uid_map.forward); in free_mnt_idmap()
278 kfree(idmap->uid_map.reverse); in free_mnt_idmap()
280 if (idmap->gid_map.nr_extents > UID_GID_MAP_MAX_BASE_EXTENTS) { in free_mnt_idmap()
281 kfree(idmap->gid_map.forward); in free_mnt_idmap()
282 kfree(idmap->gid_map.reverse); in free_mnt_idmap()
284 kfree(idmap); in free_mnt_idmap()
289 struct mnt_idmap *idmap; in alloc_mnt_idmap() local
292 idmap = kzalloc(sizeof(struct mnt_idmap), GFP_KERNEL_ACCOUNT); in alloc_mnt_idmap()
293 if (!idmap) in alloc_mnt_idmap()
296 refcount_set(&idmap->count, 1); in alloc_mnt_idmap()
297 ret = copy_mnt_idmap(&mnt_userns->uid_map, &idmap->uid_map); in alloc_mnt_idmap()
299 ret = copy_mnt_idmap(&mnt_userns->gid_map, &idmap->gid_map); in alloc_mnt_idmap()
301 free_mnt_idmap(idmap); in alloc_mnt_idmap()
302 idmap = ERR_PTR(ret); in alloc_mnt_idmap()
304 return idmap; in alloc_mnt_idmap()
315 struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap) in mnt_idmap_get() argument
317 if (idmap != &nop_mnt_idmap && idmap != &invalid_mnt_idmap) in mnt_idmap_get()
318 refcount_inc(&idmap->count); in mnt_idmap_get()
320 return idmap; in mnt_idmap_get()
331 void mnt_idmap_put(struct mnt_idmap *idmap) in mnt_idmap_put() argument
333 if (idmap != &nop_mnt_idmap && idmap != &invalid_mnt_idmap && in mnt_idmap_put()
334 refcount_dec_and_test(&idmap->count)) in mnt_idmap_put()
335 free_mnt_idmap(idmap); in mnt_idmap_put()
339 int statmount_mnt_idmap(struct mnt_idmap *idmap, struct seq_file *seq, bool uid_map) in statmount_mnt_idmap() argument
344 if (!is_valid_mnt_idmap(idmap)) in statmount_mnt_idmap()
352 map = &idmap->uid_map; in statmount_mnt_idmap()
355 map = &idmap->gid_map; in statmount_mnt_idmap()