Lines Matching refs:idmap
30 * @idmap: idmap of the relevent mount
33 * Return: true if @idmap is allowed, false if not.
35 bool check_fsmapping(const struct mnt_idmap *idmap,
38 return idmap->owner != sb->s_user_ns;
77 * @idmap: the mount's idmapping
81 * Take a @kuid and remap it from @fs_userns into @idmap. Use this
91 * Return: @kuid mapped according to @idmap.
92 * If @kuid has no mapping in either @idmap or @fs_userns INVALID_UID is
96 vfsuid_t make_vfsuid(struct mnt_idmap *idmap,
101 struct user_namespace *mnt_userns = idmap->owner;
117 * @idmap: the mount's idmapping
121 * Take a @kgid and remap it from @fs_userns into @idmap. Use this
131 * Return: @kgid mapped according to @idmap.
132 * If @kgid has no mapping in either @idmap or @fs_userns INVALID_GID is
135 vfsgid_t make_vfsgid(struct mnt_idmap *idmap,
139 struct user_namespace *mnt_userns = idmap->owner;
155 * @idmap: the mount's idmapping
164 kuid_t from_vfsuid(struct mnt_idmap *idmap,
168 struct user_namespace *mnt_userns = idmap->owner;
183 * @idmap: the mount's idmapping
192 kgid_t from_vfsgid(struct mnt_idmap *idmap,
196 struct user_namespace *mnt_userns = idmap->owner;
233 struct mnt_idmap *idmap;
235 idmap = kzalloc(sizeof(struct mnt_idmap), GFP_KERNEL_ACCOUNT);
236 if (!idmap)
239 idmap->owner = get_user_ns(mnt_userns);
240 refcount_set(&idmap->count, 1);
241 return idmap;
246 * @idmap: the idmap to bump the reference on
248 * If @idmap is not the @nop_mnt_idmap bump the reference count.
250 * Return: @idmap with reference count bumped if @not_mnt_idmap isn't passed.
252 struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap)
254 if (idmap != &nop_mnt_idmap)
255 refcount_inc(&idmap->count);
257 return idmap;
262 * @idmap: the idmap to put the reference on
267 void mnt_idmap_put(struct mnt_idmap *idmap)
269 if (idmap != &nop_mnt_idmap && refcount_dec_and_test(&idmap->count)) {
270 put_user_ns(idmap->owner);
271 kfree(idmap);