cd_setdevmap(3X) cd_setdevmap(3X)
NAME
cd_setdevmap - set or unset major and minor numbers
assignments for a CD-ROM device
SYNOPSIS
cc [flag . . . ] file . . . -lcdfs -lgen [library] . . .
#include <sys/cdrom.h>
int cd_setdevmap(const char *path, int cmd, int *new_major,
int *new_minor);
DESCRIPTION
cd_setdevmap sets (reassign) or unsets (based on cmd) the
major and minor numbers of a device file to new values so the
appropriate device on the host system is accessed.
The major and minor number of any device files on a CD-ROM are
assigned by the CD-ROM publisher during manufacturing. These
values may not match the major and minor numbers assigned to
the physical devices on the host system.
When a device file is referenced, the major and minor number
assigned using the cd_setdevmap function or the values
recorded on the media are used. When the CD-ROM is unmounted,
any new major and minor number assignments are invalidated.
The cd_setdevmap function should be used before the device
file is used, otherwise the change will not take effect until
the device file is closed and reopened. Only a privileged
user can use the cd_setdevmap function.
The maximum number of device files per CD-ROM that can be
reset is defined in sys/cdrom.h.
The cd_setdevmap function must be specified as follows:
path Points to a device file within the CD-ROM file
hierarchy.
cmd Specifies the command to execute (set or unset). cmd is
one of the following:
CD_SETDMAP
Specifies that the original major and minor
number pair of a device file (specified by
path) be replaced with the value specified by
new_major and new_minor. Any previous
Copyright 1994 Novell, Inc. Page 1
cd_setdevmap(3X) cd_setdevmap(3X)
reassignments are overridden.
CD_UNSETDMAP
Specifies that the major and minor numbers of
the device file pointed to by path should be
unset (the values on the mounted CD-ROM will
be used from then on).
new_major
Identifies the memory location where the major number
is stored.
new_minor
Identifies the memory location where the minor number
is stored.
Return Values
For CD_SETDMAP, exit status is 1 if the major and minor number
of the device file is successfully reassigned, and the exit
status is 0 if no more assignments are allowed. (See the
NOTICES section).
For CD_UNSETDMAP, the exit status is 1 if the major and minor
number assignments of the device file is successfully unset,
and the exit status is 0 if the major and minor number
assignments of the device files are not found.
Exit status is -1 if an error occurs, and errno is set to
indicate the error.
Errors
EACCES Search permission is denied for a component of the
path prefix.
EACCES Write permission on the device file pointed to by
path is denied.
EFAULT The address of path, new_major, or new_minor is
invalid.
EINTR A signal was caught during the cd_setdevmap
function.
EINVAL The value of cmd is invalid.
Copyright 1994 Novell, Inc. Page 2
cd_setdevmap(3X) cd_setdevmap(3X)
EINVAL The path argument points to a device file that is
not within the CD-ROM file hierarchy.
EINVAL The file pointed to by path is not a device file.
EMFILE Too many file descriptors are currently open in the
calling process.
ENAMETOOLONG
The length of the path string exceeds MAXPATHLEN.
ENAMETOOLONG
A pathname component is longer than MAXNAMELEN while
_POSIX_NO_TRUNC is in effect.
ENFILE The system file table is full.
ENOENT A component of path does not exist.
ENOENT The path argument points to an empty string.
ENOTDIR A component of the path prefix is not a directory.
ENXIO The CD-ROM is not in the drive.
ENXIO A read error occurred.
EPERM User does not have read/write permission for the
specified device file.
REFERENCES
cd_getdevmap(3X), cddevsuppl(1M), cdsuf(1M)
Rock Ridge Interchange Protocol from the Rock Ridge Technical
Working Group
Copyright 1994 Novell, Inc. Page 3