include/linux/mnt_idmapping.h
Source file repositories/reference/linux-study-clean/include/linux/mnt_idmapping.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/mnt_idmapping.h- Extension
.h- Size
- 7186 bytes
- Lines
- 254
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/uidgid.h
Detected Declarations
struct mnt_idmapstruct user_namespacefunction is_valid_mnt_idmapfunction __vfsuid_valfunction __vfsgid_valfunction __vfsuid_valfunction __vfsgid_valfunction vfsuid_validfunction vfsgid_validfunction vfsuid_eqfunction vfsgid_eqfunction vfsuid_eq_kuidfunction vfsgid_eq_kgidfunction vfsuid_has_fsmappingfunction vfsuid_has_mappingfunction vfsuid_into_kuidfunction vfsgid_has_fsmappingfunction vfsgid_has_mappingfunction vfsgid_into_kgidfunction mapped_fsuidfunction mapped_fsgid
Annotated Snippet
#ifndef _LINUX_MNT_IDMAPPING_H
#define _LINUX_MNT_IDMAPPING_H
#include <linux/types.h>
#include <linux/uidgid.h>
struct mnt_idmap;
struct user_namespace;
extern struct mnt_idmap nop_mnt_idmap;
extern struct mnt_idmap invalid_mnt_idmap;
extern struct user_namespace init_user_ns;
typedef struct {
uid_t val;
} vfsuid_t;
typedef struct {
gid_t val;
} vfsgid_t;
static_assert(sizeof(vfsuid_t) == sizeof(kuid_t));
static_assert(sizeof(vfsgid_t) == sizeof(kgid_t));
static_assert(offsetof(vfsuid_t, val) == offsetof(kuid_t, val));
static_assert(offsetof(vfsgid_t, val) == offsetof(kgid_t, val));
static inline bool is_valid_mnt_idmap(const struct mnt_idmap *idmap)
{
return idmap != &nop_mnt_idmap && idmap != &invalid_mnt_idmap;
}
#ifdef CONFIG_MULTIUSER
static inline uid_t __vfsuid_val(vfsuid_t uid)
{
return uid.val;
}
static inline gid_t __vfsgid_val(vfsgid_t gid)
{
return gid.val;
}
#else
static inline uid_t __vfsuid_val(vfsuid_t uid)
{
return 0;
}
static inline gid_t __vfsgid_val(vfsgid_t gid)
{
return 0;
}
#endif
static inline bool vfsuid_valid(vfsuid_t uid)
{
return __vfsuid_val(uid) != (uid_t)-1;
}
static inline bool vfsgid_valid(vfsgid_t gid)
{
return __vfsgid_val(gid) != (gid_t)-1;
}
static inline bool vfsuid_eq(vfsuid_t left, vfsuid_t right)
{
return vfsuid_valid(left) && __vfsuid_val(left) == __vfsuid_val(right);
}
static inline bool vfsgid_eq(vfsgid_t left, vfsgid_t right)
{
return vfsgid_valid(left) && __vfsgid_val(left) == __vfsgid_val(right);
}
/**
* vfsuid_eq_kuid - check whether kuid and vfsuid have the same value
* @vfsuid: the vfsuid to compare
* @kuid: the kuid to compare
*
* Check whether @vfsuid and @kuid have the same values.
*
* Return: true if @vfsuid and @kuid have the same value, false if not.
* Comparison between two invalid uids returns false.
*/
static inline bool vfsuid_eq_kuid(vfsuid_t vfsuid, kuid_t kuid)
{
return vfsuid_valid(vfsuid) && __vfsuid_val(vfsuid) == __kuid_val(kuid);
}
/**
* vfsgid_eq_kgid - check whether kgid and vfsgid have the same value
Annotation
- Immediate include surface: `linux/types.h`, `linux/uidgid.h`.
- Detected declarations: `struct mnt_idmap`, `struct user_namespace`, `function is_valid_mnt_idmap`, `function __vfsuid_val`, `function __vfsgid_val`, `function __vfsuid_val`, `function __vfsgid_val`, `function vfsuid_valid`, `function vfsgid_valid`, `function vfsuid_eq`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.