xref: /titanic_41/usr/src/head/metamhd.x (revision 1816cb7076d3ec8a78ef9ac9f895574e13c43645)
1 %/*
2 % * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3 % * Use is subject to license terms.
4 % *
5 % * CDDL HEADER START
6 % *
7 % * The contents of this file are subject to the terms of the
8 % * Common Development and Distribution License, Version 1.0 only
9 % * (the "License").  You may not use this file except in compliance
10 % * with the License.
11 % *
12 % * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13 % * or http://www.opensolaris.org/os/licensing.
14 % * See the License for the specific language governing permissions
15 % * and limitations under the License.
16 % *
17 % * When distributing Covered Code, include this CDDL HEADER in each
18 % * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19 % * If applicable, add the following below this CDDL HEADER, with the
20 % * fields enclosed by brackets "[]" replaced with your own identifying
21 % * information: Portions Copyright [yyyy] [name of copyright owner]
22 % *
23 % * CDDL HEADER END
24 % */
25 %
26 %#pragma ident	"%Z%%M%	%I%	%E% SMI"
27 %
28 
29 /* pick up multihost ioctl definitions */
30 %#include <mhdx.h>
31 
32 #ifdef	RPC_SVC
33 %
34 %#include <signal.h>
35 #endif	/* RPC_SVC */
36 
37 #ifdef	RPC_HDR
38 %
39 %/*
40 % * error info
41 % */
42 %#define	MHD_E_MAJORITY	-1	/* couldn't get majority reservation */
43 %#define	MHD_E_RESERVED	-2	/* drive is reserved */
44 #endif	/* RPC_HDR */
45 struct mhd_error_t {
46 	int		errnum;		/* errno or negative error code */
47 	string		name<>;		/* associated name */
48 };
49 
50 #ifdef	RPC_HDR
51 %
52 %/*
53 % * null error constant
54 % */
55 %#define	MHD_NULL_ERROR	{ 0, NULL }
56 #endif	/* RPC_HDR */
57 
58 #ifdef	RPC_XDR
59 %
60 %/*
61 % * Constant null error struct.
62 % */
63 %const		mhd_error_t		mhd_null_error = MHD_NULL_ERROR;
64 #endif	/* RPC_XDR */
65 
66 #ifdef	RPC_HDR
67 %
68 %/*
69 % * External reference to constant null error struct. (decl. in metamhd_xdr.c)
70 % */
71 %extern	const	mhd_error_t		mhd_null_error;
72 #endif	/* RPC_HDR */
73 
74 
75 %
76 %/*
77 % * drivename type
78 % */
79 typedef	string	mhd_drivename_t<>;
80 
81 %
82 %/*
83 % * set definition
84 % */
85 struct mhd_set_t {
86 	string		setname<>;	/* set name */
87 	mhd_drivename_t	drives<>;	/* drive names */
88 };
89 
90 %
91 %/*
92 % * common options
93 % */
94 typedef	u_int	mhd_opts_t;
95 #ifdef	RPC_HDR
96 %
97 %#define	MHD_PARTIAL_SET	0x01	/* partial set definition */
98 %#define	MHD_SERIAL	0x02	/* process disks serially */
99 #endif	/* RPC_HDR */
100 
101 %
102 %/*
103 % * take ownership
104 % */
105 enum mhd_ff_mode_t {
106 	MHD_FF_NONE,			/* no failfast */
107 	MHD_FF_DRIVER,			/* set failfast on each drive */
108 	MHD_FF_DEBUG,			/* use /dev/ff debug mode */
109 	MHD_FF_HALT,			/* use /dev/ff halt mode */
110 	MHD_FF_PANIC			/* use /dev/ff panic mode */
111 };
112 struct mhd_tkown_args_t {
113 	mhd_set_t	set;		/* set definition */
114 	mhd_mhiargs_t	timeouts;	/* timeout values */
115 	mhd_ff_mode_t	ff_mode;	/* failfast mode */
116 	mhd_opts_t	options;	/* options */
117 };
118 
119 %
120 %/*
121 % * release ownership
122 % */
123 struct mhd_relown_args_t {
124 	mhd_set_t	set;		/* set definition */
125 	mhd_opts_t	options;	/* options */
126 };
127 
128 %
129 %/*
130 % * inquire status
131 % */
132 struct mhd_status_args_t {
133 	mhd_set_t	set;		/* set definition */
134 	mhd_opts_t	options;	/* options */
135 };
136 struct mhd_drive_status_t {
137 	mhd_drivename_t	drive;		/* drive name */
138 	int		errnum;		/* drive status */
139 };
140 struct mhd_status_res_t {
141 	mhd_error_t		status;		/* status of command */
142 	mhd_drive_status_t	results<>;	/* drive status */
143 };
144 
145 %/*
146 % * get local drives
147 % */
148 struct mhd_list_args_t {
149 	string		path<>;		/* where to look (or NULL) */
150 	mhd_did_flags_t	flags;		/* what to get */
151 };
152 struct mhd_list_res_t {
153 	mhd_error_t		status;		/* status of command */
154 	mhd_drive_info_list_t	results;	/* drive info list */
155 };
156 
157 %
158 %/*
159 % * authorization info
160 % */
161 const	METAMHD_GID = 14;		/* magic sysadmin group */
162 
163 %
164 %/*
165 % * services available
166 % */
167 program METAMHD {
168 	version METAMHD_VERSION {
169 
170 		mhd_error_t
171 		mhd_tkown(mhd_tkown_args_t)		= 1;
172 
173 		mhd_error_t
174 		mhd_relown(mhd_relown_args_t)		= 2;
175 
176 		mhd_status_res_t
177 		mhd_status(mhd_status_args_t)		= 3;
178 
179 		mhd_list_res_t
180 		mhd_list(mhd_list_args_t)		= 4;
181 
182 	} = 1;
183 } = 100230;
184