Remove conversions between VfsStat struct and IoctlStat struct
This commit is contained in:
@ -72,7 +72,7 @@ int32_t littlefs_vobj_write(struct VfsObj *vobj, const uint8_t *const buffer, si
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
int32_t littlefs_stat(struct VfsMountPoint *vmp, const char *path, struct VfsStat *statbuf) {
|
||||
int32_t littlefs_stat(struct VfsMountPoint *vmp, const char *path, IoctlStat *statbuf) {
|
||||
struct lfs_info info;
|
||||
|
||||
spinlock_acquire(&vmp->spinlock);
|
||||
@ -84,10 +84,10 @@ int32_t littlefs_stat(struct VfsMountPoint *vmp, const char *path, struct VfsSta
|
||||
}
|
||||
|
||||
if (info.type == LFS_TYPE_REG) {
|
||||
statbuf->type = VFS_TYPE_FILE;
|
||||
statbuf->type = IOCTLSTAT_FILE;
|
||||
statbuf->size = info.size;
|
||||
} else if (info.type == LFS_TYPE_DIR) {
|
||||
statbuf->type = VFS_TYPE_DIR;
|
||||
statbuf->type = IOCTLSTAT_DIR;
|
||||
statbuf->size = 0;
|
||||
// TODO: find a better way than this... !!!
|
||||
lfs_dir_t dir;
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define LITTLEFS_BLOCK_SIZE 4096
|
||||
|
||||
struct VfsMountPoint;
|
||||
struct VfsStat;
|
||||
struct VfsObj;
|
||||
|
||||
typedef struct {
|
||||
@ -18,7 +17,7 @@ typedef struct {
|
||||
|
||||
int32_t littlefs_cleanup(struct VfsMountPoint *vmp);
|
||||
struct VfsObj *littlefs_open(struct VfsMountPoint *vmp, const char *path, uint32_t flags);
|
||||
int32_t littlefs_stat(struct VfsMountPoint *vmp, const char *path, struct VfsStat *statbuf);
|
||||
int32_t littlefs_stat(struct VfsMountPoint *vmp, const char *path, IoctlStat *statbuf);
|
||||
int32_t littlefs_fetchdirent(struct VfsMountPoint *vmp, const char *path, IoctlDirent *direntbuf, size_t idx);
|
||||
|
||||
int portlfs_read(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size);
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "bootinfo/bootinfo.h"
|
||||
#include "ipc/pipe/pipe.h"
|
||||
#include "sysdefs/processctl.h"
|
||||
#include "sysdefs/ioctl.h"
|
||||
|
||||
#define PROC_REAPER_FREQ 30
|
||||
|
||||
@ -74,12 +75,12 @@ ElfAuxval proc_load_elf_segs(Proc *proc, uint8_t *data) {
|
||||
}
|
||||
|
||||
Proc *proc_spawnuser(char *mountpoint, char *path) {
|
||||
VfsStat stat;
|
||||
IoctlStat stat;
|
||||
if (vfs_stat(mountpoint, path, &stat) != E_OK) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (stat.type != VFS_TYPE_FILE) {
|
||||
if (stat.type != IOCTLSTAT_FILE) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -152,14 +152,7 @@ int32_t SYSCALL5(sys_ioctl, ioh1, cmd1, arg1, arg2, arg3) {
|
||||
|
||||
path_parse(opath, mp, path);
|
||||
|
||||
VfsStat stat1;
|
||||
ret = vfs_stat(mp, path, &stat1);
|
||||
if (ret != E_OK) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
iostat->size = stat1.size;
|
||||
iostat->type = stat1.type;
|
||||
ret = vfs_stat(mp, path, iostat);
|
||||
} break;
|
||||
case IOCTL_FETCHDIRENT: {
|
||||
const char *opath = (const char *)arg1;
|
||||
|
@ -50,7 +50,7 @@ void vfs_init_littlefs(VfsMountPoint *mp, bool format) {
|
||||
mp->fetchdirent = &littlefs_fetchdirent;
|
||||
}
|
||||
|
||||
int32_t vfs_stat(char *mountpoint, const char *path, VfsStat *stat) {
|
||||
int32_t vfs_stat(char *mountpoint, const char *path, IoctlStat *stat) {
|
||||
VfsMountPoint *mp = NULL;
|
||||
|
||||
spinlock_acquire(&VFS_TABLE.spinlock);
|
||||
|
@ -20,11 +20,6 @@ static const char *vfs_strings[] = {
|
||||
"Little FS",
|
||||
};
|
||||
|
||||
enum {
|
||||
VFS_TYPE_DIR = 0,
|
||||
VFS_TYPE_FILE = 1,
|
||||
};
|
||||
|
||||
enum {
|
||||
VFS_FLAG_READ = 1<<0,
|
||||
VFS_FLAG_WRITE = 1<<1,
|
||||
@ -33,11 +28,6 @@ enum {
|
||||
|
||||
#define VFS_PATH_MAX 1024
|
||||
|
||||
typedef struct VfsStat {
|
||||
size_t size;
|
||||
int32_t type;
|
||||
} VfsStat;
|
||||
|
||||
typedef struct VfsObj {
|
||||
SpinLock spinlock;
|
||||
void *extra;
|
||||
@ -58,7 +48,7 @@ typedef struct VfsMountPoint {
|
||||
|
||||
VfsObj *(*open)(struct VfsMountPoint *vmp, const char *path, uint32_t flags);
|
||||
int32_t (*cleanup)(struct VfsMountPoint *vmp);
|
||||
int32_t (*stat)(struct VfsMountPoint *vmp, const char *path, struct VfsStat *statbuf);
|
||||
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);
|
||||
|
||||
union {
|
||||
@ -79,7 +69,7 @@ int32_t vfs_unmount(char *mountpoint);
|
||||
int32_t vfs_mount(char *mountpoint, int32_t fstype, StoreDev *backingsd, bool format);
|
||||
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, VfsStat *stat);
|
||||
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);
|
||||
|
||||
#endif // VFS_VFS_H_
|
||||
|
Reference in New Issue
Block a user