diff options
Diffstat (limited to 'src/kernel/vfs.h')
-rw-r--r-- | src/kernel/vfs.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/kernel/vfs.h b/src/kernel/vfs.h index a6de690..c9c9179 100644 --- a/src/kernel/vfs.h +++ b/src/kernel/vfs.h @@ -7,15 +7,17 @@ typedef struct { char name[32]; } vfs_dirent; -typedef struct { +typedef struct vfs_volume_funcs_t { void *(*open)(const char *file); - void (*close)(void *info); + int (*close)(void *info); uint32_t (*read)(void *info, uint32_t count, uint8_t *buffer); uint32_t (*write)(void *info, uint32_t count, const uint8_t *buffer); vfs_dirent *(*readdir)(const char *path); } vfs_volume_funcs; +// Indicates mounted volume #define VFS_MOUNTED (1 << 0) +// Set if filesystem is read-only #define VFS_READONLY (1 << 1) typedef struct { @@ -23,24 +25,27 @@ typedef struct { vfs_volume_funcs *funcs; } vfs_volume; +// Indicates an opened file #define VFS_FILE_OPEN (1 << 0) +// Indicates read permission on file #define VFS_FILE_READ (1 << 1) +// Indicates write permission on file #define VFS_FILE_WRITE (1 << 2) -#define VFS_FILE_MODF (1 << 3) -#define VFS_TEMPORARY (1 << 4) -#define VFS_EOF (1 << 5) +// Set if EOF has been reached +#define VFS_EOF (1 << 3) typedef struct { - uint32_t flags; - uint32_t vol; - uint32_t pid; - void *fsinfo; + uint32_t flags; /**< File attribute flags */ + uint32_t vol; /**< Index of volume file is stored on */ + uint32_t pid; /**< PID of process handling this file */ + void *fsinfo; /**< Filesystem-specific data, handled by fs driver */ } vfs_file; void vfs_init(void); int vfs_mount(vfs_volume_funcs *funcs, uint32_t flags); int vfs_open(const char *path, uint32_t flags); +int vfs_close(int fd); uint32_t vfs_read(int fd, uint32_t count, uint8_t *buffer); #endif // VFS_H_ |