VFS_MOUNT(9)

πŸ’– VFS_MOUNT β€” bestie, we're mounting a file system πŸ’–

okay so this is VFS_MOUNT(9) from the Kernel Developer's Manual β€” yes, the section 9 one, the kernel-nerd one, not the lil baby section 1 ones. this is the macro that gets your file system into the namespace. iconic behavior honestly. πŸ¦‹


✨ SYNOPSIS ✨

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

int
VFS_MOUNT(struct mount *mp);

🌸 DESCRIPTION 🌸

The VFS_MOUNT() macro mounts a file system into the system's namespace, or updates the attributes of an already mounted file system. two jobs, one macro, main character energy fr fr. πŸ‘‘

The arguments it expects are:

  • mp β€” Structure representing the file system.

So the way this works is: VFS_MOUNT() gets called both to mount brand new file systems and to change the attributes of an existing one. same macro, different vibe depending on one lil flag. πŸŽ€

if the MNT_UPDATE flag is set in mp->mnt_flag, then the file system should update its internal state from the value of mp->mnt_flag. yes, it reads itself. no, that's not a typo, that's just how it is. πŸ’…

That MNT_UPDATE path is lowkey multipurpose β€” it can be used, for instance, to convert a read-only file system to read-write. it's also what mountd(8) uses to update the NFS export information for the file system. so like, glow-ups for file systems. ✨

And if the MNT_UPDATE flag is not specified? then congrats, this is a newly mounted file system, fresh out the box 🎁. The file system code should allocate and initialize any private data needed to represent the file system β€” and it can use the mp->mnt_data field to store this information. put ur stuff there bestie, that's literally what it's for. 🫢


πŸ‘€ SEE ALSO πŸ‘€


πŸ’œ AUTHORS πŸ’œ

This manual page was written by Doug Rabson. king behavior, we stan. 🫑


and that's the whole page, no cap β€” written by Doug Rabson, living in the Debian edition of the manual, dated May 23, 2009. go mount something cute bestie, ily, mwah πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from