summaryrefslogtreecommitdiff
path: root/include/mercury/kernel/fs/tarfs.hpp
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-01-10 00:17:29 -0500
committerBenji Dial <benji@benjidial.net>2024-01-10 00:17:29 -0500
commit15e62510104bc0e2b9180b66e5845d985cac03cc (patch)
treefa950c29622823a825a523e63de610746a70cbe1 /include/mercury/kernel/fs/tarfs.hpp
parentc2f48fb5df0981df1df23de2b277274f9fe75080 (diff)
downloadhilbert-os-15e62510104bc0e2b9180b66e5845d985cac03cc.tar.gz
partial (largely untested) memory block device and tar file system support
Diffstat (limited to 'include/mercury/kernel/fs/tarfs.hpp')
-rw-r--r--include/mercury/kernel/fs/tarfs.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/mercury/kernel/fs/tarfs.hpp b/include/mercury/kernel/fs/tarfs.hpp
new file mode 100644
index 0000000..41773ee
--- /dev/null
+++ b/include/mercury/kernel/fs/tarfs.hpp
@@ -0,0 +1,40 @@
+#ifndef MERCURY_KERNEL_FS_TARFS_HPP
+#define MERCURY_KERNEL_FS_TARFS_HPP
+
+#include <mercury/kernel/storage.hpp>
+
+namespace mercury::kernel::fs {
+
+ class tarfs_instance : public storage::file_system_instance {
+
+ private:
+ storage::block_device *bd;
+
+ storage::io_result next_node(storage::node_id_t &node);
+ //name_buf must be at least 255 chars long.
+ storage::io_result read_name(storage::node_id_t node, char *name_buf, size_t &name_len_out);
+ //len <= 12
+ storage::io_result read_num(uint64_t offset, size_t len, uint64_t &out);
+
+ public:
+ tarfs_instance(storage::block_device *bd);
+
+ storage::io_result get_root_node(storage::node_id_t &out) override;
+ storage::io_result get_first_child(
+ storage::node_id_t node, storage::node_id_t &out, storage::directory_iter_t &iter_out) override;
+ storage::io_result get_next_child(
+ storage::node_id_t node, storage::node_id_t &out, storage::directory_iter_t &iter) override;
+ storage::io_result get_child(
+ storage::node_id_t node, storage::node_id_t &out, const char *name, size_t name_len) override;
+ storage::io_result get_name_length(storage::node_id_t node, size_t &length_out) override;
+ storage::io_result get_name(storage::node_id_t node, char *buffer, size_t &length_out) override;
+ storage::io_result get_file_length(storage::node_id_t node, uint64_t &length_out) override;
+ storage::io_result get_file_type(storage::node_id_t node, storage::file_type &out) override;
+
+ };
+
+ storage::io_result tarfs_mounter(storage::block_device *bd, storage::file_system_instance *&fs_out);
+
+}
+
+#endif