Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

devlinks(1M)

disks(1M)

ports(1M)

tapes(1M)

ucblinks(1B)

NAME

ucblinks − adds /dev entries to give SunOS 4.0 compatible names to SunOS 5.0 devices

SYNOPSIS

/usr/ucb/ucblinks [ −e rulebase ] [ −r rootdir ]

AVAILABILITY

SUNWscpu

DESCRIPTION

ucblinks creates symbolic links under /dev directory for devices whose SunOS 5.0 names differ from their SunOS 4.1 names.  Where possible, these symbolic links point to the device’s SunOS 5.0 name rather than to the actual /devices entry. 

ucblinks uses a rule-base to construct the SunOS 4.1 compatible names.  This rule-base is normally found in /usr/ucblib/ucblinks.awk, though this can be overridden by specifying a different rule-base with the −e option.  This rule-base consists of nawk(1) pattern-action pairs.  The patterns are applied to a table constructed from a list of all the device nodes under /devices and the actions are calls to an nawk function out(), passing the name of the compatibility link to be created and the name of a subdirectory under /dev which should contain the real SunOS 5.0 device link. 

ucblinks does not remove unneeded compatibility links; these must be removed by hand. 

ucblinks should be called each time the system is reconfiguration-booted, after any new SunOS 5.0 links that are needed have been created, since the reconfiguration may have resulted in more compatibility names being needed. 

Table File Format

Records in the table passed to this nawk script have 5 fields:

driver-name The driver name associated with this special file.  This is the name of the driver owning the major number as reported by the getmajor () command. 

minor-number The minor number of the special file found. 

Special file type This is b or c depending on whether the special file belongs to a block or character device. 

Special file name The name of this special file int the /devices directory, given as a pathname relative to the /dev directory.  That is, all names start with “../devices/”.

First minor subfield The first subfield of the minor field in the Special file name. This component is particularly useful as it often used to construct the SunOS 5.0 /dev/name, and in a number of drivers it can also be used to construct the binary compatibility package name. 

Since this rule-base contains rules which are simply inverted from the SunOS 4.1 MAKEDEV script it is relatively easy to convert between the two different rule systems.  (The MAKEDEV script specifies to which device-type, major- and minor-numbers a particular /dev/name should be mapped, while this rule-base specifies to which /dev/name a particular device-type, major-driver-name and minor-number should be linked.) 

OPTIONS

−e rulebase Specify rulebase as the file containing nawk(1) pattern-action statements.  This defaults to /usr/ucblib/ucblinks.awk. 

−r rootdir Specify rootdir as the directory under which dev and devices will be found, rather than the standard root directory /. 

EXAMPLES

The sun4c SunOS 4.1.1 MAKEDEV script has the following lines for SCSI disk drives:

sd∗|xd∗|xy∗)
case $i in
sd∗) name=sd blk=7  chr=17 ;;
xd∗) name=xd blk=10 chr=42 ;;
xy∗) name=xy blk=3  chr=9  ;;
esac
minor=‘expr $unit ’∗’ 8‘
mk ${name}${unit}ab $blk ‘expr $minor + 0‘ 640 operator
mk ${name}${unit}bb $blk ‘expr $minor + 1‘ 640 operator
...
mk ${name}${unit}hb $blk ‘expr $minor + 7‘ 640 operator
mk r${name}${unit}ac $chr ‘expr $minor + 0‘ 640 operator
mk r${name}${unit}bc $chr ‘expr $minor + 1‘ 640 operator
...
mk r${name}${unit}hc $chr ‘expr $minor + 7‘ 640 operator
;;

The above shell-script fragment is changed to a bcpdev.tbl entry by taking the above rules which construct unit numbers given device names (minor is “(unit ∗ 8) + partition-no”) and changing them to generate a name from a minor number.  These Sun-supplied drivers have the same driver name (as reported by getmajor () as used in the above MAKEDEV script entry. 

Taking into account the differences in syntax of nawk(1) instead of the shell, and of the complications introduced by the above rules working for three different types of devices, gives us:

#
# Standard disks (all bar IPI)
#
# Note special-case coding for sd; where, in SunOS 5.0,
# minors 32 thru 39 are used for sr drive.
#
$3 == "b" && ($1 == "sd" && $2 < 32) || $1 == "xd" || $1 == "xy"{
out(sprintf("%s%d%s", $1, $2/8, $5), "dsk/");
}
$3 == "c" && ($1 == "sd" && $2 < 32) || $1 == "xd" || $1 == "xy"{
out(sprintf("r%s%d%s", $1, $2/8, $5), "rdsk/");
}

This script has two rules; one for block and one for character devices, distinguished by the third field in the input file.  It applies to sd(7), and drivers, as specified in the first field of the input file. 

In each case the action-part of the rule is a single out() function call.  The first parameter passed to this call the compatibility link name, created by a sprintf() function call.  The name is constructed from the driver name, the minor number (field 2) and the first subcomponent of the minor component of the devfs name, which is the partition letter for disk drives.  The second parameter to the out() function is the name of the directory in which the SunOS 5.0 links should be found — either dsk or rdsk. 

ERRORS

If an entry in the rule-base file is incorrectly formatted a nawk(1) error message is issued and the ucblinks command exits. 

FILES

/usr/ucblib/ucblinks.awk
default rule-base for compatibility link

SEE ALSO

devlinks(1M), disks(1M), ports(1M), tapes(1M)

SunOS 5.1/SPARC  —  Last change: 14 Sep 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026