xref: /titanic_41/usr/src/uts/common/sys/lvm/mdmn_commd.x (revision d89fccd8788afe1e920f842edd883fe192a1b8fe)
1 %/*
2 % * CDDL HEADER START
3 % *
4 % * The contents of this file are subject to the terms of the
5 % * Common Development and Distribution License (the "License").
6 % * You may not use this file except in compliance with the License.
7 % *
8 % * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 % * or http://www.opensolaris.org/os/licensing.
10 % * See the License for the specific language governing permissions
11 % * and limitations under the License.
12 % *
13 % * When distributing Covered Code, include this CDDL HEADER in each
14 % * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 % * If applicable, add the following below this CDDL HEADER, with the
16 % * fields enclosed by brackets "[]" replaced with your own identifying
17 % * information: Portions Copyright [yyyy] [name of copyright owner]
18 % *
19 % * CDDL HEADER END
20 % */
21 %
22 %/*
23 % * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24 % * Use is subject to license terms.
25 % */
26 %
27 %#pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 %#include <sys/types.h>
30 %#include <sys/types32.h>
31 %#include <sys/lvm/md_basic.h>
32 %#include <sys/lvm/mdio.h>
33 %#ifndef _KERNEL
34 %#include <mdiox.h>
35 %#include <meta_basic.h>
36 %extern  bool_t  xdr_md_set_params_t(XDR *xdrs, md_set_params_t *objp);
37 %extern  bool_t  xdr_mp_unit_t(XDR *xdrs, mp_unit_t *objp);
38 %extern  bool_t  xdr_diskaddr_t(XDR *xdrs, diskaddr_t *objp);
39 %extern  bool_t  xdr_md_dev64_t(XDR *xdrs, md_dev64_t *objp);
40 %extern  bool_t  xdr_daddr_t(XDR *xdrs, daddr_t *objp);
41 %extern  bool_t  xdr_daddr32_t(XDR *xdrs, daddr32_t *objp);
42 %#else
43 %#include <sys/lvm/md_mdiox.h>
44 %#endif /* ! _KERNEL */
45 
46 /* every message handler must have these parameters */
47 %#define	HANDLER_PARMS md_mn_msg_t *msg, uint_t flag, md_mn_result_t *res
48 
49 
50 /* every submessage generator must have these parameters */
51 %#define	SMGEN_PARMS md_mn_msg_t *msg, md_mn_msg_t **msglist
52 
53 /* when ever a new message type is added, an entry for it must be made in the master msg_table (defined in mdmn_commd_server.c*/
54 
55 enum md_mn_msgtype_t {
56         MD_MN_MSG_NULL = 0,  /* special message type for internal use only */
57 	MD_MN_MSG_TEST1,
58 	MD_MN_MSG_TEST2,
59 	MD_MN_MSG_TEST3,
60 	MD_MN_MSG_TEST4,
61 	MD_MN_MSG_TEST5,
62 	MD_MN_MSG_TEST6,
63 	MD_MN_MSG_BC_CMD,		/* Send metacommand */
64 	MD_MN_MSG_BC_CMD_RETRY,		/* Send metacommand, retry on busy */
65 	MD_MN_MSG_CLU_CHECK,
66 	MD_MN_MSG_CLU_LOCK,
67 	MD_MN_MSG_CLU_UNLOCK,
68 	MD_MN_MSG_REQUIRE_OWNER,	/* Request to become Mirror owner */
69 	MD_MN_MSG_CHOOSE_OWNER,		/* Request to allocate a resync owner */
70 	MD_MN_MSG_CHANGE_OWNER,		/* Change owner to a specific node */
71 	MD_MN_MSG_SUSPEND_WRITES,	/* Suspend writes to a mirror */
72 	MD_MN_MSG_STATE_UPDATE_RESWR,	/* Ch state of comp & resume writes */
73 	MD_MN_MSG_STATE_UPDATE,		/* Susp writes/Change state of comp */
74 	MD_MN_MSG_ALLOCATE_HOTSPARE,	/* Allocate hotspare for mirror comp */
75 	MD_MN_MSG_RESYNC_STARTING,	/* Resync thread starting */
76 	MD_MN_MSG_RESYNC_NEXT,		/* Next resync region */
77 	MD_MN_MSG_RESYNC_FINISH,	/* Resync thread finished */
78 	MD_MN_MSG_RESYNC_PHASE_DONE,	/* End of resync phase */
79 	MD_MN_MSG_SET_CAP,		/* Set capability, eg ABR */
80 	MD_MN_MSG_VERBOSITY,		/* set various levels of debug */
81 	MD_MN_MSG_MDDB_PARSE,		/* Slave to reparse portion of mddb */
82 	MD_MN_MSG_MDDB_BLOCK,		/* Block parse/recs on master/slave */
83 	MD_MN_MSG_META_DB_ATTACH,	/* Master message to add new mddb */
84 	MD_MN_MSG_SM_MDDB_ATTACH,	/* Submessage to add new mddb */
85 	MD_MN_MSG_META_DB_DETACH,	/* Master message to delete mddb */
86 	MD_MN_MSG_SM_MDDB_DETACH,	/* Submessage to delete mddb */
87 	MD_MN_MSG_META_DB_NEWSIDE,	/* Node adding mddb side info */
88 	MD_MN_MSG_META_DB_DELSIDE,	/* Node deleting mddb side info */
89 	MD_MN_MSG_META_MD_ADDSIDE,	/* Node adding md side info */
90 	MD_MN_MSG_META_MD_DELSIDE,	/* Node deleting md side info */
91 	MD_MN_MSG_MDDB_OPTRECERR,	/* Node detects opt rec error */
92 	MD_MN_MSG_ABORT,		/* Stop sending messages to any node */
93 	MD_MN_MSG_STATE_UPDATE_RESWR2,	/* UPDATE_RESWR for watermark updates */
94 	MD_MN_MSG_STATE_UPDATE2,	/* STATE_UPDATE for watermark updates */
95 	MD_MN_MSG_ALLOCATE_HOTSPARE2,	/* ALLOCATE_HOTSPARE for wm updates */
96 	MD_MN_MSG_IOCSET,		/* Send IOCSET ioctl */
97 	MD_MN_MSG_SP_SETSTAT,		/* Update status of softpart */
98 	MD_MN_MSG_ADDKEYNAME,		/* Add key */
99 	MD_MN_MSG_DELKEYNAME,		/* Delete key */
100 	MD_MN_MSG_GET_TSTATE,		/* Get tstate from master */
101 	MD_MN_MSG_GET_MIRROR_STATE,	/* Get submirror state from master */
102 	MD_MN_MSG_SP_SETSTAT2,		/* Update softpart status on error */
103 	MD_MN_MSG_SETSYNC,		/* Set resync status */
104 	MD_MN_MSG_POKE_HOTSPARES,	/* Call poke_hotspares */
105 	MD_MN_MSG_ADDMDNAME,		/* Add metadevice name */
106 	MD_MN_NMESSAGES /* insert elements before */
107 };
108 
109 /*
110  * A message of class X may trigger only messages of classes higher than X
111  * Feel free to change the order here. As long as you leave MD_MSG_CL_NULL
112  * and NCLASSES, of course
113  */
114 
115 enum md_mn_msgclass_t {
116 	MD_MSG_CLASS0 = 0,  /* special message class for internal use only */
117 	MD_MSG_CLASS1,
118 	MD_MSG_CLASS2,
119 	MD_MSG_CLASS3,
120 	MD_MSG_CLASS4,
121 	MD_MSG_CLASS5,
122 	MD_MSG_CLASS6,
123 	MD_MSG_CLASS7,
124 	MD_MN_NCLASSES /* insert elements before */
125 };
126 
127 %/*
128 % * The following are needed for things like suspend and resume when the
129 % * operation is to be applied to all classes / all sets.
130 % */
131 %#define	MD_COMM_ALL_CLASSES MD_MSG_CLASS0
132 %#define	MD_COMM_ALL_SETS 0
133 
134 /* This is for state changes of submirror components */
135 struct md_mn_msg_stch_t {
136         minor_t		msg_stch_mnum;		/* minor number of dev */
137 	int		msg_stch_sm;		/* submirror involved */
138 	int		msg_stch_comp;		/* component */
139 	int		msg_stch_new_state;	/* new state for comp */
140 	mddb_recid_t	msg_stch_hs_id;		/* hs_id at time of call */
141 };
142 
143 
144 /* This is for suspending writes to a mirror */
145 struct md_mn_msg_suspwr_t {
146         minor_t         msg_suspwr_mnum;        /* minor number of dev */
147 };
148 
149 /* Message format for choosing a resync owner */
150 struct md_mn_msg_chooseid_t {
151 	minor_t	msg_chooseid_mnum;	/* minor num of dev */
152 	int	msg_chooseid_rcnt;	/* resync count for set */
153 	int	msg_chooseid_set_node;	/* 1 => use rcnt as nodeid for owner */
154 };
155 
156 /* Message format for changing a resync owner */
157 struct md_mn_msg_chowner_t {
158 	minor_t	msg_chowner_mnum;	/* minor num of dev */
159 	int	msg_chowner_nodeid;	/* node id of new owner */
160 };
161 
162 /* Message format for setting metadevice capability */
163 struct md_mn_msg_setcap_t {
164 	char msg_setcap_driver[MD_DRIVERNAMELEN];	/* Driver name */
165 	minor_t	msg_setcap_mnum;	/* minor num of dev */
166 	u_int	msg_setcap_set;		/* new settings */
167 };
168 
169 /* This is for setting the verbosity level (MD_MN_MSG_VERBOSITY) */
170 struct md_mn_verbose_t {
171 	set_t			mmv_setno;
172 	md_mn_msgclass_t	mmv_class;
173 	u_int			mmv_what;
174 };
175 
176 /* What do we want to debug ? (mmv_what) */
177 %/* turn off everything */
178 %#define	MD_MMV_NULL 		0x00000000
179 %/* initialization of nodes / rpc clients */
180 %#define	MD_MMV_INIT		0x00000001
181 %/* mdmn_send_svc_1 related / early stage */
182 %#define	MD_MMV_SEND		0x00000002
183 %/* mdmn_work_svc_1 stuff on master */
184 %#define	MD_MMV_WORK		0x00000004
185 %/* mdmn_master_process_msg stuff */
186 %#define	MD_MMV_PROC_M		0x00000008
187 %/* mdmn_slave_process_msg stuff */
188 %#define	MD_MMV_PROC_S		0x00000010
189 %/* wakeup_master  */
190 %#define	MD_MMV_WAKE_M		0x00000020
191 %/* wakeup_initiator */
192 %#define	MD_MMV_WAKE_I		0x00000040
193 %/* Misc stuff*/
194 %#define	MD_MMV_MISC		0x00000080
195 %/* turn on everything */
196 %#define	MD_MMV_ALL		0x0000ffff
197 %/* write to syslog instead of output file, for critical messages */
198 %#define	MD_MMV_SYSLOG		0x10000000
199 %/* enable timestamps */
200 %#define	MD_MMV_TIMESTAMP	0x20000000
201 
202 
203 /* Message format for allocating hotspares */
204 struct md_mn_msg_allochsp_t {
205 	minor_t msg_allochsp_mnum;		/* minor num of dev */
206 	int msg_allochsp_sm;			/* submirror index */
207 	int msg_allochsp_comp;			/* component index */
208 	mddb_recid_t msg_allochsp_hs_id;	/* hotspare id */
209 };
210 
211 /* Message format for resync messages */
212 struct md_mn_msg_resync_t {
213 	minor_t msg_resync_mnum;		/* minor num of dev */
214 	int msg_resync_type;			/* resync type */
215 	diskaddr_t msg_resync_start;		/* start of resync region */
216 	diskaddr_t msg_resync_rsize;		/* size of resync region */
217 	diskaddr_t msg_resync_done;		/* count of resync done */
218 	diskaddr_t msg_resync_2_do;		/* total size of resync */
219 	int msg_originator;			/* message originator */
220 	int	msg_resync_flags;		/* resync flags */
221 	sm_state_t	msg_sm_state[NMIRROR];	/* submirror state */
222 	sm_flags_t	msg_sm_flags[NMIRROR];	/* submirror flags */
223 };
224 
225 %#define	MD_MSGF_DEFAULT_FLAGS		0x00000000
226 
227 /* Message format for blocking/unblocking MDDB parsing and record changes  */
228 struct md_mn_msg_mddb_block_t {
229 	int	msg_block_flags;
230 };
231 
232 /* Message format for MDDB re-parsing */
233 struct md_mn_msg_mddb_parse_t {
234 	int	msg_parse_flags;	/* flags describe part to reparse */
235 	int	msg_lb_flags[50];
236 };
237 
238 /* Message format for MDDB attach */
239 struct md_mn_msg_meta_db_attach_t {
240 	md_dev64_t	msg_l_dev;
241 	int		msg_cnt;
242 	int		msg_dbsize;
243 	char		msg_dname[16];
244 	md_splitname	msg_splitname;
245 	u_int		msg_options;
246 	char		msg_devid[1];	/* unused for now, for future */
247 					/* must be last element */
248 };
249 
250 /* Message format for MDDB detach */
251 struct md_mn_msg_meta_db_detach_t {
252 	md_splitname	msg_splitname;
253 	char		msg_devid[1];	/* unused for now, for future */
254 					/* must be last element */
255 };
256 
257 /* Message format for MDDB newside */
258 struct md_mn_msg_meta_db_newside_t {
259 	md_dev64_t	msg_l_dev;
260 	daddr_t		msg_blkno;
261 	side_t		msg_sideno;
262 	minor_t		msg_mnum;
263 	char		msg_dname[16];
264 	md_splitname	msg_splitname;
265 	char		msg_devid[1];	/* unused for now, for future */
266 					/* must be last element */
267 };
268 
269 /* Message format for MDDB delside */
270 struct md_mn_msg_meta_db_delside_t {
271 	md_dev64_t	msg_l_dev;
272 	daddr_t		msg_blkno;
273 	side_t		msg_sideno;
274 	char		msg_devid[1];	/* unused for now, for future */
275 					/* must be last element */
276 };
277 
278 /* Message format for MD addside */
279 struct md_mn_msg_meta_md_addside_t {
280 	side_t		msg_sideno;
281 	side_t		msg_otherside;
282 };
283 
284 /* Message format for MDDB delside */
285 struct md_mn_msg_meta_md_delside_t {
286 	side_t		msg_sideno;
287 };
288 
289 /* Message format for optimized record error */
290 struct md_mn_msg_mddb_optrecerr_t {
291 	md_replica_recerr_t	msg_recerr[2];
292 };
293 
294 /*
295  * Message format for IOCSET message
296  */
297 
298 struct md_mn_msg_iocset_t {
299 	md_set_params_t	iocset_params;
300 	mp_unit_t		unit;
301 };
302 
303 /* Message format for SP_SETSTAT message */
304 
305 struct md_mn_msg_sp_setstat_t {
306 	minor_t		sp_setstat_mnum;
307 	int		sp_setstat_status;
308 };
309 
310 /* Message format for ADDKEYNAME message */
311 
312 struct md_mn_msg_addkeyname_t {
313 	set_t		addkeyname_setno;
314 	char		addkeyname_name[1];	/* must be last element */
315 };
316 
317 /*
318  * Add metadevice name into replica
319  */
320 struct md_mn_msg_addmdname_t {
321 	set_t		addmdname_setno;
322 	char		addmdname_name[1];
323 };
324 
325 /* Message format for DELKEYNAME message */
326 
327 struct md_mn_msg_delkeyname_t {
328 	md_dev64_t	delkeyname_dev;
329 	set_t		delkeyname_setno;
330 	mdkey_t		delkeyname_key;
331 };
332 
333 /* Message format for GET_TSTATE message */
334 
335 struct md_mn_msg_gettstate_t {
336 	md_dev64_t	gettstate_dev;
337 };
338 
339 /* Message format for GET_MIRROR_STATE message */
340 
341 struct md_mn_msg_mir_state_t {
342 	minor_t		mir_state_mnum;
343 };
344 
345 /* Results format for GET_SM_STATE message */
346 struct md_mn_msg_mir_state_res_t {
347 	sm_state_t	sm_state[NMIRROR];
348 	sm_flags_t	sm_flags[NMIRROR];
349 	u_int		mir_tstate;
350 };
351 
352 /* Message format for MD_MN_MSG_SETSYNC message */
353 struct md_mn_msg_setsync_t {
354 	minor_t		setsync_mnum;
355 	md_riflags_t	setsync_flags;
356 	diskaddr_t	setsync_copysize;
357 };
358 
359 /* Message format for MD_MN_MSG_POKE_HOTSPARES message */
360 struct md_mn_msg_pokehsp_t {
361 	minor_t		pokehsp_setno;
362 };
363 
364 %#define	MD_MSGF_NO_LOG			0x00000001
365 %#define	MD_MSGF_NO_BCAST		0x00000002
366 %#define	MD_MSGF_STOP_ON_ERROR		0x00000004
367 %#define	MD_MSGF_REPLAY_MSG		0x00000008
368 %#define	MD_MSGF_OVERRIDE_SUSPEND	0x00000010
369 %#define	MD_MSGF_ON_MASTER		0x00000020
370 %#define	MD_MSGF_ON_SLAVE		0x00000040
371 %#define	MD_MSGF_ON_INITIATOR		0x00000080
372 %#define	MD_MSGF_LOCAL_ONLY		0x00000100
373 %#define	MD_MSGF_FAIL_ON_SUSPEND		0x00000200
374 %#define	MD_MSGF_NO_MCT			0x00000400
375 %#define	MD_MSGF_PANIC_WHEN_INCONSISTENT	0x00000800
376 %#define	MD_MSGF_VERBOSE			0x10000000
377 %#define	MD_MSGF_VERBOSE_2		0x20000000
378 
379 %#define	MD_MSGF_INHERIT_BITS		\
380 %			MD_MSGF_REPLAY_MSG | MD_MSGF_OVERRIDE_SUSPEND
381 
382 
383 
384 %/* maximum number of nodes in cluster (not in diskset) */
385 %#define	NNODES MD_MNMAXSIDES
386 
387 
388 /* if you add elements here, make sure, to add them to MSGID_COPY(), too */
389 struct md_mn_msgid_t {
390 	uint64_t	mid_time;	/* unique timestamp */
391 	md_mn_nodeid_t	mid_nid;	/* node that created the message */
392 	md_mn_msgclass_t mid_oclass;	/* for submessages original class */
393 	uint8_t		mid_smid;	/* sub message number */
394 	uint8_t		mid_spare[15];	/* Always good to have some spares */
395 };
396 
397 %#define MD_NULL_MSGID (md_mn_msgid_t *)NULL
398 %
399 %/* macros to handle msgid's */
400 %#define	MSGID_COPY(from, to) {				\
401 %			(to)->mid_nid = (from)->mid_nid;	\
402 %			(to)->mid_smid = (from)->mid_smid;	\
403 %			(to)->mid_oclass = (from)->mid_oclass;	\
404 %			(to)->mid_time = (from)->mid_time;	\
405 %		}
406 %
407 %#define	MSGID_CMP(a, b) 				\
408 %			(((a)->mid_nid == (b)->mid_nid) &&	\
409 %			((a)->mid_smid == (b)->mid_smid) &&	\
410 %			((a)->mid_time == (b)->mid_time))
411 %
412 %#define	MSGID_ELEMS(mid) (mid).mid_nid, (mid).mid_time, (mid).mid_smid
413 
414 /* if you add elements here, make sure, to add them to copy_msg(), too */
415 struct md_mn_msg_t {
416         md_mn_msgid_t	msg_msgid;	/* Message id */
417 	md_mn_nodeid_t	msg_sender;	/* who wants the results? */
418 	u_int		msg_flags;	/* See MD_MSGF_* above */
419 	set_t		msg_setno;	/* which set is involved */
420         md_mn_msgtype_t msg_type;       /* what type of message */
421 	char		msg_spare[32];	/* Always good to hav'em */
422 	opaque		msg_event<>;	/* the actual event wrapped up */
423 };
424 %#define	msg_event_data	msg_event.msg_event_val
425 %#define	msg_event_size	msg_event.msg_event_len
426 %
427 %#define	MD_MN_MSG_LEN(msg)	((msg)->msg_event_size +\
428 %							sizeof (md_mn_msg_t))
429 %#define	MD_MN_MSG_MAXDATALEN	1024
430 
431 /* ondisk version of the message */
432 struct md_mn_msg_od_t {
433         md_mn_msgid_t	msg_msgid;	/* Message id */
434 	md_mn_nodeid_t	msg_sender;	/* who wants the results? */
435 	uint32_t	msg_flags;	/* See MD_MSGF_* above */
436 	set_t		msg_setno;	/* which set is involved */
437         md_mn_msgtype_t msg_type;       /* what type of message */
438 	char		msg_spare[32];	/* Always good to hav'em */
439 	uint32_t	msg_ev_len;
440 	char		msg_ev_val[MD_MN_MSG_MAXDATALEN];
441 };
442 %
443 %#define	msg_od_event_data	msg_ev_val
444 %#define	msg_od_event_size	msg_ev_len
445 %#define	MDMN_MAX_KMSG_DATA	256
446 
447 /* needed for mdmn_ksend_message to deliver the data into userland thru doors */
448 struct md_mn_kmsg_t {
449 	md_mn_msgid_t 	kmsg_msgid;
450 	u_int		kmsg_flags;
451 	set_t		kmsg_setno;
452 	md_mn_msgtype_t	kmsg_type;
453 	int		kmsg_size;
454 	char		kmsg_data[MDMN_MAX_KMSG_DATA];
455 };
456 
457 /* if you add elements here, make sure, to add them to copy_result(), too */
458 struct md_mn_result_t {
459 	md_mn_msgid_t	mmr_msgid;
460 	md_mn_msgtype_t	mmr_msgtype;
461 	set_t		mmr_setno;
462 	u_int		mmr_flags;
463 	md_mn_nodeid_t	mmr_sender;   /* needed to check for unsolicited msgs */
464 	md_mn_nodeid_t	mmr_failing_node; /* trouble maker */
465 	int		mmr_comm_state;
466 	int		mmr_exitval;
467 	md_error_t	mmr_ep;
468 	opaque		mmr_output<>; /* msg handler can store output here */
469 	opaque		mmr_error<>;  /* ... and error output goes here */
470 };
471 
472 %#define	MDMN_MAX_KRES_DATA	256
473 /* kernel results don't provide something like stderr */
474 struct md_mn_kresult_t {
475 	md_mn_msgtype_t	kmmr_msgtype;
476 	u_int		kmmr_flags;
477 	int		kmmr_comm_state;
478 	md_mn_nodeid_t	kmmr_failing_node; /* trouble maker */
479 	int		kmmr_exitval;
480 	int		kmmr_res_size;
481 	char		kmmr_res_data[MDMN_MAX_KRES_DATA];
482 };
483 
484 /* possible return values for the rpc services */
485 enum md_mn_retval_t {
486 	MDMNE_NULL = 0,
487 	MDMNE_ACK,		/* this is the good one */
488 	MDMNE_CLASS_BUSY,	/* try again */
489 	MDMNE_RPC_FAIL,		/* some RPC error occurred */
490 	MDMNE_THR_CREATE_FAIL,  /* cannot create working thread */
491 	MDMNE_NO_HANDLER,	/* this message has no handler */
492 	MDMNE_LOG_FAIL,		/* logging failed for some reason */
493 	MDMNE_CANNOT_CONNECT,	/* rpc connection not possible */
494 	MDMNE_NO_WAKEUP_ENTRY,	/* no entry in wakeup table for msgid */
495 	MDMNE_NOT_JOINED,	/* this host hasn't joined yet */
496 	MDMNE_HANDLER_FAILED,	/* could not run the handler for this message */
497 	MDMNE_EINVAL,		/* bad argument specified for special message */
498 	MDMNE_SUSPENDED,	/* commd doesn't accept new messgaes */
499 	MDMNE_CLASS_LOCKED,	/* class has been locked (for testing only) */
500 	MDMNE_TIMEOUT,		/* processing message took too long */
501 	MDMNE_SET_NOT_DRAINED,	/* still outstandang messages for this set */
502 	MDMNE_ABORT,		/* Contacted node is in abort state */
503 	MDMNE_IGNORE_NODE	/* ignore current node, send msg to next one */
504 };
505 
506 %
507 %#define	MDMN_KSEND_MSG_OK(rv, kres)		\
508 %	(((rv) == 0) && (((kres)->kmmr_exitval == 0) && \
509 %	 (((kres)->kmmr_comm_state == MDMNE_ACK) || \
510 %	  (!md_mn_is_commd_present() && \
511 %	   ((kres)->kmmr_comm_state == MDMNE_RPC_FAIL)))))
512 %
513 
514 %
515 %#define	mmr_out		mmr_output.mmr_output_val
516 %#define	mmr_out_size	mmr_output.mmr_output_len
517 %#define	mmr_err		mmr_error.mmr_error_val
518 %#define	mmr_err_size	mmr_error.mmr_error_len
519 %
520 %
521 %extern void mdmn_master_process_msg(md_mn_msg_t *);
522 %extern void mdmn_slave_process_msg(md_mn_msg_t *);
523 
524 
525 struct md_mn_set_and_class_t {
526 	set_t			msc_set;
527 	md_mn_msgclass_t	msc_class;
528 	u_int			msc_flags;
529 };
530 
531 %/* possible values for msc_flags above */
532 %#define	MD_MSCF_NO_FLAGS		0x0000
533 %#define	MD_MSCF_DONT_RESUME_CLASS1	0x0001
534 
535 struct md_mn_type_and_lock_t {
536 	md_mn_msgtype_t	mmtl_type;
537 	u_int		mmtl_lock;
538 };
539 
540 %/* possible values for mmtl_flags above */
541 %#define	MMTL_UNLOCK		0x0000
542 %#define	MMTL_LOCK		0x0001
543 
544 %/* Currently not used, but thinkable extensions */
545 %#define	MMTL_LOCK_ON_INITIATOR	0x0002
546 %#define	MMTL_LOCK_ON_MASTER	0x0004
547 %#define	MMTL_LOCK_ON_SLAVE	0x0008
548 %#define	MMTL_LOCK_ONE_TIME_ONLY	0x0010
549 
550 
551 program MDMN_COMMD {
552 	version ONE {
553 		md_mn_result_t
554 		mdmn_send(md_mn_msg_t) = 1;
555 
556 		int
557 		mdmn_work(md_mn_msg_t msg) = 2;
558 
559 		int
560 		mdmn_wakeup_initiator(md_mn_result_t) = 3;
561 
562 		int
563 		mdmn_wakeup_master(md_mn_result_t) = 4;
564 
565 		int
566 		mdmn_comm_lock(md_mn_set_and_class_t) = 5;
567 
568 		int
569 		mdmn_comm_unlock(md_mn_set_and_class_t) = 6;
570 
571 		int
572 		mdmn_comm_suspend(md_mn_set_and_class_t) = 7;
573 
574 		int
575 		mdmn_comm_resume(md_mn_set_and_class_t) = 8;
576 
577 		int
578 		mdmn_comm_reinit_set(set_t) = 9;
579 
580 		int
581 		mdmn_comm_msglock(md_mn_type_and_lock_t) = 10;
582 	} = 1;
583 } = 100422;
584