From f39d4994c80225986fb6b27ef2ecef9268540b69 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 15 Oct 2025 14:48:21 -0400 Subject: kern: vfs: Add reclaim callback to vnode The reclaim callback simply reclaims any filesystem specific resources used with vnodes back to the operating system. Signed-off-by: Ian Moffett --- src/sys/os/vfs_subr.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/sys/os/vfs_subr.c') diff --git a/src/sys/os/vfs_subr.c b/src/sys/os/vfs_subr.c index a06b64f..6cb7767 100644 --- a/src/sys/os/vfs_subr.c +++ b/src/sys/os/vfs_subr.c @@ -203,3 +203,24 @@ vop_read(struct vnode *vp, char *data, off_t off, size_t len) rwdata.off = off; return vops->read(&rwdata); } + +int +vop_reclaim(struct vnode *vp, int flags) +{ + struct vop *vops; + + if (vp == NULL) { + return -EINVAL; + } + + /* Grab the virtual operations */ + if ((vops = vp->vops) == NULL) { + return -EIO; + } + + if (vops->reclaim == NULL) { + return -ENOTSUP; + } + + return vops->reclaim(vp, flags); +} -- cgit v1.2.3