<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/IOReporter_IVars/handleSwapPrepare",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@S@IOReporter_IVars@F@handleSwapPrepare#I#"
  },
  "title" : "handleSwapPrepare"
}
-->

# handleSwapPrepare

```
virtual IOReturn handleSwapPrepare(int newNChannels);
```

## Parameters

`newNChannels`

target number of channels

## Return Value

IOReturn code

## Discussion

\abstract allocate memory in preparation for an instance variable swap
\discussion ::handleSwapPrepare() is responsible for allocating appropriately-
sized buffers (based on the new number of channels) and storing
them in _swap* instance variables.  If returning and error, it
must deallocate any buffers and set to NULL any _swap* variables.

Locking: The caller must ensure that the *config* lock is HELD but
that the reporter (data) lock is *NOT HELD*.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)