|
|
#include <volmgt.h>
char *media_getattr(char *vol_path, char *attr);
int media_setattr(char *vol_path, char *attr, char *value);
Volume Management supports system properties and user properties. System properties are ones that Volume Management predefines. Some of these system properties are writable, but only by the user that owns the volume being specified, and some system properties are read only:
Attribute Writable Value Description
------------------------------------------------------------------
s-access RO "seq", "rand" sequential or
random access
s-density RO "low", "medium", "high" media density
s-parts RO comma separated list of list of par
slice numbers titions on
this volume
s-location RO pathname Volume Mana
gement path
name to media
s-mejectable RO "true", "false" whether or
not media is
manually
ejectable
s-rmoneject R/W "true", "false" should media
access points
be removed
from database
upon ejection
s-enxio R/W "true", "false" if set return
ENXIO when
media access
attempted
Properties can also be defined by the user. In this case the value can be any string the user wishes.
media_setattr() returns 1 upon success, and 0 upon failure.
media_getattr() can also fail if the specified attribute was not found, and media_setattr() can also fail if the caller doesn't have permission to set the attribute, either because it's is a system attribute, or because the caller doesn't own the specified volume.
Additionally, either routine can fail returning the following error values:
if (media_getattr("/vol/rdsk/fred", "s-mejectable") != NULL) {
(void) printf("\"fred\" must be manually ejected\n");
} else {
(void) printf("software can eject \"fred\"\n");
}
This example shows setting the
s-enxio
property for the floppy volume currently in the first floppy drive:
int res;
if ((res = media_setattr("/vol/dev/aliases/floppy0", "s-enxio",
"true")) == 0) {
(void) printf("can't set s-enxio flag for floppy0\n");
}
Upon success media_getattr() returns a pointer to a string which has been allocated, and should be freed when no longer in use (see free.3c
|
|
Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 21/April/97