1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 23*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate 26*7c478bd9Sstevel@tonic-gate #ifndef _DEVMGMT_H 27*7c478bd9Sstevel@tonic-gate #define _DEVMGMT_H 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.12 */ 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 32*7c478bd9Sstevel@tonic-gate extern "C" { 33*7c478bd9Sstevel@tonic-gate #endif 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gate /* 36*7c478bd9Sstevel@tonic-gate * devmgmt.h 37*7c478bd9Sstevel@tonic-gate * 38*7c478bd9Sstevel@tonic-gate * Contents: 39*7c478bd9Sstevel@tonic-gate * - Device Management definitions, 40*7c478bd9Sstevel@tonic-gate * - getvol() definitions 41*7c478bd9Sstevel@tonic-gate */ 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate /* 44*7c478bd9Sstevel@tonic-gate * Device management definitions 45*7c478bd9Sstevel@tonic-gate * - Default pathnames (relative to installation point) 46*7c478bd9Sstevel@tonic-gate * - Environment variable namess 47*7c478bd9Sstevel@tonic-gate * - Standard field names in the device table 48*7c478bd9Sstevel@tonic-gate * - Flags 49*7c478bd9Sstevel@tonic-gate * - Miscellaneous definitions 50*7c478bd9Sstevel@tonic-gate */ 51*7c478bd9Sstevel@tonic-gate 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate /* 54*7c478bd9Sstevel@tonic-gate * Default pathnames (relative to the package installation 55*7c478bd9Sstevel@tonic-gate * point) to the files used by Device Management: 56*7c478bd9Sstevel@tonic-gate * 57*7c478bd9Sstevel@tonic-gate * DTAB_PATH Device table 58*7c478bd9Sstevel@tonic-gate * DGRP_PATH Device group table 59*7c478bd9Sstevel@tonic-gate * DVLK_PATH Device reservation table 60*7c478bd9Sstevel@tonic-gate */ 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate #define DTAB_PATH "/etc/device.tab" 63*7c478bd9Sstevel@tonic-gate #define DGRP_PATH "/etc/dgroup.tab" 64*7c478bd9Sstevel@tonic-gate #define DVLK_PATH "/etc/devlkfile" 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate /* 68*7c478bd9Sstevel@tonic-gate * Names of environment variables 69*7c478bd9Sstevel@tonic-gate * 70*7c478bd9Sstevel@tonic-gate * OAM_DEVTAB Name of variable that defines the pathname to 71*7c478bd9Sstevel@tonic-gate * the device-table file 72*7c478bd9Sstevel@tonic-gate * OAM_DGROUP Name of variable that defines the pathname to 73*7c478bd9Sstevel@tonic-gate * the device-group table file 74*7c478bd9Sstevel@tonic-gate * OAM_DEVLKTAB Name of variable that defines the pathname to 75*7c478bd9Sstevel@tonic-gate * the device-reservation table file 76*7c478bd9Sstevel@tonic-gate */ 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate #define OAM_DEVTAB "OAM_DEVTAB" 79*7c478bd9Sstevel@tonic-gate #define OAM_DGROUP "OAM_DGROUP" 80*7c478bd9Sstevel@tonic-gate #define OAM_DEVLKTAB "OAM_DEVLKTAB" 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate /* 84*7c478bd9Sstevel@tonic-gate * Standard field names in the device table 85*7c478bd9Sstevel@tonic-gate */ 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate #define DTAB_ALIAS "alias" 88*7c478bd9Sstevel@tonic-gate #define DTAB_CDEVICE "cdevice" 89*7c478bd9Sstevel@tonic-gate #define DTAB_BDEVICE "bdevice" 90*7c478bd9Sstevel@tonic-gate #define DTAB_PATHNAME "pathname" 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate 93*7c478bd9Sstevel@tonic-gate /* 94*7c478bd9Sstevel@tonic-gate * Flags: 95*7c478bd9Sstevel@tonic-gate * For getdev() and getdgrp(): 96*7c478bd9Sstevel@tonic-gate * DTAB_ANDCRITERIA Devices must meet all criteria 97*7c478bd9Sstevel@tonic-gate * instead of any of the criteria 98*7c478bd9Sstevel@tonic-gate * DTAB_EXCLUDEFLAG The list of devices or device groups 99*7c478bd9Sstevel@tonic-gate * is the list that is to be excluded, 100*7c478bd9Sstevel@tonic-gate * not those to select from. 101*7c478bd9Sstevel@tonic-gate * DTAB_LISTALL List all device groups, even those that 102*7c478bd9Sstevel@tonic-gate * have no valid members (getdgrp() only). 103*7c478bd9Sstevel@tonic-gate */ 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate #define DTAB_ANDCRITERIA 0x01 106*7c478bd9Sstevel@tonic-gate #define DTAB_EXCLUDEFLAG 0x02 107*7c478bd9Sstevel@tonic-gate #define DTAB_LISTALL 0x04 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate /* 111*7c478bd9Sstevel@tonic-gate * Miscellaneous Definitions 112*7c478bd9Sstevel@tonic-gate * 113*7c478bd9Sstevel@tonic-gate * DTAB_MXALIASLN Maximum alias length 114*7c478bd9Sstevel@tonic-gate */ 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gate #define DTAB_MXALIASLN 14 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate /* 119*7c478bd9Sstevel@tonic-gate * Device Management Structure definitions 120*7c478bd9Sstevel@tonic-gate * reservdev Reserved device description 121*7c478bd9Sstevel@tonic-gate */ 122*7c478bd9Sstevel@tonic-gate 123*7c478bd9Sstevel@tonic-gate /* 124*7c478bd9Sstevel@tonic-gate * struct reservdev 125*7c478bd9Sstevel@tonic-gate * 126*7c478bd9Sstevel@tonic-gate * Structure describes a reserved device. 127*7c478bd9Sstevel@tonic-gate * 128*7c478bd9Sstevel@tonic-gate * Elements: 129*7c478bd9Sstevel@tonic-gate * char *devname Alias of the reserved device 130*7c478bd9Sstevel@tonic-gate * pid_t key Key used to reserve the device 131*7c478bd9Sstevel@tonic-gate */ 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate struct reservdev { 134*7c478bd9Sstevel@tonic-gate char *devname; 135*7c478bd9Sstevel@tonic-gate pid_t key; 136*7c478bd9Sstevel@tonic-gate }; 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate /* 139*7c478bd9Sstevel@tonic-gate * Device Management Functions: 140*7c478bd9Sstevel@tonic-gate * 141*7c478bd9Sstevel@tonic-gate * devattr() Returns a device's attribute 142*7c478bd9Sstevel@tonic-gate * devreserv() Reserves a device 143*7c478bd9Sstevel@tonic-gate * devfree() Frees a reserved device 144*7c478bd9Sstevel@tonic-gate * reservdev() Return list of reserved devices 145*7c478bd9Sstevel@tonic-gate * getdev() Get devices that match criteria 146*7c478bd9Sstevel@tonic-gate * getdgrp() Get device-groups containing devices 147*7c478bd9Sstevel@tonic-gate * that match criteria 148*7c478bd9Sstevel@tonic-gate * listdev() List attributes defined for a device 149*7c478bd9Sstevel@tonic-gate * listdgrp() List members of a device-group 150*7c478bd9Sstevel@tonic-gate */ 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate char *devattr(char *, char *); 153*7c478bd9Sstevel@tonic-gate int devfree(int, char *); 154*7c478bd9Sstevel@tonic-gate char **devreserv(int, char ***); 155*7c478bd9Sstevel@tonic-gate char **getdev(char **, char **, int); 156*7c478bd9Sstevel@tonic-gate char **getdgrp(char **, char **, int); 157*7c478bd9Sstevel@tonic-gate char **listdev(char *); 158*7c478bd9Sstevel@tonic-gate char **listdgrp(char *); 159*7c478bd9Sstevel@tonic-gate struct reservdev **reservdev(void); 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate /* 162*7c478bd9Sstevel@tonic-gate * getvol() definitions 163*7c478bd9Sstevel@tonic-gate */ 164*7c478bd9Sstevel@tonic-gate 165*7c478bd9Sstevel@tonic-gate #define DM_BATCH 0x0001 166*7c478bd9Sstevel@tonic-gate #define DM_ELABEL 0x0002 167*7c478bd9Sstevel@tonic-gate #define DM_FORMAT 0x0004 168*7c478bd9Sstevel@tonic-gate #define DM_FORMFS 0x0008 169*7c478bd9Sstevel@tonic-gate #define DM_WLABEL 0x0010 170*7c478bd9Sstevel@tonic-gate #define DM_OLABEL 0x0020 171*7c478bd9Sstevel@tonic-gate 172*7c478bd9Sstevel@tonic-gate int getvol(char *, char *, int, char *); 173*7c478bd9Sstevel@tonic-gate 174*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 175*7c478bd9Sstevel@tonic-gate } 176*7c478bd9Sstevel@tonic-gate #endif 177*7c478bd9Sstevel@tonic-gate 178*7c478bd9Sstevel@tonic-gate #endif /* _DEVMGMT_H */ 179