summaryrefslogtreecommitdiff
path: root/src/sys/os
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-15 14:48:21 -0400
committerIan Moffett <ian@osmora.org>2025-10-15 14:48:21 -0400
commitf39d4994c80225986fb6b27ef2ecef9268540b69 (patch)
tree22fffdcaa7f704f77ec77a71cdabd0d9c5e29be5 /src/sys/os
parent4343f79fb78d9c3e4b2c7e09147cc499562593d2 (diff)
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 <ian@osmora.org>
Diffstat (limited to 'src/sys/os')
-rw-r--r--src/sys/os/vfs_subr.c21
1 files changed, 21 insertions, 0 deletions
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);
+}