Specifications

D
evice Driver Programming
14-14
Packages should never access Sd files in /etc/conf directly; they should use the
idinstall command instead.
The contents of the /etc/conf/sd.d directory are linked to etc/idsd.d whenever a
new configuration of the kernel is first booted. On this initial reboot, and on all subsequent
reboots, the module's Sd file is invoked upon entering init level0,5,or6(see
init(1M)).
Space.c 14
An optional component, the Space.c file contains storage allocations and initializations
of data structures associated with a kernel module, when the size or initial value of the
data structures depend on configurable parameters, such as the number of subdevices con-
figured for a particular device or tunable parameter. For example, the Space.c file gives
a driver the ability to allocate storage only for the subdevices being configured, by refer-
encing symbolic constants defined in the config.h file. The config.h file is a tempo-
rary file created during the system reconfiguration process and made available in the
include path when Space.c files are compiled.
When the Space.c component of a module's DSP is installed, idinstall stores the
module's Space.c file in /etc/conf/pack.d/module-name/space.c, where module-
name is the name of the module being installed.
Packages should never access Space.c files in /etc/conf directly; they should use the
idinstall command instead.
Following is an example Space.c file for the hps driver.
For complete information about the Space.c file format, refer to the Space.c(4)
manual page.
#include <sys/types.h>
#include <config.h>
#include <sys/ksynch.h>
#include <sys/strtty.h>
#include <sys/serial.h>
#include <sys/adapter.h>
#include <sys/hps.h>
#include <sys/termios.h>
#include <sys/termiox.h>
/* Group assignments of statically/binary configurable
* data to the global data structure for the hps driver.
* Arrange for remaining fields to start out zeroed.
*/
struct hps_conf hps_global = {
(CS8 | CREAD| HUPCL | B9600), /* cflag - initial t_cflag */
IGNPAR, /* iflag - initial t_iflag */
0, /* hflag - initial x_hflag */
HPS_CMAJOR_0, /* c_major - major dev# from Master*/
0 /* hps_id - set up consinit */
};
int hpsmajor = HPS_CMAJOR_0; /* assigned major number for this driver */