2 .\" Copyright (c) 1995, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
4 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
5 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH MEDIA_GETATTR 3VOLMGT "Mar 8, 2007"
8 media_getattr, media_setattr \- get and set media attributes
12 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lvolmgt\fR [ \fIlibrary\fR ... ]
17 \fBchar *\fR\fBmedia_getattr\fR(\fBchar *\fR\fIvol_path\fR, \fBchar *\fR\fIattr\fR);
22 \fBint\fR \fBmedia_setattr\fR(\fBchar *\fR\fIvol_path\fR, \fBchar *\fR\fIattr\fR, \fBchar *\fR\fIvalue\fR);
28 This function is obsolete. The management of removable media by the Volume
29 Management feature, including \fBvold\fR, has been replaced by software that
30 supports the Hardware Abstraction Layer (HAL). Programmatic support for HAL is
31 through the HAL APIs, which are documented on the HAL web site. See
32 \fBhal\fR(5). The return value of this function is undefined.
35 \fBmedia_setattr()\fR and \fBmedia_getattr()\fR respectively set and get
36 attribute-value pairs (called properties) on a per-volume basis.
39 Volume management supports system properties and user properties. System
40 properties are ones that volume management predefines. Some of these system
41 properties are writable, but only by the user that owns the volume being
42 specified, and some system properties are read only:
49 \fBAttribute\fR \fBWritable\fR \fBValue\fR \fBDescription\fR
51 \fBs-access\fR RO "seq", "rand" sequential or random access
52 \fBs-density\fR RO "low", "medium", "high" media density
53 \fBs-parts\fR RO comma separated list of slice numbers list of partitions on this volume
54 \fBs-location\fR RO \fIpathname\fR volume management pathname to media
55 \fBs-mejectable\fR RO "true", "false" T{
56 whether or not media is manually ejectable
58 \fBs-rmoneject\fR R/W "true", "false" T{
59 should media access points be removed from database upon ejection
61 \fBs-enxio\fR R/W "true", "false" T{
62 if set return \fBENXIO\fR when media access attempted
68 Properties can also be defined by the user. In this case the value can be any
69 string the user wishes.
73 The return from this function is undefined.
77 Both \fBmedia_getattr()\fR and \fBmedia_setattr()\fR can fail returning a null
78 pointer if an \fBopen\fR(2) of the specified \fIvol_path\fR fails, if an
79 \fBfstat\fR(2) of that pathname fails, or if that pathname is not a block or
80 character special device.
83 \fBmedia_getattr()\fR can also fail if the specified attribute was not found,
84 and \fBmedia_setattr()\fR can also fail if the caller doesn't have permission
85 to set the attribute, either because it's is a system attribute, or because the
86 caller doesn't own the specified volume.
89 \fBExample 1 \fRUsing \fBmedia_getattr()\fR
92 The following example checks to see if the volume called \fIfred\fR that volume
93 management is managing can be ejected by means of software, or if it can only
99 \fBif (media_getattr("/rdsk/fred", "s-mejectable") != NULL) {
100 (void) printf("\e"fred\e" must be manually ejected\en");
102 (void) printf("software can eject \e"fred\e"\en");
109 This example shows setting the \fIs-enxio\fR property for the floppy volume
110 currently in the first floppy drive:
116 if ((res = media_setattr("/dev/aliases/floppy0", "s-enxio",
118 (void) printf("can't set s-enxio flag for floppy0\en");
126 See \fBattributes\fR(5) for descriptions of the following attributes:
134 ATTRIBUTE TYPE ATTRIBUTE VALUE
138 Interface Stability Obsolete
144 \fBlstat\fR(2), \fBopen\fR(2), \fBreadlink\fR(2), \fBstat\fR(2),
145 \fBfree\fR(3C), \fBmalloc\fR(3C), \fBmedia_findname\fR(3VOLMGT),
146 \fBvolmgt_check\fR(3VOLMGT), \fBvolmgt_inuse\fR(3VOLMGT),
147 \fBvolmgt_root\fR(3VOLMGT), \fBvolmgt_running\fR(3VOLMGT),
148 \fBvolmgt_symname\fR(3VOLMGT), \fBattributes\fR(5), \fBhal\fR(5)