|
|
|
@ -92,7 +92,7 @@ err_free_dir: |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static struct mufs_tree *resolve_path(struct mufs *fs, const char *path) |
|
|
|
|
struct mufs_tree *resolve_path(struct mufs *fs, const char *path) |
|
|
|
|
{ |
|
|
|
|
struct mufs_dir *dir; |
|
|
|
|
struct mufs_dirent entry; |
|
|
|
@ -176,7 +176,7 @@ void mufs_closedir(struct mufs_dir *dir) |
|
|
|
|
free(dir); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static size_t read_dirent(struct mufs *fs, struct mufs_tree *tree, |
|
|
|
|
size_t read_dirent(struct mufs *fs, struct mufs_tree *tree, |
|
|
|
|
struct mufs_dirent *dirent, uint32_t va) |
|
|
|
|
{ |
|
|
|
|
struct flash_dev *dev = fs->dev; |
|
|
|
@ -191,7 +191,7 @@ static size_t read_dirent(struct mufs *fs, struct mufs_tree *tree, |
|
|
|
|
if (va + sizeof(entry) > tree->file_size) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
if (mufs_read(tree, &entry, va, sizeof entry) == 0) |
|
|
|
|
if (mufs_tree_read(tree, &entry, va, sizeof entry) == 0) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
if (!entry.type) |
|
|
|
@ -204,7 +204,7 @@ static size_t read_dirent(struct mufs *fs, struct mufs_tree *tree, |
|
|
|
|
if (va + len > tree->file_size) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
if (mufs_read(tree, dirent->path, va, len) == 0) |
|
|
|
|
if (mufs_tree_read(tree, dirent->path, va, len) == 0) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
dirent->path[len] = '\0'; |
|
|
|
@ -225,7 +225,7 @@ static size_t read_dirent(struct mufs *fs, struct mufs_tree *tree, |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static size_t write_dirent(struct mufs_tree *tree, |
|
|
|
|
size_t write_dirent(struct mufs_tree *tree, |
|
|
|
|
uint32_t va, struct mufs_dirent *dirent) |
|
|
|
|
{ |
|
|
|
|
struct mufs_dtree dtree; |
|
|
|
@ -237,11 +237,11 @@ static size_t write_dirent(struct mufs_tree *tree, |
|
|
|
|
entry.tree.depth = dirent->tree.depth; |
|
|
|
|
entry.path_len = strlen(dirent->path); |
|
|
|
|
|
|
|
|
|
if (mufs_write(tree, dirent->path, va + sizeof entry, |
|
|
|
|
if (mufs_tree_write(tree, dirent->path, va + sizeof entry, |
|
|
|
|
entry.path_len) == 0) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
if (mufs_write(tree, &entry, va, sizeof entry) == 0) |
|
|
|
|
if (mufs_tree_write(tree, &entry, va, sizeof entry) == 0) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
tree->file_size = max(tree->file_size, va + sizeof entry + entry.path_len); |
|
|
|
|