Lines Matching +full:reverse +full:- +full:data

1 // SPDX-License-Identifier: GPL-2.0
36 * Carries the invalid idmapping of a full 0-4294967295 {g,u}id range.
45 * initial_idmapping - check whether this is the initial mapping
59 * make_vfsuid - map a filesystem kuid according to an idmapping
93 if (uid == (uid_t)-1) in make_vfsuid()
95 return VFSUIDT_INIT_RAW(map_id_down(&idmap->uid_map, uid)); in make_vfsuid()
100 * make_vfsgid - map a filesystem kgid according to an idmapping
132 if (gid == (gid_t)-1) in make_vfsgid()
134 return VFSGIDT_INIT_RAW(map_id_down(&idmap->gid_map, gid)); in make_vfsgid()
139 * from_vfsuid - map a vfsuid into the filesystem idmapping
145 * order to e.g. write @vfsuid to inode->i_uid.
158 uid = map_id_up(&idmap->uid_map, __vfsuid_val(vfsuid)); in from_vfsuid()
159 if (uid == (uid_t)-1) in from_vfsuid()
168 * from_vfsgid - map a vfsgid into the filesystem idmapping
174 * order to e.g. write @vfsgid to inode->i_gid.
187 gid = map_id_up(&idmap->gid_map, __vfsgid_val(vfsgid)); in from_vfsgid()
188 if (gid == (gid_t)-1) in from_vfsgid()
198 * vfsgid_in_group_p() - check whether a vfsuid matches the caller's groups
221 struct uid_gid_extent *forward, *reverse; in copy_mnt_idmap() local
222 u32 nr_extents = READ_ONCE(map_from->nr_extents); in copy_mnt_idmap()
230 * then we might end up with inconsistent data. So just don't do in copy_mnt_idmap()
234 return -EINVAL; in copy_mnt_idmap()
248 forward = kmemdup_array(map_from->forward, nr_extents, in copy_mnt_idmap()
252 return -ENOMEM; in copy_mnt_idmap()
254 reverse = kmemdup_array(map_from->reverse, nr_extents, in copy_mnt_idmap()
257 if (!reverse) { in copy_mnt_idmap()
259 return -ENOMEM; in copy_mnt_idmap()
267 map_to->forward = forward; in copy_mnt_idmap()
268 map_to->reverse = reverse; in copy_mnt_idmap()
269 map_to->nr_extents = nr_extents; in copy_mnt_idmap()
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()
293 return ERR_PTR(-ENOMEM); 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()
307 * mnt_idmap_get - get a reference to an idmapping
317 refcount_inc(&idmap->count); in mnt_idmap_get()
324 * mnt_idmap_put - put a reference to an idmapping
327 * If this is a non-initial idmapping, put the reference count when a mount is
333 refcount_dec_and_test(&idmap->count)) in mnt_idmap_put()