[Kernel] XFile::Read: add notify_completion param to allow disabling XIOCompletion
This commit is contained in:
parent
86ba17847b
commit
0400eba274
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue