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