2 % * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
3 % * Use is subject to license terms.
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
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.
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]
26 %#pragma ident "%Z%%M% %I% %E% SMI"
30 %#include <meta_basic.h>
31 %#include <sys/lvm/mdmn_commd.h>
35 %int md_in_daemon = 1;
40 %int _md_in_daemon = 0;
41 %#pragma weak md_in_daemon = _md_in_daemon
46 %extern int md_in_daemon;
48 % * There are too many external factors that affect the timing of the
49 % * operations, so we set the timeout to a very large value, in this
50 % * case 1 day, which should handle HW timeouts, large configurations,
51 % * and other potential delays.
53 %#define CL_LONG_TMO 86400L
58 %/* Start - Avoid duplicate definitions, but get the xdr calls right */
60 #include "../uts/common/sys/lvm/meta_arr.x"
62 %/* End - Avoid duplicate definitions, but get the xdr calls right */
68 % * Structure Revisions
70 enum mdrpc_metad_args_rev {
71 MD_METAD_ARGS_REV_1 = 1 /* Revision 1 */
78 struct mdrpc_devid_res {
79 string enc_devid<>; /* encoded device id */
80 md_error_t status; /* status of RPC call */
85 % * svm rpc version 2 device id arguments
86 % * (member union in mdrpc_devid_2_args)
88 struct mdrpc_devid_args {
91 mddrivename_t *drivenamep;
96 % * svm rpc version 2 device id arguments
97 % * (union of all version 2 revisions)
99 union mdrpc_devid_2_args switch (mdrpc_metad_args_rev rev) {
100 case MD_METAD_ARGS_REV_1:
101 mdrpc_devid_args rev1;
108 % * For getting the devinfo based upon devid
110 struct mdrpc_devidstr_args {
112 string enc_devid<>; /* encoded device id */
113 md_error_t status; /* status of RPC call */
118 % * For getting the devinfo based upon devid/devname
120 struct mdrpc_devid_name_args {
122 string orig_devname<>; /* devname on orig node */
123 string enc_devid<>; /* encoded device id */
128 % * svm rpc version 2 devinfo based upon devid/devname
129 % * (union of all version 2 revisions)
131 union mdrpc_devid_name_2_args switch (mdrpc_metad_args_rev rev) {
132 case MD_METAD_ARGS_REV_1:
133 mdrpc_devid_name_args rev1;
140 % * version 1 device info
142 struct mdrpc_devinfo_res {
143 dev_t dev; /* major.minor */
144 int vtime; /* vtoc timestamp */
145 md_error_t status; /* status of RPC call */
150 % * version 2 device info. dev_t is always 64-bit
152 struct mdrpc_devinfo_2_res {
153 md_dev64_t dev; /* major.minor */
154 int vtime; /* vtoc timestamp */
155 string enc_devid<>; /* encoded device id */
156 string devname<>; /* name of the device */
157 string drivername<>; /* name of the driver */
158 md_error_t status; /* status of RPC call */
163 % * svm rpc version 1 device info arguments
165 struct mdrpc_devinfo_args {
168 o_mddrivename_t *drivenamep;
173 % * svm rpc version 2 (revision 1) device info arguments
174 % * (member of union in mdrpc_devinfo_2_args)
176 struct mdrpc_devinfo_2_args_r1 {
179 mddrivename_t *drivenamep;
180 string enc_devid<>; /* encoded device id */
185 % * svm rpc version 2 device info arguments
186 % * (union of all version 2 revisions)
188 union mdrpc_devinfo_2_args switch (mdrpc_metad_args_rev rev) {
189 case MD_METAD_ARGS_REV_1:
190 mdrpc_devinfo_2_args_r1 rev1;
195 struct mdrpc_hostname_res {
202 % * svm rpc version 1 and version 2 (revision 1) getset arguments
204 struct mdrpc_getset_args {
211 % * svm rpc version 2 getset arguments
212 % * (union of all version 2 revisions)
214 union mdrpc_getset_2_args switch (mdrpc_metad_args_rev rev) {
215 case MD_METAD_ARGS_REV_1:
216 mdrpc_getset_args rev1;
222 %/* NOTE: if you add to this struct, then fix the clnt_getset() */
223 %/* to prevent memory leaks */
224 struct mdrpc_getset_res {
230 %/* NOTE: if you add to this struct, then fix the clnt_mngetset() */
231 %/* to prevent memory leaks */
232 struct mdrpc_mngetset_res {
233 md_mnset_record *mnsr;
238 %/* NOTE: if you add to this struct, then fix the clnt_getdrivedesc() */
239 %/* to prevent memory leaks */
240 struct mdrpc_getdrivedesc_res {
248 typedef string stringarray<>;
256 % * svm rpc version 1 and version 2 (revision 1) createset arguments
258 struct mdrpc_createset_args {
261 md_node_nm_arr_t nodes;
262 md_timeval32_t timestamp;
268 % * svm rpc version 2 createset arguments
269 % * (union of all version 2 revisions)
271 union mdrpc_createset_2_args switch (mdrpc_metad_args_rev rev) {
272 case MD_METAD_ARGS_REV_1:
273 mdrpc_createset_args rev1;
278 struct mdrpc_mncreateset_args {
281 md_mnnode_desc *nodelist;
282 md_timeval32_t timestamp;
284 md_node_nm_t master_nodenm;
290 % * svm rpc version 2 mncreateset arguments
291 % * (union of all version 2 revisions)
293 union mdrpc_mncreateset_2_args switch (mdrpc_metad_args_rev rev) {
294 case MD_METAD_ARGS_REV_1:
295 mdrpc_mncreateset_args rev1;
301 struct mdrpc_bool_res {
308 % * svm rpc version 1 drive arguments
310 struct mdrpc_drives_args {
313 o_md_drive_desc *drivedescs;
314 md_timeval32_t timestamp;
320 % * svm rpc version 2 (revision 1) drive arguments
321 % * (member of union in mrpc_drives_2_args)
323 struct mdrpc_drives_2_args_r1 {
326 md_drive_desc *drivedescs;
327 md_timeval32_t timestamp;
333 % * svm rpc version 2 drive arguments
334 % * (union of all version 2 revisions)
336 union mdrpc_drives_2_args switch (mdrpc_metad_args_rev rev) {
337 case MD_METAD_ARGS_REV_1:
338 mdrpc_drives_2_args_r1 rev1;
345 % * svm rpc version 1 sidename arguments
347 struct mdrpc_drv_sidenm_args {
352 stringarray node_v<>;
357 % * svm rpc version 2 (revision 1) sidename arguments
358 % * (member of union in mdrpc_drv_sidenm_2_args)
360 struct mdrpc_drv_sidenm_2_args_r1 {
365 stringarray node_v<>;
370 % * svm rpc version 2 sidename arguments
371 % * (union of all version 2 revisions)
373 union mdrpc_drv_sidenm_2_args switch (mdrpc_metad_args_rev rev) {
374 case MD_METAD_ARGS_REV_1:
375 mdrpc_drv_sidenm_2_args_r1 rev1;
382 % * svm rpc version 1 drvused arguments
384 struct mdrpc_drvused_args {
387 o_mddrivename_t *drivenamep;
392 % * svm rpc version 2 (revision 1) drvused arguments
393 % * (member of union in mdrpc_drvused_2_args)
395 struct mdrpc_drvused_2_args_r1 {
398 mddrivename_t *drivenamep;
403 % * svm rpc version 2 drvused arguments
404 % * (union of all version 2 revisions)
406 union mdrpc_drvused_2_args switch (mdrpc_metad_args_rev rev) {
407 case MD_METAD_ARGS_REV_1:
408 mdrpc_drvused_2_args_r1 rev1;
415 % * svm rpc version 1 and version 2 (revision 1) host arguments
417 struct mdrpc_host_args {
425 % * svm rpc version 2 host arguments
426 % * (union of all version 2 revisions)
428 union mdrpc_host_2_args switch (mdrpc_metad_args_rev rev) {
429 case MD_METAD_ARGS_REV_1:
430 mdrpc_host_args rev1;
435 struct mdrpc_gtimeout_res {
437 mhd_mhiargs_t *mhiargsp;
442 % * svm rpc version 1 and version 2 (revision 1) set timeout arguments
444 struct mdrpc_stimeout_args {
447 mhd_mhiargs_t *mhiargsp;
452 % * svm rpc version 2 set timeout arguments
453 % * (union of all version 2 revisions)
455 union mdrpc_stimeout_2_args switch (mdrpc_metad_args_rev rev) {
456 case MD_METAD_ARGS_REV_1:
457 mdrpc_stimeout_args rev1;
464 % * svm rpc version 1 arguments
466 struct mdrpc_upd_dr_flags_args {
469 o_md_drive_desc *drivedescs;
475 % * svm rpc version 2 (revision 1) arguments
476 % * (member of union in mdrpc_upd_dr_flags_2_args)
478 struct mdrpc_upd_dr_flags_2_args_r1 {
481 md_drive_desc *drivedescs;
487 % * svm rpc version 2 arguments
488 % * (union of all version 2 revisions)
490 union mdrpc_upd_dr_flags_2_args switch (mdrpc_metad_args_rev rev) {
491 case MD_METAD_ARGS_REV_1:
492 mdrpc_upd_dr_flags_2_args_r1 rev1;
499 % * svm rpc version 1 and version 2 (revision 1) arguments
501 struct mdrpc_upd_sr_flags_args {
509 % * svm rpc version 2 arguments
510 % * (union of all version 2 revisions)
512 union mdrpc_upd_sr_flags_2_args switch (mdrpc_metad_args_rev rev) {
513 case MD_METAD_ARGS_REV_1:
514 mdrpc_upd_sr_flags_args rev1;
521 % * svm rpc version 2 (revision 1) arguments
523 struct mdrpc_upd_nr_flags_args {
526 md_mnnode_desc *nodedescs;
533 % * svm rpc version 2 arguments
534 % * (union of all version 2 revisions)
536 union mdrpc_upd_nr_flags_2_args switch (mdrpc_metad_args_rev rev) {
537 case MD_METAD_ARGS_REV_1:
538 mdrpc_upd_nr_flags_args rev1;
544 struct mdrpc_setlock_res {
549 struct mdrpc_generic_res {
555 % * svm rpc version 1 and version 2 (revision 1) set arguments
557 struct mdrpc_setno_args {
564 % * svm rpc version 2 set arguments
565 % * (union of all version 2 revisions)
567 union mdrpc_setno_2_args switch (mdrpc_metad_args_rev rev) {
568 case MD_METAD_ARGS_REV_1:
569 mdrpc_setno_args rev1;
574 struct mdrpc_null_args {
580 % * svm rpc version 1 and version 2 (revision 1) arguments
582 struct mdrpc_sp_args {
589 % * svm rpc version 2 arguments
590 % * (union of all version 2 revisions)
592 union mdrpc_sp_2_args switch (mdrpc_metad_args_rev rev) {
593 case MD_METAD_ARGS_REV_1:
601 % * svm rpc version 2 (revision 1) arguments
603 struct mdrpc_sp_flags_args {
611 % * svm rpc version 2 arguments
612 % * (union of all version 2 revisions)
614 union mdrpc_sp_flags_2_args switch (mdrpc_metad_args_rev rev) {
615 case MD_METAD_ARGS_REV_1:
616 mdrpc_sp_flags_args rev1;
623 % * svm rpc version 1 and version 2 (revision 1) arguments
625 struct mdrpc_updmeds_args {
633 % * svm rpc version 2 arguments
634 % * (union of all version 2 revisions)
636 union mdrpc_updmeds_2_args switch (mdrpc_metad_args_rev rev) {
637 case MD_METAD_ARGS_REV_1:
638 mdrpc_updmeds_args rev1;
643 struct mdrpc_mnsetmaster_args {
646 md_node_nm_t master_nodenm;
652 % * svm rpc version 2 arguments
653 % * (union of all version 2 revisions)
655 union mdrpc_mnsetmaster_2_args switch (mdrpc_metad_args_rev rev) {
656 case MD_METAD_ARGS_REV_1:
657 mdrpc_mnsetmaster_args rev1;
663 * Defines and structures to support rpc.mdcommd.
664 * RPC routines in rpc.metad will be used to suspend, resume
665 * and reinitialize the rpc.mdcommd running on that node.
666 * These actions are needed when the nodelist is changing.
668 %#define COMMDCTL_SUSPEND 1
669 %#define COMMDCTL_RESUME 2
670 %#define COMMDCTL_REINIT 3
672 struct mdrpc_mdcommdctl_args {
675 md_mn_msgclass_t class;
682 % * svm rpc version 2 arguments
683 % * (union of all version 2 revisions)
685 union mdrpc_mdcommdctl_2_args switch (mdrpc_metad_args_rev rev) {
686 case MD_METAD_ARGS_REV_1:
687 mdrpc_mdcommdctl_args rev1;
694 % * svm rpc version 2 (revision 1) nodeid arguments
696 struct mdrpc_nodeid_args {
704 % * svm rpc version 2 nodeid arguments
705 % * (union of all version 2 revisions)
707 union mdrpc_nodeid_2_args switch (mdrpc_metad_args_rev rev) {
708 case MD_METAD_ARGS_REV_1:
709 mdrpc_nodeid_args rev1;
716 % * Defines and structures to support suspend and resume I/O
717 % * driven by a remote node.
719 %#define MN_SUSP_IO 1
723 % * svm rpc version 2 (revision 1) mn_susp_res_io arguments
724 % * setno of 0 represents all disksets.
726 struct mdrpc_mn_susp_res_io_args {
727 md_setkey_t *susp_res_l_sk;
728 set_t susp_res_setno;
734 % * svm rpc version 2 nodeid arguments
735 % * (union of all version 2 revisions)
737 union mdrpc_mn_susp_res_io_2_args switch (mdrpc_metad_args_rev rev) {
738 case MD_METAD_ARGS_REV_1:
739 mdrpc_mn_susp_res_io_args rev1;
747 % * authorization info
749 const METAD_GID = 14; /* magic sysadmin group */
754 % * services available
757 version METAD_VERSION {
759 mdrpc_nullproc(void) = 0;
762 mdrpc_hostname(mdrpc_null_args) = 1;
765 mdrpc_addhosts(mdrpc_host_args) = 2;
768 mdrpc_delhosts(mdrpc_host_args) = 3;
771 mdrpc_createset(mdrpc_createset_args) = 4;
774 mdrpc_delset(mdrpc_sp_args) = 5;
777 mdrpc_getset(mdrpc_getset_args) = 6;
780 mdrpc_setnumbusy(mdrpc_setno_args) = 7;
783 mdrpc_setnameok(mdrpc_sp_args) = 8;
786 mdrpc_ownset(mdrpc_sp_args) = 9;
789 mdrpc_adddrvs(mdrpc_drives_args) = 10;
792 mdrpc_deldrvs(mdrpc_drives_args) = 11;
795 mdrpc_upd_dr_dbinfo(mdrpc_drives_args) = 12;
798 mdrpc_devinfo(mdrpc_devinfo_args) = 13;
801 mdrpc_drvused(mdrpc_drvused_args) = 14;
804 mdrpc_add_drv_sidenms(mdrpc_drv_sidenm_args) = 15;
807 mdrpc_del_drv_sidenms(mdrpc_sp_args) = 16;
810 mdrpc_gtimeout(mdrpc_sp_args) = 17;
813 mdrpc_stimeout(mdrpc_stimeout_args) = 18;
816 mdrpc_upd_dr_flags(mdrpc_upd_dr_flags_args) = 19;
819 mdrpc_upd_sr_flags(mdrpc_upd_sr_flags_args) = 20;
822 mdrpc_unlock_set(mdrpc_null_args) = 21;
825 mdrpc_lock_set(mdrpc_null_args) = 22;
828 mdrpc_updmeds(mdrpc_updmeds_args) = 23;
831 mdrpc_flush_internal(mdrpc_null_args) = 24;
835 version METAD_VERSION_DEVID {
837 mdrpc_nullproc(void) = 0;
840 mdrpc_hostname(mdrpc_null_args) = 1;
843 mdrpc_addhosts(mdrpc_host_2_args) = 2;
846 mdrpc_delhosts(mdrpc_host_2_args) = 3;
849 mdrpc_createset(mdrpc_createset_2_args) = 4;
852 mdrpc_delset(mdrpc_sp_2_args) = 5;
855 mdrpc_getset(mdrpc_getset_2_args) = 6;
858 mdrpc_setnumbusy(mdrpc_setno_2_args) = 7;
861 mdrpc_setnameok(mdrpc_sp_2_args) = 8;
864 mdrpc_ownset(mdrpc_sp_2_args) = 9;
867 mdrpc_adddrvs(mdrpc_drives_2_args) = 10;
870 mdrpc_deldrvs(mdrpc_drives_2_args) = 11;
873 mdrpc_upd_dr_dbinfo(mdrpc_drives_2_args) = 12;
876 mdrpc_devinfo(mdrpc_devinfo_2_args) = 13;
879 mdrpc_drvused(mdrpc_drvused_2_args) = 14;
882 mdrpc_add_drv_sidenms(mdrpc_drv_sidenm_2_args) = 15;
885 mdrpc_del_drv_sidenms(mdrpc_sp_2_args) = 16;
888 mdrpc_gtimeout(mdrpc_sp_2_args) = 17;
891 mdrpc_stimeout(mdrpc_stimeout_2_args) = 18;
894 mdrpc_upd_dr_flags(mdrpc_upd_dr_flags_2_args) = 19;
897 mdrpc_upd_sr_flags(mdrpc_upd_sr_flags_2_args) = 20;
900 mdrpc_unlock_set(mdrpc_null_args) = 21;
903 mdrpc_lock_set(mdrpc_null_args) = 22;
906 mdrpc_updmeds(mdrpc_updmeds_2_args) = 23;
909 mdrpc_flush_internal(mdrpc_null_args) = 24;
912 mdrpc_devid(mdrpc_devid_2_args) = 25;
915 mdrpc_devinfo_by_devid(mdrpc_devidstr_args) = 26;
918 mdrpc_resnarf_set(mdrpc_setno_2_args) = 27;
921 mdrpc_mncreateset(mdrpc_mncreateset_2_args) = 28;
924 mdrpc_mngetset(mdrpc_getset_2_args) = 29;
927 mdrpc_mnsetmaster(mdrpc_mnsetmaster_2_args) = 30;
930 mdrpc_joinset(mdrpc_sp_flags_2_args) = 31;
933 mdrpc_withdrawset(mdrpc_sp_2_args) = 32;
936 mdrpc_upd_nr_flags(mdrpc_upd_nr_flags_2_args) = 33;
939 mdrpc_mn_is_stale(mdrpc_setno_2_args) = 34;
942 mdrpc_mdcommdctl(mdrpc_mdcommdctl_2_args) = 35;
945 mdrpc_clr_mnsetlock(mdrpc_null_args) = 36;
947 mdrpc_getdrivedesc_res
948 mdrpc_getdrivedesc(mdrpc_sp_2_args) = 37;
951 mdrpc_upd_dr_reconfig(mdrpc_upd_dr_flags_2_args) = 38;
954 mdrpc_reset_mirror_owner(mdrpc_nodeid_2_args) = 39;
957 mdrpc_mn_susp_res_io(mdrpc_mn_susp_res_io_2_args) = 40;
960 mdrpc_mn_mirror_resync_all(mdrpc_setno_2_args) = 41;
963 mdrpc_devinfo_by_devid_name(mdrpc_devid_name_2_args) = 42;
966 mdrpc_mn_sp_update_abr(mdrpc_setno_2_args) = 43;
969 mdrpc_imp_adddrvs(mdrpc_drives_2_args) = 44;
976 %extern void short_circuit_getset(mdrpc_getset_args *args,
977 % mdrpc_getset_res *res);
978 %extern void short_circuit_mngetset(mdrpc_getset_args *args,
979 % mdrpc_mngetset_res *res);