mufs: read and write file size during mount and format

This commit is contained in:
S.J.R. van Schaik 2017-05-29 15:02:48 +02:00
parent c08a8be9a9
commit b634e3c715

View file

@ -9,6 +9,7 @@
struct mufs_super {
char magic[4];
uint32_t nblocks;
uint32_t file_size;
uint32_t root;
uint8_t depth;
} __attribute__((packed));
@ -28,6 +29,8 @@ int mufs_mount(struct mufs *fs, struct flash_dev *dev)
fs->dev = dev;
fs->nblocks = super.nblocks;
fs->root.file_size = super.file_size;
fs->root.root = super.root;
fs->root.depth = super.depth;
@ -40,6 +43,8 @@ int mufs_format(struct flash_dev *dev)
memcpy(super.magic, "mufs", 4);
super.nblocks = flash_get_capacity(dev) >> dev->log2_block_size;
super.file_size = 0;
super.root = 0;
super.depth = 0;