cfgddev
Purpose
Deletes a device.
Library
Run-time Services Library (librts.a)
Syntax
#include <cfg01.h>
int cfgddev (master, system, dstname, vflag)
char *master, *system, *dstname;
int vflag;
Description
The cfgddev subroutine deletes information about devices
and device drivers from the system configuration.
The master parameter points to the full path name of the
master file. The system parameter points to the full
path name of the system file. These files are usually
/etc/master and /etc/system, respectively. The dstname
parameter points to a string containing the name of the
stanza in the system file of the device to be deleted.
The vflag parameter is either 1 (for "yes") or 0 (for
"no"). If the vflag parameter is 1, then cfgddev exe-
cutes the vrmconfig command with the -d dstname flag.
The vrmconfig command then processes the named stanza for
driver deletion and produces a shell procedure. The
cfgddev subroutine then runs this shell procedure to
delete the special file (/dev file) for the device. If
the vrmconfig command returns an error, then the device
is not deleted.
The cfgddev subroutine then gets the VRM device driver
stanza associated with the device being deleted. If it
contains a code keyword, then cfgddev searches the master
file for other VRM device driver stanzas that copy this
stanza by specifying its name as the value of a copy
keyword. If any are found, they are updated so that the
first of these stanzas defined in the master file con-
tains the code keyword, and the other stanzas copy the
first stanza.
If the VRM device driver stanza for the device being
deleted contains a copy keyword, then it is replaced with
a code keyword whose value is the same as the value of
the code keyword in the stanza it is copying.
If the device stanza being deleted from the system file
contains an admgr keyword, then its value is the name of
the device manager's stanza in the system file. The
device is deleted from the vdmgr keyword value list in
the device manager's stanza.
If the device stanza named by the dstname parameter con-
tains the specproc keyword, then the program specified by
the value of this keyword is executed to perform any
special processing required when deleting this device.
The value of the specproc keyword must be the full path
name of an executable file. The following arguments are
passed to the program using the argv mechanism described
in "exec: execl, execv, execle, execve, execlp, execvp."
All of them are passed as character strings.
argv[0| The full path name of the special-processing
program
argv[1| The full path name of the master file
argv[2| The full path name of the system file
argv[3| The name of the device stanza
argv[4| The character string ""d"", indicating
deletion.
If the special processing program fails, then the device
is still deleted from the system, but some additional
steps may be required to clean up the system.
The device stanza associated with the deleted device is
then deleted from the system file.
Return Value
Upon successful completion, the value CFG_SUCC is
returned. If the cfgddev subroutine fails then one of
the following values is returned:
CFG_CLSE An error was detected while trying to close a
file.
CFG_CPYF A failure occurred while trying to update the
VRM driver stanzas that copy the driver
stanza of the device being deleted.
CFG_DVND The device could not be deleted from the
system file.
CFG_DVNF The device to be deleted cannot be found in
the system file.
CFG_FCOR The master or system file is set up incor-
rectly.
CFG_MALF Memory allocation failed because of insuffi-
cient space.
CFG_MGRF A failure occurred while updating the device
manager's stanza for the device being
deleted.
CFG_OPNE An error was detected while trying to open a
file.
CFG_SLPF Special processing failed. The device is
deleted, but some additional steps may be
required to clean up the system.
CFG_VCFG The vrmconfig command failed.
Files
/etc/specials
Related Information
In this book: "attributes," "master," and "system."
The vrmconfig command in AIX Operating System Commands
Reference.