devswchg Kernel Service
Purpose
Alters a device switch entry point in the device switch table.
Syntax
Parameters
| Item | Description |
|---|---|
| devno | Specifies the major and minor device numbers of the device to be changed. |
| type | Specifies the device switch entry point to alter. The type parameter can have one of
the following values:
|
| newfunc | Specifies the new value for the device switch entry point. |
| oldfunc | Specifies that the old value of the device switch entry point must be returned. When a device switch entry point is conditionally altered, use this parameter to specify the function that is compared against the current device switch entry point. |
Description
The devswchg kernel service alters the value of a device switch entry point (function pointer) after a device switch table entry has been added by the devswadd kernel service. The device switch entry point specified by the type parameter is set to the value of the newfunc parameter. Its previous value is returned in the memory addressed by the oldfunc parameter. Only one device switch entry can be altered per call.
The devswchg kernel service also supports a conditional update of a device switch entry point (function pointer) after a device switch table entry has been added by the devswadd kernel service. Conditional update means that, the device switch entry point that is specified by the type parameter is set to the value of the newfunc parameter when the current device switch entry point matches the function pointer value that is specified in the memory addressed by the oldfunc parameter. When the function pointers do not match, the device switch entry point is not updated and the current device switch entry point value is returned in the memory addressed by the oldfunc parameter. Only one device switch table entry can be conditionally altered per call.
If the devswchg kernel service is unsuccessful due to any errors other than a conditional update failure, the value referenced by the oldfunc parameter is not defined.
Execution Environment
The devswchg kernel service can be called from the process environment only.
Return Values
| Item | Description |
|---|---|
| 0 | Indicates a successful operation. |
| EINVAL | Indicates that the Type parameter was not valid or the oldfunc parameter was not specified for a conditional update. |
| ENODEV | Indicates the device switch entry specified by the devno parameter is not defined. |
| EPERM | Indicates that the current device switch entry point did not match the function pointer that is specified in the memory addressed by the oldfunc parameter. |