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