diff options
author | Marvin Borner | 2022-01-02 18:37:51 +0100 |
---|---|---|
committer | Marvin Borner | 2022-01-02 18:37:51 +0100 |
commit | e4b01ac99b3d13c5d1057eacc04757cea957cbd7 (patch) | |
tree | 5bc2a7af3a788047aab8482959eddc306831adfe /inc/spec.h | |
parent | 6a1f4e4d394b3c5ff7a7d1c58a8775a645275e4a (diff) |
Read/write maybe more
Diffstat (limited to 'inc/spec.h')
-rw-r--r-- | inc/spec.h | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -16,6 +16,7 @@ #define MARFS_NAME_LENGTH 32 #define MARFS_ENTRY_SIZE 1024 +#define MARFS_EMPTY_ENTRY 0 #define MARFS_DIR_ENTRY 1 #define MARFS_FILE_ENTRY 2 @@ -29,8 +30,9 @@ struct marfs_header { char magic[6]; u32 version; u32 entry_size; + u32 entry_count; struct marfs_pointer main; - u8 padding[MARFS_ENTRY_SIZE - 22]; + u8 padding[MARFS_ENTRY_SIZE - 26]; } PACKED; struct marfs_entry_header { @@ -45,18 +47,27 @@ struct marfs_dir_entry_data { struct marfs_pointer pointer; } PACKED; -struct marfs_dir_entry { +struct marfs_dir_entry_info { struct marfs_entry_header header; u32 count; +} PACKED; + +struct marfs_dir_entry { + struct marfs_dir_entry_info info; struct marfs_dir_entry_data entries[MARFS_DIR_ENTRY_COUNT]; - u8 padding[MARFS_ENTRY_SIZE - sizeof(struct marfs_entry_header) - sizeof(u32) - + u8 padding[MARFS_ENTRY_SIZE - sizeof(struct marfs_dir_entry_info) - (MARFS_DIR_ENTRY_COUNT * sizeof(struct marfs_dir_entry_data))]; } PACKED; -struct marfs_file_entry { +struct marfs_file_entry_info { struct marfs_entry_header header; + u32 parent; u32 size; - u8 data[MARFS_ENTRY_SIZE - sizeof(struct marfs_entry_header) - sizeof(u32)]; +} PACKED; + +struct marfs_file_entry { + struct marfs_file_entry_info info; + u8 data[MARFS_ENTRY_SIZE - sizeof(struct marfs_file_entry_info)]; } PACKED; #endif |