ioctl() IOCTL_MKDIR command, vfs_mkdir()
This commit is contained in:
@ -48,6 +48,7 @@ void vfs_init_littlefs(VfsMountPoint *mp, bool format) {
|
||||
mp->open = &littlefs_open;
|
||||
mp->stat = &littlefs_stat;
|
||||
mp->fetchdirent = &littlefs_fetchdirent;
|
||||
mp->mkdir = &littlefs_mkdir;
|
||||
}
|
||||
|
||||
int32_t vfs_stat(char *mountpoint, const char *path, IoctlStat *stat) {
|
||||
@ -64,6 +65,20 @@ int32_t vfs_stat(char *mountpoint, const char *path, IoctlStat *stat) {
|
||||
return mp->stat(mp, path, stat);
|
||||
}
|
||||
|
||||
int32_t vfs_mkdir(char *mountpoint, const char *path) {
|
||||
VfsMountPoint *mp = NULL;
|
||||
|
||||
spinlock_acquire(&VFS_TABLE.spinlock);
|
||||
HSHTB_GET(VFS_TABLE.mountpoints, label, mountpoint, mp);
|
||||
spinlock_release(&VFS_TABLE.spinlock);
|
||||
|
||||
if (mp == NULL) {
|
||||
return E_NOENTRY;
|
||||
}
|
||||
|
||||
return mp->mkdir(mp, path);
|
||||
}
|
||||
|
||||
int32_t vfs_fetchdirent(char *mountpoint, const char *path, IoctlDirent *direntbuf, size_t idx) {
|
||||
VfsMountPoint *mp = NULL;
|
||||
|
||||
|
@ -52,6 +52,7 @@ typedef struct VfsMountPoint {
|
||||
int32_t (*cleanup)(struct VfsMountPoint *vmp);
|
||||
int32_t (*stat)(struct VfsMountPoint *vmp, const char *path, IoctlStat *statbuf);
|
||||
int32_t (*fetchdirent)(struct VfsMountPoint *vmp, const char *path, IoctlDirent *direntbuf, size_t idx);
|
||||
int32_t (*mkdir)(struct VfsMountPoint *vmp, const char *path);
|
||||
|
||||
union {
|
||||
LittleFs littlefs;
|
||||
@ -73,5 +74,6 @@ void vfs_close(VfsObj *vobj);
|
||||
VfsObj *vfs_open(char *mountpoint, const char *path, uint32_t flags);
|
||||
int32_t vfs_stat(char *mountpoint, const char *path, IoctlStat *stat);
|
||||
int32_t vfs_fetchdirent(char *mountpoint, const char *path, IoctlDirent *direntbuf, size_t idx);
|
||||
int32_t vfs_mkdir(char *mountpoint, const char *path);
|
||||
|
||||
#endif // VFS_VFS_H_
|
||||
|
Reference in New Issue
Block a user