VFS_SET(9)

✨ VFS_SET(9) ✨

okay bestie, welcome to the Kernel Developer's Manual, page VFS_SET(9) πŸ’– this is the one that sets up your loadable file system's vfsconf and honestly? she's giving backstage-pass energy. let's get into it πŸŽ€


🌸 NAME 🌸

VFS_SET β€” set up loadable file system vfsconf πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

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

void
VFS_SET(struct vfsops *vfsops, fsname, int flags);

like, yes, those includes are non-negotiable, do not skip them, they are the fit check before the function call πŸ’…


πŸ’– DESCRIPTION πŸ’–

so VFS_SET() does two things and it does them flawlessly. first, it creates a vfsconf structure for the loadable module using the vfsops you hand it, plus fsname, plus flags. then it declares that whole thing by calling DECLARE_MODULE(9), with vfs_modevent() as the event handler. that's it. that's the whole slay. ✨

now, the flags argument β€” she has OPTIONS, and here's every single one, no skips, no crumbs left behind:

  • VFCF_STATIC β€” the file system should be statically available in the kernel.
  • VFCF_NETWORK β€” network exportable file system.
  • VFCF_READONLY β€” does not support write operations.
  • VFCF_SYNTHETIC β€” pseudo file system, data does not represent on-disk files.
  • VFCF_LOOPBACK β€” loopback file system layer.
  • VFCF_UNICODE β€” file names are stored as Unicode.
  • VFCF_JAIL β€” can be mounted from within a jail if allow.mount and allow.mount.<fsname> jail parameters are set.
  • VFCF_DELEGADMIN β€” supports delegated administration if vfs.usermount sysctl is set to 1.
  • VFCF_SBDRY β€” when in VFS method, the thread suspension is deferred to the user boundary upon arrival of stop action.
bestie note: VFCF_JAIL and VFCF_DELEGADMIN are conditional girlies β€” they only do their thing when those jail parameters / that vfs.usermount sysctl are set. don't come for me, that's literally what the page says πŸ™ˆ

🧚 PSEUDOCODE 🧚

here's the vibe, copy the shape, not the letters:

/*
 * Fill in the fields for which we have special methods.
 * The others are initially null.  This tells vfs to change them to
 * pointers to vfs_std* functions during file system registration.
 */
static struct vfsops myfs_vfsops = {
        .vfs_mount =    myfs_mount,
        .vfs_root =     myfs_root,
        .vfs_statfs =   myfs_statfs,
        .vfs_unmount =  myfs_unmount,
};

VFS_SET(myfs_vfsops, myfs, 0);

see how she only fills in the fields with special methods? the rest stay null on purpose, and that's intentional β€” it tells vfs to swap them for pointers to vfs_std* functions during file system registration. main character behavior fr fr πŸ’œ


πŸ”₯ SEE ALSO πŸ”₯

jail(2), jail(8), DECLARE_MODULE(9), vfs_modevent(9), vfsconf(9) β€” go read them, iykyk 🫢


πŸ‘‘ AUTHORS πŸ‘‘

this manual page was written by Chad David <davidc@acns.ab.ca>. thank you chad, king behavior, we appreciate you πŸ’


and that's the whole page bestie, no notes, ate and left no crumbs πŸ’…βœ¨ this cutie came to you from Debian, dated August 16, 2018, filed under VFS_SET(9) β€” mwah, go write a file system πŸŒˆπŸŽ€

πŸ“¦ where this page comes from