obj.mk: rewrite; use "obj" symlinks in unleashed tree
[unleashed.git] / include / devmgmt.h
blob4c37c216d3f6b9d6b15a131dbb6ff7a7c6594d30
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
26 #ifndef _DEVMGMT_H
27 #define _DEVMGMT_H
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
34 * devmgmt.h
36 * Contents:
37 * - Device Management definitions,
38 * - getvol() definitions
42 * Device management definitions
43 * - Default pathnames (relative to installation point)
44 * - Environment variable namess
45 * - Standard field names in the device table
46 * - Flags
47 * - Miscellaneous definitions
52 * Default pathnames (relative to the package installation
53 * point) to the files used by Device Management:
55 * DTAB_PATH Device table
56 * DGRP_PATH Device group table
57 * DVLK_PATH Device reservation table
60 #define DTAB_PATH "/etc/device.tab"
61 #define DGRP_PATH "/etc/dgroup.tab"
62 #define DVLK_PATH "/etc/devlkfile"
66 * Names of environment variables
68 * OAM_DEVTAB Name of variable that defines the pathname to
69 * the device-table file
70 * OAM_DGROUP Name of variable that defines the pathname to
71 * the device-group table file
72 * OAM_DEVLKTAB Name of variable that defines the pathname to
73 * the device-reservation table file
76 #define OAM_DEVTAB "OAM_DEVTAB"
77 #define OAM_DGROUP "OAM_DGROUP"
78 #define OAM_DEVLKTAB "OAM_DEVLKTAB"
82 * Standard field names in the device table
85 #define DTAB_ALIAS "alias"
86 #define DTAB_CDEVICE "cdevice"
87 #define DTAB_BDEVICE "bdevice"
88 #define DTAB_PATHNAME "pathname"
92 * Flags:
93 * For getdev() and getdgrp():
94 * DTAB_ANDCRITERIA Devices must meet all criteria
95 * instead of any of the criteria
96 * DTAB_EXCLUDEFLAG The list of devices or device groups
97 * is the list that is to be excluded,
98 * not those to select from.
99 * DTAB_LISTALL List all device groups, even those that
100 * have no valid members (getdgrp() only).
103 #define DTAB_ANDCRITERIA 0x01
104 #define DTAB_EXCLUDEFLAG 0x02
105 #define DTAB_LISTALL 0x04
109 * Miscellaneous Definitions
111 * DTAB_MXALIASLN Maximum alias length
114 #define DTAB_MXALIASLN 14
117 * Device Management Structure definitions
118 * reservdev Reserved device description
122 * struct reservdev
124 * Structure describes a reserved device.
126 * Elements:
127 * char *devname Alias of the reserved device
128 * pid_t key Key used to reserve the device
131 struct reservdev {
132 char *devname;
133 pid_t key;
137 * Device Management Functions:
139 * devattr() Returns a device's attribute
140 * devreserv() Reserves a device
141 * devfree() Frees a reserved device
142 * reservdev() Return list of reserved devices
143 * getdev() Get devices that match criteria
144 * getdgrp() Get device-groups containing devices
145 * that match criteria
146 * listdev() List attributes defined for a device
147 * listdgrp() List members of a device-group
150 char *devattr(char *, char *);
151 int devfree(int, char *);
152 char **devreserv(int, char ***);
153 char **getdev(char **, char **, int);
154 char **getdgrp(char **, char **, int);
155 char **listdev(char *);
156 char **listdgrp(char *);
157 struct reservdev **reservdev(void);
160 * getvol() definitions
163 #define DM_BATCH 0x0001
164 #define DM_ELABEL 0x0002
165 #define DM_FORMAT 0x0004
166 #define DM_FORMFS 0x0008
167 #define DM_WLABEL 0x0010
168 #define DM_OLABEL 0x0020
170 int getvol(char *, char *, int, char *);
172 #ifdef __cplusplus
174 #endif
176 #endif /* _DEVMGMT_H */