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
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]
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
33 #pragma ident "%Z%%M% %I% %E% SMI"
44 * This header file is local to the liboam component
45 * and should not contain any data that may need to
46 * be reference anywhere. The definitions here are used
47 * to reference the device tables and the device-group
52 * Constant definitions
53 * NULL Manifest constant NULL (null-address)
54 * TRUE Boolean TRUE value
55 * FALSE Boolean FALSE value
56 * DTAB_BUFSIZ Initial buffersize for reading device table records
57 * DTAB_BUFINC Amount to increase device table record buffer
58 * DGRP_BUFSIZ Initial buffersize for reading devgrp table records
59 * DGRP_BUFINC Amount to increase device-group table record buffer
60 * XTND_MAXCNT Maximum extend count (may have insane tables)
61 * DTAB_ESCS Characters that are escaped in fields in the devtab
76 #define DTAB_BUFSIZ 512
77 #define DTAB_BUFINC 512
78 #define DGRP_BUFSIZ 512
79 #define DGRP_BUFINC 512
80 #define XTND_MAXCNT 16
82 #define DTAB_ESCS ":\\\"\n"
85 * oam_devtab File descriptor of the open device table
88 extern FILE *oam_devtab
;
89 extern FILE *oam_dgroup
;
92 * Structure definitions for device table records:
93 * devtabent Describes an entry in the device table
94 * dgrpent Describes an entry in the device-group table
95 * attrval Describes an attribute/value pair
101 * Describes an entry in the device table.
103 * entryno This record's entry number in the device table
104 * comment Comment flag, TRUE if record is a comment
105 * alias The device's alias
106 * cdevice A pathname to the inode describing the device as
107 * a character-special device
108 * bdevice A pathname to the inode describing the device as
109 * a block-special device
110 * pathname A pathname to the device (not char or blk special)
111 * attrstr The character-string containing the attributes
112 * attrlist The address of the first attribute description
116 int entryno
; /* Entry number of this record */
117 int comment
; /* Comment flag */
118 char *alias
; /* Alias of the device */
119 char *cdevice
; /* Character device pathname */
120 char *bdevice
; /* Block device pathname */
121 char *pathname
; /* Vanilla pathname */
122 char *attrstr
; /* String containing attributes */
123 struct attrval
*attrlist
; /* Addr of 1st attribute description */
129 * Describes an attribute-value pair
131 * char *attr Pointer to the name of the attribute
132 * char *val Pointer to the name of the value of the attr
133 * struct attrval *next Pointer to the next item in the list
137 char *attr
; /* Attribute name */
138 char *val
; /* Value of the attribute */
139 struct attrval
*next
; /* Next attrval in list */
143 * Structure definitions for device-group records:
144 * struct dgrptabent Describes a record in the device-group table
145 * struct member Describes a member of a device group
150 * entryno The entry number of this record
151 * comment Comment flag, TRUE if record is a comment
152 * name The name of the device group
153 * memberspace The buffer containing the members of the
155 * membership Pointer to the head of the list of
156 * members in the group.
160 int entryno
; /* Entry number of this record */
161 int comment
; /* TRUE if a comment record */
162 char *name
; /* Device group name */
163 char *dataspace
; /* Buffer containing membership */
164 struct member
*membership
; /* Ptr to top of membership list */
170 * name Member name (a device alias or pathname)
171 * next Ptr to next item in the list
175 char *name
; /* Member name */
176 struct member
*next
; /* Next member in the list */
180 * Global function and data definitions:
181 * _setdevtab() Rewinds the open device table
182 * _enddevtab() Closes the open device table
183 * _getdevtabent() Gets the next device table entry
184 * _freedevtabent() Frees space allocated to a device-table entry
185 * _getdevrec() Gets a specific device table entry
186 * _opendevtab() Open the device table
187 * _devtabpath() Get the pathname of the device table file
189 * _setdgrptab() Rewind the open device-group table
190 * _enddgrptab() Close the open device table
191 * _getdgrptabent() Get the next device-group table entry
192 * _freedgrptabent() Frees space alloced to a dev-grp table entry
193 * _getdgrprec() Gets a specific device-group table entry
194 * _opendgrptab() Open the device group table
195 * _dgrptabpath() Get the pathname of the device group table file
197 * _openlkfile() Open device lock file
198 * rsvtabpath() Get device lock file pathname
199 * _closelkfile() Close device lock file
201 * _validalias() Determine if a character-string is a valid alias
202 * unreserv() Remove a device reservation
205 void _setdevtab(void);
206 void _enddevtab(void);
207 struct devtabent
*_getdevtabent(void);
208 void _freedevtabent(struct devtabent
*);
209 struct devtabent
*_getdevrec(char *);
210 int _opendevtab(char *);
211 char *_devtabpath(void);
213 void _setdgrptab(void);
214 void _enddgrptab(void);
215 struct dgrptabent
*_getdgrptabent(void);
216 void _freedgrptabent(struct dgrptabent
*);
217 struct dgrptabent
*_getdgrprec(char *);
218 int _opendgrptab(char *);
219 char *_dgrptabpath(void);
221 int _openlkfile(void);
222 char *_rsvtabpath(void);
223 int _closelkfile(void);
225 int _validalias(char *);
226 int unreserv(int, char *);
228 extern int _adddevtabrec(char *, char **);
229 extern int _moddevtabrec(char *, char **);
230 extern int _putdevtabrec(FILE *stream
, struct devtabent
*rec
);
231 extern int _rmdevtabattrs(char *, char **, char ***);
232 extern int _rmdevtabrec(char *);
234 extern int _adddgrptabrec(char *dgrp
, char **members
);
235 extern int _putdgrptabrec(FILE *stream
, struct dgrptabent
*rec
);
236 extern int _rmdgrpmems(char *dgrp
, char **mems
, char ***notfounds
);
237 extern int _rmdgrptabrec(char *dgrp
);
243 #endif /* _DEVTAB_H */