Move IoDevice to orbis

This commit is contained in:
DH 2025-10-11 14:49:51 +03:00
parent 63e9a3f597
commit 05dee2c8e3
71 changed files with 368 additions and 299 deletions

View file

@ -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> *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

View file

@ -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<EventEmitter> deviceEventEmitter;
rx::Ref<rx::RcBase> shmDevice;
rx::Ref<rx::RcBase> dmemDevice;
rx::Ref<rx::RcBase> blockpoolDevice;
rx::Ref<IoDevice> shmDevice;
rx::Ref<IoDevice> dmemDevice;
rx::Ref<IoDevice> blockpoolDevice;
rx::Ref<rx::RcBase> gpuDevice;
rx::Ref<rx::RcBase> dceDevice;
rx::Ref<IoDevice> dceDevice;
rx::shared_mutex gpuDeviceMtx;
uint sdkVersion{};
uint fwSdkVersion{};

View file

@ -5,6 +5,7 @@
#include "note.hpp"
#include "rx/Rc.hpp"
#include "rx/SharedMutex.hpp"
#include "IoDevice.hpp"
#include "stat.hpp"
#include <cstdint>
@ -77,7 +78,7 @@ struct File : rx::RcBase {
rx::shared_mutex mtx;
rx::Ref<EventEmitter> event;
const FileOps *ops = nullptr;
rx::Ref<RcBase> device;
rx::Ref<IoDevice> device;
std::uint64_t nextOff = 0;
int flags = 0;
int mode = 0;