putdev(1M)


putdev -- create and update the device database

Synopsis

putdev -m device attribute=value [attribute=value [. . .]]
putdev -d device [attribute [. . .]]
putdev -p device attribute=value[,value . . .]
putdev -r device attribute=value[,value . . .]

Description

The putdev command is used to add a new device to the Device Database (DDB), modify an existing device's attributes, or remove a device entry from the DDB. It also allows appending new values to attributes that take value-lists (separated by commas), and removal of specific values from value-lists.

Command options

putdev takes the following options:

-a alias
Add a device to the DDB using the specified attributes. The device must be referenced by its alias.

-m device
Modify a device entry in the DDB, using the specified attribute values. If a specified attribute does not exist in the device entry, putdev adds the specified attribute to the entry. It also modifies attributes that already have a value with the value specified.

-d device
Remove a device entry from the DDB, when executed without the attribute argument. If the attribute argument is specified, the attribute and its value are deleted from the device entry.

-p device
Append the list of values to the attribute value-list of the device. If the value item is multiply defined in the input value-list or already defined in the DDB, putdev fails and prints an error message.

-r device
Remove the list of values from the attribute value-list, of the device. The command succeeds, even if the value has been removed or is not defined for the attribute in the DDB.

alias
Define the alias name of the device, a value which must be unique throughout the DDB. alias is limited to 64 characters (DDB_MAXALIAS) and should contain only alphanumeric characters and any of the following special characters: period (.), underscore (_), dollar sign ($), and hyphen (-).

device
Designate the absolute pathname or alias name of the device whose attribute is to be added, modified, or removed. If device is a pathname, then the attributes of the alias to which it maps are updated.

attribute
Designate a device attribute to be added, modified, or deleted. This prevents an accidental modification or deletion of a device's alias from the DDB.

value
Designate the value to be assigned to a device's attribute. If any of the values are invalid, then putdev fails and prints an error message.
Whenever the attributes in a Device Database file are updated, the old version of the file is saved to a file with the capital letter ``O'' prefixed to the filename. If there are errors in the modification of device attributes, you can recover the old versions of the Device Database files.

Attributes

Following are all of the attributes which can be defined for a device:

alias
The unique name by which a device is known. No two devices in the database may share the same alias name. The name is limited in length to 64 characters (DDB_MAXALIAS) and should contain only alphanumeric characters and any of the special characters: underscore (_), dollar sign ($), hyphen (-), and period (.).

bdevice
The absolute pathname to the block special device node associated with the device, if any, with maximum length of PATH_MAX. This attribute is optional.

bdevlist
A list of additional pathnames of block device special files which map to the same logical or secure device. Each item in the list is separated by a comma, and each must be an absolute pathname of the device special file, with a maximum length of PATH_MAX. Since, this attribute takes a list of values, putdev -p | -r can be used for this attribute. This attribute is optional.

capacity
The capacity of the device or of the typical volume, if removable.

cdevice
The absolute pathname to the character special device node associated with the device, if any, with maximum length of PATH_MAX. This attribute is optional.

cdevlist
It contains a list of additional pathnames of character device special files mapping to the same logical or secure device. Each item in the list is separated by a comma, and each must be an absolute pathname of the device special file, with a maximum length of PATH_MAX. Since, this attribute takes a list of values, putdev -p | -r can be used for this attribute. This attribute is optional.

cyl
Used by the command specified in the mkfscmd attribute.

desc
A description of any instance of a volume associated with this device (such as floppy diskette).

dpartlist
The list of disk partitions associated with this device. Used only if type=disk. The list should contain device aliases, each of which must have type=dpart.

dparttype
The type of disk partition represented by this device. Used only if type=dpart. It should be either fs (for filesystem) or dp (for data partition).

erasecmd
The command string that, when executed, erases the device.

fmtcmd
The command string that, when executed, formats the device.

fsname
The filesystem name on the filesystem administered on this partition, as supplied to the /usr/sbin/labelit command. This attribute is specified only if type=dpart and dparttype=fs.

gap
Used by the command specified in the mkfscmd attribute.

mkfscmd
The command string that, when executed, places a filesystem on a previously formatted device.

mountpt
The default mount point to use for the device. Used only if the device is mountable. For disk partitions where type=dpart and dparttype=fs, this attribute should specify the location where the partition is normally mounted.

nblocks
The number of blocks in the filesystem administered on this partition. Used only if type=dpart and dparttype=fs.

ninodes
The number of inodes in the filesystem administered on this partition. Used only if type=dpart and dparttype=fs.

norewind
The name of the character special device node that allows access to the serial device without rewinding when the device is closed.

pathname
Defines the pathname to an i-node describing the device (used for non-block or character device pathnames, such as directories).

type
A token that represents inherent qualities of the device. Standard types include: 9-track, ctape, disk, directory, diskette, dpart, and qtape.

volname
The volume name on the filesystem administered on this partition, as supplied to the /usr/sbin/labelit command. Used only if type=dpart and dparttype=fs.

volume
A text string used to describe any instance of a volume associated with this device. This attribute should not be defined for devices which are not removable.

Files


/etc/device.tab

Exit codes

If putdev is successful, it returns an exit code of 0. Otherwise, it returns one of the following exit codes and prints the corresponding error message:

1
incorrect usage
USAGE: putdev -a alias [attribute=value] . . .

2
Device Database in inconsistent state - notify administrator

2
Device Database could not be accessed or created

3
alias already exists in Device Database

3
device does not exist in Device Database

?
"dsf" already exists in Device Database

6
invalid alias or invalid pathname "device"

4
hilevel does not dominate lolevel in attribute range

4
invalid value for attribute "attr"
level= "level" not defined in LTDB

6
invalid value for attribute "attr"
user/uid= "uid" not defined in system

6
invalid value for attribute "attr"
group/gid= "group" not defined in system

6
invalid value for attribute "attr"
invalid permissions specified "perm"

6
invalid value for attribute "attr"
invalid delimiter specified in "value"

6
"value" multiply defined for attribute "attr"

6
Device Database in use. Try again later.

3
"alias" not defined in Device Database

5
system service not installed

References

devattr(1M), getdev(1M)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004