|
|
|
@ -116,3 +116,20 @@ size_t mufs_write(struct mufs_file *file, const void *data, size_t len) |
|
|
|
|
|
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int mufs_unlink(struct mufs *fs, const char *path) |
|
|
|
|
{ |
|
|
|
|
struct mufs_stat stat; |
|
|
|
|
struct mufs_tree *tree; |
|
|
|
|
|
|
|
|
|
if (!(tree = resolve_path(fs, path, &stat))) |
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
if (stat.type != MUFS_FILE) |
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
if (mufs_shrink_tree(tree, 0) < 0) |
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
return mufs_rmpath(fs, path); |
|
|
|
|
} |
|
|
|
|