VFS_GETNEWFSID(9)

πŸ’– VFS_GETNEWFSID(9) πŸ’–

ok bestie so this is a page from the Kernel Developer's Manual (section 9, kernel land, we're in the deep end and it's giving main character energy 🫢) and it's all about one lil function that hands out file system IDs like they're friendship bracelets.


✨ NAME ✨

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


🌸 SYNOPSIS 🌸

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

void
vfs_getnewfsid(struct mount *mp);

like yes it takes one (1) pointer and returns nothing, humble of it honestly πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so vfs_getnewfsid() allocates a brand new file system identifier for the mount point you give it. no cap, that's the whole job.

File systems typically call vfs_getnewfsid() in their mount routine so they can snag a unique ID within the system β€” and that ID can later be used to uniquely identify the file system through calls like vfs_getvfs(9). it's giving "get your own name tag at the party so people know who you are" πŸŽ€

the actual fsid is made up of two 32 bit integers, and they live in the statfs structure of mp. breaking it down:

  • the first integer is unique in the set of mounted file systems ✨
  • the second holds the file system type πŸ’«

and here's the struct, verbatim, no edits bestie:

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

🧚 PSEUDOCODE 🧚

here's how it looks inside a mount routine, so you can clock the vibe:

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

like, you literally just call it in the middle of everything else and it does its thing. obsessed. 🌈


πŸ‘‘ SEE ALSO πŸ‘‘

  • vfs_getvfs(9) β€” the bestie that looks up the fsid later πŸ’œ

πŸ’œ AUTHORS πŸ’œ

This manual page was written by Chad David <davidc@acns.ab.ca>.


fr fr that's the whole page. it's short, it's sweet, it ate and left no crumbs πŸ’…

kay bye ily, this page came from Debian and it's dated November 21, 2001 β€” yeah it's a vintage icon, we stan a classic πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from