mufs: implement mufs_rmdir()
This commit is contained in:
parent
3b531e868b
commit
d6fa387868
2 changed files with 14 additions and 0 deletions
|
@ -48,6 +48,7 @@ struct mufs_dir *mufs_opendir(struct mufs *fs, const char *path);
|
||||||
void mufs_closedir(struct mufs_dir *dir);
|
void mufs_closedir(struct mufs_dir *dir);
|
||||||
int mufs_readdir(struct mufs_dir *dir, struct mufs_dirent *dirent);
|
int mufs_readdir(struct mufs_dir *dir, struct mufs_dirent *dirent);
|
||||||
int mufs_mkdir(struct mufs *fs, const char *path);
|
int mufs_mkdir(struct mufs *fs, const char *path);
|
||||||
|
int mufs_rmdir(struct mufs *fs, const char *path);
|
||||||
|
|
||||||
int mufs_create(struct mufs *fs, const char *path);
|
int mufs_create(struct mufs *fs, const char *path);
|
||||||
struct mufs_file *mufs_open(struct mufs *fs, const char *path, int mode);
|
struct mufs_file *mufs_open(struct mufs *fs, const char *path, int mode);
|
||||||
|
|
|
@ -288,3 +288,16 @@ int mufs_mkdir(struct mufs *fs, const char *path)
|
||||||
{
|
{
|
||||||
return mufs_mkpath(fs, path, MUFS_DIR);
|
return mufs_mkpath(fs, path, MUFS_DIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mufs_rmdir(struct mufs *fs, const char *path)
|
||||||
|
{
|
||||||
|
struct mufs_stat stat;
|
||||||
|
|
||||||
|
if (mufs_stat(fs, path, &stat) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (stat.type != MUFS_DIR || stat.file_size != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return mufs_rmpath(fs, path);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue