orbis: add stat and statfs to IoDevice

cleanup debug code
This commit is contained in:
DH 2025-11-09 21:47:23 +03:00
parent 9fc036d9a5
commit 6f611e23dd
4 changed files with 29 additions and 32 deletions

View file

@ -31,11 +31,21 @@ enum OpenFlags {
struct File;
struct Thread;
struct Process;
struct Stat;
struct StatFs;
struct IoDevice : rx::RcBase {
virtual ErrorCode open(rx::Ref<File> *file, const char *path,
std::uint32_t flags, std::uint32_t mode,
Thread *thread) = 0;
virtual ErrorCode statfs(const char *path, StatFs *sb, Thread *thread) {
return ErrorCode::NOTSUP;
}
virtual ErrorCode stat(const char *path, Stat *sb, Thread *thread) {
return ErrorCode::NOTSUP;
}
virtual ErrorCode unlink(const char *path, bool recursive, Thread *thread) {
return ErrorCode::NOTSUP;
}

View file

@ -24,6 +24,13 @@ struct Stat {
timespec birthtim; // time of file creation
};
struct StatFs {
char pad[0x118];
char f_fstypename[16]; // filesystem type name
char f_mntfromname[88]; // mounted filesystem
char f_mntonname[88]; // directory on which mounted
};
struct Dirent {
uint32_t fileno;
uint16_t reclen;

View file

@ -27,6 +27,7 @@ struct timesec;
struct timezone;
struct timeval;
struct Stat;
struct StatFs;
struct stack_t;
struct IoVec;
struct BatchMapEntry;
@ -393,12 +394,12 @@ SysResult sys_sendfile(Thread *thread, sint fd, sint s, off_t offset,
ptr<off_t> sbytes, sint flags);
SysResult sys_mac_syscall(Thread *thread, ptr<const char> policy, sint call,
ptr<void> arg);
SysResult sys_getfsstat(Thread *thread, ptr<struct statfs> buf, slong bufsize,
SysResult sys_getfsstat(Thread *thread, ptr<StatFs> buf, slong bufsize,
sint flags);
SysResult sys_statfs(Thread *thread, ptr<char> path, ptr<struct statfs> buf);
SysResult sys_fstatfs(Thread *thread, sint fd, ptr<struct statfs> buf);
SysResult sys_statfs(Thread *thread, ptr<char> path, ptr<StatFs> buf);
SysResult sys_fstatfs(Thread *thread, sint fd, ptr<StatFs> buf);
SysResult sys_fhstatfs(Thread *thread, ptr<const struct fhandle> u_fhp,
ptr<struct statfs> buf);
ptr<StatFs> buf);
SysResult sys_ksem_close(Thread *thread, semid_t id);
SysResult sys_ksem_post(Thread *thread, semid_t id);
SysResult sys_ksem_wait(Thread *thread, semid_t id);