summaryrefslogtreecommitdiff
path: root/src/sys/include/os
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/include/os')
-rw-r--r--src/sys/include/os/filedesc.h12
-rw-r--r--src/sys/include/os/vnode.h20
2 files changed, 30 insertions, 2 deletions
diff --git a/src/sys/include/os/filedesc.h b/src/sys/include/os/filedesc.h
index 8cdf161..a6a2ac5 100644
--- a/src/sys/include/os/filedesc.h
+++ b/src/sys/include/os/filedesc.h
@@ -39,11 +39,13 @@ struct proc;
* Represents a file descriptor
*
* @fdno: File descriptor index
+ * @off: Current file offset
* @vp: Vnode this fd is linked with
* @mode: File attributes
*/
struct filedesc {
int fdno;
+ off_t off;
struct vnode *vp;
mode_t mode;
};
@@ -82,6 +84,16 @@ int fdtab_init(struct proc *procp);
int fd_open(const char *path, mode_t mode);
/*
+ * Close a file
+ *
+ * @fd: File descriptor to close
+ *
+ * Returns zero on success, otherwise a less than
+ * zero value on failure
+ */
+int fd_close(int fd);
+
+/*
* Write to a file descriptor
*
* @fd: File descriptor to write to
diff --git a/src/sys/include/os/vnode.h b/src/sys/include/os/vnode.h
index 868e137..1bef1e2 100644
--- a/src/sys/include/os/vnode.h
+++ b/src/sys/include/os/vnode.h
@@ -72,11 +72,13 @@ struct vop_lookup_args {
*
* @data: Buffer containing I/O data
* @len: Length of buffer
+ * @off: Offset of operation
* @vp: Current vnode
*/
struct vop_rw_data {
void *data;
size_t len;
+ off_t off;
struct vnode *vp;
};
@@ -86,6 +88,7 @@ struct vop_rw_data {
*/
struct vop {
int(*lookup)(struct vop_lookup_args *args);
+ int(*reclaim)(struct vnode *vp, int flags);
ssize_t(*write)(struct vop_rw_data *data);
ssize_t(*read)(struct vop_rw_data *data);
};
@@ -141,23 +144,36 @@ int vfs_vrel(struct vnode *vp, int flags);
*
* @vp: Vnode to write to
* @data: Data to write
+ * @off: Offset to write at
* @len: Length of bytes to write
*
* Returns the number of bytes written on success, otherwise
* a less than zero value on failure.
*/
-ssize_t vop_write(struct vnode *vp, char *data, size_t len);
+ssize_t vop_write(struct vnode *vp, char *data, off_t off, size_t len);
/*
* Wrapper for the read write callback
*
* @vp: Vnode to read from
* @data: Read data written here
+ * @off: Offset to read at
* @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);
+ssize_t vop_read(struct vnode *vp, char *data, off_t off, size_t len);
+
+/*
+ * Reclaim the resources tied to a specific vnode
+ *
+ * @vp: Vnode to reclaim
+ * @flags: Optional flags
+ *
+ * Returns zero on success, otherwise a less than zero value
+ * on failure.
+ */
+int vop_reclaim(struct vnode *vp, int flags);
#endif /* !_OS_VNODE_H_ */