VFS_GETVFS(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’… VFS_GETVFS(9) β€” the kernel dev manual, but make it cute πŸŽ€

okay so bestie, welcome to the kernel developer's manual for vfs_getvfs β€” yes it's a section 9 page, yes it's real, yes we're doing this πŸ’–


✨ NAME ✨

vfs_getvfs β€” 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 πŸ¦‹

so the vfs_getvfs() function returns the mount point structure for a file system, given its file system identifier. literally that's it, that's the whole vibe 🫢

⭐ tiny but important detail, bestie: the file system ID should have been allocated by calling vfs_getnewfsid(9) β€” otherwise, it will not be found. no cap. πŸ™ˆ

a major user of vfs_getvfs() is NFS, which uses the fsid as part of file handles in order to determine the 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. awkward. πŸ’€


πŸ‘‘ RETURN VALUES πŸ‘‘

  • if fsid is found β†’ the mount point for the ID is returned ✨
  • otherwise β†’ NULL is returned 😭

🧚 PSEUDOCODE 🧚

here's the vibe in code form, iconic honestly:

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

🌈 SEE ALSO 🌈


πŸ’œ AUTHORS πŸ’œ

this manual page was written by Chad David <davidc@acns.ab.ca> β€” king behavior honestly πŸ‘‘


okay that's the whole page bestie, you ate that πŸ“ and for the record: this one's from the Debian manual set, dated November 21, 2001 β€” yeah it's old but it still slays πŸ’… mwah, go mount something responsibly πŸŽ€

πŸ“¦ where this page comes from