VFS_GETNEWFSID(9)

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

πŸ’… vfs_getnewfsid β€” allocate a new file system identifier πŸ’…

okay bestie, this is from the Kernel Developer's Manual, section 9 β€” the page name is VFS_GETNEWFSID(9), and it's literally about giving a mount point its own little ID moment. ✨


🌸 NAME 🌸

vfs_getnewfsid β€” allocate a new file system identifier

✨ SYNOPSIS ✨

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

void
vfs_getnewfsid(struct mount *mp);

πŸ’– DESCRIPTION πŸ’–

okay so vfs_getnewfsid() allocates a new file system identifier for the mount point you give it. File systems typically call vfs_getnewfsid() in their mount routine in order to acquire a unique ID within the system, which can later be used to uniquely identify the file system via calls such as vfs_getvfs(9). slay, that's the whole point. 🫢

The actual fsid is made up of two 32 bit integers, and those are stored in the statfs structure of mp. The first integer is unique in the set of mounted file systems, while the second holds the file system type. periodt. πŸ’…

typedef struct fsid {
        int32_t val[2];
} fsid_t;

πŸ¦‹ PSEUDOCODE πŸ¦‹

here's the vibe in code form, no cap:

xxx_mount(struct mount *mp, char *path, caddr_t data,
        struct nameidata *ndp, struct thread *td)
{
        ...
        vfs_getnewfsid(mp);
        ...
}

πŸŽ€ SEE ALSO πŸŽ€

πŸ‘‘ AUTHORS πŸ‘‘

This manual page was written by Chad David <davidc@acns.ab.ca> β€” ty for the lore! πŸ’–


🌸 source/version + date sign-off: Debian, November 21, 2001 β€” mwah, bestie πŸ’‹

πŸ“¦ where this page comes from