From 6074369de8b4406f4c3dec2e136cb5282d628810 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 15 Oct 2025 12:57:09 -0400 Subject: kern: vfs: Add vnode operation for reads Introduces a read callback wrapper implementation for vnodes to simplify file reading Signed-off-by: Ian Moffett --- src/sys/include/os/vnode.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/sys/include/os/vnode.h') diff --git a/src/sys/include/os/vnode.h b/src/sys/include/os/vnode.h index 77459a1..868e137 100644 --- a/src/sys/include/os/vnode.h +++ b/src/sys/include/os/vnode.h @@ -87,6 +87,7 @@ struct vop_rw_data { struct vop { int(*lookup)(struct vop_lookup_args *args); ssize_t(*write)(struct vop_rw_data *data); + ssize_t(*read)(struct vop_rw_data *data); }; /* @@ -147,4 +148,16 @@ int vfs_vrel(struct vnode *vp, int flags); */ ssize_t vop_write(struct vnode *vp, char *data, size_t len); +/* + * Wrapper for the read write callback + * + * @vp: Vnode to read from + * @data: Read data written here + * @len: Length of bytes to read + * + * Returns the number of bytes read on success, otherwise + * a less than zero value on failure. + */ +ssize_t vop_read(struct vnode *vp, char *data, size_t len); + #endif /* !_OS_VNODE_H_ */ -- cgit v1.2.3