mufs: simplify super block by embedding struct mufs_dtree instead of struct mufs_dentry

This commit is contained in:
S.J.R. van Schaik 2017-06-11 16:32:12 +02:00
parent 89ec3a94c0
commit 93c0466c90

View file

@ -14,7 +14,7 @@
struct mufs_super { struct mufs_super {
char magic[4]; char magic[4];
uint32_t nblocks; uint32_t nblocks;
struct mufs_dentry root; struct mufs_dtree root;
} __attribute__((packed)); } __attribute__((packed));
int mufs_mount(struct mufs *fs, struct flash_dev *dev) int mufs_mount(struct mufs *fs, struct flash_dev *dev)
@ -51,11 +51,9 @@ int mufs_format(struct flash_dev *dev)
super.nblocks = flash_get_capacity(dev) >> dev->log2_block_size; super.nblocks = flash_get_capacity(dev) >> dev->log2_block_size;
super.root.type = MUFS_DIR;
super.root.file_size = 0; super.root.file_size = 0;
super.root.root = 0; super.root.root = 0;
super.root.depth = 0; super.root.depth = 0;
super.root.path_len = 0;
if (flash_write(dev, 0, &super, sizeof super) == 0) if (flash_write(dev, 0, &super, sizeof super) == 0)
return -1; return -1;