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 individual file has an identical format. For
convenience, this collection of files will be referred to as
the master file, as though it was a single file. This will
allow 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
a generate segment descriptor
array
t initialize cdevsw[].d_ttys
s software driver
Page 1 May 1989
MASTER(4) MASTER(4)
f STREAMS driver
m STREAMS module
x not a driver; a loadable module
number The first interrupt vector for
an integral device
Field 2: number of interrupt vectors required by a
hardware device: "-" if none.
Field 3: handler prefix (4 chars. maximum)
Field 4: software driver external major number; "-"
if not a software driver, or to be assigned
during execution of drvinstall(1M)
Field 5: number of sub-devices per device; "-" if
none
Field 6: interrupt priority level of the device; "-"
if none
Field 7: 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(1M): 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 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.
Routine references are defined as follows:
Field 1: routine name ()
Field 2: the routine type: one of
{} routine_name(){}
Page 2 May 1989
MASTER(4) MASTER(4)
{nosys}
routine_name(){return nosys();}
{nodev}
routine_name(){return nodev();}
{false}
routine_name(){return 0;}
{true}
routine_name(){return 1;}
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:
%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
Page 3 May 1989
MASTER(4) MASTER(4)
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 infix 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
#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
Page 4 May 1989
MASTER(4) MASTER(4)
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
will proceed element by element. Note that %number
specification cannot be initialized--they are set to zero.
Only the first element of an array can be initialized, the
other elements are set to zero. If there are more
initializers than size specifications, it is an error and
execution of the mkboot(1M) program will be aborted. 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
Page 5 May 1989
MASTER(4) MASTER(4)
lines.
Parameters are defined as follows:
Field 1: identifier (8 characters maximum)
Field 2: =
Field 3: value, the value may be a number (decimal,
octal, or hex allowed), 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, two
interrupt vectors are used, and the interrupt priority is 6.
In addition, another driver named "ATLOG" is necessary for
the correct operation of the software associated with this
device.
*FLAG #VEC PREFIX SOFT #DEV IPL DEPENDENCIES/VARIABLES
tca 2 at - 2 6 ATLOG
atpoint(){false}
at_tty[#C*#D] (%0x58)
at_cnt(%i) ={ #C*#D }
at_logmaj(%i) ={ #M(ATLOG) }
at_id(%8c) ={ ATID }
at_table(%i%l%31%s)
={ max(#C,ATMAX),
&at_tty,
#C }
$
ATID = "fred"
ATMAX = 6
This master file will cause 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 at_tty, at_cnt, at_logmaj, at_id, and at_table
will be allocated and initialized as specified. Due to the
t flag, the d_ttys field in the character device switch
table will be initialized to point to attty (the first
Page 6 May 1989
MASTER(4) MASTER(4)
variable definition line contains the variable whose address
will be stored in d_ttys). The ATTY driver would reference
these variables by coding:
extern struct tty at_tty[];
extern int at_cnt;
extern int at_logmaj;
extern char at_id[8];
extern struct {
int member1;
struct tty *member2;
char junk[31];
short member3;
} at_table;
FILES
/etc/master.d/*
SEE ALSO
system(4).
drvinstall(1M), mkboot(1M), sysdef(1M) in the System
Administrator's Reference Manual.
Page 7 May 1989