VFS_ROOT(9)

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

πŸ’… VFS_ROOT πŸ’…

okay so bestie, welcome to the VFS_ROOT page β€” it's from the Kernel Developer's Manual (section 9, the kernel-functions one, iykyk) and it's literally about getting your hands on the root vnode of a file system. slay. let's get into it πŸŽ€


✨ NAME ✨

VFS_ROOT β€” return the root vnode of a file system 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

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

int
VFS_ROOT(struct mount *mp, int flags, struct vnode **vpp);

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so the whole vibe here: this one returns a locked vnode for the root directory of the file system. locked, bestie β€” don't forget that part, it's the whole point πŸ’…

Its arguments are, one by one:

  • mp β€” the file system. like, the mount you're asking about.
  • flags β€” the lock type. Could be LK_EXCLUSIVE or LK_SHARED. πŸ’€ and here's the tea: the file system is free to ignore the flags argument and instead acquire an exclusive lock. so don't come crying if you asked for shared and got exclusive, that's allowed, periodt.
  • vpp β€” the return parameter for the root vnode. this is where you get your vnode back 🫢
ngl the "free to ignore the flags argument" thing is highkey the most important sentence on this page. read it twice. πŸ“Œ

🌈 SEE ALSO 🌈


🧚 AUTHORS 🧚

This manual page was written by Doug Rabson. ty king πŸ‘‘βœ¨


and that's the whole page bestie, no cap, nothing skipped πŸ’– β€” this was the Debian version, dated May 23, 2009, so like, vintage but iconic. go get that root vnode. mwah πŸ“

πŸ“¦ where this page comes from