XFile: Track asynchronous/synchronous flag (and return appropriately in nt Read/Write file)
This commit is contained in:
@@ -18,8 +18,10 @@
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
XFile::XFile(KernelState* kernel_state, vfs::File* file)
|
||||
: XObject(kernel_state, kTypeFile), file_(file) {
|
||||
XFile::XFile(KernelState* kernel_state, vfs::File* file, bool synchronous)
|
||||
: XObject(kernel_state, kTypeFile),
|
||||
file_(file),
|
||||
is_synchronous_(synchronous) {
|
||||
async_event_ = threading::Event::CreateAutoResetEvent(false);
|
||||
}
|
||||
|
||||
@@ -174,6 +176,7 @@ bool XFile::Save(ByteStream* stream) {
|
||||
stream->Write(file_->entry()->absolute_path());
|
||||
stream->Write<uint64_t>(position_);
|
||||
stream->Write(file_access());
|
||||
stream->Write<bool>(is_synchronous_);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -190,6 +193,7 @@ object_ref<XFile> XFile::Restore(KernelState* kernel_state,
|
||||
auto abs_path = stream->Read<std::string>();
|
||||
uint64_t position = stream->Read<uint64_t>();
|
||||
auto access = stream->Read<uint32_t>();
|
||||
auto is_synchronous = stream->Read<bool>();
|
||||
|
||||
XELOGD("XFile %.8X (%s)", file->handle(), abs_path.c_str());
|
||||
|
||||
@@ -204,6 +208,7 @@ object_ref<XFile> XFile::Restore(KernelState* kernel_state,
|
||||
|
||||
file->file_ = vfs_file;
|
||||
file->position_ = position;
|
||||
file->is_synchronous_ = is_synchronous;
|
||||
|
||||
return object_ref<XFile>(file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user