diff options
author | Benji Dial <benji@benjidial.net> | 2024-01-11 23:53:57 -0500 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2024-01-11 23:53:57 -0500 |
commit | c4ab2f6f440f060b1686991b24379a4998aa55a9 (patch) | |
tree | e1b4cc875554a18ac110847cca9ba55261fca9c9 /include/mercury/kernel/storage.hpp | |
parent | 88816732b53eb536fe0e8db3d9ed15f0d1c29bb4 (diff) | |
download | hilbert-os-c4ab2f6f440f060b1686991b24379a4998aa55a9.tar.gz |
file reading, tarfs directory listing
Diffstat (limited to 'include/mercury/kernel/storage.hpp')
-rw-r--r-- | include/mercury/kernel/storage.hpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/include/mercury/kernel/storage.hpp b/include/mercury/kernel/storage.hpp index 1374766..0df0829 100644 --- a/include/mercury/kernel/storage.hpp +++ b/include/mercury/kernel/storage.hpp @@ -38,19 +38,22 @@ namespace mercury::kernel::storage { //first child of this node. get_next_child gets the child after the child //represented by the value of iter passed in, and changes iter to represent //that next child. for an empty directory node, get_first_child returns - //io_result::out_of_bounds. when iter represents the last child of a node, - //get_next_child also returns io_result::out_of_bounds. + //io_result::not_found. when iter represents the last child of a node, + //get_next_child also returns io_result::not_found. virtual io_result get_first_child(node_id_t node, node_id_t &out, directory_iter_t &iter_out) = 0; virtual io_result get_next_child(node_id_t node, node_id_t &out, directory_iter_t &iter) = 0; - virtual io_result get_child(node_id_t node, node_id_t &out, const char *name, size_t name_len) = 0; + virtual io_result get_child(node_id_t node, node_id_t &out, const char *name, unsigned name_len) = 0; - virtual io_result get_name_length(node_id_t node, size_t &length_out) = 0; + virtual io_result get_name_length(node_id_t node, unsigned &length_out) = 0; //buffer is assumed to be long enough - call get_name_length first. - virtual io_result get_name(node_id_t node, char *buffer, size_t &length_out) = 0; - + virtual io_result get_name(node_id_t node, char *buffer, unsigned &length_out) = 0; virtual io_result get_file_length(node_id_t node, uint64_t &length_out) = 0; - virtual io_result get_file_type(node_id_t node, file_type &out) = 0; + + virtual io_result resize_file(node_id_t node, uint64_t new_length) = 0; + virtual io_result read_bytes_from_file(node_id_t node, uint64_t start, uint64_t count, void *into) = 0; + virtual io_result write_bytes_into_file(node_id_t node, uint64_t start, uint64_t count, const void *from) = 0; + }; class block_device { @@ -112,7 +115,7 @@ namespace mercury::kernel::storage { }; - void canonize_path(const char *str, size_t len, canon_path &out); + void canonize_path(const char *str, unsigned len, canon_path &out); //path must be absolute. io_result mount_device(block_device *bd, const canon_path &path, file_system_mounter mounter); |