xref: /titanic_41/usr/src/uts/common/sys/lvm/metamed.x (revision ed5289f91b9bf164dccd6c75398362be77a4478d)
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 %#include <sys/types.h>
29 %#include <sys/errno.h>
30 %#include <sys/utsname.h>
31 #ifndef _KERNEL
32 %#include <netdb.h>
33 #endif
34 %
35 %#include <sys/lvm/md_basic.h>
36 
37 #ifdef	RPC_SVC
38 %
39 %#include <signal.h>
40 #endif	/* RPC_SVC */
41 
42 %
43 %/*
44 % * mediator (med) errors, definition of MDE_MED_HOSTNOMED must be changed
45 % * when new errors are added, since MDE_MED_NOERROR has to come out to
46 % * be zero!
47 % */
48 enum md_med_errno_t {
49 	MDE_MED_HOSTNOMED = -16,
50 	MDE_MED_DBNOTINIT,
51 	MDE_MED_DBSZBAD,
52 	MDE_MED_DBKEYADDFAIL,
53 	MDE_MED_DBKEYDELFAIL,
54 	MDE_MED_DBHDRSZBAD,
55 	MDE_MED_DBHDRMAGBAD,
56 	MDE_MED_DBHDRREVBAD,
57 	MDE_MED_DBHDRCKSBAD,
58 	MDE_MED_DBRECSZBAD,
59 	MDE_MED_DBRECMAGBAD,
60 	MDE_MED_DBRECREVBAD,
61 	MDE_MED_DBRECCKSBAD,
62 	MDE_MED_DBRECOFFBAD,
63 	MDE_MED_DBRECNOENT,
64 	MDE_MED_DBARGSMISMATCH,
65 	MDE_MED_NOERROR
66 };
67 
68 struct med_err_t {
69 	int			med_errno; /* errno or negative error code */
70 	string			med_node<>;	/* associated node */
71 	string			med_misc<>;	/* misc text */
72 };
73 
74 #ifdef	RPC_HDR
75 %
76 %/*
77 % * Null error structure initializer.
78 % */
79 %#define	MED_NULL_ERR	{ 0, NULL, NULL }
80 %#define	MD_MED_DEF_TO	{2, 0}		/* 2 seconds */
81 %#define	MD_MED_PMAP_TO	{5, 0}		/* 5 seconds */
82 %
83 %/*
84 % * Mediator Magic Number and Data Revision String
85 % */
86 %#define	MED_DATA_MAGIC	0x6d656461
87 %#define	MED_DATA_REV	0x10000000
88 %
89 %#define	MED_REC_MAGIC	0x6d657265
90 %#define	MED_REC_REV	0x10000000
91 %
92 %#define	MED_DB_MAGIC	0x6d656462
93 %#define	MED_DB_REV	0x10000000
94 %
95 %#define	METAETCDIR	"/etc/lvm/"
96 %#define	MED_DB_FILE	METAETCDIR "meddb"
97 %
98 %extern	char	*med_errnum_to_str(int errnum);
99 #endif	/* RPC_HDR */
100 
101 %/* Mediator records in MN diskset have all callers set to multiowner */
102 %#define	MED_MN_CALLER	"multiowner"
103 %
104 
105 #ifdef	RPC_XDR
106 %
107 %/* Start - Avoid duplicate definitions, but get the xdr calls right */
108 %#if 0
109 #include "meta_arr.x"
110 %#endif	/* 0 */
111 %/* End   - Avoid duplicate definitions, but get the xdr calls right */
112 %
113 #endif	/* RPC_XDR */
114 
115 #ifdef	RPC_HDR
116 struct	med_db_hdr_t	{
117 	u_int			med_dbh_mag;
118 	u_int			med_dbh_rev;
119 	u_int			med_dbh_cks;
120 	u_int			med_dbh_nm;
121 };
122 
123 %
124 %/*
125 % * Flags for the mediator data
126 % */
127 %
128 %#define	MED_DFL_GOLDEN		0x0001
129 %#define	MED_DFL_ERROR		0x0002
130 %
131 #endif	/* RPC_HDR */
132 
133 %
134 struct	med_data_t	{
135 	u_int			med_dat_mag;
136 	u_int			med_dat_rev;
137 	u_int			med_dat_cks;
138 	u_int			med_dat_fl;
139 	u_int			med_dat_cc;
140 	set_t			med_dat_sn;
141 	struct	timeval		med_dat_id;
142 	int			med_dat_spare;
143 };
144 
145 #ifdef	RPC_HDR
146 %
147 %/*
148 % * List of mediator data
149 % */
150 %
151 struct med_data_lst_t	{
152 	med_data_lst_t		*mdl_nx;
153 	med_data_t		*mdl_med;
154 };
155 
156 %
157 %/*
158 % * Flags for the mediator record
159 % */
160 %
161 %#define	MED_RFL_DEL		0x0001
162 %
163 #endif	/* RPC_HDR */
164 
165 %
166 #ifndef _KERNEL
167 struct	med_rec_t	{
168 	u_int			med_rec_mag;
169 	u_int			med_rec_rev;
170 	u_int			med_rec_cks;
171 	u_int			med_rec_fl;
172 	set_t			med_rec_sn;
173 	md_set_nm_t		med_rec_snm;
174 	md_node_nm_arr_t	med_rec_nodes;
175 	md_h_arr_t		med_rec_meds;
176 	med_data_t		med_rec_data;
177 	off_t			med_rec_foff;
178 };
179 #endif /* !_KERNEL */
180 
181 struct	med_med_t	{
182 	set_t			med_setno;
183 	string			med_setname<>;
184 	string			med_caller<>;
185 };
186 
187 struct	med_args_t	{
188 	med_med_t		med;
189 };
190 
191 struct	med_res_t	{
192 	med_err_t		med_status;
193 	med_med_t		med;
194 };
195 
196 struct	med_get_data_res_t	{
197 	med_err_t		med_status;
198 	med_data_t		med_data;
199 };
200 
201 struct	med_upd_data_args_t	{
202 	med_med_t		med;
203 	med_data_t		med_data;
204 };
205 
206 #ifndef _KERNEL
207 struct	med_get_rec_res_t	{
208 	med_err_t		med_status;
209 	med_med_t		med;
210 	med_rec_t		med_rec;
211 };
212 
213 struct	med_upd_rec_args_t	{
214 	u_int			med_flags;
215 	med_med_t		med;
216 	med_rec_t		med_rec;
217 };
218 #endif /* !_KERNEL */
219 
220 struct med_hnm_res_t {
221 	med_err_t		med_status;
222 	string			med_hnm<>;
223 };
224 
225 #ifdef	RPC_XDR
226 %
227 %/*
228 % * Constant null error struct.
229 % */
230 %const		med_err_t		med_null_err = MED_NULL_ERR;
231 %const	struct	timeval			md_med_def_timeout = MD_MED_DEF_TO;
232 %const	struct	timeval			md_med_pmap_timeout = MD_MED_PMAP_TO;
233 #endif	/* RPC_XDR */
234 
235 #ifdef	RPC_HDR
236 %
237 %/*
238 % * External reference to constant null error struct. (declared in med_xdr.c)
239 % */
240 %extern	const	med_err_t		med_null_err;
241 %extern	const	struct	timeval		md_med_def_timeout;
242 %extern	const	struct	timeval		md_med_pmap_timeout;
243 %
244 %/*
245 % * Some useful defines
246 % */
247 %#define	MED_SERVNAME	"rpc.metamedd"
248 %#define	MED_SVC		"metamed"
249 %
250 %/*
251 % * authorization info
252 % */
253 const	MED_GID = 14;		/* mag sysadmin group */
254 #endif	/* RPC_HDR */
255 
256 program MED_PROG {
257 	version MED_VERS {
258 		med_err_t MED_NULL(void)				= 0;
259 		med_err_t MED_UPD_DATA(med_upd_data_args_t)		= 1;
260 		med_get_data_res_t MED_GET_DATA(med_args_t)		= 2;
261 #ifndef _KERNEL
262 		med_err_t MED_UPD_REC(med_upd_rec_args_t)		= 3;
263 		med_get_rec_res_t MED_GET_REC(med_args_t)		= 4;
264 #endif
265 		med_hnm_res_t MED_HOSTNAME(void)			= 5;
266 	} = 1;
267 } = 100242;
268 
269 #ifdef  RPC_HDR
270 #ifdef	_KERNEL
271 %
272 %extern	int		upd_med_hosts(md_hi_arr_t *mp, char *setname,
273 %			    med_data_t *meddp, char *caller);
274 %extern	med_data_lst_t 	*get_med_host_data(md_hi_arr_t *mp, char *setname,
275 %			    set_t setno);
276 #endif	/* ! _KERNEL */
277 #endif  /* RPC_HDR */
278