VFS_FHTOVP(9)
π VFS_FHTOVP β the Kernel Developer's Manual era π
okay bestie, gather round, we're doing kernel stuff today and honestly? it's giving iconic. this is the VFS_FHTOVP(9) page from the Kernel Developer's Manual, and by the end of this you're gonna know exactly how to turn an NFS filehandle into a vnode. no cap. π¦
β¨ NAME β¨
VFS_FHTOVP β turn an NFS filehandle into a vnode
like, the glow-up from "mystery filehandle" to "actual vnode" π
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/vnode.h>
int
VFS_FHTOVP(struct mount *mp, struct fid *fhp, int flags,
struct vnode **vpp);
π DESCRIPTION π
so the VFS_FHTOVP() macro is what the NFS server uses to turn an NFS filehandle into a vnode. that's the whole vibe. the NFS server hands over a filehandle, and this thing is like "say less" and produces a vnode. π₯
the arguments it expects are, in order, bestie:
mpβ the file system. your main character fs, literally.fhpβ the filehandle to convert. the one that needs the transformation.flagsβ extra locking flags that get passed straight through tovget(9). important: file systems are allowed to just ignoreflagsand useLK_EXCLUSIVEinstead. so don't be shocked if that happens, it's fully within their rights. πvppβ the return parameter where the new locked vnode lands. your prize at the end of the quest. π
here's the tea about the filehandle itself: its contents are defined by the file system and are not examined by any other part of the system. so the fs is the only one who knows what's inside, and everyone else is like "not my business, not my problem". π
what the filehandle should contain is enough info to:
- uniquely identify a file within the file system, and
- notice when a file has been removed and the file system resources have been reused for a brand new file.
for instance β and this is the classic example β the UFS file system stores the inode number and the inode generation counter in its filehandle. two pieces of info, one very clever system. slay. β¨
π«Ά heads up bestie: a call toVFS_FHTOVP()should generally be preceded by a call toVFS_CHECKEXP(9), which checks whether the file is actually accessible to the client. like, do the vibe check first. check the exp. then convert.
π RETURN VALUES π
the locked vnode for the file gets returned in *vpp. that's it, that's the return value. locked and loaded. π
π¦ SEE ALSO π¦
go read them, they're all part of the same friend group fr fr.
π AUTHORS π
this manual page was written by Doug Rabson. legend behaviour, honestly. π
okay that's the whole page, bestie β you're officially caught up on VFS_FHTOVP. and just so you have the receipts: this one comes from the Debian crew and it's dated May 19, 2019. π stay locked, stay iconic, and remember β check the exp before you convert. periodt. π
πΈ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1996 Doug Rabson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms