devswchg Kernel Service

Purpose

Alters a device switch entry point in the device switch table.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/device.h>
int devswchg ( devno,  type,  newfunc,  oldfunc);
dev_t devno;
int type;
int (*newfunc) ();
int (**oldfunc)();

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:
DSW_BLOCK
Alters the ddstrategy entry point.
DSW_CONFIG
Alters the ddconfig entry point.
DSW_CREAD
Alters the ddread entry point.
DSW_CWRITE
Alters the ddwrite entry point.
DSW_DUMP
Alters the dddump entry point.
DSW_IOCTL
Alters the ddioctl entry point.
DSW_MPX
Alters the ddmpx entry point.
DSW_SELECT
Alters the ddselect entry point.
DSW_TCPATH
Alters the ddrevoke entry point.
DSW_BLOCK_COND
Conditionally alters the ddstrategy entry point.
DSW_CONFIG_COND
Conditionally alters the ddconfig entry point.
DSW_CREAD_COND
Conditionally alters the ddread entry point.
DSW_CWRITE_COND
Conditionally alters the ddwrite entry point.
DSW_DUMP_COND
Conditionally alters the dddump entry point.
DSW_IOCTL_COND
Conditionally alters the ddioctl entry point.
DSW_MPX_COND
Conditionally alters the ddmpx entry point.
DSW_SELECT_COND
Conditionally alters the ddselect entry point.
DSW_TCPATH_COND
Conditionally alters the ddrevoke entry point.
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.