CD-ROM library (libcdrom.so, libcdrom.a)
int cd_getdevmap (path, pathlen, index, new_major, new_minor)
This function gets the major and minor numbers of one device file on a mounted Rock Ridge format CD-ROM. The argument path points to a file or directory within the CD-ROM file hierarchy. The argument index refers to the number index mapped device file. Mappings can be obtained by path or index.
If index is zero, this function gets the mapped major and minor numbers of the device file pointed to by path. The value of the mapped major number shall be returned in new_major. The value of the mapped minor number shall be returned in new_minor. The value of pathlen is not used.
If index is not zero, this function gets the major and minor numbers and pathname of the mapped device file specified by index. Numbering for index starts at one. The value of the mapped major number shall be returned in new_major. The value of the mapped minor number shall be returned in new_minor. The pathname of the device file shall be returned in 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.
The cd_getdevmap function will return the length of pathname if the device file is successfully returned (a return value of zero means mapping not found). Note: if the pathname is truncated, the return value will be larger than pathlen.
In case of error, -1 is returned and errno is set to indicate the error.
The maximum number of mappings is defined in <sys/cdrom.h>. The device file mappings for a mounted CD-ROM are undone when the CD-ROM is unmounted.
The index numbers from 1 to n (where n is the number of the last device file mapping) are always guaranteed to have a device file mapping associated with the number. Thus if an application wishes to successively delete all device file mappings, one at a time, it would call cd_getdevmap() with index equal to 1, and then cd_setdevmap() with CD_UNSETDMAP in a loop until cd_getdevmap() returns zero.
Files: <sys/cdrom.h> delim off