---
title: prepare
framework: kernel
role: symbol
role_heading: Instance Method
path: kernel/iomemorydescriptor/1442024-prepare
---

# prepare

Prepare the memory for an I/O transfer.

## Declaration

```occ
virtual IOReturn prepare(IODirection forDirection);
```

## Parameters

- `forDirection`: The direction of the I/O just completed, or kIODirectionNone for the direction specified by the memory descriptor.

## Return Value

Return Value An IOReturn code.

## Discussion

Discussion This involves paging in the memory, if necessary, and wiring it down for the duration of the transfer. The complete() method completes the processing of the memory after the I/O transfer finishes. Note that the prepare call is not thread safe and it is expected that the client will more easily be able to guarantee single threading a particular memory descriptor.

## See Also

### Preparing the Buffer

- [prepare](kernel/iomemorydescriptor/1812845-prepare.md)
- [complete](kernel/iomemorydescriptor/1812740-complete.md)
- [complete](kernel/iomemorydescriptor/1442043-complete.md)
- [getPreparationID](kernel/iomemorydescriptor/1441964-getpreparationid.md)
- [setPreparationID](kernel/iomemorydescriptor/1442011-setpreparationid.md)
