From 05dee2c8e37bf3718a47491bd42d7ef7e346e1ef Mon Sep 17 00:00:00 2001 From: DH Date: Sat, 11 Oct 2025 14:49:51 +0300 Subject: [PATCH] Move IoDevice to orbis --- kernel/orbis/include/orbis/IoDevice.hpp | 54 ++++++++++ kernel/orbis/include/orbis/KernelContext.hpp | 9 +- kernel/orbis/include/orbis/file.hpp | 3 +- rpcsx/io-device.cpp | 47 ++++---- rpcsx/io-device.hpp | 55 ++-------- rpcsx/io-devices.hpp | 106 ++++++++++--------- rpcsx/iodev/a53io.cpp | 8 +- rpcsx/iodev/ajm.cpp | 4 +- rpcsx/iodev/aout.cpp | 5 +- rpcsx/iodev/av_control.cpp | 4 +- rpcsx/iodev/blockpool.cpp | 6 +- rpcsx/iodev/blockpool.hpp | 4 +- rpcsx/iodev/bt.cpp | 4 +- rpcsx/iodev/camera.cpp | 6 +- rpcsx/iodev/cayman_reg.cpp | 4 +- rpcsx/iodev/cd.cpp | 4 +- rpcsx/iodev/console.cpp | 4 +- rpcsx/iodev/dce.cpp | 2 +- rpcsx/iodev/dce.hpp | 2 +- rpcsx/iodev/devact.cpp | 6 +- rpcsx/iodev/devctl.cpp | 6 +- rpcsx/iodev/devstat.cpp | 4 +- rpcsx/iodev/dipsw.cpp | 6 +- rpcsx/iodev/dmem.cpp | 6 +- rpcsx/iodev/dmem.hpp | 4 +- rpcsx/iodev/evlg.cpp | 6 +- rpcsx/iodev/gbase.cpp | 8 +- rpcsx/iodev/gc.cpp | 6 +- rpcsx/iodev/hdd.cpp | 6 +- rpcsx/iodev/hdmi.cpp | 8 +- rpcsx/iodev/hid.cpp | 7 +- rpcsx/iodev/hmd2_cmd.cpp | 7 +- rpcsx/iodev/hmd2_gaze.cpp | 7 +- rpcsx/iodev/hmd2_gen_data.cpp | 7 +- rpcsx/iodev/hmd2_imu.cpp | 7 +- rpcsx/iodev/hmd_3da.cpp | 8 +- rpcsx/iodev/hmd_cmd.cpp | 9 +- rpcsx/iodev/hmd_mmap.cpp | 7 +- rpcsx/iodev/hmd_snsr.cpp | 6 +- rpcsx/iodev/icc_configuration.cpp | 6 +- rpcsx/iodev/icc_power.cpp | 6 +- rpcsx/iodev/lvdctl.cpp | 8 +- rpcsx/iodev/mbus.cpp | 5 +- rpcsx/iodev/mbus.hpp | 6 +- rpcsx/iodev/mbus_av.cpp | 5 +- rpcsx/iodev/mbus_av.hpp | 6 +- rpcsx/iodev/metadbg.cpp | 7 +- rpcsx/iodev/notification.cpp | 6 +- rpcsx/iodev/npdrm.cpp | 8 +- rpcsx/iodev/nsid_ctl.cpp | 7 +- rpcsx/iodev/null.cpp | 9 +- rpcsx/iodev/rng.cpp | 7 +- rpcsx/iodev/s3da.cpp | 8 +- rpcsx/iodev/sbl_srv.cpp | 8 +- rpcsx/iodev/scanin.cpp | 8 +- rpcsx/iodev/shm.cpp | 5 +- rpcsx/iodev/srtc.cpp | 8 +- rpcsx/iodev/sshot.cpp | 6 +- rpcsx/iodev/urandom.cpp | 7 +- rpcsx/iodev/uvd.cpp | 6 +- rpcsx/iodev/vce.cpp | 6 +- rpcsx/iodev/xpt.cpp | 6 +- rpcsx/iodev/zero.cpp | 9 +- rpcsx/ipmi.cpp | 2 +- rpcsx/linker.cpp | 3 +- rpcsx/main.cpp | 2 +- rpcsx/ops.cpp | 2 +- rpcsx/vfs.cpp | 15 +-- rpcsx/vfs.hpp | 9 +- rpcsx/vm.cpp | 4 +- rpcsx/vm.hpp | 5 +- 71 files changed, 368 insertions(+), 299 deletions(-) create mode 100644 kernel/orbis/include/orbis/IoDevice.hpp diff --git a/kernel/orbis/include/orbis/IoDevice.hpp b/kernel/orbis/include/orbis/IoDevice.hpp new file mode 100644 index 000000000..02b7a6aeb --- /dev/null +++ b/kernel/orbis/include/orbis/IoDevice.hpp @@ -0,0 +1,54 @@ +#pragma once + +#include "error/ErrorCode.hpp" +#include "rx/Rc.hpp" + +namespace orbis { +enum OpenFlags { + kOpenFlagReadOnly = 0x0, + kOpenFlagWriteOnly = 0x1, + kOpenFlagReadWrite = 0x2, + kOpenFlagNonBlock = 0x4, + kOpenFlagAppend = 0x8, + kOpenFlagShLock = 0x10, + kOpenFlagExLock = 0x20, + kOpenFlagAsync = 0x40, + kOpenFlagFsync = 0x80, + kOpenFlagCreat = 0x200, + kOpenFlagTrunc = 0x400, + kOpenFlagExcl = 0x800, + kOpenFlagDSync = 0x1000, + kOpenFlagDirect = 0x10000, + kOpenFlagDirectory = 0x20000, +}; + +struct File; +struct Thread; + +struct IoDevice : rx::RcBase { + virtual ErrorCode open(rx::Ref *file, const char *path, + std::uint32_t flags, std::uint32_t mode, + Thread *thread) = 0; + + virtual ErrorCode unlink(const char *path, bool recursive, Thread *thread) { + return ErrorCode::NOTSUP; + } + + virtual ErrorCode createSymlink(const char *target, const char *linkPath, + Thread *thread) { + return ErrorCode::NOTSUP; + } + + virtual ErrorCode mkdir(const char *path, int mode, Thread *thread) { + return ErrorCode::NOTSUP; + } + + virtual ErrorCode rmdir(const char *path, Thread *thread) { + return ErrorCode::NOTSUP; + } + + virtual ErrorCode rename(const char *from, const char *to, Thread *thread) { + return ErrorCode::NOTSUP; + } +}; +} // namespace orbis diff --git a/kernel/orbis/include/orbis/KernelContext.hpp b/kernel/orbis/include/orbis/KernelContext.hpp index 7d6312c55..9053596bf 100644 --- a/kernel/orbis/include/orbis/KernelContext.hpp +++ b/kernel/orbis/include/orbis/KernelContext.hpp @@ -1,6 +1,7 @@ #pragma once #include "AppInfo.hpp" #include "Budget.hpp" +#include "IoDevice.hpp" #include "KernelObject.hpp" #include "evf.hpp" #include "ipmi.hpp" @@ -136,11 +137,11 @@ public: } rx::Ref deviceEventEmitter; - rx::Ref shmDevice; - rx::Ref dmemDevice; - rx::Ref blockpoolDevice; + rx::Ref shmDevice; + rx::Ref dmemDevice; + rx::Ref blockpoolDevice; rx::Ref gpuDevice; - rx::Ref dceDevice; + rx::Ref dceDevice; rx::shared_mutex gpuDeviceMtx; uint sdkVersion{}; uint fwSdkVersion{}; diff --git a/kernel/orbis/include/orbis/file.hpp b/kernel/orbis/include/orbis/file.hpp index 26cf5bf64..b32b01466 100644 --- a/kernel/orbis/include/orbis/file.hpp +++ b/kernel/orbis/include/orbis/file.hpp @@ -5,6 +5,7 @@ #include "note.hpp" #include "rx/Rc.hpp" #include "rx/SharedMutex.hpp" +#include "IoDevice.hpp" #include "stat.hpp" #include @@ -77,7 +78,7 @@ struct File : rx::RcBase { rx::shared_mutex mtx; rx::Ref event; const FileOps *ops = nullptr; - rx::Ref device; + rx::Ref device; std::uint64_t nextOff = 0; int flags = 0; int mode = 0; diff --git a/rpcsx/io-device.cpp b/rpcsx/io-device.cpp index b1d7cc2f9..b42134158 100644 --- a/rpcsx/io-device.cpp +++ b/rpcsx/io-device.cpp @@ -339,9 +339,8 @@ static orbis::ErrorCode host_mmap(orbis::File *file, void **address, if (!hostFile->dirEntries.empty()) return orbis::ErrorCode::ISDIR; - auto result = - vm::map(*address, size, prot, flags, vm::kMapInternalReserveOnly, - hostFile->device.cast().get(), offset); + auto result = vm::map(*address, size, prot, flags, + vm::kMapInternalReserveOnly, hostFile->device.get(), offset); if (result == (void *)-1) { return orbis::ErrorCode::NOMEM; @@ -695,8 +694,8 @@ static const orbis::FileOps socketOps = { .getsockopt = socket_getsockopt, }; -IoDevice *createHostIoDevice(orbis::kstring hostPath, - orbis::kstring virtualPath) { +orbis::IoDevice *createHostIoDevice(orbis::kstring hostPath, + orbis::kstring virtualPath) { while (hostPath.size() > 0 && hostPath.ends_with("/")) { hostPath.resize(hostPath.size() - 1); } @@ -778,44 +777,44 @@ orbis::ErrorCode HostFsDevice::open(rx::Ref *file, int realFlags = flags & O_ACCMODE; flags &= ~O_ACCMODE; - if ((flags & kOpenFlagAppend) != 0) { + if ((flags & orbis::kOpenFlagAppend) != 0) { realFlags |= O_APPEND; - flags &= ~kOpenFlagAppend; + flags &= ~orbis::kOpenFlagAppend; } - if ((flags & kOpenFlagNonBlock) != 0) { + if ((flags & orbis::kOpenFlagNonBlock) != 0) { realFlags |= O_NONBLOCK; - flags &= ~kOpenFlagNonBlock; + flags &= ~orbis::kOpenFlagNonBlock; } - if ((flags & kOpenFlagFsync) != 0) { + if ((flags & orbis::kOpenFlagFsync) != 0) { realFlags |= O_FSYNC; - flags &= ~kOpenFlagFsync; + flags &= ~orbis::kOpenFlagFsync; } - if ((flags & kOpenFlagAsync) != 0) { + if ((flags & orbis::kOpenFlagAsync) != 0) { realFlags |= O_ASYNC; - flags &= ~kOpenFlagAsync; + flags &= ~orbis::kOpenFlagAsync; } - if ((flags & kOpenFlagTrunc) != 0) { + if ((flags & orbis::kOpenFlagTrunc) != 0) { realFlags |= O_TRUNC; - flags &= ~kOpenFlagTrunc; + flags &= ~orbis::kOpenFlagTrunc; } - if ((flags & kOpenFlagCreat) != 0) { + if ((flags & orbis::kOpenFlagCreat) != 0) { realFlags |= O_CREAT; - flags &= ~kOpenFlagCreat; + flags &= ~orbis::kOpenFlagCreat; } - if ((flags & kOpenFlagExcl) != 0) { + if ((flags & orbis::kOpenFlagExcl) != 0) { realFlags |= O_EXCL; - flags &= ~kOpenFlagExcl; + flags &= ~orbis::kOpenFlagExcl; } - if ((flags & kOpenFlagDirectory) != 0) { + if ((flags & orbis::kOpenFlagDirectory) != 0) { realFlags |= O_DIRECTORY; - flags &= ~kOpenFlagDirectory; + flags &= ~orbis::kOpenFlagDirectory; } if (flags != 0) { @@ -937,7 +936,7 @@ orbis::ErrorCode HostFsDevice::rename(const char *from, const char *to, return convertErrorCode(ec); } -orbis::File *createHostFile(int hostFd, rx::Ref device, +orbis::File *createHostFile(int hostFd, rx::Ref device, bool alignTruncate) { auto newFile = orbis::knew(); newFile->hostFd = hostFd; @@ -947,7 +946,7 @@ orbis::File *createHostFile(int hostFd, rx::Ref device, return newFile; } -struct FdWrapDevice : public IoDevice { +struct FdWrapDevice : public orbis::IoDevice { int fd; orbis::ErrorCode open(rx::Ref *file, const char *path, @@ -959,7 +958,7 @@ struct FdWrapDevice : public IoDevice { } }; -IoDevice *createFdWrapDevice(int fd) { +orbis::IoDevice *createFdWrapDevice(int fd) { auto result = orbis::knew(); result->fd = fd; return result; diff --git a/rpcsx/io-device.hpp b/rpcsx/io-device.hpp index 16a9b2dc6..bf0394251 100644 --- a/rpcsx/io-device.hpp +++ b/rpcsx/io-device.hpp @@ -1,56 +1,13 @@ #pragma once +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "rx/Rc.hpp" #include #include -enum OpenFlags { - kOpenFlagReadOnly = 0x0, - kOpenFlagWriteOnly = 0x1, - kOpenFlagReadWrite = 0x2, - kOpenFlagNonBlock = 0x4, - kOpenFlagAppend = 0x8, - kOpenFlagShLock = 0x10, - kOpenFlagExLock = 0x20, - kOpenFlagAsync = 0x40, - kOpenFlagFsync = 0x80, - kOpenFlagCreat = 0x200, - kOpenFlagTrunc = 0x400, - kOpenFlagExcl = 0x800, - kOpenFlagDSync = 0x1000, - kOpenFlagDirect = 0x10000, - kOpenFlagDirectory = 0x20000, -}; - -struct IoDevice : rx::RcBase { - virtual orbis::ErrorCode open(rx::Ref *file, const char *path, - std::uint32_t flags, std::uint32_t mode, - orbis::Thread *thread) = 0; - virtual orbis::ErrorCode unlink(const char *path, bool recursive, - orbis::Thread *thread) { - return orbis::ErrorCode::NOTSUP; - } - virtual orbis::ErrorCode createSymlink(const char *target, - const char *linkPath, - orbis::Thread *thread) { - return orbis::ErrorCode::NOTSUP; - } - virtual orbis::ErrorCode mkdir(const char *path, int mode, - orbis::Thread *thread) { - return orbis::ErrorCode::NOTSUP; - } - virtual orbis::ErrorCode rmdir(const char *path, orbis::Thread *thread) { - return orbis::ErrorCode::NOTSUP; - } - virtual orbis::ErrorCode rename(const char *from, const char *to, - orbis::Thread *thread) { - return orbis::ErrorCode::NOTSUP; - } -}; - -struct HostFsDevice : IoDevice { +struct HostFsDevice : orbis::IoDevice { orbis::kstring hostPath; orbis::kstring virtualPath; @@ -72,12 +29,12 @@ struct HostFsDevice : IoDevice { orbis::ErrorCode convertErrorCode(const std::error_code &code); orbis::ErrorCode convertErrno(); -IoDevice *createHostIoDevice(orbis::kstring hostPath, - orbis::kstring virtualPath); +orbis::IoDevice *createHostIoDevice(orbis::kstring hostPath, + orbis::kstring virtualPath); rx::Ref wrapSocket(int hostFd, orbis::kstring name, int dom, int type, int prot); orbis::ErrorCode createSocket(rx::Ref *file, orbis::kstring name, int dom, int type, int prot); -orbis::File *createHostFile(int hostFd, rx::Ref device, +orbis::File *createHostFile(int hostFd, rx::Ref device, bool alignTruncate = false); -IoDevice *createFdWrapDevice(int fd); +orbis::IoDevice *createFdWrapDevice(int fd); diff --git a/rpcsx/io-devices.hpp b/rpcsx/io-devices.hpp index edbff23c6..6c6e260cb 100644 --- a/rpcsx/io-devices.hpp +++ b/rpcsx/io-devices.hpp @@ -3,57 +3,59 @@ #include "audio/AudioDevice.hpp" #include +namespace orbis { struct IoDevice; +} -IoDevice *createDceCharacterDevice(); -IoDevice *createDipswCharacterDevice(); -IoDevice *createDmemCharacterDevice(int index); -IoDevice *createGcCharacterDevice(); -IoDevice *createHidCharacterDevice(); -IoDevice *createHmd3daCharacterDevice(); -IoDevice *createHmdCmdCharacterDevice(); -IoDevice *createHmdMmapCharacterDevice(); -IoDevice *createHmdSnsrCharacterDevice(); -IoDevice *createNullCharacterDevice(); -IoDevice *createZeroCharacterDevice(); -IoDevice *createRngCharacterDevice(); -IoDevice *createAjmCharacterDevice(); -IoDevice *createIccConfigurationCharacterDevice(); -IoDevice *createNpdrmCharacterDevice(); -IoDevice *createConsoleCharacterDevice(int inputFd, int outputFd); -IoDevice *createSblSrvCharacterDevice(); -IoDevice *createShmDevice(); -IoDevice *createBlockPoolDevice(); -IoDevice *createUrandomCharacterDevice(); -IoDevice *createCameraCharacterDevice(); -IoDevice *createNotificationCharacterDevice(int index); -IoDevice *createMBusCharacterDevice(); -IoDevice *createBtCharacterDevice(); -IoDevice *createXptCharacterDevice(); -IoDevice *createCdCharacterDevice(); -IoDevice *createMetaDbgCharacterDevice(); -IoDevice *createHddCharacterDevice(std::uint64_t size); -IoDevice *createAoutCharacterDevice(std::int8_t id, AudioDevice *device); -IoDevice *createAVControlCharacterDevice(); -IoDevice *createHDMICharacterDevice(); -IoDevice *createMBusAVCharacterDevice(); -IoDevice *createScaninCharacterDevice(); -IoDevice *createS3DACharacterDevice(); -IoDevice *createGbaseCharacterDevice(); -IoDevice *createDevStatCharacterDevice(); -IoDevice *createDevCtlCharacterDevice(); -IoDevice *createDevActCharacterDevice(); -IoDevice *createUVDCharacterDevice(); -IoDevice *createVCECharacterDevice(); -IoDevice *createEvlgCharacterDevice(int outputFd); -IoDevice *createSrtcCharacterDevice(); -IoDevice *createScreenShotCharacterDevice(); -IoDevice *createLvdCtlCharacterDevice(); -IoDevice *createIccPowerCharacterDevice(); -IoDevice *createCaymanRegCharacterDevice(); -IoDevice *createA53IoCharacterDevice(); -IoDevice *createNsidCtlCharacterDevice(); -IoDevice *createHmd2CmdCharacterDevice(); -IoDevice *createHmd2ImuCharacterDevice(); -IoDevice *createHmd2GazeCharacterDevice(); -IoDevice *createHmd2GenDataCharacterDevice(); +orbis::IoDevice *createDceCharacterDevice(); +orbis::IoDevice *createDipswCharacterDevice(); +orbis::IoDevice *createDmemCharacterDevice(int index); +orbis::IoDevice *createGcCharacterDevice(); +orbis::IoDevice *createHidCharacterDevice(); +orbis::IoDevice *createHmd3daCharacterDevice(); +orbis::IoDevice *createHmdCmdCharacterDevice(); +orbis::IoDevice *createHmdMmapCharacterDevice(); +orbis::IoDevice *createHmdSnsrCharacterDevice(); +orbis::IoDevice *createNullCharacterDevice(); +orbis::IoDevice *createZeroCharacterDevice(); +orbis::IoDevice *createRngCharacterDevice(); +orbis::IoDevice *createAjmCharacterDevice(); +orbis::IoDevice *createIccConfigurationCharacterDevice(); +orbis::IoDevice *createNpdrmCharacterDevice(); +orbis::IoDevice *createConsoleCharacterDevice(int inputFd, int outputFd); +orbis::IoDevice *createSblSrvCharacterDevice(); +orbis::IoDevice *createShmDevice(); +orbis::IoDevice *createBlockPoolDevice(); +orbis::IoDevice *createUrandomCharacterDevice(); +orbis::IoDevice *createCameraCharacterDevice(); +orbis::IoDevice *createNotificationCharacterDevice(int index); +orbis::IoDevice *createMBusCharacterDevice(); +orbis::IoDevice *createBtCharacterDevice(); +orbis::IoDevice *createXptCharacterDevice(); +orbis::IoDevice *createCdCharacterDevice(); +orbis::IoDevice *createMetaDbgCharacterDevice(); +orbis::IoDevice *createHddCharacterDevice(std::uint64_t size); +orbis::IoDevice *createAoutCharacterDevice(std::int8_t id, AudioDevice *device); +orbis::IoDevice *createAVControlCharacterDevice(); +orbis::IoDevice *createHDMICharacterDevice(); +orbis::IoDevice *createMBusAVCharacterDevice(); +orbis::IoDevice *createScaninCharacterDevice(); +orbis::IoDevice *createS3DACharacterDevice(); +orbis::IoDevice *createGbaseCharacterDevice(); +orbis::IoDevice *createDevStatCharacterDevice(); +orbis::IoDevice *createDevCtlCharacterDevice(); +orbis::IoDevice *createDevActCharacterDevice(); +orbis::IoDevice *createUVDCharacterDevice(); +orbis::IoDevice *createVCECharacterDevice(); +orbis::IoDevice *createEvlgCharacterDevice(int outputFd); +orbis::IoDevice *createSrtcCharacterDevice(); +orbis::IoDevice *createScreenShotCharacterDevice(); +orbis::IoDevice *createLvdCtlCharacterDevice(); +orbis::IoDevice *createIccPowerCharacterDevice(); +orbis::IoDevice *createCaymanRegCharacterDevice(); +orbis::IoDevice *createA53IoCharacterDevice(); +orbis::IoDevice *createNsidCtlCharacterDevice(); +orbis::IoDevice *createHmd2CmdCharacterDevice(); +orbis::IoDevice *createHmd2ImuCharacterDevice(); +orbis::IoDevice *createHmd2GazeCharacterDevice(); +orbis::IoDevice *createHmd2GenDataCharacterDevice(); diff --git a/rpcsx/iodev/a53io.cpp b/rpcsx/iodev/a53io.cpp index 56d5ad124..9aff18e49 100644 --- a/rpcsx/iodev/a53io.cpp +++ b/rpcsx/iodev/a53io.cpp @@ -1,8 +1,8 @@ #include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" -#include #include struct A53IoFile : orbis::File {}; @@ -26,7 +26,7 @@ static const orbis::FileOps fileOps = { .read = a53io_read, }; -struct A53IoDevice : IoDevice { +struct A53IoDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -39,4 +39,6 @@ struct A53IoDevice : IoDevice { } }; -IoDevice *createA53IoCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createA53IoCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/ajm.cpp b/rpcsx/iodev/ajm.cpp index 2ff692924..46878be4b 100644 --- a/rpcsx/iodev/ajm.cpp +++ b/rpcsx/iodev/ajm.cpp @@ -40,7 +40,7 @@ enum { AJM_RESULT_CODEC_ERROR = 0x40000000, }; -struct AjmDevice : IoDevice { +struct AjmDevice : orbis::IoDevice { rx::shared_mutex mtx; orbis::uint32_t batchId = 1; // temp @@ -789,4 +789,4 @@ orbis::ErrorCode AjmDevice::open(rx::Ref *file, const char *path, return {}; } -IoDevice *createAjmCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createAjmCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/aout.cpp b/rpcsx/iodev/aout.cpp index f7c849d0b..d1a5a7611 100644 --- a/rpcsx/iodev/aout.cpp +++ b/rpcsx/iodev/aout.cpp @@ -27,7 +27,7 @@ struct AoutFile : orbis::File {}; -struct AoutDevice : public IoDevice { +struct AoutDevice : public orbis::IoDevice { std::int8_t id; rx::Ref audioDevice; @@ -205,6 +205,7 @@ orbis::ErrorCode AoutDevice::open(rx::Ref *file, const char *path, return {}; } -IoDevice *createAoutCharacterDevice(std::int8_t id, AudioDevice *device) { +orbis::IoDevice *createAoutCharacterDevice(std::int8_t id, + AudioDevice *device) { return orbis::knew(id, device); } diff --git a/rpcsx/iodev/av_control.cpp b/rpcsx/iodev/av_control.cpp index f153ad605..625d8a2e0 100644 --- a/rpcsx/iodev/av_control.cpp +++ b/rpcsx/iodev/av_control.cpp @@ -34,7 +34,7 @@ static const orbis::FileOps fileOps = { .ioctl = av_control_ioctl, }; -struct AVControlDevice : IoDevice { +struct AVControlDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -47,6 +47,6 @@ struct AVControlDevice : IoDevice { } }; -IoDevice *createAVControlCharacterDevice() { +orbis::IoDevice *createAVControlCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/blockpool.cpp b/rpcsx/iodev/blockpool.cpp index 045b85d04..62066954e 100644 --- a/rpcsx/iodev/blockpool.cpp +++ b/rpcsx/iodev/blockpool.cpp @@ -1,6 +1,6 @@ #include "blockpool.hpp" #include "dmem.hpp" -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/KernelContext.hpp" #include "orbis/file.hpp" @@ -139,4 +139,6 @@ orbis::ErrorCode BlockPoolDevice::unmap(void *address, std::uint64_t len, } return orbis::ErrorCode::INVAL; } -IoDevice *createBlockPoolDevice() { return orbis::knew(); } +orbis::IoDevice *createBlockPoolDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/blockpool.hpp b/rpcsx/iodev/blockpool.hpp index 047e08b15..ec4ab6256 100644 --- a/rpcsx/iodev/blockpool.hpp +++ b/rpcsx/iodev/blockpool.hpp @@ -1,6 +1,6 @@ #pragma once -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/error/ErrorCode.hpp" #include "orbis/file.hpp" #include "rx/MemoryTable.hpp" @@ -8,7 +8,7 @@ #include "rx/SharedMutex.hpp" #include -struct BlockPoolDevice : public IoDevice { +struct BlockPoolDevice : public orbis::IoDevice { rx::shared_mutex mtx; rx::MemoryAreaTable<> pool; diff --git a/rpcsx/iodev/bt.cpp b/rpcsx/iodev/bt.cpp index 361bf31e7..129317012 100644 --- a/rpcsx/iodev/bt.cpp +++ b/rpcsx/iodev/bt.cpp @@ -16,7 +16,7 @@ static const orbis::FileOps fileOps = { .ioctl = bt_ioctl, }; -struct BtDevice : IoDevice { +struct BtDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -29,4 +29,4 @@ struct BtDevice : IoDevice { } }; -IoDevice *createBtCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createBtCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/camera.cpp b/rpcsx/iodev/camera.cpp index 15ed707c1..c653ad0f0 100644 --- a/rpcsx/iodev/camera.cpp +++ b/rpcsx/iodev/camera.cpp @@ -49,7 +49,7 @@ static const orbis::FileOps fileOps = { .write = camera_write, }; -struct CameraDevice : IoDevice { +struct CameraDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -62,4 +62,6 @@ struct CameraDevice : IoDevice { } }; -IoDevice *createCameraCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createCameraCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/cayman_reg.cpp b/rpcsx/iodev/cayman_reg.cpp index fe0eb0d6d..e324617c6 100644 --- a/rpcsx/iodev/cayman_reg.cpp +++ b/rpcsx/iodev/cayman_reg.cpp @@ -4,7 +4,7 @@ #include "orbis/thread/Thread.hpp" #include "orbis/utils/Logs.hpp" -struct CaymanRegDevice : IoDevice { +struct CaymanRegDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -34,6 +34,6 @@ orbis::ErrorCode CaymanRegDevice::open(rx::Ref *file, return {}; } -IoDevice *createCaymanRegCharacterDevice() { +orbis::IoDevice *createCaymanRegCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/cd.cpp b/rpcsx/iodev/cd.cpp index 946794c54..6d7be0dae 100644 --- a/rpcsx/iodev/cd.cpp +++ b/rpcsx/iodev/cd.cpp @@ -23,7 +23,7 @@ static const orbis::FileOps fileOps = { .ioctl = cd_ioctl, }; -struct CdDevice : IoDevice { +struct CdDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -36,4 +36,4 @@ struct CdDevice : IoDevice { } }; -IoDevice *createCdCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createCdCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/console.cpp b/rpcsx/iodev/console.cpp index f71a4c3f0..6f0a1579e 100644 --- a/rpcsx/iodev/console.cpp +++ b/rpcsx/iodev/console.cpp @@ -9,7 +9,7 @@ #include struct ConsoleFile : orbis::File {}; -struct ConsoleDevice : IoDevice { +struct ConsoleDevice : orbis::IoDevice { int inputFd; int outputFd; @@ -76,6 +76,6 @@ orbis::ErrorCode ConsoleDevice::open(rx::Ref *file, return {}; } -IoDevice *createConsoleCharacterDevice(int inputFd, int outputFd) { +orbis::IoDevice *createConsoleCharacterDevice(int inputFd, int outputFd) { return orbis::knew(inputFd, outputFd); } diff --git a/rpcsx/iodev/dce.cpp b/rpcsx/iodev/dce.cpp index 845d25d5f..dcafe6b9e 100644 --- a/rpcsx/iodev/dce.cpp +++ b/rpcsx/iodev/dce.cpp @@ -653,4 +653,4 @@ void DceDevice::initializeProcess(orbis::Process *process) { } } -IoDevice *createDceCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createDceCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/dce.hpp b/rpcsx/iodev/dce.hpp index 1c965b811..38dd03741 100644 --- a/rpcsx/iodev/dce.hpp +++ b/rpcsx/iodev/dce.hpp @@ -10,7 +10,7 @@ static constexpr auto kVmIdCount = 6; -struct DceDevice : IoDevice { +struct DceDevice : orbis::IoDevice { rx::shared_mutex mtx; std::uint32_t eopCount = 0; std::uint32_t freeVmIds = (1 << (kVmIdCount + 1)) - 1; diff --git a/rpcsx/iodev/devact.cpp b/rpcsx/iodev/devact.cpp index 203fe23ad..a105c960e 100644 --- a/rpcsx/iodev/devact.cpp +++ b/rpcsx/iodev/devact.cpp @@ -48,7 +48,7 @@ static const orbis::FileOps fileOps = { .ioctl = devact_ioctl, }; -struct DevActDevice : IoDevice { +struct DevActDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -61,4 +61,6 @@ struct DevActDevice : IoDevice { } }; -IoDevice *createDevActCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createDevActCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/devctl.cpp b/rpcsx/iodev/devctl.cpp index 1f1f97afc..4bc01f648 100644 --- a/rpcsx/iodev/devctl.cpp +++ b/rpcsx/iodev/devctl.cpp @@ -16,7 +16,7 @@ static const orbis::FileOps fileOps = { .ioctl = devctl_ioctl, }; -struct DevCtlDevice : IoDevice { +struct DevCtlDevice : orbis::IoDevice { orbis::kstring data; orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, @@ -30,4 +30,6 @@ struct DevCtlDevice : IoDevice { } }; -IoDevice *createDevCtlCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createDevCtlCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/devstat.cpp b/rpcsx/iodev/devstat.cpp index 443971d2a..0a1bbb361 100644 --- a/rpcsx/iodev/devstat.cpp +++ b/rpcsx/iodev/devstat.cpp @@ -16,7 +16,7 @@ static const orbis::FileOps fileOps = { .ioctl = devstat_ioctl, }; -struct DevStatDevice : IoDevice { +struct DevStatDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -29,6 +29,6 @@ struct DevStatDevice : IoDevice { } }; -IoDevice *createDevStatCharacterDevice() { +orbis::IoDevice *createDevStatCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/dipsw.cpp b/rpcsx/iodev/dipsw.cpp index 8f47531bd..1e99e02fb 100644 --- a/rpcsx/iodev/dipsw.cpp +++ b/rpcsx/iodev/dipsw.cpp @@ -60,7 +60,7 @@ static const orbis::FileOps ops = { .ioctl = dipsw_ioctl, }; -struct DipswDevice : public IoDevice { +struct DipswDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -72,4 +72,6 @@ struct DipswDevice : public IoDevice { } }; -IoDevice *createDipswCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createDipswCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/dmem.cpp b/rpcsx/iodev/dmem.cpp index f8060bd01..89f4d6c3c 100644 --- a/rpcsx/iodev/dmem.cpp +++ b/rpcsx/iodev/dmem.cpp @@ -86,7 +86,7 @@ orbis::ErrorCode DmemDevice::mmap(void **address, std::uint64_t len, static orbis::ErrorCode dmem_ioctl(orbis::File *file, std::uint64_t request, void *argp, orbis::Thread *thread) { - auto device = static_cast(file->device.get()); + auto device = file->device.rawStaticCast(); std::lock_guard lock(device->mtx); switch (request) { @@ -250,7 +250,7 @@ static orbis::ErrorCode dmem_mmap(orbis::File *file, void **address, std::uint64_t size, std::int32_t prot, std::int32_t flags, std::int64_t offset, orbis::Thread *thread) { - auto device = static_cast(file->device.get()); + auto device = file->device.rawStaticCast(); return device->mmap(address, size, prot, flags, offset); } @@ -395,7 +395,7 @@ orbis::ErrorCode DmemDevice::open(rx::Ref *file, const char *path, return {}; } -IoDevice *createDmemCharacterDevice(int index) { +orbis::IoDevice *createDmemCharacterDevice(int index) { auto *newDevice = orbis::knew(); newDevice->index = index; newDevice->dmemTotalSize = dmemSize; diff --git a/rpcsx/iodev/dmem.hpp b/rpcsx/iodev/dmem.hpp index aa95ead1d..34bc997f0 100644 --- a/rpcsx/iodev/dmem.hpp +++ b/rpcsx/iodev/dmem.hpp @@ -1,6 +1,6 @@ #pragma once -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/error/ErrorCode.hpp" #include "orbis/file.hpp" @@ -10,7 +10,7 @@ #include #include -struct DmemDevice : public IoDevice { +struct DmemDevice : public orbis::IoDevice { rx::shared_mutex mtx; int index; int shmFd = -1; diff --git a/rpcsx/iodev/evlg.cpp b/rpcsx/iodev/evlg.cpp index b00894b31..b455c1b51 100644 --- a/rpcsx/iodev/evlg.cpp +++ b/rpcsx/iodev/evlg.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/error/ErrorCode.hpp" #include "orbis/file.hpp" @@ -8,7 +8,7 @@ #include struct EvlgFile : orbis::File {}; -struct EvlgDevice : IoDevice { +struct EvlgDevice : orbis::IoDevice { int outputFd; EvlgDevice(int outputFd) : outputFd(outputFd) {} @@ -53,6 +53,6 @@ orbis::ErrorCode EvlgDevice::open(rx::Ref *file, const char *path, return {}; } -IoDevice *createEvlgCharacterDevice(int outputFd) { +orbis::IoDevice *createEvlgCharacterDevice(int outputFd) { return orbis::knew(outputFd); } diff --git a/rpcsx/iodev/gbase.cpp b/rpcsx/iodev/gbase.cpp index 12a33d5d1..bd81d0934 100644 --- a/rpcsx/iodev/gbase.cpp +++ b/rpcsx/iodev/gbase.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/thread/Thread.hpp" @@ -36,7 +36,7 @@ static const orbis::FileOps fileOps = { .ioctl = gbase_ioctl, }; -struct GbaseDevice : IoDevice { +struct GbaseDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -49,4 +49,6 @@ struct GbaseDevice : IoDevice { } }; -IoDevice *createGbaseCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createGbaseCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/gc.cpp b/rpcsx/iodev/gc.cpp index 8d09aac95..6647f25e5 100644 --- a/rpcsx/iodev/gc.cpp +++ b/rpcsx/iodev/gc.cpp @@ -1,7 +1,7 @@ #include "gpu/DeviceCtl.hpp" -#include "io-device.hpp" #include "iodev/dce.hpp" #include "iodev/dmem.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/KernelContext.hpp" #include "orbis/file.hpp" @@ -24,7 +24,7 @@ struct ComputeQueue { std::uint64_t len{}; }; -struct GcDevice : public IoDevice { +struct GcDevice : public orbis::IoDevice { rx::shared_mutex mtx; orbis::kmap clients; orbis::kmap computeQueues; @@ -490,4 +490,4 @@ void GcDevice::removeClient(orbis::Process *process) { } } -IoDevice *createGcCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createGcCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/hdd.cpp b/rpcsx/iodev/hdd.cpp index 3cf385abe..813ec2ad5 100644 --- a/rpcsx/iodev/hdd.cpp +++ b/rpcsx/iodev/hdd.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/error/ErrorCode.hpp" #include "orbis/file.hpp" @@ -9,7 +9,7 @@ struct HddFile : orbis::File {}; -struct HddDevice : IoDevice { +struct HddDevice : orbis::IoDevice { std::uint64_t size; HddDevice(std::uint64_t size) : size(size) {} @@ -146,6 +146,6 @@ orbis::ErrorCode HddDevice::open(rx::Ref *fs, const char *path, return {}; } -IoDevice *createHddCharacterDevice(std::uint64_t size) { +orbis::IoDevice *createHddCharacterDevice(std::uint64_t size) { return orbis::knew(size); } diff --git a/rpcsx/iodev/hdmi.cpp b/rpcsx/iodev/hdmi.cpp index 4196a790a..3f5929095 100644 --- a/rpcsx/iodev/hdmi.cpp +++ b/rpcsx/iodev/hdmi.cpp @@ -1,5 +1,5 @@ -#include "io-device.hpp" #include "orbis-config.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/thread/Thread.hpp" @@ -75,7 +75,7 @@ static const orbis::FileOps fileOps = { .ioctl = hdmi_ioctl, }; -struct HDMIDevice : IoDevice { +struct HDMIDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -88,4 +88,6 @@ struct HDMIDevice : IoDevice { } }; -IoDevice *createHDMICharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createHDMICharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/hid.cpp b/rpcsx/iodev/hid.cpp index 50283c19d..3a34e4eff 100644 --- a/rpcsx/iodev/hid.cpp +++ b/rpcsx/iodev/hid.cpp @@ -1,13 +1,12 @@ #include "gpu/DeviceCtl.hpp" -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/KernelContext.hpp" #include "orbis/file.hpp" #include "orbis/thread/Thread.hpp" #include "orbis/utils/Logs.hpp" -#include -struct HidDevice : public IoDevice { +struct HidDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -165,4 +164,4 @@ orbis::ErrorCode HidDevice::open(rx::Ref *file, const char *path, return {}; } -IoDevice *createHidCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createHidCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/hmd2_cmd.cpp b/rpcsx/iodev/hmd2_cmd.cpp index a2bd41164..0afdb99f1 100644 --- a/rpcsx/iodev/hmd2_cmd.cpp +++ b/rpcsx/iodev/hmd2_cmd.cpp @@ -1,8 +1,9 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" -struct Hmd2CmdDevice : public IoDevice { +struct Hmd2CmdDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -30,6 +31,6 @@ orbis::ErrorCode Hmd2CmdDevice::open(rx::Ref *file, return {}; } -IoDevice *createHmd2CmdCharacterDevice() { +orbis::IoDevice *createHmd2CmdCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/hmd2_gaze.cpp b/rpcsx/iodev/hmd2_gaze.cpp index a3b1070f7..5d0b8d500 100644 --- a/rpcsx/iodev/hmd2_gaze.cpp +++ b/rpcsx/iodev/hmd2_gaze.cpp @@ -1,8 +1,9 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" -struct Hmd2GazeDevice : public IoDevice { +struct Hmd2GazeDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -31,6 +32,6 @@ orbis::ErrorCode Hmd2GazeDevice::open(rx::Ref *file, return {}; } -IoDevice *createHmd2GazeCharacterDevice() { +orbis::IoDevice *createHmd2GazeCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/hmd2_gen_data.cpp b/rpcsx/iodev/hmd2_gen_data.cpp index 7542be55f..12dff7a47 100644 --- a/rpcsx/iodev/hmd2_gen_data.cpp +++ b/rpcsx/iodev/hmd2_gen_data.cpp @@ -1,8 +1,9 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" -struct Hmd2GenDataDevice : public IoDevice { +struct Hmd2GenDataDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -31,6 +32,6 @@ orbis::ErrorCode Hmd2GenDataDevice::open(rx::Ref *file, return {}; } -IoDevice *createHmd2GenDataCharacterDevice() { +orbis::IoDevice *createHmd2GenDataCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/hmd2_imu.cpp b/rpcsx/iodev/hmd2_imu.cpp index d04f164ef..3e7b53511 100644 --- a/rpcsx/iodev/hmd2_imu.cpp +++ b/rpcsx/iodev/hmd2_imu.cpp @@ -1,8 +1,9 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" -struct Hmd2ImuDevice : public IoDevice { +struct Hmd2ImuDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -30,6 +31,6 @@ orbis::ErrorCode Hmd2ImuDevice::open(rx::Ref *file, return {}; } -IoDevice *createHmd2ImuCharacterDevice() { +orbis::IoDevice *createHmd2ImuCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/hmd_3da.cpp b/rpcsx/iodev/hmd_3da.cpp index 88ba9c660..4891894b2 100644 --- a/rpcsx/iodev/hmd_3da.cpp +++ b/rpcsx/iodev/hmd_3da.cpp @@ -1,9 +1,9 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" -struct Hmd3daDevice : public IoDevice { +struct Hmd3daDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -32,4 +32,6 @@ orbis::ErrorCode Hmd3daDevice::open(rx::Ref *file, return {}; } -IoDevice *createHmd3daCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createHmd3daCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/hmd_cmd.cpp b/rpcsx/iodev/hmd_cmd.cpp index b59860f01..cf7166972 100644 --- a/rpcsx/iodev/hmd_cmd.cpp +++ b/rpcsx/iodev/hmd_cmd.cpp @@ -1,8 +1,9 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" -struct HmdCmdDevice : public IoDevice { +struct HmdCmdDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -31,4 +32,6 @@ orbis::ErrorCode HmdCmdDevice::open(rx::Ref *file, return {}; } -IoDevice *createHmdCmdCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createHmdCmdCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/hmd_mmap.cpp b/rpcsx/iodev/hmd_mmap.cpp index 464a0f4b6..dc9909e95 100644 --- a/rpcsx/iodev/hmd_mmap.cpp +++ b/rpcsx/iodev/hmd_mmap.cpp @@ -1,9 +1,10 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" #include "vm.hpp" -struct HmdMmapDevice : public IoDevice { +struct HmdMmapDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -49,6 +50,6 @@ orbis::ErrorCode HmdMmapDevice::open(rx::Ref *file, return {}; } -IoDevice *createHmdMmapCharacterDevice() { +orbis::IoDevice *createHmdMmapCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/hmd_snsr.cpp b/rpcsx/iodev/hmd_snsr.cpp index 897448e80..dbc336a10 100644 --- a/rpcsx/iodev/hmd_snsr.cpp +++ b/rpcsx/iodev/hmd_snsr.cpp @@ -1,9 +1,9 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" -struct HmdSnsrDevice : public IoDevice { +struct HmdSnsrDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -33,6 +33,6 @@ orbis::ErrorCode HmdSnsrDevice::open(rx::Ref *file, return {}; } -IoDevice *createHmdSnsrCharacterDevice() { +orbis::IoDevice *createHmdSnsrCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/icc_configuration.cpp b/rpcsx/iodev/icc_configuration.cpp index 923bc165e..f1ff88762 100644 --- a/rpcsx/iodev/icc_configuration.cpp +++ b/rpcsx/iodev/icc_configuration.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" @@ -18,7 +18,7 @@ static const orbis::FileOps fileOps = { .ioctl = icc_configuration_ioctl, }; -struct IccConfigurationDevice : IoDevice { +struct IccConfigurationDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -31,6 +31,6 @@ struct IccConfigurationDevice : IoDevice { } }; -IoDevice *createIccConfigurationCharacterDevice() { +orbis::IoDevice *createIccConfigurationCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/icc_power.cpp b/rpcsx/iodev/icc_power.cpp index 476032708..adbbf5966 100644 --- a/rpcsx/iodev/icc_power.cpp +++ b/rpcsx/iodev/icc_power.cpp @@ -1,10 +1,10 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/thread/Thread.hpp" #include "orbis/utils/Logs.hpp" -struct IccPowerDevice : IoDevice { +struct IccPowerDevice : orbis::IoDevice { std::uint8_t bootphase = 0; orbis::ErrorCode open(rx::Ref *file, const char *path, @@ -69,6 +69,6 @@ orbis::ErrorCode IccPowerDevice::open(rx::Ref *file, return {}; } -IoDevice *createIccPowerCharacterDevice() { +orbis::IoDevice *createIccPowerCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/lvdctl.cpp b/rpcsx/iodev/lvdctl.cpp index ee2fcb90f..caea001b1 100644 --- a/rpcsx/iodev/lvdctl.cpp +++ b/rpcsx/iodev/lvdctl.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/thread/Thread.hpp" @@ -17,7 +17,7 @@ static const orbis::FileOps fileOps = { .ioctl = lvdctl_ioctl, }; -struct LvdCtlDevice : IoDevice { +struct LvdCtlDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -30,4 +30,6 @@ struct LvdCtlDevice : IoDevice { } }; -IoDevice *createLvdCtlCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createLvdCtlCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/mbus.cpp b/rpcsx/iodev/mbus.cpp index 5ae6455c6..769feeb88 100644 --- a/rpcsx/iodev/mbus.cpp +++ b/rpcsx/iodev/mbus.cpp @@ -1,5 +1,4 @@ #include "mbus.hpp" -#include "io-device.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/uio.hpp" @@ -65,4 +64,6 @@ orbis::ErrorCode MBusDevice::open(rx::Ref *file, const char *path, return {}; } -IoDevice *createMBusCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createMBusCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/mbus.hpp b/rpcsx/iodev/mbus.hpp index 4e31db57e..e26ba3d30 100644 --- a/rpcsx/iodev/mbus.hpp +++ b/rpcsx/iodev/mbus.hpp @@ -1,11 +1,13 @@ #pragma once -#include "io-device.hpp" #include "iodev/MBusEvent.hpp" +#include "orbis/IoDevice.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/note.hpp" #include "rx/SharedCV.hpp" #include "rx/SharedMutex.hpp" -struct MBusDevice : IoDevice { +struct MBusDevice : orbis::IoDevice { rx::shared_mutex mtx; rx::shared_cv cv; orbis::kdeque events; diff --git a/rpcsx/iodev/mbus_av.cpp b/rpcsx/iodev/mbus_av.cpp index d42275ab7..c5e000c43 100644 --- a/rpcsx/iodev/mbus_av.cpp +++ b/rpcsx/iodev/mbus_av.cpp @@ -1,5 +1,4 @@ #include "mbus_av.hpp" -#include "io-device.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/note.hpp" @@ -65,4 +64,6 @@ void MBusAVDevice::emitEvent(const MBusEvent &event) { eventEmitter->emit(orbis::kEvFiltRead); } -IoDevice *createMBusAVCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createMBusAVCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/mbus_av.hpp b/rpcsx/iodev/mbus_av.hpp index c7e0a5711..1bb9d705b 100644 --- a/rpcsx/iodev/mbus_av.hpp +++ b/rpcsx/iodev/mbus_av.hpp @@ -1,11 +1,13 @@ #pragma once -#include "io-device.hpp" #include "iodev/MBusEvent.hpp" +#include "orbis/IoDevice.hpp" +#include "orbis/KernelAllocator.hpp" +#include "orbis/note.hpp" #include "rx/SharedCV.hpp" #include "rx/SharedMutex.hpp" -struct MBusAVDevice : IoDevice { +struct MBusAVDevice : orbis::IoDevice { rx::shared_mutex mtx; rx::shared_cv cv; orbis::kdeque events; diff --git a/rpcsx/iodev/metadbg.cpp b/rpcsx/iodev/metadbg.cpp index badf28502..bf2fbd83e 100644 --- a/rpcsx/iodev/metadbg.cpp +++ b/rpcsx/iodev/metadbg.cpp @@ -1,8 +1,7 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" -#include #include struct MetaDbgFile : orbis::File {}; @@ -26,7 +25,7 @@ static const orbis::FileOps fileOps = { .read = metadbg_read, }; -struct MetaDbgDevice : IoDevice { +struct MetaDbgDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -39,6 +38,6 @@ struct MetaDbgDevice : IoDevice { } }; -IoDevice *createMetaDbgCharacterDevice() { +orbis::IoDevice *createMetaDbgCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/notification.cpp b/rpcsx/iodev/notification.cpp index ed623578a..190d6d055 100644 --- a/rpcsx/iodev/notification.cpp +++ b/rpcsx/iodev/notification.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/thread/Thread.hpp" @@ -12,7 +12,7 @@ #include struct NotificationFile : orbis::File {}; -struct NotificationDevice : IoDevice { +struct NotificationDevice : orbis::IoDevice { int index; rx::shared_mutex mutex; orbis::kvector data; @@ -104,6 +104,6 @@ orbis::ErrorCode NotificationDevice::open(rx::Ref *file, return {}; } -IoDevice *createNotificationCharacterDevice(int index) { +orbis::IoDevice *createNotificationCharacterDevice(int index) { return orbis::knew(index); } diff --git a/rpcsx/iodev/npdrm.cpp b/rpcsx/iodev/npdrm.cpp index cfc899128..1331812c3 100644 --- a/rpcsx/iodev/npdrm.cpp +++ b/rpcsx/iodev/npdrm.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" @@ -16,7 +16,7 @@ static const orbis::FileOps fileOps = { .ioctl = npdrm_ioctl, }; -struct NpdrmDevice : IoDevice { +struct NpdrmDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -29,4 +29,6 @@ struct NpdrmDevice : IoDevice { } }; -IoDevice *createNpdrmCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createNpdrmCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/nsid_ctl.cpp b/rpcsx/iodev/nsid_ctl.cpp index 3c70e0a0d..dc383030c 100644 --- a/rpcsx/iodev/nsid_ctl.cpp +++ b/rpcsx/iodev/nsid_ctl.cpp @@ -1,10 +1,9 @@ #include "../io-devices.hpp" -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" #include "vfs.hpp" -#include #include struct NsidCtlFile : orbis::File {}; @@ -34,7 +33,7 @@ static const orbis::FileOps fileOps = { .read = nsid_ctl_read, }; -struct NsidCtlDevice : IoDevice { +struct NsidCtlDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -47,6 +46,6 @@ struct NsidCtlDevice : IoDevice { } }; -IoDevice *createNsidCtlCharacterDevice() { +orbis::IoDevice *createNsidCtlCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/null.cpp b/rpcsx/iodev/null.cpp index 5b9ba614f..1e2edb0ba 100644 --- a/rpcsx/iodev/null.cpp +++ b/rpcsx/iodev/null.cpp @@ -1,9 +1,10 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" #include "orbis/uio.hpp" #include -struct NullDevice : public IoDevice { +struct NullDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -32,4 +33,6 @@ orbis::ErrorCode NullDevice::open(rx::Ref *file, const char *path, return {}; } -IoDevice *createNullCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createNullCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/rng.cpp b/rpcsx/iodev/rng.cpp index 99e441679..e089f8a7b 100644 --- a/rpcsx/iodev/rng.cpp +++ b/rpcsx/iodev/rng.cpp @@ -1,9 +1,10 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" #include "vm.hpp" -struct RngDevice : public IoDevice { +struct RngDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -48,4 +49,4 @@ orbis::ErrorCode RngDevice::open(rx::Ref *file, const char *path, return {}; } -IoDevice *createRngCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createRngCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/s3da.cpp b/rpcsx/iodev/s3da.cpp index 626fb1372..3531c4ca1 100644 --- a/rpcsx/iodev/s3da.cpp +++ b/rpcsx/iodev/s3da.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" @@ -16,7 +16,7 @@ static const orbis::FileOps fileOps = { .ioctl = s3da_ioctl, }; -struct S3DADevice : IoDevice { +struct S3DADevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -29,4 +29,6 @@ struct S3DADevice : IoDevice { } }; -IoDevice *createS3DACharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createS3DACharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/sbl_srv.cpp b/rpcsx/iodev/sbl_srv.cpp index 4a346f1a2..e08269a57 100644 --- a/rpcsx/iodev/sbl_srv.cpp +++ b/rpcsx/iodev/sbl_srv.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/error/ErrorCode.hpp" #include "orbis/file.hpp" @@ -9,7 +9,7 @@ struct SblSrvFile : public orbis::File {}; -struct SblSrvDevice : IoDevice { +struct SblSrvDevice : orbis::IoDevice { rx::shared_mutex mtx; orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, @@ -53,4 +53,6 @@ orbis::ErrorCode SblSrvDevice::open(rx::Ref *file, return {}; } -IoDevice *createSblSrvCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createSblSrvCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/scanin.cpp b/rpcsx/iodev/scanin.cpp index 812faf038..7a655b1a3 100644 --- a/rpcsx/iodev/scanin.cpp +++ b/rpcsx/iodev/scanin.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/thread/Thread.hpp" @@ -18,7 +18,7 @@ static const orbis::FileOps fileOps = { .ioctl = scanin_ioctl, }; -struct ScaninDevice : IoDevice { +struct ScaninDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -31,4 +31,6 @@ struct ScaninDevice : IoDevice { } }; -IoDevice *createScaninCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createScaninCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/shm.cpp b/rpcsx/iodev/shm.cpp index 49239d7b2..42edcd783 100644 --- a/rpcsx/iodev/shm.cpp +++ b/rpcsx/iodev/shm.cpp @@ -1,4 +1,5 @@ #include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/error/ErrorCode.hpp" #include "orbis/file.hpp" @@ -9,7 +10,7 @@ #include #include -struct ShmDevice : IoDevice { +struct ShmDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -56,4 +57,4 @@ orbis::ErrorCode ShmDevice::unlink(const char *path, bool recursive, return convertErrorCode(ec); } -IoDevice *createShmDevice() { return orbis::knew(); } +orbis::IoDevice *createShmDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/srtc.cpp b/rpcsx/iodev/srtc.cpp index 1eb67a382..24f4d635b 100644 --- a/rpcsx/iodev/srtc.cpp +++ b/rpcsx/iodev/srtc.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/thread/Thread.hpp" @@ -17,7 +17,7 @@ static const orbis::FileOps fileOps = { .ioctl = srtc_ioctl, }; -struct SrtcDevice : IoDevice { +struct SrtcDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -30,4 +30,6 @@ struct SrtcDevice : IoDevice { } }; -IoDevice *createSrtcCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createSrtcCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/iodev/sshot.cpp b/rpcsx/iodev/sshot.cpp index 7e2cb7067..f041e6fac 100644 --- a/rpcsx/iodev/sshot.cpp +++ b/rpcsx/iodev/sshot.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/thread/Thread.hpp" @@ -18,7 +18,7 @@ static const orbis::FileOps fileOps = { .ioctl = sshot_ioctl, }; -struct ScreenShotDevice : IoDevice { +struct ScreenShotDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -31,6 +31,6 @@ struct ScreenShotDevice : IoDevice { } }; -IoDevice *createScreenShotCharacterDevice() { +orbis::IoDevice *createScreenShotCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/urandom.cpp b/rpcsx/iodev/urandom.cpp index dc79e1f62..1bf06df9c 100644 --- a/rpcsx/iodev/urandom.cpp +++ b/rpcsx/iodev/urandom.cpp @@ -1,10 +1,11 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" #include "orbis/uio.hpp" #include #include -struct UrandomDevice : public IoDevice { +struct UrandomDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -36,6 +37,6 @@ orbis::ErrorCode UrandomDevice::open(rx::Ref *file, return {}; } -IoDevice *createUrandomCharacterDevice() { +orbis::IoDevice *createUrandomCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/uvd.cpp b/rpcsx/iodev/uvd.cpp index 2c32a8e39..71b83ab87 100644 --- a/rpcsx/iodev/uvd.cpp +++ b/rpcsx/iodev/uvd.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/utils/Logs.hpp" @@ -16,7 +16,7 @@ static const orbis::FileOps fileOps = { .ioctl = uvd_ioctl, }; -struct UVDDevice : IoDevice { +struct UVDDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -29,4 +29,4 @@ struct UVDDevice : IoDevice { } }; -IoDevice *createUVDCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createUVDCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/vce.cpp b/rpcsx/iodev/vce.cpp index fc2a52cb6..51907274e 100644 --- a/rpcsx/iodev/vce.cpp +++ b/rpcsx/iodev/vce.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/thread/Thread.hpp" @@ -29,7 +29,7 @@ static const orbis::FileOps fileOps = { .ioctl = vce_ioctl, }; -struct VCEDevice : IoDevice { +struct VCEDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -42,4 +42,4 @@ struct VCEDevice : IoDevice { } }; -IoDevice *createVCECharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createVCECharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/xpt.cpp b/rpcsx/iodev/xpt.cpp index 05b86a703..57db2e77b 100644 --- a/rpcsx/iodev/xpt.cpp +++ b/rpcsx/iodev/xpt.cpp @@ -1,4 +1,4 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" #include "orbis/file.hpp" #include "orbis/thread/Thread.hpp" @@ -22,7 +22,7 @@ static const orbis::FileOps fileOps = { .ioctl = xpt_ioctl, }; -struct XptDevice : IoDevice { +struct XptDevice : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -35,4 +35,4 @@ struct XptDevice : IoDevice { } }; -IoDevice *createXptCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createXptCharacterDevice() { return orbis::knew(); } diff --git a/rpcsx/iodev/zero.cpp b/rpcsx/iodev/zero.cpp index 1cb954e79..d982e878b 100644 --- a/rpcsx/iodev/zero.cpp +++ b/rpcsx/iodev/zero.cpp @@ -1,10 +1,11 @@ -#include "io-device.hpp" +#include "orbis/IoDevice.hpp" #include "orbis/KernelAllocator.hpp" +#include "orbis/file.hpp" #include "orbis/uio.hpp" #include #include -struct ZeroDevice : public IoDevice { +struct ZeroDevice : public orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override; @@ -35,4 +36,6 @@ orbis::ErrorCode ZeroDevice::open(rx::Ref *file, const char *path, return {}; } -IoDevice *createZeroCharacterDevice() { return orbis::knew(); } +orbis::IoDevice *createZeroCharacterDevice() { + return orbis::knew(); +} diff --git a/rpcsx/ipmi.cpp b/rpcsx/ipmi.cpp index b66d7c7e1..44bb64af9 100644 --- a/rpcsx/ipmi.cpp +++ b/rpcsx/ipmi.cpp @@ -179,7 +179,7 @@ orbis::EventFlag *ipmi::createEventFlag(std::string_view name, uint32_t attrs, void ipmi::createShm(const char *name, uint32_t flags, uint32_t mode, uint64_t size) { rx::Ref shm; - auto shmDevice = orbis::g_context->shmDevice.staticCast(); + auto shmDevice = orbis::g_context->shmDevice.staticCast(); shmDevice->open(&shm, name, flags, mode, nullptr); shm->ops->truncate(shm.get(), size, nullptr); } diff --git a/rpcsx/linker.cpp b/rpcsx/linker.cpp index 22705fdfd..fec2d8bd6 100644 --- a/rpcsx/linker.cpp +++ b/rpcsx/linker.cpp @@ -974,7 +974,8 @@ rx::Ref rx::linker::loadModule(std::span image, static rx::Ref loadModuleFileImpl(std::string_view path, orbis::Thread *thread) { rx::Ref instance; - if (vfs::open(path, kOpenFlagReadOnly, 0, &instance, thread).isError()) { + if (vfs::open(path, orbis::kOpenFlagReadOnly, 0, &instance, thread) + .isError()) { return {}; } diff --git a/rpcsx/main.cpp b/rpcsx/main.cpp index 0a2f06c98..1af8a7249 100644 --- a/rpcsx/main.cpp +++ b/rpcsx/main.cpp @@ -869,7 +869,7 @@ static orbis::SysResult launchDaemon(orbis::Thread *thread, std::string path, { rx::Ref file; - auto result = vfs::open(path, kOpenFlagReadOnly, 0, &file, thread); + auto result = vfs::open(path, orbis::kOpenFlagReadOnly, 0, &file, thread); if (result.isError()) { return result; } diff --git a/rpcsx/ops.cpp b/rpcsx/ops.cpp index f563c6cb2..48caa7d7f 100644 --- a/rpcsx/ops.cpp +++ b/rpcsx/ops.cpp @@ -303,7 +303,7 @@ orbis::SysResult open(orbis::Thread *thread, orbis::ptr path, orbis::SysResult shm_open(orbis::Thread *thread, const char *path, orbis::sint flags, orbis::sint mode, rx::Ref *file) { - auto dev = static_cast(orbis::g_context->shmDevice.get()); + auto dev = orbis::g_context->shmDevice; return dev->open(file, path, flags, mode, thread); } orbis::SysResult unlink(orbis::Thread *thread, orbis::ptr path) { diff --git a/rpcsx/vfs.cpp b/rpcsx/vfs.cpp index 987ca0744..52217f380 100644 --- a/rpcsx/vfs.cpp +++ b/rpcsx/vfs.cpp @@ -18,7 +18,7 @@ static orbis::FileOps devfs_ops = { .stat = devfs_stat, }; -struct DevFs : IoDevice { +struct DevFs : orbis::IoDevice { std::map, std::less<>> devices; orbis::ErrorCode open(rx::Ref *file, const char *path, @@ -50,7 +50,7 @@ struct DevFs : IoDevice { } }; -struct ProcFs : IoDevice { +struct ProcFs : orbis::IoDevice { orbis::ErrorCode open(rx::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { @@ -60,7 +60,8 @@ struct ProcFs : IoDevice { }; static rx::shared_mutex gMountMtx; -static std::map, std::greater<>> gMountsMap; +static std::map, std::greater<>> + gMountsMap; static rx::Ref gDevFs; void vfs::fork() { @@ -93,16 +94,16 @@ void vfs::deinitialize() { gMountsMap.clear(); } -void vfs::addDevice(std::string name, IoDevice *device) { +void vfs::addDevice(std::string name, orbis::IoDevice *device) { std::lock_guard lock(gMountMtx); gDevFs->devices[std::move(name)] = device; } -std::pair, std::string> +std::pair, std::string> vfs::get(const std::filesystem::path &guestPath) { std::string normalPath = std::filesystem::path(guestPath).lexically_normal(); std::string_view path = normalPath; - rx::Ref device; + rx::Ref device; std::lock_guard lock(gMountMtx); @@ -141,7 +142,7 @@ vfs::get(const std::filesystem::path &guestPath) { } orbis::SysResult vfs::mount(const std::filesystem::path &guestPath, - IoDevice *dev) { + orbis::IoDevice *dev) { auto mp = guestPath.lexically_normal().string(); if (!mp.ends_with("/")) { mp += "/"; diff --git a/rpcsx/vfs.hpp b/rpcsx/vfs.hpp index 9aa145874..1b8e3b6de 100644 --- a/rpcsx/vfs.hpp +++ b/rpcsx/vfs.hpp @@ -5,16 +5,19 @@ #include "rx/Rc.hpp" #include +namespace orbis { struct IoDevice; +} namespace vfs { void fork(); void initialize(); void deinitialize(); -void addDevice(std::string name, IoDevice *device); -std::pair, std::string> +void addDevice(std::string name, orbis::IoDevice *device); +std::pair, std::string> get(const std::filesystem::path &guestPath); -orbis::SysResult mount(const std::filesystem::path &guestPath, IoDevice *dev); +orbis::SysResult mount(const std::filesystem::path &guestPath, + orbis::IoDevice *dev); orbis::SysResult open(std::string_view path, int flags, int mode, rx::Ref *file, orbis::Thread *thread); bool exists(std::string_view path, orbis::Thread *thread); diff --git a/rpcsx/vm.cpp b/rpcsx/vm.cpp index d201e68d3..ab71fcafe 100644 --- a/rpcsx/vm.cpp +++ b/rpcsx/vm.cpp @@ -649,7 +649,7 @@ struct Block { static Block gBlocks[kBlockCount]; struct MapInfo { - rx::Ref device; + rx::Ref device; std::uint64_t offset; std::uint32_t flags; char name[32]; @@ -776,7 +776,7 @@ constexpr auto kMainDirectMemorySize = kPhysicalMemorySize - kFlexibleMemorySize; void *vm::map(void *addr, std::uint64_t len, std::int32_t prot, - std::int32_t flags, std::int32_t internalFlags, IoDevice *device, + std::int32_t flags, std::int32_t internalFlags, orbis::IoDevice *device, std::uint64_t offset) { std::println(stderr, "vm::map(addr = {}, len = {}, prot = {}, flags = {})", addr, len, mapProtToString(prot), mapFlagsToString(flags)); diff --git a/rpcsx/vm.hpp b/rpcsx/vm.hpp index 40134c797..c2e93cf34 100644 --- a/rpcsx/vm.hpp +++ b/rpcsx/vm.hpp @@ -1,6 +1,5 @@ #pragma once -#include "io-device.hpp" -#include +#include "orbis/IoDevice.hpp" #include #include @@ -72,7 +71,7 @@ void reset(); void initialize(std::uint64_t pid); void deinitialize(); void *map(void *addr, std::uint64_t len, std::int32_t prot, std::int32_t flags, - std::int32_t internalFlags = 0, IoDevice *device = nullptr, + std::int32_t internalFlags = 0, orbis::IoDevice *device = nullptr, std::uint64_t offset = 0); bool unmap(void *addr, std::uint64_t size); bool protect(void *addr, std::uint64_t size, std::int32_t prot);