From bbd861c0cd4c26e2699392fec3ae0ec7df8ab145 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 27 Jun 2025 19:03:31 -0400 Subject: kernel: vfs: Add support for O_CREAT flag Add support for the O_CREAT flag which allows file creation upon an open() call. Signed-off-by: Ian Moffett --- sys/include/sys/fcntl.h | 1 + sys/include/sys/vnode.h | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'sys/include') diff --git a/sys/include/sys/fcntl.h b/sys/include/sys/fcntl.h index 122a378..83d38af 100644 --- a/sys/include/sys/fcntl.h +++ b/sys/include/sys/fcntl.h @@ -33,6 +33,7 @@ #define O_RDONLY 0x0000 #define O_WRONLY 0x0001 #define O_RDWR 0x0002 +#define O_CREAT 0x0004 /* Makes seal checking easier */ #if defined(_KERNEL) diff --git a/sys/include/sys/vnode.h b/sys/include/sys/vnode.h index cd71817..1a6b2aa 100644 --- a/sys/include/sys/vnode.h +++ b/sys/include/sys/vnode.h @@ -86,6 +86,13 @@ struct vop_lookup_args { struct vnode **vpp; /* Result vnode */ }; +struct vop_create_args { + const char *path; /* Full path */ + const char *ppath; /* Parent path */ + struct vnode *dirvp; /* Directory vnode */ + struct vnode **vpp; /* Result vnode */ +}; + /* * A field in this structure is unavailable * if it has a value of VNOVAL. @@ -106,6 +113,7 @@ struct vops { int(*read)(struct vnode *vp, struct sio_txn *sio); int(*write)(struct vnode *vp, struct sio_txn *sio); int(*reclaim)(struct vnode *vp); + int(*create)(struct vop_create_args *args); }; extern struct vnode *g_root_vnode; -- cgit v1.2.3