aboutsummaryrefslogtreecommitdiff
path: root/kernel/inc/fs.h
diff options
context:
space:
mode:
authorMarvin Borner2021-04-13 22:09:23 +0200
committerMarvin Borner2021-04-13 22:09:23 +0200
commit9ded3a2bde80eede5fd887812d70c2f834b53c84 (patch)
tree932a90608c5f30d38b810dc4fe9264cc43c2da68 /kernel/inc/fs.h
parentf96b8ad1ee83dec08ae636e179cc48019ca50b12 (diff)
Started IO dev manager
Diffstat (limited to 'kernel/inc/fs.h')
-rw-r--r--kernel/inc/fs.h52
1 files changed, 22 insertions, 30 deletions
diff --git a/kernel/inc/fs.h b/kernel/inc/fs.h
index 1a78072..93a8a5c 100644
--- a/kernel/inc/fs.h
+++ b/kernel/inc/fs.h
@@ -13,67 +13,60 @@
enum dev_type { DEV_BLOCK, DEV_CHAR };
-struct device {
+struct vfs_dev {
u32 id;
const char *name;
enum dev_type type;
struct vfs *vfs;
void *data;
- res (*read)(void *buf, u32 offset, u32 count, struct device *dev) NONNULL;
- res (*write)(void *buf, u32 offset, u32 count, struct device *dev) NONNULL;
- res (*ioctl)(u32 request, void *arg1, void *arg2, void *arg3, struct device *dev)
+ res (*read)(void *buf, u32 offset, u32 count, struct vfs_dev *dev) NONNULL;
+ res (*write)(void *buf, u32 offset, u32 count, struct vfs_dev *dev) NONNULL;
+ res (*ioctl)(u32 request, void *arg1, void *arg2, void *arg3, struct vfs_dev *dev)
ATTR((nonnull(5)));
- res (*ready)(void);
};
-void device_install(void);
-
-void device_add(struct device *dev) NONNULL;
-
/**
* VFS
*/
-enum vfs_type { VFS_DEVFS, VFS_TMPFS, VFS_PROCFS, VFS_EXT2 };
+enum vfs_type { VFS_TMPFS, VFS_PROCFS, VFS_EXT2 };
enum vfs_perm { VFS_EXEC, VFS_WRITE, VFS_READ };
struct vfs {
enum vfs_type type;
int flags;
void *data;
- res (*read)(const char *path, void *buf, u32 offset, u32 count, struct device *dev) NONNULL;
+ res (*read)(const char *path, void *buf, u32 offset, u32 count,
+ struct vfs_dev *dev) NONNULL;
res (*write)(const char *path, void *buf, u32 offset, u32 count,
- struct device *dev) NONNULL;
+ struct vfs_dev *dev) NONNULL;
res (*ioctl)(const char *path, u32 request, void *arg1, void *arg2, void *arg3,
- struct device *dev) ATTR((nonnull(1, 6)));
- res (*stat)(const char *path, struct stat *buf, struct device *dev) NONNULL;
- res (*block)(const char *path, u32 func_ptr, struct device *dev) NONNULL;
- res (*ready)(const char *path, struct device *dev) NONNULL;
- res (*perm)(const char *path, enum vfs_perm perm, struct device *dev) NONNULL;
+ struct vfs_dev *dev) ATTR((nonnull(1, 6)));
+ res (*stat)(const char *path, struct stat *buf, struct vfs_dev *dev) NONNULL;
+ res (*block)(const char *path, u32 func_ptr, struct vfs_dev *dev) NONNULL;
+ res (*perm)(const char *path, enum vfs_perm perm, struct vfs_dev *dev) NONNULL;
};
struct mount_info {
const char *path;
- struct device *dev;
+ struct vfs_dev *dev;
};
void vfs_install(void);
-u8 vfs_mounted(struct device *dev, const char *path) NONNULL;
-res vfs_mount(struct device *dev, const char *path) NONNULL;
+u8 vfs_mounted(struct vfs_dev *dev, const char *path) NONNULL;
+res vfs_mount(struct vfs_dev *dev, const char *path) NONNULL;
-struct device *vfs_find_dev(const char *path) NONNULL;
+struct vfs_dev *vfs_find_dev(const char *path) NONNULL;
+void vfs_add_dev(struct vfs_dev *dev) NONNULL;
res vfs_read(const char *path, void *buf, u32 offset, u32 count) NONNULL;
res vfs_write(const char *path, void *buf, u32 offset, u32 count) NONNULL;
res vfs_ioctl(const char *path, u32 request, void *arg1, void *arg2, void *arg3) ATTR((nonnull(1)));
res vfs_stat(const char *path, struct stat *buf) NONNULL;
-res vfs_block(const char *path, u32 func_ptr) NONNULL;
-res vfs_poll(const char **files) NONNULL;
-res vfs_ready(const char *path) NONNULL;
-struct device *device_get_by_name(const char *name) NONNULL;
-struct device *device_get_by_id(u32 id) NONNULL;
+struct vfs_dev *device_get_by_name(const char *name) NONNULL;
+struct vfs_dev *device_get_by_id(u32 id) NONNULL;
/**
* EXT2
@@ -177,9 +170,8 @@ struct ext2_file {
u32 curr_block_pos;
};
-res ext2_read(const char *path, void *buf, u32 offset, u32 count, struct device *dev) NONNULL;
-res ext2_stat(const char *path, struct stat *buf, struct device *dev) NONNULL;
-res ext2_perm(const char *path, enum vfs_perm perm, struct device *dev) NONNULL;
-res ext2_ready(const char *path, struct device *dev) NONNULL;
+res ext2_read(const char *path, void *buf, u32 offset, u32 count, struct vfs_dev *dev) NONNULL;
+res ext2_stat(const char *path, struct stat *buf, struct vfs_dev *dev) NONNULL;
+res ext2_perm(const char *path, enum vfs_perm perm, struct vfs_dev *dev) NONNULL;
#endif