mufs: clean up code by embedding struct mufs into struct mufs_tree

This commit is contained in:
S.J.R. van Schaik 2017-06-09 13:35:37 +02:00
parent 7212269675
commit 99e2229bbb
3 changed files with 70 additions and 48 deletions

View file

@ -1,8 +1,11 @@
#pragma once
struct flash_dev;
struct mufs;
struct mufs_dir;
struct mufs_tree {
struct mufs *fs;
uint32_t file_size;
uint32_t root;
uint8_t depth;
@ -15,5 +18,16 @@ struct mufs {
uint8_t log2_nentries;
};
struct mufs_dirent {
char path[256];
struct mufs_tree tree;
uint8_t type;
};
int mufs_mount(struct mufs *fs, struct flash_dev *dev);
int mufs_format(struct flash_dev *dev);
struct mufs_dir *mufs_opendir(struct mufs *fs, const char *path);
void mufs_closedir(struct mufs_dir *dir);
int mufs_readdir(struct mufs_dir *dir, struct mufs_dirent *dirent);
int mufs_mkdir(struct mufs *fs, const char *path);