From 93c729aefb2596c14bbe135b0126d964342ab77b Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 17 Oct 2025 12:37:49 -0400 Subject: kern: vfs: Add 'create' virtual file operation The create VOP allows the caller to create a node within the parent directory of a filesystem represented by a vnode. Signed-off-by: Ian Moffett --- src/sys/os/vfs_subr.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/sys/os') diff --git a/src/sys/os/vfs_subr.c b/src/sys/os/vfs_subr.c index 6cb7767..adfcffb 100644 --- a/src/sys/os/vfs_subr.c +++ b/src/sys/os/vfs_subr.c @@ -224,3 +224,25 @@ vop_reclaim(struct vnode *vp, int flags) return vops->reclaim(vp, flags); } + +int +vop_create(struct vnode *vp, struct nameidata *ndp) +{ + struct vop *vops; + struct vop_create_args args; + + if (vp == NULL || ndp == NULL) { + return -EINVAL; + } + + if ((vops = vp->vops) == NULL) { + return -EIO; + } + + if (vops->create == NULL) { + return -EIO; + } + + args.ndp = ndp; + return vops->create(&args); +} -- cgit v1.2.3