VFS_GETVFS(9)

πŸ’… VFS_GETVFS πŸ’…

ok so bestie, welcome to VFS_GETVFS, straight out of the Kernel Developer's Manual (section 9, we're in the deep end now and you're gonna slay). it's giving "find my mount point" energy and honestly? iconic.


✨ NAME ✨

vfs_getvfs</purl> β€” returns a mount point given its file system identifier πŸŽ€


🌸 SYNOPSIS 🌸

#include <sys/param.h>
#include <sys/mount.h>

struct mount *
vfs_getvfs(fsid_t *fsid);

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea. the vfs_getvfs() function returns the mount point structure for a file system, given its file system identifier. literally just hand it an fsid and it hands you back the struct mount *. that's the whole vibe. πŸ¦‹

⚠️ but bestie listen β€” that file system ID should have been allocated by calling vfs_getnewfsid(9). if it wasn't? it will not be found. no cap. not a single crumb. πŸ’€

a major user of vfs_getvfs() is NFS β€” she's the main character here, fr fr. NFS uses the fsid as part of file handles, so it can figure out which file system a given RPC is for. and if vfs_getvfs() fails to find the mount point related to fsid, the file system is considered stale. it's giving ghosted. πŸ‘»


🌈 RETURN VALUES 🌈

  • if fsid is found β†’ the mount point for the ID is returned ✨
  • otherwise β†’ NULL is returned πŸ™ˆ

🧚 PSEUDOCODE 🧚

here's the little snippet, copied exactly, no edits, we respect the source:

if ((mp = vfs_getvfs(&fhp->fh_fsid)) == NULL) {
        error = ESTALE;
        goto out;
}

see that ESTALE? yeah. stale. we hate to see it but we do see it. 😭


πŸ‘‘ SEE ALSO πŸ‘‘

  • vfs_getnewfsid(9) β€” the girl who hands out the IDs in the first place πŸ’…

πŸ“ AUTHORS πŸ“

this manual page was written by Chad David <davidc@acns.ab.ca>. giving credit where credit is due, periodt. 🫢


and that's a wrap, bestie!! this lil slice of kernel lore came to you via Debian, dated November 21, 2001 β€” yes it's been serving looks since 2001 and it still eats. go find those mount points, you've got this πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from