vfs_delete() implement deleting files
This commit is contained in:
@ -117,6 +117,16 @@ int32_t littlefs_mkdir(struct VfsMountPoint *vmp, const char *path) {
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
int32_t littlefs_delete(struct VfsMountPoint *vmp, const char *path) {
|
||||
spinlock_acquire(&vmp->spinlock);
|
||||
int ok = lfs_remove(&vmp->fs.littlefs.instance, path);
|
||||
spinlock_release(&vmp->spinlock);
|
||||
if (ok < 0) {
|
||||
return E_BADIO;
|
||||
}
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
struct VfsObj *littlefs_open(struct VfsMountPoint *vmp, const char *path, uint32_t flags) {
|
||||
VfsObj *vobj = dlmalloc(sizeof(*vobj));
|
||||
if (vobj == NULL) {
|
||||
|
||||
@ -20,6 +20,7 @@ struct VfsObj *littlefs_open(struct VfsMountPoint *vmp, const char *path, uint32
|
||||
int32_t littlefs_stat(struct VfsMountPoint *vmp, const char *path, FsStat *statbuf);
|
||||
int32_t littlefs_fetchdirent(struct VfsMountPoint *vmp, const char *path, FsDirent *direntbuf, size_t idx);
|
||||
int32_t littlefs_mkdir(struct VfsMountPoint *vmp, const char *path);
|
||||
int32_t littlefs_delete(struct VfsMountPoint *vmp, const char *path);
|
||||
|
||||
int portlfs_read(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size);
|
||||
int portlfs_prog(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size);
|
||||
|
||||
Reference in New Issue
Block a user