summaryrefslogtreecommitdiff
path: root/src/sys/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-15 12:57:09 -0400
committerIan Moffett <ian@osmora.org>2025-10-15 12:57:09 -0400
commit6074369de8b4406f4c3dec2e136cb5282d628810 (patch)
tree848e5b6f0894d4c861edde6200bc68d0b89be92c /src/sys/include
parentd1181bb2e8dc918fcfedad55d3af558034df4a80 (diff)
kern: vfs: Add vnode operation for reads
Introduces a read callback wrapper implementation for vnodes to simplify file reading Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/include')
-rw-r--r--src/sys/include/os/vnode.h13
1 files changed, 13 insertions, 0 deletions
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_ */