17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 23*b4203d75SMarcel Telka /* All Rights Reserved */ 247c478bd9Sstevel@tonic-gate 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _DEVMGMT_H 277c478bd9Sstevel@tonic-gate #define _DEVMGMT_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * devmgmt.h 357c478bd9Sstevel@tonic-gate * 367c478bd9Sstevel@tonic-gate * Contents: 377c478bd9Sstevel@tonic-gate * - Device Management definitions, 387c478bd9Sstevel@tonic-gate * - getvol() definitions 397c478bd9Sstevel@tonic-gate */ 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * Device management definitions 437c478bd9Sstevel@tonic-gate * - Default pathnames (relative to installation point) 447c478bd9Sstevel@tonic-gate * - Environment variable namess 457c478bd9Sstevel@tonic-gate * - Standard field names in the device table 467c478bd9Sstevel@tonic-gate * - Flags 477c478bd9Sstevel@tonic-gate * - Miscellaneous definitions 487c478bd9Sstevel@tonic-gate */ 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* 527c478bd9Sstevel@tonic-gate * Default pathnames (relative to the package installation 537c478bd9Sstevel@tonic-gate * point) to the files used by Device Management: 547c478bd9Sstevel@tonic-gate * 557c478bd9Sstevel@tonic-gate * DTAB_PATH Device table 567c478bd9Sstevel@tonic-gate * DGRP_PATH Device group table 577c478bd9Sstevel@tonic-gate * DVLK_PATH Device reservation table 587c478bd9Sstevel@tonic-gate */ 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate #define DTAB_PATH "/etc/device.tab" 617c478bd9Sstevel@tonic-gate #define DGRP_PATH "/etc/dgroup.tab" 627c478bd9Sstevel@tonic-gate #define DVLK_PATH "/etc/devlkfile" 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate /* 667c478bd9Sstevel@tonic-gate * Names of environment variables 677c478bd9Sstevel@tonic-gate * 687c478bd9Sstevel@tonic-gate * OAM_DEVTAB Name of variable that defines the pathname to 697c478bd9Sstevel@tonic-gate * the device-table file 707c478bd9Sstevel@tonic-gate * OAM_DGROUP Name of variable that defines the pathname to 717c478bd9Sstevel@tonic-gate * the device-group table file 727c478bd9Sstevel@tonic-gate * OAM_DEVLKTAB Name of variable that defines the pathname to 737c478bd9Sstevel@tonic-gate * the device-reservation table file 747c478bd9Sstevel@tonic-gate */ 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate #define OAM_DEVTAB "OAM_DEVTAB" 777c478bd9Sstevel@tonic-gate #define OAM_DGROUP "OAM_DGROUP" 787c478bd9Sstevel@tonic-gate #define OAM_DEVLKTAB "OAM_DEVLKTAB" 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate /* 827c478bd9Sstevel@tonic-gate * Standard field names in the device table 837c478bd9Sstevel@tonic-gate */ 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate #define DTAB_ALIAS "alias" 867c478bd9Sstevel@tonic-gate #define DTAB_CDEVICE "cdevice" 877c478bd9Sstevel@tonic-gate #define DTAB_BDEVICE "bdevice" 887c478bd9Sstevel@tonic-gate #define DTAB_PATHNAME "pathname" 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* 927c478bd9Sstevel@tonic-gate * Flags: 937c478bd9Sstevel@tonic-gate * For getdev() and getdgrp(): 947c478bd9Sstevel@tonic-gate * DTAB_ANDCRITERIA Devices must meet all criteria 957c478bd9Sstevel@tonic-gate * instead of any of the criteria 967c478bd9Sstevel@tonic-gate * DTAB_EXCLUDEFLAG The list of devices or device groups 977c478bd9Sstevel@tonic-gate * is the list that is to be excluded, 987c478bd9Sstevel@tonic-gate * not those to select from. 997c478bd9Sstevel@tonic-gate * DTAB_LISTALL List all device groups, even those that 1007c478bd9Sstevel@tonic-gate * have no valid members (getdgrp() only). 1017c478bd9Sstevel@tonic-gate */ 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #define DTAB_ANDCRITERIA 0x01 1047c478bd9Sstevel@tonic-gate #define DTAB_EXCLUDEFLAG 0x02 1057c478bd9Sstevel@tonic-gate #define DTAB_LISTALL 0x04 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate /* 1097c478bd9Sstevel@tonic-gate * Miscellaneous Definitions 1107c478bd9Sstevel@tonic-gate * 1117c478bd9Sstevel@tonic-gate * DTAB_MXALIASLN Maximum alias length 1127c478bd9Sstevel@tonic-gate */ 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate #define DTAB_MXALIASLN 14 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate /* 1177c478bd9Sstevel@tonic-gate * Device Management Structure definitions 1187c478bd9Sstevel@tonic-gate * reservdev Reserved device description 1197c478bd9Sstevel@tonic-gate */ 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* 1227c478bd9Sstevel@tonic-gate * struct reservdev 1237c478bd9Sstevel@tonic-gate * 1247c478bd9Sstevel@tonic-gate * Structure describes a reserved device. 1257c478bd9Sstevel@tonic-gate * 1267c478bd9Sstevel@tonic-gate * Elements: 1277c478bd9Sstevel@tonic-gate * char *devname Alias of the reserved device 1287c478bd9Sstevel@tonic-gate * pid_t key Key used to reserve the device 1297c478bd9Sstevel@tonic-gate */ 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate struct reservdev { 1327c478bd9Sstevel@tonic-gate char *devname; 1337c478bd9Sstevel@tonic-gate pid_t key; 1347c478bd9Sstevel@tonic-gate }; 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate /* 1377c478bd9Sstevel@tonic-gate * Device Management Functions: 1387c478bd9Sstevel@tonic-gate * 1397c478bd9Sstevel@tonic-gate * devattr() Returns a device's attribute 1407c478bd9Sstevel@tonic-gate * devreserv() Reserves a device 1417c478bd9Sstevel@tonic-gate * devfree() Frees a reserved device 1427c478bd9Sstevel@tonic-gate * reservdev() Return list of reserved devices 1437c478bd9Sstevel@tonic-gate * getdev() Get devices that match criteria 1447c478bd9Sstevel@tonic-gate * getdgrp() Get device-groups containing devices 1457c478bd9Sstevel@tonic-gate * that match criteria 1467c478bd9Sstevel@tonic-gate * listdev() List attributes defined for a device 1477c478bd9Sstevel@tonic-gate * listdgrp() List members of a device-group 1487c478bd9Sstevel@tonic-gate */ 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate char *devattr(char *, char *); 1517c478bd9Sstevel@tonic-gate int devfree(int, char *); 1527c478bd9Sstevel@tonic-gate char **devreserv(int, char ***); 1537c478bd9Sstevel@tonic-gate char **getdev(char **, char **, int); 1547c478bd9Sstevel@tonic-gate char **getdgrp(char **, char **, int); 1557c478bd9Sstevel@tonic-gate char **listdev(char *); 1567c478bd9Sstevel@tonic-gate char **listdgrp(char *); 1577c478bd9Sstevel@tonic-gate struct reservdev **reservdev(void); 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate /* 1607c478bd9Sstevel@tonic-gate * getvol() definitions 1617c478bd9Sstevel@tonic-gate */ 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate #define DM_BATCH 0x0001 1647c478bd9Sstevel@tonic-gate #define DM_ELABEL 0x0002 1657c478bd9Sstevel@tonic-gate #define DM_FORMAT 0x0004 1667c478bd9Sstevel@tonic-gate #define DM_FORMFS 0x0008 1677c478bd9Sstevel@tonic-gate #define DM_WLABEL 0x0010 1687c478bd9Sstevel@tonic-gate #define DM_OLABEL 0x0020 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate int getvol(char *, char *, int, char *); 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1737c478bd9Sstevel@tonic-gate } 1747c478bd9Sstevel@tonic-gate #endif 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate #endif /* _DEVMGMT_H */ 177