[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

devswdel Kernel Service


Deletes a device driver entry from the device switch table.


#include <sys/types.h>
#include <sys/errno.h>
#include <sys/device.h>
int devswdel 
dev_t devno;


devno Specifies the major and minor device numbers of the device to be deleted.


The devswdel kernel service is typically called by a device driver's ddconfig routine on termination to remove the device driver's entry points from the device switch table.The device switch table is a table of device switch (devsw) structures indexed by the device driver's major device number. The device driver interface services use this table of structures in the kernel to facilitate calling device driver routines.

The major device number portion of the devno parameter is used to specify the index into the device switch table for the entry to be removed. Before the device switch structure is removed, the existing entry is checked to determine if any opened device is using it.

If an opened device is currently occupying the entry to be removed, the devswdel service does not perform the update. Instead, it returns an EEXIST return code. If the removal is successful, a return code of 0 is set.

The devswdel service removes a device switch structure entry from the table by marking the entry as undefined and setting all of the entry point fields within the structure to a nodev value. As a result, any callers of the removed device driver return an ENODEV error code. If the specified entry is already marked undefined, the devswdel service returns an ENODEV error code.

Execution Environment

The devswdel kernel service can be called from the process environment only.

Return Values

0 Indicates a successful operation.
EEXIST Indicates that the specified device switch entry is in use and cannot be removed.
ENODEV Indicates that the specified device switch entry is not defined.
EINVAL Indicates that the major device number portion of the devno parameter exceeds the maximum permitted number of device switch entries.

Implementation Specifics

The devswdel kernel service is part of Base Operating System (BOS) Runtime.

Related Information

The devswadd kernel service, devswchg kernel service, devswqry kernel service.

Kernel Extension and Device Driver Management Kernel Services in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.

[ Previous | Next | Contents | Home | Search ]