master(4) master(4)
NAME
master - master configuration database
DESCRIPTION
The master configuration database is a collection of files. Each
file contains configuration information for a device or module that
may be included in the system. A file is named with the module name
to which it applies. This collection of files is maintained in a
directory called /etc/master.d. Each file has an identical format.
For convenience, this collection of files will be referred to as the
master file, as though it were a single file. Treating the master
file as a single file allows a reference to the master file to be
understood to mean the individual file in the master.d directory that
corresponds to the name of a device or module. The file is used by
the mkboot(1M) program to obtain device information to generate the
device driver and configurable module files. It is also used by the
sysdef(1M) program to obtain the names of supported devices. master
consists of two parts; they are separated by a line with a dollar
sign ($) in column 1. Part 1 contains device information for both
hardware and software devices, and loadable modules. Part 2 contains
parameter declarations used in Part 1. Any line with an asterisk (*)
in column 1 is treated as a comment.
Part 1. Description
Hardware devices, software drivers and loadable modules are defined
with a line containing the following information. Field 1 must begin
in the left-most position on the line. Fields are separated by white
space (tab or blank).
Field 1: element characteristics:
o specify only once
r required device
b block device
c character device
h hardware driver
d dispatch driver
j file-system driver
n new-style device driver
e executable-type driver
t initialize cdevsw[].dttys
s software driver
f STREAMS driver
m STREAMS module
x not a driver; a loadable module
none no flags for this driver or module
Field 2: handler prefix (4 characters maximum)
Field 3: hardware/software driver external major number; "-"
if not a software/hardware driver, or to be assigned
during execution of drvinstall(1M)
8/91 Page 1
master(4) master(4)
Field 4: number of sub-devices per device; "-" if none
Field 5: dependency list (optional); this is a comma-separated
list of other drivers or modules that must be present
in the configuration if this module is to be included
For each module, two classes of information are required by mkboot:
external routine references and variable definitions. Routine and
variable definition lines begin with white space and immediately
follow the initial module specification line. These lines are free
form, thus they may be continued arbitrarily between non-blank tokens
as long as the first character of a line is white space.
Part 1. Routine Reference Lines
If the UNIX system kernel or other dependent module contains external
references to a module, but the module is not configured, then these
external references would be undefined. Therefore, the routine
reference lines are used to provide the information necessary to
generate appropriate dummy functions at boot time when the driver is
not loaded. The format of a routine reference is as follows:
routine_name()action
The valid actions and their meanings are:
{} routine_name(){}
{nosys} {return nosys();
{nodev} {return nodev();}
{false} {return 0;}
{true} {return 1;}
{nopkg} {return nopkg();}
{noreach} panic the system
Part 1. Variable Definition Lines
Variable definition lines are used to generate all variables required
by the module. The variable generated may be of arbitrary size, be
initialized or not, or be arrays containing an arbitrary number of
elements. Variable references are defined as follows:
Field 1: variable_name
Field 2: [ expr ] - optional field used to indicate array
size
Field 3: (length) - required field indicating the size of
the variable
Field 4: ={ expr,... } - optional field used to initialize
individual elements of a variable
The length field is mandatory. It is an arbitrary sequence of length
specifiers, each of which may be one of the following:
Page 2 8/91
master(4) master(4)
%i an integer
%l a long integer
%s a short integer
%c a single character
%number a field which is number bytes long
%number c a character string which is number bytes long
For example, the length field
( %8c %l %0x58 %l %c %c )
could be used to identify a variable consisting of a character string
8-bytes long, a long integer, a 0x58 byte structure of any type,
another long integer, and two characters. Appropriate alignment of
each % specification is performed (%number is word-aligned) and the
variable length is rounded up to the next word boundary during
processing.
The expressions for the optional array size and initialization are
infixed expressions consisting of the usual operators for addition,
subtraction, multiplication, and division: +, -, *, and /.
Multiplication and division have the higher precedence, but
parentheses may be used to override the default order. The builtin
functions min and max accept a pair of expressions, and return the
appropriate value. The operands of the expression may be any mixture
of the following:
&name address of name, where name is any symbol defined by the
kernel, any module loaded, or any variable definition
line of any module loaded
#name sizeof name where name is any variable name defined by a
variable definition for any module loaded; the size is
that of the individual variable-not the size of an
entire array
#C number of controllers present; this number is determined
by the EDT for hardware devices, or by the number
provided in the system file for non-hardware drivers or
modules
#C(name) number of controllers present for the module name; this
number is determined by the EDT for hardware devices, or
by the number provided in the system file for non-
hardware drivers or modules
#D number of devices per controller taken directly from the
current master file entry
8/91 Page 3
master(4) master(4)
#D(name) number of devices per controller taken directly from the
master file entry for the module name
#M the internal major number assigned to the current module
if it is a device driver; zero of this module is not a
device driver
#M(name) the internal major number assigned to the module name if
it is a device driver: zero if that module is not a
device driver
name value of a parameter as defined in the second part of
master
number arbitrary number (octal, decimal, or hex allowed)
string a character string enclosed within double quotes (all of
the character string conventions supported by the C
language are allowed); this operand has a value which is
the address of a character array containing the
specified string
When initializing a variable, one initialization expression should be
provided for each %i, %l, %s, or %c of the length field. The only
initializers allowed for a %number c are either a character string
(the string may not be longer than number), or an explicit zero.
Initialization expressions must be separated by commas, and variable
initialization proceeds element by element. Note that %number
specification cannot be initialized-they are set to zero. Multiple
elements of an array may be initialized; uninitialized elements are
set to zero. If there are more initializers than size
specifications, it is an error and execution of the mkboot program is
aborted. In the case of an array, mkboot will report an error only
if the array's dimension is a literal. C unix will report an error
if the dimension is a symbol or expression and too many initializers
are given. If there are fewer initializations than size
specifications, zeros will be used to pad the variable. For example:
={ "V2.L1", #C*#D, max(10,#D), #C(OTHER), #M(OTHER) }
would be a possible initialization of the variable whose length field
was given in the preceding example.
Part 2. Description
Parameter declarations may be used to define a value symbolically.
Values can be associated with identifiers and these identifiers may
be used in the variable definition lines. Parameters are defined as
follows:
Page 4 8/91
master(4) master(4)
identifier = value
The identifier may have a maximum of 8 characters. The value may be
a number (decimal, octal, or hex) or a string.
EXAMPLE
A sample master file for a tty device driver would be named atty if
the device appeared in the EDT as ATTY. The driver is a character
device, the driver prefix is at. In addition, another driver named
ATLOG is necessary for the correct operation of the software
associated with this device.
*FLAG PREFIX SOFT #DEV DEPENDENCIES/VARIABLES
tca at - 2 ATLOG
atpoint(){false}
attty[#C*#D] (%0x58)
atcnt(%i) ={ #C*#D }
atlogmaj(%i) ={ #M(ATLOG) }
atid(%8c) ={ ATID }
attable(%i%l%31%s)
={ max(#C,ATMAX),
&attty,
#C }
$
ATID = "fred"
ATMAX = 6
This master file causes a routine named atpoint to be generated by
the boot program if the ATTY driver is not loaded, and there is a
reference to this routine from any other module loaded. When the
driver is loaded, the variables attty, atcnt, atlogmaj, atid, and
attable are allocated and initialized as specified. Because of the
t flag, the dttys field in the character device switch table is
initialized to point to attty (the first variable definition line
contains the variable whose address will be stored in dttys). The
ATTY driver would reference these variables by coding:
extern struct tty attty[];
extern int atcnt;
extern int atlogmaj;
extern char atid[8];
extern struct {
int member1;
struct tty *member2;
char junk[31];
short member3;
} attable;
FILES
/etc/master.d/*
8/91 Page 5
master(4) master(4)
SEE ALSO
drvinstall(1M), mkboot(1M), sysdef(1M), system(4)
Page 6 8/91