VFS_HOOKS(9)
πΈ NAME πΈ
vfs_hooks, vfs_hooks_unmount β VFS hooks interface
okay bestie, this is VFS_HOOKS(9), the kernel developerβs manual page, and itβs literally about the VFS hooks interface. The VFS hooks interface provides a way for different kernel subsystems to attach custom functions to specific VFS operations. It enforces code separation by keeping the VFSβs core sources uncluttered and makes all subsystem functionality reside in a single place. As an example, this interface is used by the NFS server code to automatically handle the exports list for each mount point. slay. β¨
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/mount.h>
void
vfs_hooks_unmount(struct mount *mp);
π¦ DESCRIPTION π¦
Hooks are described by a struct vfs_hooks object, as seen below:
struct vfs_hooks {
int (*vh_unmount)(struct mount *);
};
For simplicity, each field is named after the VFS operation it refers to. The purpose of each member function, alongside some important notes, is shown below:
vh_unmount(mp)
This hook is executed during the unmount process of a file system.
For more information about the purpose of each operation, see vfsops(9). Note that any of these fields may be a null pointer.
After the definition of a struct vfs_hooks object, the kernel has to add it to the vfs_hooks link set using the VFS_HOOKS_ATTACH(struct vfs_hooks *) macro.
Please note that this interface is incomplete on purpose to keep it in its smallest possible size (i.e., do not provide a hook that is not used). If you feel the need to hook a routine to a VFS operation that is not yet supported by this interface, just add it to the files described in βCODE REFERENCESβ.
π FUNCTIONS π
The following functions are provided to the VFS code to run the hooked functions:
vfs_hooks_unmount(mp)
Runs all hooks for the VFS unmount operation. Given that these operations shall not fail, it returns void.
π₯ CODE REFERENCES π₯
The VFS hooks interface is implemented within the files sys/kern/vfs_hooks.c and sys/sys/mount.h.
π SEE ALSO π
π HISTORY π
The VFS hooks interface appeared in NetBSD 4.0.
xoxo, your Debian bestie π β source/version: Debian, dated September 23, 2005, for VFS_HOOKS(9) πΈπ«Ά
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2005 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms