diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-17 12:37:49 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-17 12:37:49 -0400 |
commit | 93c729aefb2596c14bbe135b0126d964342ab77b (patch) | |
tree | 82ae69ba41a5a26e9681f8834c35fc4c54d762cb /src/sys/os | |
parent | 98205eb9fd88826b6d906cc74f635ef76718355a (diff) |
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 <ian@osmora.org>
Diffstat (limited to 'src/sys/os')
-rw-r--r-- | src/sys/os/vfs_subr.c | 22 |
1 files changed, 22 insertions, 0 deletions
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); +} |