mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-12-06 07:12:14 +01:00
orbis: add stat and statfs to IoDevice
cleanup debug code
This commit is contained in:
parent
9fc036d9a5
commit
6f611e23dd
|
|
@ -31,11 +31,21 @@ enum OpenFlags {
|
||||||
struct File;
|
struct File;
|
||||||
struct Thread;
|
struct Thread;
|
||||||
struct Process;
|
struct Process;
|
||||||
|
struct Stat;
|
||||||
|
struct StatFs;
|
||||||
struct IoDevice : rx::RcBase {
|
struct IoDevice : rx::RcBase {
|
||||||
virtual ErrorCode open(rx::Ref<File> *file, const char *path,
|
virtual ErrorCode open(rx::Ref<File> *file, const char *path,
|
||||||
std::uint32_t flags, std::uint32_t mode,
|
std::uint32_t flags, std::uint32_t mode,
|
||||||
Thread *thread) = 0;
|
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) {
|
virtual ErrorCode unlink(const char *path, bool recursive, Thread *thread) {
|
||||||
return ErrorCode::NOTSUP;
|
return ErrorCode::NOTSUP;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,13 @@ struct Stat {
|
||||||
timespec birthtim; // time of file creation
|
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 {
|
struct Dirent {
|
||||||
uint32_t fileno;
|
uint32_t fileno;
|
||||||
uint16_t reclen;
|
uint16_t reclen;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ struct timesec;
|
||||||
struct timezone;
|
struct timezone;
|
||||||
struct timeval;
|
struct timeval;
|
||||||
struct Stat;
|
struct Stat;
|
||||||
|
struct StatFs;
|
||||||
struct stack_t;
|
struct stack_t;
|
||||||
struct IoVec;
|
struct IoVec;
|
||||||
struct BatchMapEntry;
|
struct BatchMapEntry;
|
||||||
|
|
@ -393,12 +394,12 @@ SysResult sys_sendfile(Thread *thread, sint fd, sint s, off_t offset,
|
||||||
ptr<off_t> sbytes, sint flags);
|
ptr<off_t> sbytes, sint flags);
|
||||||
SysResult sys_mac_syscall(Thread *thread, ptr<const char> policy, sint call,
|
SysResult sys_mac_syscall(Thread *thread, ptr<const char> policy, sint call,
|
||||||
ptr<void> arg);
|
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);
|
sint flags);
|
||||||
SysResult sys_statfs(Thread *thread, ptr<char> path, ptr<struct statfs> buf);
|
SysResult sys_statfs(Thread *thread, ptr<char> path, ptr<StatFs> buf);
|
||||||
SysResult sys_fstatfs(Thread *thread, sint fd, ptr<struct statfs> buf);
|
SysResult sys_fstatfs(Thread *thread, sint fd, ptr<StatFs> buf);
|
||||||
SysResult sys_fhstatfs(Thread *thread, ptr<const struct fhandle> u_fhp,
|
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_close(Thread *thread, semid_t id);
|
||||||
SysResult sys_ksem_post(Thread *thread, semid_t id);
|
SysResult sys_ksem_post(Thread *thread, semid_t id);
|
||||||
SysResult sys_ksem_wait(Thread *thread, semid_t id);
|
SysResult sys_ksem_wait(Thread *thread, semid_t id);
|
||||||
|
|
|
||||||
|
|
@ -13,22 +13,14 @@ orbis::SysResult orbis::sys_quotactl(Thread *thread, ptr<char> path, sint cmd,
|
||||||
return ErrorCode::NOSYS;
|
return ErrorCode::NOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace orbis {
|
|
||||||
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 */
|
|
||||||
};
|
|
||||||
} // namespace orbis
|
|
||||||
|
|
||||||
orbis::SysResult orbis::sys_statfs(Thread *thread, ptr<char> path,
|
orbis::SysResult orbis::sys_statfs(Thread *thread, ptr<char> path,
|
||||||
ptr<struct statfs> buf) {
|
ptr<StatFs> buf) {
|
||||||
if (buf == 0) {
|
if (buf == 0) {
|
||||||
thread->retval[0] = 1;
|
thread->retval[0] = 1;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: use statfs
|
||||||
std::strncpy(buf->f_fstypename, "unionfs", sizeof(buf->f_fstypename));
|
std::strncpy(buf->f_fstypename, "unionfs", sizeof(buf->f_fstypename));
|
||||||
std::strncpy(buf->f_mntfromname, "/dev/super-hdd",
|
std::strncpy(buf->f_mntfromname, "/dev/super-hdd",
|
||||||
sizeof(buf->f_mntfromname));
|
sizeof(buf->f_mntfromname));
|
||||||
|
|
@ -37,13 +29,13 @@ orbis::SysResult orbis::sys_statfs(Thread *thread, ptr<char> path,
|
||||||
thread->retval[0] = 1;
|
thread->retval[0] = 1;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
orbis::SysResult orbis::sys_fstatfs(Thread *thread, sint fd,
|
orbis::SysResult orbis::sys_fstatfs(Thread *thread, sint fd, ptr<StatFs> buf) {
|
||||||
ptr<struct statfs> buf) {
|
|
||||||
if (buf == 0) {
|
if (buf == 0) {
|
||||||
thread->retval[0] = 1;
|
thread->retval[0] = 1;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: use statfs
|
||||||
std::strncpy(buf->f_fstypename, "unionfs", sizeof(buf->f_fstypename));
|
std::strncpy(buf->f_fstypename, "unionfs", sizeof(buf->f_fstypename));
|
||||||
std::strncpy(buf->f_mntfromname, "/dev/super-hdd",
|
std::strncpy(buf->f_mntfromname, "/dev/super-hdd",
|
||||||
sizeof(buf->f_mntfromname));
|
sizeof(buf->f_mntfromname));
|
||||||
|
|
@ -52,7 +44,7 @@ orbis::SysResult orbis::sys_fstatfs(Thread *thread, sint fd,
|
||||||
thread->retval[0] = 1;
|
thread->retval[0] = 1;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
orbis::SysResult orbis::sys_getfsstat(Thread *thread, ptr<struct statfs> buf,
|
orbis::SysResult orbis::sys_getfsstat(Thread *thread, ptr<StatFs> buf,
|
||||||
slong bufsize, sint flags) {
|
slong bufsize, sint flags) {
|
||||||
return ErrorCode::NOSYS;
|
return ErrorCode::NOSYS;
|
||||||
}
|
}
|
||||||
|
|
@ -70,7 +62,6 @@ orbis::SysResult orbis::sys_chroot(Thread *thread, ptr<char> path) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// volatile bool debuggerPresent = false;
|
|
||||||
orbis::SysResult orbis::sys_open(Thread *thread, ptr<const char> path,
|
orbis::SysResult orbis::sys_open(Thread *thread, ptr<const char> path,
|
||||||
sint flags, sint mode) {
|
sint flags, sint mode) {
|
||||||
if (auto open = thread->tproc->ops->open) {
|
if (auto open = thread->tproc->ops->open) {
|
||||||
|
|
@ -82,24 +73,12 @@ orbis::SysResult orbis::sys_open(Thread *thread, ptr<const char> path,
|
||||||
|
|
||||||
auto fd = thread->tproc->fileDescriptors.insert(file);
|
auto fd = thread->tproc->fileDescriptors.insert(file);
|
||||||
thread->retval[0] = fd;
|
thread->retval[0] = fd;
|
||||||
// if (path ==
|
|
||||||
// std::string_view{"/app0/psm/Application/resource/Sce.Vsh.ShellUI.SystemMessage.rco"})
|
|
||||||
// {
|
|
||||||
ORBIS_LOG_SUCCESS(__FUNCTION__, thread->tid, path, flags, mode, fd);
|
|
||||||
if (path == std::string_view{"/app0/wave/wave1.fbxd"}) {
|
|
||||||
thread->where();
|
|
||||||
}
|
|
||||||
|
|
||||||
// while (debuggerPresent == false) {
|
|
||||||
// std::this_thread::sleep_for(std::chrono::seconds(1));
|
|
||||||
// }
|
|
||||||
// // thread->where();
|
|
||||||
// }
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return ErrorCode::NOSYS;
|
return ErrorCode::NOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
orbis::SysResult orbis::sys_openat(Thread *thread, sint fd, ptr<char> path,
|
orbis::SysResult orbis::sys_openat(Thread *thread, sint fd, ptr<char> path,
|
||||||
sint flag, mode_t mode) {
|
sint flag, mode_t mode) {
|
||||||
ORBIS_LOG_WARNING(__FUNCTION__, fd, path, flag, mode);
|
ORBIS_LOG_WARNING(__FUNCTION__, fd, path, flag, mode);
|
||||||
|
|
@ -485,7 +464,7 @@ orbis::SysResult orbis::sys_fhstat(Thread *thread,
|
||||||
}
|
}
|
||||||
orbis::SysResult orbis::sys_fhstatfs(Thread *thread,
|
orbis::SysResult orbis::sys_fhstatfs(Thread *thread,
|
||||||
ptr<const struct fhandle> u_fhp,
|
ptr<const struct fhandle> u_fhp,
|
||||||
ptr<struct statfs> buf) {
|
ptr<StatFs> buf) {
|
||||||
return ErrorCode::NOSYS;
|
return ErrorCode::NOSYS;
|
||||||
}
|
}
|
||||||
orbis::SysResult orbis::sys_posix_fallocate(Thread *thread, sint fd,
|
orbis::SysResult orbis::sys_posix_fallocate(Thread *thread, sint fd,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue