mufs: read and write file size during mount and format
This commit is contained in:
parent
c08a8be9a9
commit
b634e3c715
1 changed files with 5 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue