aboutsummaryrefslogtreecommitdiff
path: root/kernel/inc
diff options
context:
space:
mode:
authorMarvin Borner2021-04-30 15:03:27 +0200
committerMarvin Borner2021-04-30 15:03:27 +0200
commit350748137b62e2aa15c62c53ebf4d30816e441f4 (patch)
treea4c1b1c443c1f0de4bd74336a9ceed9376ce694a /kernel/inc
parent3a3d50d7eb0f4fdbb9beaf16bacfa98689cc448c (diff)
Added MBR driver and better disk creation
Diffstat (limited to 'kernel/inc')
-rw-r--r--kernel/inc/fs.h8
-rw-r--r--kernel/inc/mbr.h28
2 files changed, 32 insertions, 4 deletions
diff --git a/kernel/inc/fs.h b/kernel/inc/fs.h
index 329af21..a1cb696 100644
--- a/kernel/inc/fs.h
+++ b/kernel/inc/fs.h
@@ -15,7 +15,7 @@ enum dev_type { DEV_BLOCK, DEV_CHAR };
struct vfs_dev {
u32 id;
- const char *name;
+ char name[8];
enum dev_type type;
struct vfs *vfs;
void *data;
@@ -65,6 +65,8 @@ res vfs_read(const char *path, void *buf, u32 offset, u32 count);
res vfs_write(const char *path, const void *buf, u32 offset, u32 count);
res vfs_stat(const char *path, struct stat *buf);
+void vfs_load(struct vfs_dev *dev) NONNULL;
+
struct vfs_dev *device_get_by_name(const char *name) NONNULL;
struct vfs_dev *device_get_by_id(u32 id) NONNULL;
@@ -170,8 +172,6 @@ struct ext2_file {
u32 curr_block_pos;
};
-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;
+u8 ext2_load(struct vfs_dev *dev) NONNULL;
#endif
diff --git a/kernel/inc/mbr.h b/kernel/inc/mbr.h
new file mode 100644
index 0000000..07f6da0
--- /dev/null
+++ b/kernel/inc/mbr.h
@@ -0,0 +1,28 @@
+// MIT License, Copyright (c) 2021 Marvin Borner
+
+#ifndef MBR_H
+#define MBR_H
+
+#include <def.h>
+#include <fs.h>
+
+struct mbr_entry {
+ u8 attributes;
+ u8 chs_start[3];
+ u8 type;
+ u8 chs_end[3];
+ u32 start;
+ u32 size;
+} PACKED;
+
+struct mbr {
+ u8 bootstrap[440];
+ u32 signature;
+ u16 reserved;
+ struct mbr_entry entries[4];
+ u16 magic;
+} PACKED;
+
+u8 mbr_load(struct vfs_dev *dev);
+
+#endif