VFS_VGET(9)

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

πŸ’– NAME πŸ’–

okay so bestie, this is VFS_VGET(9) β€” a page from the Kernel Developer's Manual β€” and it’s literally about converting an inode number to a vnode. ✨ That’s the whole assignment. No cap. 🫢

🌸 SYNOPSIS 🌸

bestie, here’s the spell you need to cast at the top of your file:

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

int
VFS_VGET(struct mount *mp, ino_t ino, int flags, struct vnode **vpp);

That function signature is the main character, periodt. πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

VFS_VGET() literally looks up or creates a vnode from a (mount, inode#) tuple. It’s giving β€œmatchmaker for filesystem objects” energy. πŸ’…

Its arguments are:

  • mp β€” the mount point. like, the mount point. that’s it. πŸŽ€
  • ino β€” the inode representing the file. this is a unique number assigned by the file system when vnodes are first created. unique number moment, iykyk. ✨
  • flags β€” additional locking flags to pass through to vget(9). pass them through, bestie, don’t gatekeep. πŸ”₯
  • vpp β€” return parameter for the vnode. this is where the vnode comes back out. 🫢

This is an optional file system entry-point for file systems mainly intended for NFS server use, but many file systems use it internally in VOP_LOOKUP(9) and similar. so it’s lowkey everywhere. 😭

If the file system does not support this call, then it should return EOPNOTSUPP. that’s the polite β€œnot supported, bestie” signal. 🚫

Please see ffs_vget() in sys/ufs/ffs/ffs_vfsops.c for the canonical example. like, the blueprint. the reference fit. the one to study. πŸ“šβœ¨

🌈 SEE ALSO 🌈

πŸ’œ AUTHORS πŸ’œ

This manual page was written by Doug Rabson. iconic behavior. slay. πŸ‘‘


mwah πŸ’‹ β€” huge shoutout to Debian (the source/version from the footer) and January 7, 2005 (the date), folded into this cute sign-off, bestie. πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from