- //
- // Prepare the memory for an I/O transfer.
- //
- // This involves paging in the memory and wiring it down for the duration
- // of the transfer. The complete() method finishes the processing of the
- // memory after the I/O transfer finishes.
- //
-
- unsigned index;
- IOReturn status = kIOReturnSuccess;
- IOReturn statusUndo;
-
- if ( forDirection == kIODirectionNone )
- {
- forDirection = getDirection();
- }
-
- for ( index = 0; index < _descriptorCount; index++ )
- {
- status = _descriptors[index]->prepare(forDirection);
- if ( status != kIOReturnSuccess ) break;
- }
-
- if ( status != kIOReturnSuccess )
- {
- for ( unsigned indexUndo = 0; indexUndo < index; indexUndo++ )
- {
- statusUndo = _descriptors[index]->complete(forDirection);
- assert(statusUndo == kIOReturnSuccess);
- }
- }
-
- if ( status == kIOReturnSuccess ) _descriptorPrepared = true;
-
- return status;
+ //
+ // Prepare the memory for an I/O transfer.
+ //
+ // This involves paging in the memory and wiring it down for the duration
+ // of the transfer. The complete() method finishes the processing of the
+ // memory after the I/O transfer finishes.
+ //
+
+ unsigned index;
+ IOReturn status = kIOReturnSuccess;
+ IOReturn statusUndo;
+
+ if (forDirection == kIODirectionNone) {
+ forDirection = getDirection();
+ }
+
+ for (index = 0; index < _descriptorCount; index++) {
+ status = _descriptors[index]->prepare(forDirection);
+ if (status != kIOReturnSuccess) {
+ break;
+ }
+ }
+
+ if (status != kIOReturnSuccess) {
+ for (unsigned indexUndo = 0; indexUndo < index; indexUndo++) {
+ statusUndo = _descriptors[index]->complete(forDirection);
+ assert(statusUndo == kIOReturnSuccess);
+ }
+ }
+
+ if (status == kIOReturnSuccess) {
+ _descriptorPrepared = true;
+ }
+
+ return status;