Solaris 1.x to 2.x Transition Guide

Device Naming From a Developer's Perspective

This section expands on the discussion in "Device Naming Conventions", focusing on aspects of device naming that concern system and kernel developers.

/devices

The /devices tree represents the tree of devices recognized by the kernel. This tree is configured by the drvconfig(1M) program. drvconfig is normally run only when the system is booted with the -r flag (see "Reconfiguration Boot"). drvconfig configures /devices with information about devices (with drivers) that are connected and ready at boot time.

Entries are exported by device drivers calling ddi_create_minor_node(9F) when they have determined that a device exists.

Use the add_drv(1M) command to add a device to the system. If the driver was successfully added, add_drv will also run drvconfig.

/dev

In this release, /dev is managed by utility programs that create symbolic links to the real entries in /devices. The programs are:

Device Driver Naming

Each device in the system is driven by a device driver. Device drivers manage many instances of a device. Devices are named in several ways:

Physical Names

Physical names are stored in /devices. They describe the hardware, and vary with the platform and configuration. For example:

/devices/vme/xdc@6d,ee80/xd@0,0:g

Physical names can be used to identify which piece of hardware is in use. For example, xdc@6d,ee80 refers to the disk controller at address 0xee80 in VME A16, D32 space. See the vme(4) and driver.conf(4) man pages.

Logical Names

Logical names are stored in /dev. They attempt to abstract most of the nature of physical device names that are specific to the platform. Logical names might be appropriate for an xd device, such as:

/dev/dsk/c2d0s6 (controller 2, slave 0, slice 6 (4.x partition "g"))

or an sd device, such as:

/dev/dsk/c0t3d0s0 (controller 0, target 3, lun 0, slice 0 (4.x partition "a"))

The logical name conveys nothing about the type of controller. It does not differentiate between SCSI and IPI; they are both just disks.

Disk Names

Disk names use the SVR4 convention of slice numbers 0-7 instead of the letters a-h used in the SunOS release 4.x software.

Disk names also use the SVR4 convention of /dev/dsk/* for block disk devices and /dev/rdsk/* for raw disks. For more information, see System Administration Guide.

Instance Names

Instance names refer to the nth device in the system (for example, sd20).

Instance names are occasionally reported in driver error messages. You can determine the binding of an instance name to a physical name by looking at dmesg(1M) output, as in the following example.


sd9 at esp2: target 1 lun 1
sd9 is /sbus@1,f8000000/esp@0,800000/sd@1,0
     <SUN0424 cyl 1151 alt 2 hd 9 sec 80>

Once the instance name has been assigned to a device, it remains bound to that device.

Instance numbers are encoded in a device's minor number. To keep instance numbers persistent across reboots, the system records them in the /etc/path_to_inst file. This file is read only at boot time, and is currently updated by the add_drv(1M) and drvconfig(1M) commands. See the path_to_inst(4) man page for more information.