cd_idmap(3X)


cd_idmap -- set or get mappings of CD-ROM user and group IDs

Synopsis

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

#include <sys/cdrom.h>

int cd_idmap(const char *path, int cmd, struct cd_idmap *idmap, int *nmaps);

Description

cd_imap sets or gets user and group ID mappings for files and directories on a mounted CD-ROM. Only files and directories that have user and group IDs defined may have them mapped.

If the user and group IDs set by the manufacturer are not appropriate for your system, change them after the CD-ROM has been mounted, but before opening any files. Mappings that are changed when a file is open will not take effect until the file is closed.


path
Mount point of the CD-ROM file system.

cmd
CD_SETUMAP or CD_SETGMAP to use the values in the idmap array to map user and group IDs.

CD_GETUMAP or CD_GETGMAP to get the current values of user and group IDs.


idmap
Pointer to the cd_idmap structure that contains values to be set (CD_SETUMAP and CD_SETGMAP) or filled in (CD_GETUMAP and CD_GETGMAP).

nmaps
Number of mappings in the array. If nmaps is zero, none of previously set mappings will stay in effect. Overrides any existing mapping or values previously set by cd_idmap.

On call, nmaps contains the maximum number of mappings that may be returned. On return, nmaps contains the number of mappings that are returned.

Return values

On success, cd_idmap returns a value of zero. On failure, cd_idmap returns -1 and sets errno to identify the error as follows:

EACCES
Read permission is denied on the mount point, or search permission is denied on a component of path.

EFAULT
Invalid address for idmap or path.

EINTR
A signal was caught during the execution of the cd_idmap function.

EINVAL
Invalid value for cmd or nmaps. cmd is negative or nmaps is larger than CD_MAXUMAP or CD_MAXGMAP.

EINVAL
The cd_idmap structure has an invalid member: from_id contains an unsupported value, or to_uid contains an unsupported value, or to_id contains an unsupported value.

EINVAL
path points to an invalid mount point.

ENAMETOOLONG
The size of path exceeds MAXPATHLEN, or the component of a path name is longer than MAXNAMELEN while _POSIX_NO_TRUNC is in effect.

ENOENT
path does not exist or the path argument points to an empty string.

ENOTDIR
A component of path is not a directory.

EPERM
User lacks write permission to set values.

References

cdmntsuppl(1M), cdfs-specific mount_cdfs(1M)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004