make_vfsgid(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ make_vfsgid(9) ✨

okay so bestie, welcome to the Kernel API Manual page for make_vfsgid β€” she's a section 9 function and she's literally here to map a filesystem kgid according to an idmapping πŸ’…


🌸 NAME 🌸

make_vfsgid β€” map a filesystem kgid according to an idmapping 🫢


πŸŽ€ SYNOPSIS πŸŽ€

vfsgid_t make_vfsgid (struct mnt_idmap *idmap , struct user_namespace
*fs_userns , kgid_t kgid );

like, three args, no drama ✨


πŸ¦‹ ARGUMENTS πŸ¦‹

  • idmap β€” the mount's idmapping πŸ‘‘ this is the one we're remapping into.
  • fs_userns β€” the filesystem's idmapping 🌈 this is where the kgid is coming from.
  • kgid β€” the actual kgid to be mapped πŸ“ the little guy getting translated.

πŸ’– DESCRIPTION πŸ’–

Take a kgid and remap it from fs_userns into idmap. Use this function when you're preparing a kgid to be reported to userspace β€” that's the whole vibe, that's the assignment πŸ’…

Now the fast paths, because she's efficient:

  • If initial_idmapping determines that this is not an idmapped mount, we can simply return kgid unchanged. no cap, nothing to do, we're done πŸŽ€
  • If initial_idmapping tells us that the filesystem is not mounted with an idmapping, we know the value of kgid won't change when calling from_kgid, so we can simply retrieve the value via __kgid_val directly πŸ”₯ lowkey a shortcut, highkey correct.
bestie please note: initial_idmapping is the vibe check that decides which path we take β€” don't sleep on it πŸ™ˆ

⭐ RETURN ⭐

kgid mapped according to idmap. πŸ’–

But β€” and this is the important part β€” if kgid has no mapping in either idmap or fs_userns, then INVALID_GID is returned. 😭 that's the sad path, that's the "she doesn't know her" path.


🌈 SEE ALSO 🌈

Kernel file ./fs/mnt_idmapping.c, plus the whole friend group:


and that's the page, bestie!! 🧚 this one lives in ./fs and she's dated October 2026 β€” slay, go map some gids responsibly πŸ’œ

πŸ“¦ where this page comes from