xref: /titanic_41/usr/src/uts/common/sys/lvm/mdmn_commd.x (revision 70025d765b044c6d8594bb965a2247a61e991a99)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 %
23 %/*
24 % * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25 % * Use is subject to license terms.
26 % */
27 %
28 %#pragma ident	"%Z%%M%	%I%	%E% SMI"
29 
30 %#include <sys/types.h>
31 %#include <sys/types32.h>
32 %#include <sys/lvm/md_basic.h>
33 %#include <sys/lvm/mdio.h>
34 %#ifndef _KERNEL
35 %#include <mdiox.h>
36 %#include <meta_basic.h>
37 %extern  bool_t  xdr_md_set_params_t(XDR *xdrs, md_set_params_t *objp);
38 %extern  bool_t  xdr_mp_unit_t(XDR *xdrs, mp_unit_t *objp);
39 %extern  bool_t  xdr_diskaddr_t(XDR *xdrs, diskaddr_t *objp);
40 %extern  bool_t  xdr_md_dev64_t(XDR *xdrs, md_dev64_t *objp);
41 %extern  bool_t  xdr_daddr_t(XDR *xdrs, daddr_t *objp);
42 %extern  bool_t  xdr_daddr32_t(XDR *xdrs, daddr32_t *objp);
43 %#else
44 %#include <sys/lvm/md_mdiox.h>
45 %#endif /* ! _KERNEL */
46 
47 /* every message handler must have these parameters */
48 %#define	HANDLER_PARMS md_mn_msg_t *msg, uint_t flag, md_mn_result_t *res
49 
50 
51 /* every submessage generator must have these parameters */
52 %#define	SMGEN_PARMS md_mn_msg_t *msg, md_mn_msg_t **msglist
53 
54 /* 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*/
55 
56 enum md_mn_msgtype_t {
57         MD_MN_MSG_NULL = 0,  /* special message type for internal use only */
58 	MD_MN_MSG_TEST1,
59 	MD_MN_MSG_TEST2,
60 	MD_MN_MSG_TEST3,
61 	MD_MN_MSG_TEST4,
62 	MD_MN_MSG_TEST5,
63 	MD_MN_MSG_TEST6,
64 	MD_MN_MSG_BC_CMD,		/* Send metacommand */
65 	MD_MN_MSG_BC_CMD_RETRY,		/* Send metacommand, retry on busy */
66 	MD_MN_MSG_CLU_CHECK,
67 	MD_MN_MSG_CLU_LOCK,
68 	MD_MN_MSG_CLU_UNLOCK,
69 	MD_MN_MSG_REQUIRE_OWNER,	/* Request to become Mirror owner */
70 	MD_MN_MSG_CHOOSE_OWNER,		/* Request to allocate a resync owner */
71 	MD_MN_MSG_CHANGE_OWNER,		/* Change owner to a specific node */
72 	MD_MN_MSG_SUSPEND_WRITES,	/* Suspend writes to a mirror */
73 	MD_MN_MSG_STATE_UPDATE_RESWR,	/* Ch state of comp & resume writes */
74 	MD_MN_MSG_STATE_UPDATE,		/* Susp writes/Change state of comp */
75 	MD_MN_MSG_ALLOCATE_HOTSPARE,	/* Allocate hotspare for mirror comp */
76 	MD_MN_MSG_RESYNC_STARTING,	/* Resync thread starting */
77 	MD_MN_MSG_RESYNC_NEXT,		/* Next resync region */
78 	MD_MN_MSG_RESYNC_FINISH,	/* Resync thread finished */
79 	MD_MN_MSG_RESYNC_PHASE_DONE,	/* End of resync phase */
80 	MD_MN_MSG_SET_CAP,		/* Set capability, eg ABR */
81 	MD_MN_MSG_VERBOSITY,		/* set various levels of debug */
82 	MD_MN_MSG_MDDB_PARSE,		/* Slave to reparse portion of mddb */
83 	MD_MN_MSG_MDDB_BLOCK,		/* Block parse/recs on master/slave */
84 	MD_MN_MSG_META_DB_ATTACH,	/* Master message to add new mddb */
85 	MD_MN_MSG_SM_MDDB_ATTACH,	/* Submessage to add new mddb */
86 	MD_MN_MSG_META_DB_DETACH,	/* Master message to delete mddb */
87 	MD_MN_MSG_SM_MDDB_DETACH,	/* Submessage to delete mddb */
88 	MD_MN_MSG_META_DB_NEWSIDE,	/* Node adding mddb side info */
89 	MD_MN_MSG_META_DB_DELSIDE,	/* Node deleting mddb side info */
90 	MD_MN_MSG_META_MD_ADDSIDE,	/* Node adding md side info */
91 	MD_MN_MSG_META_MD_DELSIDE,	/* Node deleting md side info */
92 	MD_MN_MSG_MDDB_OPTRECERR,	/* Node detects opt rec error */
93 	MD_MN_MSG_ABORT,		/* Stop sending messages to any node */
94 	MD_MN_MSG_STATE_UPDATE_RESWR2,	/* UPDATE_RESWR for watermark updates */
95 	MD_MN_MSG_STATE_UPDATE2,	/* STATE_UPDATE for watermark updates */
96 	MD_MN_MSG_ALLOCATE_HOTSPARE2,	/* ALLOCATE_HOTSPARE for wm updates */
97 	MD_MN_MSG_IOCSET,		/* Send IOCSET ioctl */
98 	MD_MN_MSG_SP_SETSTAT,		/* Update status of softpart */
99 	MD_MN_MSG_ADDKEYNAME,		/* Add key */
100 	MD_MN_MSG_DELKEYNAME,		/* Delete key */
101 	MD_MN_MSG_GET_TSTATE,		/* Get tstate from master */
102 	MD_MN_MSG_GET_MIRROR_STATE,	/* Get submirror state from master */
103 	MD_MN_MSG_SP_SETSTAT2,		/* Update softpart status on error */
104 	MD_MN_MSG_SETSYNC,		/* Set resync status */
105 	MD_MN_MSG_POKE_HOTSPARES,	/* Call poke_hotspares */
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 /* Message format for DELKEYNAME message */
318 
319 struct md_mn_msg_delkeyname_t {
320 	md_dev64_t	delkeyname_dev;
321 	set_t		delkeyname_setno;
322 	mdkey_t		delkeyname_key;
323 };
324 
325 /* Message format for GET_TSTATE message */
326 
327 struct md_mn_msg_gettstate_t {
328 	md_dev64_t	gettstate_dev;
329 };
330 
331 /* Message format for GET_MIRROR_STATE message */
332 
333 struct md_mn_msg_mir_state_t {
334 	minor_t		mir_state_mnum;
335 };
336 
337 /* Results format for GET_SM_STATE message */
338 struct md_mn_msg_mir_state_res_t {
339 	sm_state_t	sm_state[NMIRROR];
340 	sm_flags_t	sm_flags[NMIRROR];
341 	u_int		mir_tstate;
342 };
343 
344 /* Message format for MD_MN_MSG_SETSYNC message */
345 struct md_mn_msg_setsync_t {
346 	minor_t		setsync_mnum;
347 	md_riflags_t	setsync_flags;
348 	diskaddr_t	setsync_copysize;
349 };
350 
351 /* Message format for MD_MN_MSG_POKE_HOTSPARES message */
352 struct md_mn_msg_pokehsp_t {
353 	minor_t		pokehsp_setno;
354 };
355 
356 %#define	MD_MSGF_NO_LOG			0x00000001
357 %#define	MD_MSGF_NO_BCAST		0x00000002
358 %#define	MD_MSGF_STOP_ON_ERROR		0x00000004
359 %#define	MD_MSGF_REPLAY_MSG		0x00000008
360 %#define	MD_MSGF_OVERRIDE_SUSPEND	0x00000010
361 %#define	MD_MSGF_ON_MASTER		0x00000020
362 %#define	MD_MSGF_ON_SLAVE		0x00000040
363 %#define	MD_MSGF_ON_INITIATOR		0x00000080
364 %#define	MD_MSGF_LOCAL_ONLY		0x00000100
365 %#define	MD_MSGF_FAIL_ON_SUSPEND		0x00000200
366 %#define	MD_MSGF_NO_MCT			0x00000400
367 %#define	MD_MSGF_PANIC_WHEN_INCONSISTENT	0x00000800
368 %#define	MD_MSGF_VERBOSE			0x10000000
369 %#define	MD_MSGF_VERBOSE_2		0x20000000
370 
371 %#define	MD_MSGF_INHERIT_BITS		\
372 %			MD_MSGF_REPLAY_MSG | MD_MSGF_OVERRIDE_SUSPEND
373 
374 
375 
376 %/* maximum number of nodes in cluster (not in diskset) */
377 %#define	NNODES MD_MNMAXSIDES
378 
379 
380 /* if you add elements here, make sure, to add them to MSGID_COPY(), too */
381 struct md_mn_msgid_t {
382 	uint64_t	mid_time;	/* unique timestamp */
383 	md_mn_nodeid_t	mid_nid;	/* node that created the message */
384 	md_mn_msgclass_t mid_oclass;	/* for submessages original class */
385 	uint8_t		mid_smid;	/* sub message number */
386 	uint8_t		mid_spare[15];	/* Always good to have some spares */
387 };
388 
389 %#define MD_NULL_MSGID (md_mn_msgid_t *)NULL
390 %
391 %/* macros to handle msgid's */
392 %#define	MSGID_COPY(from, to) {				\
393 %			(to)->mid_nid = (from)->mid_nid;	\
394 %			(to)->mid_smid = (from)->mid_smid;	\
395 %			(to)->mid_oclass = (from)->mid_oclass;	\
396 %			(to)->mid_time = (from)->mid_time;	\
397 %		}
398 %
399 %#define	MSGID_CMP(a, b) 				\
400 %			(((a)->mid_nid == (b)->mid_nid) &&	\
401 %			((a)->mid_smid == (b)->mid_smid) &&	\
402 %			((a)->mid_time == (b)->mid_time))
403 %
404 %#define	MSGID_ELEMS(mid) (mid).mid_nid, (mid).mid_time, (mid).mid_smid
405 
406 /* if you add elements here, make sure, to add them to copy_msg(), too */
407 struct md_mn_msg_t {
408         md_mn_msgid_t	msg_msgid;	/* Message id */
409 	md_mn_nodeid_t	msg_sender;	/* who wants the results? */
410 	u_int		msg_flags;	/* See MD_MSGF_* above */
411 	set_t		msg_setno;	/* which set is involved */
412         md_mn_msgtype_t msg_type;       /* what type of message */
413 	char		msg_spare[32];	/* Always good to hav'em */
414 	opaque		msg_event<>;	/* the actual event wrapped up */
415 };
416 %#define	msg_event_data	msg_event.msg_event_val
417 %#define	msg_event_size	msg_event.msg_event_len
418 %
419 %#define	MD_MN_MSG_LEN(msg)	((msg)->msg_event_size +\
420 %							sizeof (md_mn_msg_t))
421 %#define	MD_MN_MSG_MAXDATALEN	1024
422 
423 /* ondisk version of the message */
424 struct md_mn_msg_od_t {
425         md_mn_msgid_t	msg_msgid;	/* Message id */
426 	md_mn_nodeid_t	msg_sender;	/* who wants the results? */
427 	uint32_t	msg_flags;	/* See MD_MSGF_* above */
428 	set_t		msg_setno;	/* which set is involved */
429         md_mn_msgtype_t msg_type;       /* what type of message */
430 	char		msg_spare[32];	/* Always good to hav'em */
431 	uint32_t	msg_ev_len;
432 	char		msg_ev_val[MD_MN_MSG_MAXDATALEN];
433 };
434 %
435 %#define	msg_od_event_data	msg_ev_val
436 %#define	msg_od_event_size	msg_ev_len
437 %#define	MDMN_MAX_KMSG_DATA	256
438 
439 /* needed for mdmn_ksend_message to deliver the data into userland thru doors */
440 struct md_mn_kmsg_t {
441 	md_mn_msgid_t 	kmsg_msgid;
442 	u_int		kmsg_flags;
443 	set_t		kmsg_setno;
444 	md_mn_msgtype_t	kmsg_type;
445 	int		kmsg_size;
446 	char		kmsg_data[MDMN_MAX_KMSG_DATA];
447 };
448 
449 /* if you add elements here, make sure, to add them to copy_result(), too */
450 struct md_mn_result_t {
451 	md_mn_msgid_t	mmr_msgid;
452 	md_mn_msgtype_t	mmr_msgtype;
453 	set_t		mmr_setno;
454 	u_int		mmr_flags;
455 	md_mn_nodeid_t	mmr_sender;   /* needed to check for unsolicited msgs */
456 	md_mn_nodeid_t	mmr_failing_node; /* trouble maker */
457 	int		mmr_comm_state;
458 	int		mmr_exitval;
459 	md_error_t	mmr_ep;
460 	opaque		mmr_output<>; /* msg handler can store output here */
461 	opaque		mmr_error<>;  /* ... and error output goes here */
462 };
463 
464 %#define	MDMN_MAX_KRES_DATA	256
465 /* kernel results don't provide something like stderr */
466 struct md_mn_kresult_t {
467 	md_mn_msgtype_t	kmmr_msgtype;
468 	u_int		kmmr_flags;
469 	int		kmmr_comm_state;
470 	md_mn_nodeid_t	kmmr_failing_node; /* trouble maker */
471 	int		kmmr_exitval;
472 	int		kmmr_res_size;
473 	char		kmmr_res_data[MDMN_MAX_KRES_DATA];
474 };
475 
476 /* possible return values for the rpc services */
477 enum md_mn_retval_t {
478 	MDMNE_NULL = 0,
479 	MDMNE_ACK,		/* this is the good one */
480 	MDMNE_CLASS_BUSY,	/* try again */
481 	MDMNE_RPC_FAIL,		/* some RPC error occurred */
482 	MDMNE_THR_CREATE_FAIL,  /* cannot create working thread */
483 	MDMNE_NO_HANDLER,	/* this message has no handler */
484 	MDMNE_LOG_FAIL,		/* logging failed for some reason */
485 	MDMNE_CANNOT_CONNECT,	/* rpc connection not possible */
486 	MDMNE_NO_WAKEUP_ENTRY,	/* no entry in wakeup table for msgid */
487 	MDMNE_NOT_JOINED,	/* this host hasn't joined yet */
488 	MDMNE_HANDLER_FAILED,	/* could not run the handler for this message */
489 	MDMNE_EINVAL,		/* bad argument specified for special message */
490 	MDMNE_SUSPENDED,	/* commd doesn't accept new messgaes */
491 	MDMNE_CLASS_LOCKED,	/* class has been locked (for testing only) */
492 	MDMNE_TIMEOUT,		/* processing message took too long */
493 	MDMNE_SET_NOT_DRAINED,	/* still outstandang messages for this set */
494 	MDMNE_ABORT,		/* Contacted node is in abort state */
495 	MDMNE_IGNORE_NODE	/* ignore current node, send msg to next one */
496 };
497 
498 %
499 %#define	MDMN_KSEND_MSG_OK(rv, kres)		\
500 %	(((rv) == 0) && (((kres)->kmmr_exitval == 0) && \
501 %	 (((kres)->kmmr_comm_state == MDMNE_ACK) || \
502 %	  (!md_mn_is_commd_present() && \
503 %	   ((kres)->kmmr_comm_state == MDMNE_RPC_FAIL)))))
504 %
505 
506 %
507 %#define	mmr_out		mmr_output.mmr_output_val
508 %#define	mmr_out_size	mmr_output.mmr_output_len
509 %#define	mmr_err		mmr_error.mmr_error_val
510 %#define	mmr_err_size	mmr_error.mmr_error_len
511 %
512 %
513 %extern void mdmn_master_process_msg(md_mn_msg_t *);
514 %extern void mdmn_slave_process_msg(md_mn_msg_t *);
515 
516 
517 struct md_mn_set_and_class_t {
518 	set_t			msc_set;
519 	md_mn_msgclass_t	msc_class;
520 	u_int			msc_flags;
521 };
522 
523 %/* possible values for msc_flags above */
524 %#define	MD_MSCF_NO_FLAGS		0x0000
525 %#define	MD_MSCF_DONT_RESUME_CLASS1	0x0001
526 
527 struct md_mn_type_and_lock_t {
528 	md_mn_msgtype_t	mmtl_type;
529 	u_int		mmtl_lock;
530 };
531 
532 %/* possible values for mmtl_flags above */
533 %#define	MMTL_UNLOCK		0x0000
534 %#define	MMTL_LOCK		0x0001
535 
536 %/* Currently not used, but thinkable extensions */
537 %#define	MMTL_LOCK_ON_INITIATOR	0x0002
538 %#define	MMTL_LOCK_ON_MASTER	0x0004
539 %#define	MMTL_LOCK_ON_SLAVE	0x0008
540 %#define	MMTL_LOCK_ONE_TIME_ONLY	0x0010
541 
542 
543 program MDMN_COMMD {
544 	version ONE {
545 		md_mn_result_t
546 		mdmn_send(md_mn_msg_t) = 1;
547 
548 		int
549 		mdmn_work(md_mn_msg_t msg) = 2;
550 
551 		int
552 		mdmn_wakeup_initiator(md_mn_result_t) = 3;
553 
554 		int
555 		mdmn_wakeup_master(md_mn_result_t) = 4;
556 
557 		int
558 		mdmn_comm_lock(md_mn_set_and_class_t) = 5;
559 
560 		int
561 		mdmn_comm_unlock(md_mn_set_and_class_t) = 6;
562 
563 		int
564 		mdmn_comm_suspend(md_mn_set_and_class_t) = 7;
565 
566 		int
567 		mdmn_comm_resume(md_mn_set_and_class_t) = 8;
568 
569 		int
570 		mdmn_comm_reinit_set(set_t) = 9;
571 
572 		int
573 		mdmn_comm_msglock(md_mn_type_and_lock_t) = 10;
574 	} = 1;
575 } = 100422;
576