CFGADEV(3x,L) AIX Technical Reference CFGADEV(3x,L)
-------------------------------------------------------------------------------
cfgadev
PURPOSE
Adds a device.
LIBRARY
Run-time Services Library (librts.a)
SYNTAX
#include <cfg01.h>
int cfgadev (master, system, xstanza, vstanza, dstanza, vflag, cflag)
char *master, *system, *xstanza, *vstanza, *dstanza;
int vflag, cflag;
DESCRIPTION
The cfgadev subroutine adds information about devices and device drivers to 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 xstanza, vstanza, and dstanza parameters point to buffers that contain the
text of attribute file stanzas. Any one or two of these parameters can be NULL
pointers, indicating that a stanza of that type is not to be added, but at
least one of them must point to a stanza buffer.
The xstanza parameter points to an AIX device driver stanza to be added to the
master file. If the major device number is missing from the stanza, then the
cfgadev subroutine generates a new one.
The vstanza parameter is not used but is retained for compatibility with the
RT/AIX.
The dstanza parameter points to a device stanza to be added to the system file.
It also generates a minor device number if only the prefix (c or b) is supplied
or if the value is not unique.
The vflag parameter is either 1 (for yes) or 0 (for no), indicating whether to
execute the osconfig command after the device stanza is added. If the vflag
parameter is 1, then cfgadev executes the osconfig command with the -a stname
flag, where stname is the name of the device stanza. The osconfig command then
processes this stanza for driver addition and produces a shell procedure. The
cfgadev subroutine then runs this shell procedure, which creates the special
Processed November 7, 1990 CFGADEV(3x,L) 1
CFGADEV(3x,L) AIX Technical Reference CFGADEV(3x,L)
file /dev/stname, where stname is the name of the device stanza in the system
file. If the osconfig command returns an error, then all stanzas that were
added to the master and system files are deleted.
The cflag parameter is either 1 (for no) or 0 (for yes), for osconfig to call
customize helpers when adding devices.
If the device stanza pointed to by the dstanza parameter contains the specproc
keyword, then the program specified by the value of this keyword is executed to
perform any special processing required when adding 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 ""a"", indicating addition.
If the special processing program fails, the device is still added to the
system, but additional steps may be required before it can be used.
RETURN VALUE
Upon successful completion, the value CFG_SFUL is returned. If the cfgadev
subroutine fails, then one of the following values is returned:
CFG_BFIC An input stanza is incomplete, or necessary information is missing.
CFG_BFNA A failure occurred while adding a stanza to the master or system
file.
CFG_BFSM An input stanza buffer cannot be updated because the buffer is too
small.
CFG_CLSE An error was detected while trying to close a file.
CFG_FCOR The master or system file is set up incorrectly.
CFG_MALF Memory allocation failed because of insufficient space.
CFG_MAXM The maximum number of minor device numbers has been reached for the
driver associated with the device being added.
Processed November 7, 1990 CFGADEV(3x,L) 2
CFGADEV(3x,L) AIX Technical Reference CFGADEV(3x,L)
CFG_MPRE The prefix of the device's minor number is neither b nor c.
CFG_OPNE An error was detected while trying to open a file.
CFG_SLPF Special processing failed. The device was added but may require
some additional steps before it can be used.
CFGT_VLNG A major device number could not be generated to complete an input
stanza.
CFG_VCFG The osconfig command failed.
CFG_REBOOT AIX must be rebooted by calling the cfgaply routine, although
cfgadev was successful. cfgadev will return CFG_REBOOT after a
stanza is added to /etc/master with the mandatory attribute set to
TRUE or after adding the first stanza associated with a device
driver into /etc/system.
CFG_RBSLPF Special processing failed and a AIX reboot must be performed.
RELATED INFORMATION
In this book: "attributes," "master," and "system."
The osconfig command in AIX Operating System Commands Reference.
Processed November 7, 1990 CFGADEV(3x,L) 3