[Kernel] XFile::Read: add notify_completion param to allow disabling XIOCompletion

This commit is contained in:
emoose 2020-12-28 07:30:29 +00:00 committed by Rick Gibbed
parent 86ba17847b
commit 0400eba274
2 changed files with 13 additions and 10 deletions

View File

@ -93,7 +93,7 @@ X_STATUS XFile::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
X_STATUS XFile::Read(uint32_t buffer_guest_address, uint32_t buffer_length,
uint64_t byte_offset, uint32_t* out_bytes_read,
uint32_t apc_context) {
uint32_t apc_context, bool notify_completion) {
if (byte_offset == uint64_t(-1)) {
// Read from current position.
byte_offset = position_;
@ -160,6 +160,11 @@ X_STATUS XFile::Read(uint32_t buffer_guest_address, uint32_t buffer_length,
}
}
if (out_bytes_read) {
*out_bytes_read = uint32_t(bytes_read);
}
if (notify_completion) {
XIOCompletion::IONotification notify;
notify.apc_context = apc_context;
notify.num_bytes = uint32_t(bytes_read);
@ -167,11 +172,9 @@ X_STATUS XFile::Read(uint32_t buffer_guest_address, uint32_t buffer_length,
NotifyIOCompletionPorts(notify);
if (out_bytes_read) {
*out_bytes_read = uint32_t(bytes_read);
async_event_->Set();
}
async_event_->Set();
return result;
}

View File

@ -99,7 +99,7 @@ class XFile : public XObject {
// critical region).
X_STATUS Read(uint32_t buffer_guess_address, uint32_t buffer_length,
uint64_t byte_offset, uint32_t* out_bytes_read,
uint32_t apc_context);
uint32_t apc_context, bool notify_completion = true);
X_STATUS Write(uint32_t buffer_guess_address, uint32_t buffer_length,
uint64_t byte_offset, uint32_t* out_bytes_written,