Author: bonefish Date: 2009-11-19 17:19:59 +0100 (Thu, 19 Nov 2009) New Revision: 34135 Changeset: http://dev.haiku-os.org/changeset/34135/haiku Modified: haiku/trunk/src/system/kernel/device_manager/io_requests.cpp Log: transfer_io_request_data(): There was some confusion about the isWrite parameter and request->IsWrite(). The parameter means whether we want to write to the request's I/O buffer (therefore renamed it to writeToRequest), while request->IsWrite() indicates whether the request is a write request. One can only write to a read request's buffer and vice versa. IOBuffer::LockMemory() also wants to know whether the request is a write request, not whether we want to write to the memory. Modified: haiku/trunk/src/system/kernel/device_manager/io_requests.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/io_requests.cpp 2009-11-19 14:39:48 UTC (rev 34134) +++ haiku/trunk/src/system/kernel/device_manager/io_requests.cpp 2009-11-19 16:19:59 UTC (rev 34135) @@ -13,22 +13,24 @@ static status_t transfer_io_request_data(io_request* request, void* buffer, size_t size, - bool isWrite) + bool writeToRequest) { - if (isWrite != request->IsWrite() || request->RemainingBytes() < size) + if (writeToRequest == request->IsWrite() + || request->RemainingBytes() < size) { return B_BAD_VALUE; + } // lock the request buffer memory, if it is user memory IOBuffer* ioBuffer = request->Buffer(); if (ioBuffer->IsUser() && !ioBuffer->IsMemoryLocked()) { - status_t error = ioBuffer->LockMemory(request->Team(), isWrite); + status_t error = ioBuffer->LockMemory(request->Team(), !writeToRequest); if (error != B_OK) return error; } // read/write off_t offset = request->Offset() + request->TransferredBytes(); - status_t error = isWrite + status_t error = writeToRequest ? request->CopyData(buffer, offset, size) : request->CopyData(offset, buffer, size); if (error != B_OK)