mnt_idmapping.h (d0e99511834b6828c960e978d9a8cb6e5731250d) | mnt_idmapping.h (c14329d39f2daa8132e1bbe5cc531da387bcf44a) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _LINUX_MNT_IDMAPPING_H 3#define _LINUX_MNT_IDMAPPING_H 4 5#include <linux/types.h> 6#include <linux/uidgid.h> 7 8struct mnt_idmap; --- 361 unchanged lines hidden (view full) --- 370 * Return: a kgid with the value of @vfsgid 371 */ 372static inline kgid_t vfsgid_into_kgid(vfsgid_t vfsgid) 373{ 374 return AS_KGIDT(vfsgid); 375} 376 377/** | 1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _LINUX_MNT_IDMAPPING_H 3#define _LINUX_MNT_IDMAPPING_H 4 5#include <linux/types.h> 6#include <linux/uidgid.h> 7 8struct mnt_idmap; --- 361 unchanged lines hidden (view full) --- 370 * Return: a kgid with the value of @vfsgid 371 */ 372static inline kgid_t vfsgid_into_kgid(vfsgid_t vfsgid) 373{ 374 return AS_KGIDT(vfsgid); 375} 376 377/** |
378 * mapped_fsuid - return caller's fsuid mapped up into a mnt_userns 379 * @mnt_userns: the mount's idmapping | 378 * mapped_fsuid - return caller's fsuid mapped according to an idmapping 379 * @idmap: the mount's idmapping |
380 * @fs_userns: the filesystem's idmapping 381 * 382 * Use this helper to initialize a new vfs or filesystem object based on 383 * the caller's fsuid. A common example is initializing the i_uid field of 384 * a newly allocated inode triggered by a creation event such as mkdir or 385 * O_CREAT. Other examples include the allocation of quotas for a specific 386 * user. 387 * | 380 * @fs_userns: the filesystem's idmapping 381 * 382 * Use this helper to initialize a new vfs or filesystem object based on 383 * the caller's fsuid. A common example is initializing the i_uid field of 384 * a newly allocated inode triggered by a creation event such as mkdir or 385 * O_CREAT. Other examples include the allocation of quotas for a specific 386 * user. 387 * |
388 * Return: the caller's current fsuid mapped up according to @mnt_userns. | 388 * Return: the caller's current fsuid mapped up according to @idmap. |
389 */ | 389 */ |
390static inline kuid_t mapped_fsuid(struct user_namespace *mnt_userns, | 390static inline kuid_t mapped_fsuid(struct mnt_idmap *idmap, |
391 struct user_namespace *fs_userns) 392{ | 391 struct user_namespace *fs_userns) 392{ |
393 struct user_namespace *mnt_userns = mnt_idmap_owner(idmap); |
|
393 return from_vfsuid(mnt_userns, fs_userns, 394 VFSUIDT_INIT(current_fsuid())); 395} 396 397/** | 394 return from_vfsuid(mnt_userns, fs_userns, 395 VFSUIDT_INIT(current_fsuid())); 396} 397 398/** |
398 * mapped_fsgid - return caller's fsgid mapped up into a mnt_userns 399 * @mnt_userns: the mount's idmapping | 399 * mapped_fsgid - return caller's fsgid mapped according to an idmapping 400 * @idmap: the mount's idmapping |
400 * @fs_userns: the filesystem's idmapping 401 * 402 * Use this helper to initialize a new vfs or filesystem object based on 403 * the caller's fsgid. A common example is initializing the i_gid field of 404 * a newly allocated inode triggered by a creation event such as mkdir or 405 * O_CREAT. Other examples include the allocation of quotas for a specific 406 * user. 407 * | 401 * @fs_userns: the filesystem's idmapping 402 * 403 * Use this helper to initialize a new vfs or filesystem object based on 404 * the caller's fsgid. A common example is initializing the i_gid field of 405 * a newly allocated inode triggered by a creation event such as mkdir or 406 * O_CREAT. Other examples include the allocation of quotas for a specific 407 * user. 408 * |
408 * Return: the caller's current fsgid mapped up according to @mnt_userns. | 409 * Return: the caller's current fsgid mapped up according to @idmap. |
409 */ | 410 */ |
410static inline kgid_t mapped_fsgid(struct user_namespace *mnt_userns, | 411static inline kgid_t mapped_fsgid(struct mnt_idmap *idmap, |
411 struct user_namespace *fs_userns) 412{ | 412 struct user_namespace *fs_userns) 413{ |
414 struct user_namespace *mnt_userns = mnt_idmap_owner(idmap); |
|
413 return from_vfsgid(mnt_userns, fs_userns, 414 VFSGIDT_INIT(current_fsgid())); 415} 416 417#endif /* _LINUX_MNT_IDMAPPING_H */ | 415 return from_vfsgid(mnt_userns, fs_userns, 416 VFSGIDT_INIT(current_fsgid())); 417} 418 419#endif /* _LINUX_MNT_IDMAPPING_H */ |