DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

cd_getdevmap(3X)


cd_getdevmap -- get the major and minor numbers assigned to a CD-ROM device

Synopsis

   cc [flag . . . ] file . . . -lcdfs -lgen [library] . . .
   

#include <sys/cdrom.h>

int cd_getdevmap(const char *path, int pathlen, int index, int *new_major, int *new_minor);

Description

cd_getdevmap gets the major and minor numbers currently assigned to a device file on the mounted CD-ROM. (See the cd_setdevmap(3X) command to see how to change the major/minor number assignments.)

path
Points to a device file within the CD-ROM file hierarchy.

pathlen
Specifies the maximum length of path.

index
When the major and minor number of a device file are set (reassigned) using the cd_setdevmap function, the new major and minor number values are recorded in a table. Each line in the table has a number associated with it. The first entry in the table is referred to as index number one, the second entry is index number two, and so on. index specifies which entry to look up in the table. If a major/minor number assignment of a device file is unset (using the cd_setdevmap function), the entry for the specified device file is deleted from the table.

index is specified as follows:


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

If the major and minor number of the specified device file is successfully returned, cd_getdevmap returns the length of path.

If the length of the pathname for the device file is longer than pathlen, the pathname returned in path will be truncated to pathlen length and will not be NULL terminated. Also, the return value will be larger than pathlen.

If no major and minor number assignment for the specified device file is found, zero is returned.

In case of error, -1 is returned and errno is set to indicate the error as follows:


EACCES
Search permission is denied for a component of the path prefix.

EACCES
Read 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_getdevmap function.

EINVAL
The value of index or pathlen is invalid.

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.

References

cddevsuppl(1M), cdsuf(1M), cd_setdevmap(3X), cd_suf(3X).

Rock Ridge Interchange Protocol from the Rock Ridge Technical Working Group

Notices

The index numbers from 1 to n (where n is the number of the last device file reassignment) are always guaranteed to have an associated device file. So, to write an application that successively deletes all device file major/minor number reassignments one at a time, call cd_getdevmap with index equal to 1, then call cd_setdevmap with CD_UNSETDMAP, in a loop, until cd_getdevmap returns zero.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004