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 %/* 29 % * MDD interface definitions 30 % */ 31 32 %/* pick up multihost ioctl definitions */ 33 %#include <sys/lvm/md_mhdx.h> 34 %/* get the basic XDR types */ 35 %#include <sys/lvm/md_basic.h> 36 %/* pick up device id information */ 37 %#include <sys/dditypes.h> 38 39 %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 40 %/* 41 % * NOTE: can't change these structures so make sure they are packed 42 % * in the kernel. 43 % */ 44 %#pragma pack(4) 45 %#endif 46 % 47 %/* 48 % * fundamental types 49 % */ 50 % 51 %/* 52 % * 53 % * NOTE: THESE ARE ON-DISK VALUES DO NOT CHANGE THE ORDER 54 % */ 55 enum mddb_type_t { 56 MDDB_ALL, 57 MDDB_NM_HDR, 58 MDDB_NM, 59 MDDB_SHR_NM, 60 MDDB_VTOC, 61 MDDB_USER, 62 MDDB_DID_NM_HDR, 63 MDDB_DID_NM, 64 MDDB_DID_SHR_NM, 65 MDDB_EFILABEL, 66 MDDB_FIRST_MODID = 1000 67 }; 68 69 % 70 %/* 71 % * Configuration commands. 72 % */ 73 enum mddb_cfgcmd_t { 74 MDDB_USEDEV, 75 MDDB_NEWDEV, 76 MDDB_DELDEV, 77 MDDB_GETDEV, 78 MDDB_ENDDEV, 79 MDDB_GETDRVRNAME, 80 MDDB_RELEASESET, 81 MDDB_NEWSIDE, 82 MDDB_DELSIDE, 83 MDDB_SETDID, 84 MDDB_LBINITTIME 85 }; 86 87 % 88 %/* 89 % * Return codes from DB record operations. 90 % */ 91 enum mddb_recstatus_t { 92 MDDB_NORECORD, 93 MDDB_NODATA, 94 MDDB_OK, 95 MDDB_STALE 96 }; 97 98 % 99 %/* 100 % * Commands for DB accesses from user land. 101 % */ 102 enum mddb_usercmd_t { 103 MD_DB_GETNEXTREC, 104 MD_DB_COMMIT_ONE, 105 MD_DB_COMMIT_MANY, 106 MD_DB_GETDATA, 107 MD_DB_DELETE, 108 MD_DB_CREATE, 109 MD_DB_GETSTATUS, 110 MD_DB_GETSIZE, 111 MD_DB_SETDATA, 112 MD_DB_MAKEID 113 }; 114 115 % 116 %/* 117 % * MDDB_USER record subtypes, set records and drive records. 118 % * Node records (NR) used for Multinode Disksets. 119 % * The MDDB_UR_SR record subtype is associated with the structures 120 % * md_set_record and md_mnset_record. 121 % * The MDDB_UR_DR record subtype is associated with the structure 122 % * md_drive_record. 123 % * The MDDB_NR_DR record subtype is associated with the structure 124 % * md_mnnode_record. 125 % * The MDDB_UR_LR record subtype is associated with the structure 126 % * md_mn_changelog_record_t 127 % */ 128 enum mddb_userrec_t { 129 MDDB_UR_ALL, 130 MDDB_UR_SR, 131 MDDB_UR_DR, 132 MDDB_UR_NR, 133 MDDB_UR_LR 134 }; 135 136 % 137 %/* 138 % * MDDB_USER record get commands. 139 % */ 140 enum md_ur_get_cmd_t { 141 MD_UR_GET_NEXT, 142 MD_UR_GET_WKEY 143 }; 144 145 % 146 %/* 147 % * These are the options for mddb_createrec() 148 % */ 149 enum md_create_rec_option_t { 150 MD_CRO_NOOPT = 0x000, 151 MD_CRO_OPTIMIZE = 0x001, 152 MD_CRO_32BIT = 0x002, 153 MD_CRO_64BIT = 0x004, 154 MD_CRO_STRIPE = 0x008, 155 MD_CRO_MIRROR = 0x010, 156 MD_CRO_RAID = 0x020, 157 MD_CRO_SOFTPART = 0x040, 158 MD_CRO_TRANS_MASTER = 0x080, 159 MD_CRO_TRANS_LOG = 0x100, 160 MD_CRO_HOTSPARE = 0x200, 161 MD_CRO_HOTSPARE_POOL = 0x400, 162 MD_CRO_CHANGELOG = 0x800 163 }; 164 165 % 166 %/* 167 % * This SKEW value is used to skew the sideno of 168 % * the share device names that are put into each 169 % * local set's namespace. This will prevent the 170 % * wrong name to be picked up via a devno, when 171 % * we really wanted a local device name. 172 % */ 173 const SKEW = 1; 174 175 #ifdef RPC_XDR 176 % 177 %/* Start - Avoid duplicate definitions, but get the xdr calls right */ 178 %#if 0 179 #include "meta_arr.x" 180 %#endif /* 0 */ 181 %/* End - Avoid duplicate definitions, but get the xdr calls right */ 182 % 183 #endif /* RPC_XDR */ 184 185 const MD_DRIVE_RECORD_REVISION = 0x00010000; 186 187 #ifdef RPC_HDR 188 % 189 %#define MD_DR_ADD 0x00000001U 190 %#define MD_DR_DEL 0x00000002U 191 %#define MD_DR_OK 0x80000000U 192 #endif /* RPC_HDR */ 193 194 #if !defined(_KERNEL) 195 struct md_drive_record { 196 u_int dr_revision; /* revision level */ 197 u_int dr_flags; /* state flags */ 198 mddb_recid_t dr_selfid; /* db record id */ 199 md_timeval32_t dr_ctime; /* creation timestamp */ 200 u_long dr_genid; /* generation id */ 201 md_drive_record *dr_next; /* next ptr (Incore) */ 202 mddb_recid_t dr_nextrec; /* next record id */ 203 int dr_dbcnt; /* # of replica's */ 204 int dr_dbsize; /* replica size */ 205 mdkey_t dr_key; /* namespace key */ 206 }; 207 #else /* _KERNEL */ 208 struct md_drive_record { 209 u_int dr_revision; /* revision level */ 210 u_int dr_flags; /* state flags */ 211 mddb_recid_t dr_selfid; /* db record id */ 212 md_timeval32_t dr_ctime; /* creation timestamp */ 213 u_int dr_genid; /* generation id */ 214 u_int dr_next; /* next ptr (Incore) */ 215 mddb_recid_t dr_nextrec; /* next record id */ 216 int dr_dbcnt; /* # of replica's */ 217 int dr_dbsize; /* replica size */ 218 mdkey_t dr_key; /* namespace key */ 219 }; 220 #endif /* !_KERNEL */ 221 222 #ifdef RPC_HDR 223 %/* 224 % * Actions that can be taken on a node record. 225 % * Used with routine upd_nr_flags. 226 % */ 227 % 228 %#define MD_NR_JOIN 0x00000001U /* Turn on JOIN flag */ 229 %#define MD_NR_WITHDRAW 0x00000002U /* Turn off JOIN flag */ 230 %#define MD_NR_SET 0x00000004U /* Set node flags in nodelist */ 231 %#define MD_NR_DEL 0x00000008U /* reset OK flag, set DEL */ 232 %#define MD_NR_OK 0x80000000U /* set OK flag; reset ADD */ 233 #endif /* RPC_HDR */ 234 235 struct md_mnnode_record { 236 u_int nr_revision; /* revision level */ 237 u_int nr_flags; /* state flags */ 238 mddb_recid_t nr_selfid; /* db record id */ 239 md_timeval32_t nr_ctime; /* creation timestamp */ 240 u_long nr_genid; /* generation id */ 241 md_mnnode_record *nr_next; /* next ptr (Incore) */ 242 mddb_recid_t nr_nextrec; /* next node rec id */ 243 u_int nr_nodeid; /* node id */ 244 md_node_nm_t nr_nodename; /* node name */ 245 246 }; 247 248 const MD_MNNODE_RECORD_REVISION = 0x00000100; 249 250 const MD_SET_RECORD_REVISION = 0x00010000; 251 252 #ifdef RPC_HDR 253 % 254 %#define MD_SR_ADD 0x00000001U 255 %#define MD_SR_DEL 0x00000002U 256 %#define MD_SR_CHECK 0x00000004U 257 %#define MD_SR_CVT 0x00000008U 258 %#define MD_SR_LOCAL 0x00000010U 259 %#define MD_SR_MB_DEVID 0x10000000U 260 %#define MD_SR_AUTO_TAKE 0x20000000U 261 %#define MD_SR_MN 0x40000000U 262 %#define MD_SR_OK 0x80000000U 263 %#define MD_SR_STATE_FLAGS (MD_SR_ADD | \ 264 % MD_SR_DEL | \ 265 % MD_SR_CHECK | \ 266 % MD_SR_CVT | \ 267 % MD_SR_OK) 268 #endif /* RPC_HDR */ 269 270 #if !defined(_KERNEL) 271 struct md_set_record { 272 u_int sr_revision; /* revision level */ 273 u_int sr_flags; /* state flags */ 274 mddb_recid_t sr_selfid; /* db record id */ 275 #ifdef RPC_HDR 276 md_set_record *sr_next; /* next ptr (Incore) */ 277 #endif /* RPC_HDR */ 278 set_t sr_setno; /* set number */ 279 md_set_nm_t sr_setname; /* setname */ 280 md_timeval32_t sr_ctime; /* creation timestamp */ 281 u_long sr_genid; /* generation id */ 282 md_node_nm_arr_t sr_nodes; /* array of nodenames */ 283 md_drive_record *sr_drivechain; /* dr list (Incore) */ 284 mddb_recid_t sr_driverec; /* first dr record id */ 285 mhd_mhiargs_t sr_mhiargs; /* MH ioctl timeouts */ 286 md_h_arr_t sr_med; /* Mediator hosts */ 287 }; 288 #else /* _KERNEL */ 289 struct md_set_record { 290 u_int sr_revision; /* revision level */ 291 u_int sr_flags; /* state flags */ 292 mddb_recid_t sr_selfid; /* db record id */ 293 #ifdef RPC_HDR 294 u_int sr_next; /* next ptr (Incore) */ 295 #endif /* RPC_HDR */ 296 set_t sr_setno; /* set number */ 297 md_set_nm_t sr_setname; /* setname */ 298 md_timeval32_t sr_ctime; /* creation timestamp */ 299 u_int sr_genid; /* generation id */ 300 md_node_nm_arr_t sr_nodes; /* array of nodenames */ 301 u_int sr_drivechain; /* dr list (Incore) */ 302 mddb_recid_t sr_driverec; /* first dr record id */ 303 mhd_mhiargs_t sr_mhiargs; /* MH ioctl timeouts */ 304 md_h_arr_t sr_med; /* Mediator hosts */ 305 }; 306 #endif /* !_KERNEL */ 307 308 struct md_mnset_record { 309 u_int sr_revision; /* revision level */ 310 u_int sr_flags; /* state flags */ 311 mddb_recid_t sr_selfid; /* db record id */ 312 #ifdef RPC_HDR 313 md_set_record *sr_next; /* next ptr (Incore) */ 314 #endif /* RPC_HDR */ 315 set_t sr_setno; /* set number */ 316 md_set_nm_t sr_setname; /* setname */ 317 md_timeval32_t sr_ctime; /* creation timestamp */ 318 u_long sr_genid; /* generation id */ 319 md_node_nm_arr_t sr_nodes_bw_compat; /* for compat with */ 320 /* md_set_record, */ 321 /* first node always */ 322 /* this node */ 323 md_drive_record *sr_drivechain; /* dr list (Incore) */ 324 mddb_recid_t sr_driverec; /* first dr record id */ 325 mhd_mhiargs_t sr_mhiargs; /* MH ioctl timeouts */ 326 md_h_arr_t sr_med; /* Mediator hosts */ 327 md_mnnode_record *sr_nodechain; /* node list (incore) */ 328 mddb_recid_t sr_noderec; /* first node rec id */ 329 md_node_nm_t sr_master_nodenm; /* Master nm (incore) */ 330 u_int sr_master_nodeid; /* Master id (incore) */ 331 u_int sr_mddb_min_size; /* min size of mddb */ 332 }; 333 334 #ifdef RPC_HDR 335 % 336 %#define MD_SETOWNER_NO 0 337 %#define MD_SETOWNER_YES 1 338 %#define MD_SETOWNER_NONE 2 339 #endif /* RPC_HDR */ 340 341 % 342 %/* Gate key type */ 343 struct md_setkey_t { 344 string sk_host<>; 345 set_t sk_setno; 346 string sk_setname<>; 347 md_timeval32_t sk_key; 348 #ifdef RPC_HDR 349 struct md_setkey_t *sk_next; 350 #endif /* RPC_HDR */ 351 }; 352 353 % 354 %/* metadevice ID */ 355 typedef minor_t unit_t; 356 357 % 358 %/* component ID */ 359 struct comp_t { 360 minor_t mnum; /* associated metadevice */ 361 md_dev64_t dev; 362 }; 363 364 % 365 %/* hotspare pool ID */ 366 typedef u_int hsp_t; 367 368 #ifdef RPC_HDR 369 % 370 %#define MD_HSP_NONE ((hsp_t)~0U) 371 #endif /* RPC_HDR */ 372 373 % 374 %/* hotspare ID */ 375 struct hs_t { 376 hsp_t hsp; /* associated hotspare pool */ 377 md_dev64_t dev; /* device ID */ 378 }; 379 380 % 381 %/* mnum or hsp */ 382 typedef u_int minor_or_hsp_t; 383 384 % 385 %/* 386 % * name service stuff 387 % */ 388 const MD_MAXPREFIX = 127; 389 % 390 %#define MD_MAX_CTDLEN 64 391 392 struct md_name_prefix { 393 u_char pre_len; 394 char pre_data[MD_MAXPREFIX]; 395 }; 396 397 const MD_MAXSUFFIX = 40; 398 % 399 struct md_name_suffix { 400 u_char suf_prefix; 401 u_char suf_len; 402 char suf_data[MD_MAXSUFFIX]; 403 }; 404 405 struct md_splitname { 406 md_name_prefix sn_prefix; 407 md_name_suffix sn_suffix; 408 }; 409 410 #ifdef RPC_HDR 411 % 412 %#define SPN_PREFIX(spn) ((spn)->sn_prefix) 413 %#define SPN_SUFFIX(spn) ((spn)->sn_suffix) 414 #endif /* RPC_HDR */ 415 416 % 417 %/* 418 % * Number of bits to represent a setno 419 % * this gives us all info to define masks and shifts ... 420 % * Also used for minor #, hsp id, recid mask and shifts. 421 % */ 422 const MD_BITSSET = 5; 423 const MD_DEFAULTSETS = 4; 424 % 425 #ifdef RPC_HDR 426 % 427 %#define MD_MAXSETS (1 << MD_BITSSET) 428 %#define MD_SETMASK (MD_MAXSETS - 1) 429 #endif /* RPC_HDR */ 430 431 % 432 %/* 433 % * Define a file descriptor for lockfd 434 % * when the lock is not held. 435 % */ 436 const MD_NO_LOCK = -2; 437 438 % 439 %/* 440 % * accumulated setname 441 % */ 442 struct mdsetname_t { 443 string setname<>; /* logical name */ 444 set_t setno; /* set number */ 445 #ifdef RPC_HDR 446 struct md_set_desc *setdesc; /* Cache set/drive desc */ 447 int lockfd; /* used by meta_lock_* */ 448 #endif /* RPC_HDR */ 449 }; 450 451 struct mdsetnamelist_t { 452 mdsetnamelist_t *next; 453 mdsetname_t *sp; 454 }; 455 456 % 457 %/* 458 % * device name 459 % */ 460 #ifdef RPC_HDR 461 %#define MD_FULLNAME_ONLY 0x0 462 %#define MD_BASICNAME_OK 0x1 463 %#define MD_BYPASS_DAEMON 0x2 464 % 465 %#define MD_SLICE0 0 466 %#define MD_SLICE6 6 467 %#define MD_SLICE7 7 468 % 469 %#define MD_MAX_PARTS 17 470 #endif /* RPC_HDR */ 471 472 struct mdname_t { 473 #ifdef RPC_HDR 474 struct mddrivename_t *drivenamep; /* back pointer to drive */ 475 #endif /* RPC_HDR */ 476 string cname<>; /* cannonical name */ 477 string bname<>; /* block name */ 478 string rname<>; /* raw name */ 479 string devicesname<>; /* /devices name (or NULL) */ 480 string minor_name<>; /* minor name with respect to devid */ 481 md_dev64_t dev; /* major/minor (or NODEV64) */ 482 #ifdef RPC_HDR 483 mdkey_t key; /* namespace key (or MD_KEYBAD) */ 484 #endif /* RPC_HDR */ 485 diskaddr_t end_blk; /* end of database replicas (or -1) */ 486 diskaddr_t start_blk; /* usable start block (or -1) */ 487 }; 488 489 %/* name structure (old style) */ 490 struct o_mdname_t { 491 #ifdef RPC_HDR 492 struct o_mddrivename_t *drivenamep; /* back pointer to drive */ 493 #endif /* RPC_HDR */ 494 string cname<>; /* cannonical name */ 495 string bname<>; /* block name */ 496 string rname<>; /* raw name */ 497 string devicesname<>; /* /devices name (or NULL) */ 498 dev_t dev; /* major/minor (or NODEV64) */ 499 #ifdef RPC_HDR 500 mdkey_t key; /* namespace key (or MD_KEYBAD) */ 501 #endif /* RPC_HDR */ 502 daddr_t end_blk; /* end of database replicas (or -1) */ 503 daddr_t start_blk; /* usable start block (or -1) */ 504 }; 505 506 struct mdnamelist_t { 507 mdnamelist_t *next; 508 mdname_t *namep; 509 }; 510 511 % 512 %/* 513 % * drive name 514 % */ 515 %/* name types */ 516 enum mdnmtype_t { 517 MDT_UNKNOWN = 0, /* unknown type */ 518 MDT_ACCES, /* could not access device */ 519 MDT_META, /* metadevice name */ 520 MDT_COMP, /* regular device name */ 521 MDT_FAST_META, /* metadevice name (partial) */ 522 MDT_FAST_COMP /* regular device name (partial) */ 523 }; 524 525 %/* metadevice types */ 526 enum md_types_t { 527 MD_UNDEFINED = 0, 528 MD_DEVICE, 529 MD_METAMIRROR, 530 MD_METATRANS, 531 MD_METARAID, 532 MD_METASP 533 }; 534 535 #ifdef RPC_HDR 536 % 537 %/* misc module names */ 538 %#define MD_STRIPE "md_stripe" 539 %#define MD_MIRROR "md_mirror" 540 %#define MD_TRANS "md_trans" 541 %#define MD_HOTSPARES "md_hotspares" 542 %#define MD_RAID "md_raid" 543 %#define MD_VERIFY "md_verify" 544 %#define MD_SP "md_sp" 545 %#define MD_NOTIFY "md_notify" 546 #endif /* RPC_HDR */ 547 548 %/* generic device info */ 549 struct mdgeom_t { 550 u_int ncyl; 551 u_int nhead; 552 u_int nsect; 553 u_int rpm; 554 u_int write_reinstruct; 555 u_int read_reinstruct; 556 u_int blk_sz; 557 }; 558 559 %/* generic device info (old style) */ 560 struct o_mdgeom_t { 561 u_int ncyl; 562 u_int nhead; 563 u_int nsect; 564 u_int rpm; 565 u_int write_reinstruct; 566 u_int read_reinstruct; 567 }; 568 569 struct mdcinfo_t { 570 char cname[16]; /* controller driver name */ 571 mhd_ctlrtype_t ctype; /* controller type */ 572 u_int cnum; /* controller instance */ 573 u_int tray; /* SSA100 tray */ 574 u_int bus; /* SSA100 bus */ 575 u_longlong_t wwn; /* SSA100 World Wide Name */ 576 char dname[16]; /* disk driver name */ 577 u_int unit; /* disk instance */ 578 u_int maxtransfer; /* max I/O size (in blocks) */ 579 }; 580 581 struct mdpart_t { 582 diskaddr_t start; /* start block */ 583 diskaddr_t size; /* size of partition (in blocks) */ 584 u_short tag; /* ID tag of partition */ 585 u_short flag; /* permission flags */ 586 diskaddr_t label; /* size of disk label (or 0) */ 587 }; 588 589 %/* partition information (old style) */ 590 struct o_mdpart_t { 591 daddr_t start; /* start block */ 592 daddr_t size; /* size of partition (in blocks) */ 593 u_short tag; /* ID tag of partition */ 594 u_short flag; /* permission flags */ 595 daddr_t label; /* size of disk label (or 0) */ 596 }; 597 598 struct mdvtoc_t { 599 u_int nparts; 600 diskaddr_t first_lba; /* for efi devices only */ 601 diskaddr_t last_lba; /* for efi devices only */ 602 diskaddr_t lbasize; /* for efi devices only */ 603 mdpart_t parts[MD_MAX_PARTS]; /* room for i386 too */ 604 char *typename; /* disk type (or NULL) */ 605 }; 606 607 %/* vtoc information (old style) */ 608 struct o_mdvtoc_t { 609 char *typename; /* disk type (or NULL) */ 610 u_int nparts; 611 o_mdpart_t parts[16]; /* room for i386 too */ 612 }; 613 % 614 %/* 615 % * List of drivename cnames per side, 616 % * also the driver name, mnum (for slice 7). 617 % */ 618 struct mdsidenames_t { 619 mdsidenames_t *next; 620 side_t sideno; 621 minor_t mnum; 622 string dname<>; 623 string cname<>; 624 }; 625 626 struct mddrivename_t { 627 #ifdef RPC_HDR 628 /* 629 * the following string is not used but is left in place so that 630 * it is not necessary to version the rpc interface that passes 631 * this structure. 632 */ 633 string not_used<>; 634 #endif /* RPC_HDR */ 635 string cname<>; /* canonical drive name */ 636 string rname<>; /* raw name */ 637 mdnmtype_t type; /* type of drive */ 638 string devid<>; /* Device Id of the drive */ 639 int errnum; /* errno for type == MDT_ACCES */ 640 mdgeom_t geom; /* disk geometry */ 641 mdcinfo_t cinfo; /* controller info */ 642 mdvtoc_t vtoc; /* volume table of contents info */ 643 mdname_t parts<>; /* partitions in drive */ 644 mdsidenames_t *side_names; /* list of names per side */ 645 mdkey_t side_names_key; /* key used to store the side names*/ 646 647 string miscname<>; /* metadevice misc name */ 648 #ifdef RPC_HDR 649 struct md_common_t *unitp; /* metadevice unit structure */ 650 #endif /* RPC_HDR */ 651 }; 652 653 %/* 654 % * old version of mddrivename_t that contains an old version of mdgeom_t, 655 % * mdvtoc_t and mdname_t (prefixed _o). 656 % */ 657 struct o_mddrivename_t { 658 #ifdef RPC_HDR 659 string cachenm<>; /* name used for cache lookups */ 660 #endif /* RPC_HDR */ 661 string cname<>; /* canonical drive name */ 662 string rname<>; /* raw name */ 663 mdnmtype_t type; /* type of drive */ 664 int errnum; /* errno for type == MDT_ACCES */ 665 o_mdgeom_t geom; /* disk geometry (old style) */ 666 mdcinfo_t cinfo; /* controller info */ 667 o_mdvtoc_t vtoc; /* vtoc info (old style) */ 668 o_mdname_t parts<>; /* partitions in drive (old style) */ 669 mdsidenames_t *side_names; /* list of names per side */ 670 mdkey_t side_names_key; /* key used to store the side names*/ 671 672 string miscname<>; /* metadevice misc name */ 673 #ifdef RPC_HDR 674 struct md_common_t *unitp; /* metadevice unit structure */ 675 #endif /* RPC_HDR */ 676 }; 677 struct mddrivenamelist_t { 678 mddrivenamelist_t *next; 679 mddrivename_t *drivenamep; 680 }; 681 682 % 683 %/* 684 % * replica struct 685 % */ 686 typedef u_int replica_flags_t; 687 #ifdef RPC_HDR 688 % 689 %#define MDDB_F_EREAD 0x00001 /* a read error occurred */ 690 %#define MDDB_F_TOOSMALL 0x00002 /* replica is too small to hold db */ 691 %#define MDDB_F_EFMT 0x00004 /* something is wrong with the data */ 692 %#define MDDB_F_EDATA 0x00008 /* error in data blocks */ 693 %#define MDDB_F_EMASTER 0x00010 /* error in master block(s) */ 694 %#define MDDB_F_ACTIVE 0x00020 /* this replica is currently in use */ 695 %#define MDDB_F_EWRITE 0x00040 /* a write error occurred */ 696 %#define MDDB_F_MASTER 0x00080 /* the copy which was used as input */ 697 %#define MDDB_F_SUSPECT 0x00100 /* replica write ability is suspect */ 698 %#define MDDB_F_PTCHED 0x00400 /* db location was patched in kernel */ 699 %#define MDDB_F_IOCTL 0x00800 /* db location passed in from ioctl */ 700 %#define MDDB_F_GOTTEN 0x01000 /* getdev has been done on this dev */ 701 %#define MDDB_F_LOCACC 0x02000 /* the locator has been accessed */ 702 %#define MDDB_F_UP2DATE 0x04000 /* this copy of db is up to date */ 703 %#define MDDB_F_OLDACT 0x08000 /* this copy was active previously */ 704 %#define MDDB_F_DELETED 0x10000 /* place holder in empty slot */ 705 %#define MDDB_F_TAGDATA 0x20000 /* Data is tagged */ 706 %#define MDDB_F_BADTAG 0x40000 /* Data tag was not valid */ 707 %#define MDDB_F_NODEVID 0x80000 /* No devid associated with replica */ 708 % 709 %/* 710 % * These are used in de_flags only 711 % * Do not change these values, they are stored on-disk 712 % */ 713 %#define MDDB_F_STRIPE 0x00001 /* record is a stripe record */ 714 %#define MDDB_F_MIRROR 0x00002 /* record is a mirror record */ 715 %#define MDDB_F_RAID 0x00004 /* record is a raid record */ 716 %#define MDDB_F_SOFTPART 0x00008 /* record is a sp record */ 717 %#define MDDB_F_TRANS_MASTER 0x00010 /* trans master record */ 718 %#define MDDB_F_TRANS_LOG 0x00020 /* trans log record */ 719 %#define MDDB_F_HOTSPARE 0x00040 /* hotspare record */ 720 %#define MDDB_F_HOTSPARE_POOL 0x00080 /* hotspare record */ 721 %#define MDDB_F_OPT 0x00200 /* optimization record */ 722 %#define MDDB_F_CHANGELOG 0x00400 /* change log record */ 723 724 %/* used by metadb(1m) for printing */ 725 %#define MDDB_FLAGS_STRING "RSFDMaWm pc luo tBr" 726 %#define MDDB_FLAGS_LEN (strlen(MDDB_FLAGS_STRING)) 727 % 728 %/* 729 % * See meta_prbits() in SUNWmd/lib/libmeta/meta_print.c for a description of 730 % * the way this is used 731 % */ 732 %#define MDDB_F_BITNAMES "\020\001EREAD\002TOOSMALL\003EFMT\004EDATA" \ 733 % "\005EMASTER\006ACTIVE\007EWRITE\010MASTER" \ 734 % "\011SUSPECT\012OPT\013PTCHED\014IOCTL" \ 735 % "\015GOTTEN\016LOCACC\017UP2DATE\020OLDACT" \ 736 % "\021DELETED\022TAGDATA\023BADTAG\024NORELOC" 737 % 738 #endif /* RPC_HDR */ 739 740 /* 741 * Refering to r_blkno and r_nblk: 742 * A replica will always be smaller than 1 Terabyte, so no need to 743 * change the ondisk structure to 64 bits. 744 */ 745 struct md_replica_t { 746 mdname_t *r_namep; 747 replica_flags_t r_flags; 748 daddr_t r_blkno; 749 daddr_t r_nblk; 750 ddi_devid_t r_devid; 751 char r_driver_name[MD_MAXDRVNM]; 752 char r_minor_name[MDDB_MINOR_NAME_MAX]; 753 }; 754 755 struct md_replica_recerr_t { 756 int r_li; 757 int r_flags; 758 daddr32_t r_blkno; 759 minor_t r_mnum; 760 char r_driver_name[MD_MAXDRVNM]; 761 }; 762 763 struct md_replicalist_t { 764 md_replicalist_t *rl_next; 765 md_replica_t *rl_repp; 766 }; 767 768 % 769 %/* 770 % * set/drive structs exposed by the library routines 771 % */ 772 struct md_drive_desc { 773 md_timeval32_t dd_ctime; /* creation time */ 774 u_long dd_genid; /* generation id */ 775 u_int dd_flags; /* state flags */ 776 md_drive_desc *dd_next; /* next drive */ 777 mddrivename_t *dd_dnp; /* drive name ptr */ 778 int dd_dbcnt; /* # of replicas */ 779 int dd_dbsize; /* size of replica */ 780 }; 781 782 % 783 %/* 784 % * set/drive structs exposed by the library routines (old style) 785 % */ 786 struct o_md_drive_desc { 787 md_timeval32_t dd_ctime; /* creation time */ 788 u_long dd_genid; /* generation id */ 789 u_int dd_flags; /* state flags */ 790 o_md_drive_desc *dd_next; /* next drive */ 791 o_mddrivename_t *dd_dnp; /* drive name ptr */ 792 int dd_dbcnt; /* # of replicas */ 793 int dd_dbsize; /* size of replica */ 794 }; 795 796 struct md_mnnode_desc { 797 md_timeval32_t nd_ctime; /* creation time */ 798 u_long nd_genid; /* generation id */ 799 u_int nd_flags; /* state flags */ 800 md_mnnode_desc *nd_next; /* next node */ 801 md_mnnode_nm_t nd_nodename; /* name of node */ 802 u_int nd_nodeid; /* id of node */ 803 md_mnnode_nm_t nd_priv_ic; /* priv interconnect */ 804 /* nodename */ 805 }; 806 807 struct md_set_desc { 808 md_timeval32_t sd_ctime; /* creation time */ 809 u_long sd_genid; /* generation id */ 810 set_t sd_setno; /* set number */ 811 u_int sd_flags; /* state flags */ 812 md_node_nm_arr_t sd_nodes; /* array of nodenames */ 813 /* for !MN_disksets */ 814 int sd_isown[MD_MAXSIDES]; /* bool for is owner? */ 815 md_h_arr_t sd_med; /* Mediator hosts */ 816 md_drive_desc *sd_drvs; /* drive list */ 817 u_int sd_mn_am_i_master; 818 u_int sd_mn_numnodes; /* # of nodes in list */ 819 md_mnnode_desc *sd_nodelist; /* MN node list */ 820 /* for MN_disksets */ 821 md_node_nm_t sd_mn_master_nodenm; /* Master node name */ 822 u_int sd_mn_master_nodeid; /* Master node id */ 823 md_mnnode_desc *sd_mn_mynode; /* shortcut to me */ 824 md_mnnode_desc *sd_mn_masternode; /* shortcut to master */ 825 }; 826 827 %/* 828 % * Defines to determine if diskset is a Multinode diskset. 829 % * The sd_flags field in the md_set_desc structure is never manipulated 830 % * directly but is always a copy of the set record's sr_flags field, so 831 % * the same define (MD_SR_MN) can be used for both sd_flags and sr_flags. 832 % * The set record is of the structure type md_set_record if a regular diskset 833 % * or type md_mnset_record for a Multinode diskset. 834 %*/ 835 %#define MD_MNSET_DESC(sd) (((sd)->sd_flags & MD_SR_MN) ? 1 : 0) 836 %#define MD_MNSET_REC(sr) (((sr)->sr_flags & MD_SR_MN) ? 1 : 0) 837 %#define MD_MNDR_REC(dr) (((dr)->dr_flags & MD_DR_MN) ? 1 : 0) 838 839 %/* 840 % * Define to determine if diskset is a Auto-Take diskset. 841 %*/ 842 %#define MD_ATSET_DESC(sd) (((sd)->sd_flags & MD_SR_AUTO_TAKE) ? 1 : 0) 843 844 %/* 845 % * Define to set the alive flag for a node. A node is alive if it 846 % * is in the multi_node membership list. 847 % */ 848 %#define MD_MN_NODE_ALIVE 0x0001 849 850 %/* 851 % * Define to set the own flag for a node. A node is an owner of the diskset 852 % * if that node has snarf'd in the mddb. 853 % */ 854 %#define MD_MN_NODE_OWN 0x0002 855 856 %/* 857 % * Defines to set the add, delete and ok states of a node. The add state is 858 % * set at the beginning of the addition of a node to a diskset. The 859 % * delete state is set at the beginning of a deletion of a node from a diskset. 860 % * The OK state is set (and the add state reset) when that node is 861 % * functional in the diskset. 862 % * Rollback join flag is used on an error condition when deleting the last 863 % * disk from a diskset. rpc.metad should never see this flag. 864 % * NOSET flag is used on an error condition during a reconfig cycle when 865 % * the set has been removed from this node. rpc.metad should just ignore 866 % * this flag. 867 % */ 868 %#define MD_MN_NODE_ADD 0x0004 869 %#define MD_MN_NODE_DEL 0x0008 870 %#define MD_MN_NODE_OK 0x0010 871 %#define MD_MN_NODE_RB_JOIN 0x0020 872 %#define MD_MN_NODE_NOSET 0x0040 873 874 %/* 875 % * Define for invalid node id. Used specifically to set mn set record 876 % * master nodeid to invalid when no master can be determined. 877 % */ 878 %#define MD_MN_INVALID_NID 0xfffffffful /* invalid node id */ 879 880 % 881 %/* 882 % * set description (old style) 883 % */ 884 struct o_md_set_desc { 885 md_timeval32_t sd_ctime; /* creation time */ 886 u_long sd_genid; /* generation id */ 887 set_t sd_setno; /* set number */ 888 u_int sd_flags; /* state flags */ 889 md_node_nm_arr_t sd_nodes; /* array of nodenames */ 890 int sd_isown[MD_MAXSIDES]; /* bool for is owner? */ 891 md_h_arr_t sd_med; /* Mediator hosts */ 892 o_md_drive_desc *sd_drvs; /* drive list */ 893 }; 894 895 % 896 %/* 897 % * hotspare pool name 898 % */ 899 struct mdhspname_t { 900 string hspname<>; /* hotspare pool name */ 901 hsp_t hsp; /* number */ 902 903 #ifdef RPC_HDR 904 struct md_hsp_t *unitp; /* hotspare pool unit structure */ 905 #endif /* RPC_HDR */ 906 }; 907 908 struct mdhspnamelist_t { 909 mdhspnamelist_t *next; 910 mdhspname_t *hspnamep; 911 }; 912 913 % 914 %/* 915 % * generic metadevice descriptions for status and init 916 % */ 917 % 918 919 %/* 920 % * following used with un_status 921 % * bottom 16 bits are global definitions 922 % * top 16 bits are defined by sub device 923 % */ 924 typedef u_int md_status_t; 925 #ifdef RPC_HDR 926 % 927 %#define MD_UN_GROW_PENDING 0x0008 /* grow mirror pending */ 928 %#define MD_UN_BEING_RESET 0x0040 /* reset at snarf time */ 929 #endif /* RPC_HDR */ 930 % 931 %/* 932 % * following are used with un_parent 933 % * MD_NO_PARENT - Not a sub-device. 934 % * MD_MULTI_PARENT - A sub-device with one or more parents, like a log. 935 % * other - A sub-device with only one parent, like a submirror. 936 % * The number is the parent's unit number. 937 % */ 938 typedef unit_t md_parent_t; 939 #ifdef RPC_HDR 940 % 941 %#define MD_NO_PARENT 0xffffffffu 942 %#define MD_MULTI_PARENT 0xfffffffeu 943 %#define MD_HAS_PARENT(p) ((p) != MD_NO_PARENT) 944 #endif /* RPC_HDR */ 945 946 typedef u_int md_stackcap_t; 947 #ifdef RPC_HDR 948 % 949 %#define MD_CANT_PARENT 0x00 /* cannot have a parent */ 950 %#define MD_CAN_PARENT 0x01 /* can have a parent */ 951 %#define MD_CAN_SUB_MIRROR 0x02 /* can be a sub-mirror */ 952 %#define MD_CAN_META_CHILD 0x04 /* can have metadev. children */ 953 %#define MD_CAN_SP 0x08 /* can be soft partitioned */ 954 955 #endif /* RPC_HDR */ 956 957 /* common to all metadevices */ 958 struct md_common_t { 959 mdname_t *namep; 960 md_types_t type; 961 md_status_t state; 962 md_stackcap_t capabilities; 963 md_parent_t parent; 964 diskaddr_t size; 965 u_long user_flags; 966 u_longlong_t revision; 967 }; 968 969 % 970 %/* 971 % * stripe 972 % */ 973 /* 974 * ioctl stuff 975 */ 976 struct ms_params_t { 977 int change_hsp_id; 978 hsp_t hsp_id; 979 }; 980 981 /* 982 * unit structure 983 */ 984 typedef u_int comp_state_t; 985 #ifdef RPC_HDR 986 % 987 %#define CS_OKAY 0x0001 988 %#define CS_ERRED 0x0002 989 %#define CS_RESYNC 0x0004 990 %#define CS_LAST_ERRED 0x0008 991 % 992 %/* interlace values (in bytes) */ 993 %#define MININTERLACE (16 * 512) 994 %#define MAXINTERLACE (100 * 1024 * 1024) 995 #endif /* RPC_HDR */ 996 997 struct md_comp_t { 998 mdname_t *compnamep; 999 mdname_t *hsnamep; 1000 comp_state_t state; 1001 u_int lasterrcnt; 1002 md_timeval32_t timestamp; 1003 }; 1004 1005 struct md_row_t { 1006 diskaddr_t interlace; 1007 diskaddr_t row_size; 1008 md_comp_t comps<>; 1009 }; 1010 1011 struct md_stripe_t { 1012 md_common_t common; 1013 mdhspname_t *hspnamep; 1014 md_row_t rows<>; 1015 }; 1016 1017 % 1018 %/* 1019 % * soft partition 1020 % */ 1021 typedef uint64_t xsp_offset_t; 1022 typedef uint64_t xsp_length_t; 1023 typedef u_int xsp_status_t; 1024 % 1025 %#define SP_INIT 0x0001 1026 %#define SP_OK 0x0002 1027 %#define SP_LASTERR 0x0004 1028 % 1029 /* 1030 * unit structure 1031 */ 1032 1033 struct md_sp_ext_t { 1034 xsp_offset_t voff; 1035 xsp_offset_t poff; 1036 xsp_length_t len; 1037 }; 1038 1039 struct md_sp_t { 1040 md_common_t common; 1041 mdname_t *compnamep; /* name of this component */ 1042 xsp_status_t status; /* state of this soft partition */ 1043 md_sp_ext_t ext<>; 1044 }; 1045 1046 % 1047 %/* 1048 % * mirror 1049 % */ 1050 /* 1051 * ioctl stuff 1052 */ 1053 enum mm_wr_opt_t { 1054 WR_PARALLEL = 0, /* write submirrors in parallel */ 1055 WR_SERIAL /* write submirrors one at a time */ 1056 }; 1057 1058 enum mm_rd_opt_t { 1059 RD_LOAD_BAL = 0, /* read submirrors roundrobin */ 1060 RD_GEOMETRY, /* read submirrors geometrically */ 1061 RD_FIRST /* read first submirror */ 1062 }; 1063 1064 typedef short mm_pass_num_t; 1065 const MD_PASS_DEFAULT = 1; 1066 const MD_PASS_MAX = 9; 1067 1068 struct mm_params_t { 1069 int change_read_option; 1070 mm_rd_opt_t read_option; 1071 int change_write_option; 1072 mm_wr_opt_t write_option; 1073 int change_pass_num; 1074 mm_pass_num_t pass_num; 1075 }; 1076 1077 /* 1078 * unit structure 1079 */ 1080 typedef u_int sm_state_t; 1081 #ifdef RPC_HDR 1082 % 1083 %#define SMS_UNUSED 0x0000 1084 %#define SMS_RUNNING 0x0001 1085 %#define SMS_COMP_ERRED 0x0002 1086 %#define SMS_COMP_RESYNC 0x0004 1087 %#define SMS_ATTACHED 0x0008 1088 %#define SMS_ATTACHED_RESYNC 0x0010 1089 %#define SMS_OFFLINE 0x0020 1090 %#define SMS_OFFLINE_RESYNC 0x0040 1091 %#define SMS_ALL_ERRED 0x0080 1092 %#define SMS_INUSE (0xffff) 1093 %#define SMS_LIMPING (SMS_COMP_ERRED | SMS_COMP_RESYNC) 1094 %#define SMS_IGNORE 0x4000 1095 #endif /* RPC_HDR */ 1096 1097 typedef u_int sm_flags_t; 1098 #ifdef RPC_HDR 1099 % 1100 %#define MD_SM_RESYNC_TARGET 0x0001 1101 %#define MD_SM_FAILFAST 0x0002 1102 #endif /* RPC_HDR */ 1103 1104 struct md_submirror_t { 1105 mdname_t *submirnamep; 1106 sm_state_t state; 1107 sm_flags_t flags; 1108 md_timeval32_t timestamp; 1109 }; 1110 1111 #ifdef RPC_HDR 1112 % 1113 %#define MD_UN_RESYNC_ACTIVE 0x00010000 1114 %#define MD_UN_WAR 0x00020000 1115 %#define MD_UN_OFFLINE_SM 0x00040000 1116 %#define MD_UN_OPT_NOT_DONE 0x00080000 1117 %#define MD_UN_KEEP_DIRTY (MD_UN_OFFLINE_SM | MD_UN_OPT_NOT_DONE) 1118 %#define MD_UN_RESYNC_CANCEL 0x00100000 1119 %#define MD_UN_REPLAYED 0x00200000 1120 %#define MD_UN_RENAMING 0x00400000 1121 %#define MD_UN_MOD_INPROGRESS (MD_UN_RESYNC_ACTIVE | \ 1122 % MD_UN_OPT_NOT_DONE | \ 1123 % MD_UN_RENAMING) 1124 #endif /* RPC_HDR */ 1125 1126 const NMIRROR = 4; 1127 struct md_mirror_t { 1128 md_common_t common; 1129 mm_rd_opt_t read_option; 1130 mm_wr_opt_t write_option; 1131 mm_pass_num_t pass_num; 1132 int percent_done; 1133 int percent_dirty; 1134 md_submirror_t submirrors[NMIRROR]; 1135 }; 1136 1137 1138 % 1139 %/* 1140 % * trans 1141 % */ 1142 %/* 1143 % * unit structure 1144 % */ 1145 typedef u_int mt_flags_t; 1146 #ifdef RPC_HDR 1147 % 1148 %#define TRANS_NEED_OPEN 0x0001 /* subdevs are unopened */ 1149 %#define TRANS_OPENED 0x0002 /* open at snarf succeeded */ 1150 %#define TRANS_DETACHING 0x0004 /* detaching the log */ 1151 %#define TRANS_DETACHED 0x0008 /* log successfully detached */ 1152 %#define TRANS_DETACH_SKIP 0x0010 /* already processed; skip */ 1153 %#define TRANS_ATTACHING 0x0020 /* attaching the log */ 1154 %#define TRANS_ROLL_ON_WRITE 0x0040 /* roll on physio write */ 1155 %#define TRANS_NEED_SCANROLL 0x0080 /* roll on physio write */ 1156 #endif /* RPC_HDR */ 1157 1158 typedef u_int mt_l_error_t; 1159 #ifdef RPC_HDR 1160 % 1161 %#define LDL_ERROR 0x0001 /* error state */ 1162 %#define LDL_HERROR 0x0002 /* hard error state */ 1163 %#define LDL_ANYERROR 0x0003 /* any error state */ 1164 %#define LDL_NOERROR 0x0004 /* dont error transition during scan */ 1165 %#define LDL_SAVERROR 0x0008 /* transition to error after scan */ 1166 #endif /* RPC_HDR */ 1167 1168 typedef u_int mt_debug_t; /* values in md_trans.h */ 1169 1170 struct md_trans_t { 1171 md_common_t common; 1172 mdname_t *masternamep; 1173 mdname_t *lognamep; 1174 mt_flags_t flags; 1175 md_timeval32_t timestamp; 1176 mt_l_error_t log_error; 1177 md_timeval32_t log_timestamp; 1178 daddr_t log_size; 1179 mt_debug_t debug; 1180 }; 1181 1182 1183 1184 % 1185 %/* 1186 % * RAID 1187 % */ 1188 /* 1189 * ioctl stuff 1190 */ 1191 struct mr_params_t { 1192 int change_hsp_id; 1193 hsp_t hsp_id; 1194 }; 1195 1196 /* 1197 * unit structure 1198 */ 1199 enum rcs_state_t { 1200 RCS_UNUSED = 0x0, 1201 RCS_INIT = 0x1, 1202 RCS_OKAY = 0x2, 1203 RCS_ERRED = 0x4, 1204 RCS_LAST_ERRED = 0x8, 1205 RCS_RESYNC = 0x10, 1206 RCS_INIT_ERRED = 0x20, 1207 RCS_REGEN = 0x40 1208 }; 1209 1210 typedef u_int rcs_flags_t; 1211 #ifdef RPC_HDR 1212 % 1213 %#define MD_RAID_DEV_ISOPEN 0x00001 1214 %#define MD_RAID_ALT_ISOPEN 0x00002 1215 %#define MD_RAID_RESYNC 0x00004 1216 %#define MD_RAID_RESYNC_ERRED 0x00008 1217 %#define MD_RAID_FORCE_REPLACE 0x00010 1218 %#define MD_RAID_WRITE_ALT 0x00020 1219 %#define MD_RAID_DEV_ERRED 0x00040 1220 %#define MD_RAID_COPY_RESYNC 0x00080 1221 %#define MD_RAID_REGEN_RESYNC 0x00100 1222 %#define MD_RAID_DEV_PROBEOPEN 0x00200 1223 %#define MD_RAID_HAS_LABEL 0x40000 1224 #endif /* RPC_HDR */ 1225 1226 struct md_raidcol_t { 1227 mdname_t *colnamep; 1228 mdname_t *hsnamep; 1229 rcs_state_t state; 1230 rcs_flags_t flags; 1231 md_timeval32_t timestamp; 1232 }; 1233 1234 enum rus_state_t { 1235 RUS_UNUSED = 0x0, 1236 RUS_INIT = 0x1, 1237 RUS_OKAY = 0x2, 1238 RUS_ERRED = 0x4, 1239 RUS_LAST_ERRED = 0x8, 1240 RUS_DOI = 0x10, 1241 RUS_REGEN = 0x20 1242 }; 1243 1244 typedef u_int md_riflags_t; 1245 #ifdef RPC_HDR 1246 % 1247 %#define MD_RI_INPROGRESS 0x0001 1248 %#define MD_GROW_INPROGRESS 0x0002 1249 %#define MD_RI_BLOCK 0x0004 1250 %#define MD_RI_UNBLOCK 0x0008 1251 %#define MD_RI_KILL 0x0010 1252 %#define MD_RI_BLOCK_OWNER 0x0020 1253 %#define MD_RI_SHUTDOWN 0x0040 1254 %#define MD_RI_NO_WAIT 0x0080 1255 %#define MD_RI_RESYNC_FORCE_MNSTART 0x0100 1256 #endif /* RPC_HDR */ 1257 1258 const MD_RAID_MIN = 3; 1259 struct md_raid_t { 1260 md_common_t common; 1261 rus_state_t state; 1262 md_timeval32_t timestamp; 1263 diskaddr_t interlace; 1264 diskaddr_t column_size; 1265 size_t orig_ncol; 1266 mdhspname_t *hspnamep; 1267 md_riflags_t resync_flags; 1268 int percent_dirty; 1269 int percent_done; 1270 int pw_count; 1271 md_raidcol_t cols<>; 1272 }; 1273 1274 % 1275 %/* 1276 % * shared 1277 % */ 1278 /* 1279 * unit structure 1280 */ 1281 struct md_shared_t { 1282 md_common_t common; 1283 }; 1284 1285 % 1286 %/* 1287 % * hotspare 1288 % */ 1289 /* 1290 * ioctl stuff 1291 */ 1292 enum hotspare_states_t { 1293 HSS_UNUSED, HSS_AVAILABLE, HSS_RESERVED, HSS_BROKEN 1294 }; 1295 1296 /* 1297 * unit structure 1298 */ 1299 struct md_hs_t { 1300 mdname_t *hsnamep; 1301 hotspare_states_t state; 1302 diskaddr_t size; 1303 md_timeval32_t timestamp; 1304 u_longlong_t revision; 1305 }; 1306 1307 struct md_hsp_t { 1308 mdhspname_t *hspnamep; 1309 u_int refcount; 1310 md_hs_t hotspares<>; 1311 }; 1312 1313 % 1314 %/* 1315 % * specific error info 1316 % */ 1317 % 1318 %/* 1319 % * simple errors 1320 % */ 1321 enum md_void_errno_t { 1322 MDE_NONE = 0, 1323 MDE_UNIT_NOT_FOUND, 1324 MDE_DUPDRIVE, 1325 MDE_INVAL_HSOP, 1326 MDE_NO_SET, /* no such set */ 1327 MDE_SET_DIFF, /* setname changed on command line */ 1328 MDE_BAD_RD_OPT, /* bad mirror read option */ 1329 MDE_BAD_WR_OPT, /* bad mirror write option */ 1330 MDE_BAD_PASS_NUM, /* bad mirror pass number */ 1331 MDE_BAD_INTERLACE, /* bad stripe interlace */ 1332 MDE_NO_HSPS, /* couldn't find any hotspare pools */ 1333 MDE_NOTENOUGH_DB, /* Too few replicas */ 1334 MDE_DELDB_NOTALLOWED, /* last replica in ds cannot be del in metadb */ 1335 MDE_DEL_VALIDDB_NOTALLOWED, /* last valid replica cannot be del */ 1336 MDE_SYSTEM_FILE, /* /etc/system file error */ 1337 MDE_MDDB_FILE, /* /etc/lvm/mddb.cf file error */ 1338 MDE_MDDB_CKSUM, /* /etc/lvm/mddb.cf checksum error */ 1339 MDE_VFSTAB_FILE, /* /etc/vfstab file error */ 1340 MDE_NOSLICE, /* metaslicename() with sliceno to big */ 1341 MDE_SYNTAX, /* metainit syntax error */ 1342 MDE_OPTION, /* metainit options error */ 1343 MDE_TAKE_OWN, /* take ownership failed */ 1344 MDE_NOT_DRIVENAME, /* not in drivename syntax */ 1345 MDE_RESERVED, /* device is reserved by another host */ 1346 MDE_DVERSION, /* driver version out of sync */ 1347 MDE_MVERSION, /* MDDB version out of sync */ 1348 MDE_TESTERROR, /* Test Error Message */ 1349 MDE_BAD_ORIG_NCOL, /* bad RAID original column count */ 1350 MDE_RAID_INVALID, /* attempt to use -k on invalid device */ 1351 MDE_MED_ERROR, /* mediator error */ 1352 MDE_TOOMANYMED, /* Too many mediators specified */ 1353 MDE_NOMED, /* No mediators */ 1354 MDE_ONLYNODENAME, /* Only the nodename is needed */ 1355 MDE_RAID_BAD_PW_CNT, /* bad prewrite count specified */ 1356 MDE_DEVID_TOOBIG, /* Devid size is greater than allowed */ 1357 MDE_NOPERM, /* No permission - not root */ 1358 MDE_NODEVID, /* No device id for given devt */ 1359 MDE_NOROOT, /* No root in /etc/mnttab */ 1360 MDE_EOF_TRANS, /* trans logging eof'd */ 1361 MDE_BAD_RESYNC_OPT, /* bad mirror resync option */ 1362 MDE_NOT_MN, /* option only valid within a multi-node set */ 1363 MDE_ABR_SET, /* invalid operation for ABR mirror */ 1364 MDE_INVAL_MNOP, /* Invalid operation on MN diskset */ 1365 MDE_MNSET_NOTRANS, /* Trans metadevice not supported in MN set */ 1366 MDE_MNSET_NORAID, /* RAID metadevice not supported in MN set */ 1367 MDE_FORCE_DEL_ALL_DRV, /* Must use -f flag to delete all drives */ 1368 MDE_STRIPE_TRUNC_SINGLE, /* single component stripe truncation */ 1369 MDE_STRIPE_TRUNC_MULTIPLE, /* multiple component stripe trun */ 1370 MDE_SMF_FAIL, /* service management facility error */ 1371 MDE_SMF_NO_SERVICE /* service not enabled in SMF */ 1372 }; 1373 1374 struct md_void_error_t { 1375 md_void_errno_t errnum; 1376 }; 1377 1378 % 1379 %/* 1380 % * system errors 1381 % */ 1382 struct md_sys_error_t { 1383 int errnum; 1384 }; 1385 1386 % 1387 %/* 1388 % * RPC errors 1389 % */ 1390 struct md_rpc_error_t { 1391 enum clnt_stat errnum; 1392 }; 1393 1394 % 1395 %/* 1396 % * device errors 1397 % */ 1398 enum md_dev_errno_t { 1399 MDE_INVAL_HS = 1, 1400 MDE_FIX_INVAL_STATE, 1401 MDE_FIX_INVAL_HS_STATE, 1402 MDE_NOT_META, 1403 MDE_IS_META, 1404 MDE_IS_SWAPPED, 1405 MDE_NAME_SPACE, 1406 MDE_IN_SHARED_SET, 1407 MDE_NOT_IN_SET, 1408 MDE_NOT_DISK, 1409 MDE_CANT_CONFIRM, 1410 MDE_INVALID_PART, 1411 MDE_HAS_MDDB, 1412 MDE_NO_DB, /* Replica not on device given */ 1413 MDE_CANTVERIFY_VTOC, 1414 MDE_NOT_LOCAL, 1415 MDE_DEVICES_NAME, 1416 MDE_REPCOMP_INVAL, /* replica slice not allowed in "set" metadevs */ 1417 MDE_REPCOMP_ONLY, /* only replica slice diskset replicas */ 1418 MDE_INV_ROOT, /* Invalid root device for this operation */ 1419 MDE_MULTNM, /* Multiple entries for device in namespace */ 1420 MDE_TOO_MANY_PARTS, /* dev has more than MD_MAX_PARTS partitions */ 1421 MDE_REPART_REPLICA, /* replica slice would move with repartitioning */ 1422 MDE_IS_DUMP /* device already in use as dump device */ 1423 }; 1424 1425 struct md_dev_error_t { 1426 md_dev_errno_t errnum; 1427 md_dev64_t dev; /* 64 bit fixed size */ 1428 }; 1429 1430 % 1431 %/* 1432 % * overlap errors 1433 % */ 1434 enum md_overlap_errno_t { 1435 MDE_OVERLAP_MOUNTED = 1, 1436 MDE_OVERLAP_SWAP, 1437 MDE_OVERLAP_DUMP 1438 }; 1439 1440 % 1441 1442 #if !defined(_KERNEL) 1443 struct md_overlap_error_t { 1444 md_overlap_errno_t errnum; 1445 string where<>; 1446 string overlap<>; 1447 }; 1448 #else 1449 struct md_overlap_error_t { 1450 md_overlap_errno_t errnum; 1451 u_int xwhere; 1452 u_int xoverlap; 1453 }; 1454 #endif /* !_KERNEL */ 1455 1456 % 1457 %/* 1458 % * use errors 1459 % */ 1460 enum md_use_errno_t { 1461 MDE_IS_MOUNTED = 1, 1462 MDE_ALREADY, 1463 MDE_OVERLAP, 1464 MDE_SAME_DEVID 1465 }; 1466 1467 % 1468 #if !defined(_KERNEL) 1469 struct md_use_error_t { 1470 md_use_errno_t errnum; 1471 md_dev64_t dev; 1472 string where<>; 1473 }; 1474 #else 1475 struct md_use_error_t { 1476 md_use_errno_t errnum; 1477 md_dev64_t dev; 1478 u_int xwhere; 1479 }; 1480 #endif 1481 1482 % 1483 %/* 1484 % * metadevice errors 1485 % */ 1486 enum md_md_errno_t { 1487 MDE_INVAL_UNIT = 1, 1488 MDE_UNIT_NOT_SETUP, 1489 MDE_UNIT_ALREADY_SETUP, 1490 MDE_NOT_MM, 1491 MDE_NOT_ENOUGH_DBS, 1492 MDE_IS_SM, 1493 MDE_IS_OPEN, 1494 MDE_C_WITH_INVAL_SM, 1495 MDE_RESYNC_ACTIVE, 1496 MDE_LAST_SM_RE, 1497 MDE_MIRROR_FULL, 1498 MDE_IN_USE, 1499 MDE_SM_TOO_SMALL, 1500 MDE_NO_LABELED_SM, 1501 MDE_SM_OPEN_ERR, 1502 MDE_CANT_FIND_SM, 1503 MDE_LAST_SM, 1504 MDE_NO_READABLE_SM, 1505 MDE_SM_FAILED_COMPS, 1506 MDE_ILLEGAL_SM_STATE, 1507 MDE_RR_ALLOC_ERROR, 1508 MDE_MIRROR_OPEN_FAILURE, 1509 MDE_MIRROR_THREAD_FAILURE, 1510 MDE_GROW_DELAYED, 1511 MDE_NOT_MT, 1512 MDE_HS_IN_USE, 1513 MDE_HAS_LOG, 1514 MDE_UNKNOWN_TYPE, 1515 MDE_NOT_STRIPE, 1516 MDE_NOT_RAID, 1517 MDE_NROWS, 1518 MDE_NCOMPS, 1519 MDE_NSUBMIRS, 1520 MDE_BAD_STRIPE, 1521 MDE_BAD_MIRROR, 1522 MDE_BAD_TRANS, 1523 MDE_BAD_RAID, 1524 MDE_RAID_OPEN_FAILURE, 1525 MDE_RAID_THREAD_FAILURE, 1526 MDE_RAID_NEED_FORCE, 1527 MDE_NO_LOG, 1528 MDE_RAID_DOI, 1529 MDE_RAID_LAST_ERRED, 1530 MDE_RAID_NOT_OKAY, 1531 MDE_RENAME_BUSY, 1532 MDE_RENAME_SOURCE_BAD, 1533 MDE_RENAME_TARGET_BAD, 1534 MDE_RENAME_TARGET_UNRELATED, 1535 MDE_RENAME_CONFIG_ERROR, 1536 MDE_RENAME_ORDER, 1537 MDE_RECOVER_FAILED, 1538 MDE_NOT_SP, 1539 MDE_SP_NOSPACE, 1540 MDE_SP_BADWMREAD, 1541 MDE_SP_BADWMWRITE, 1542 MDE_SP_BADWMMAGIC, 1543 MDE_SP_BADWMCRC, 1544 MDE_SP_OVERLAP, 1545 MDE_SP_BAD_LENGTH, 1546 MDE_UNIT_TOO_LARGE, 1547 MDE_LOG_TOO_LARGE, 1548 MDE_SP_NOSP, 1549 MDE_IN_UNAVAIL_STATE 1550 }; 1551 1552 struct md_md_error_t { 1553 md_md_errno_t errnum; 1554 minor_t mnum; 1555 }; 1556 1557 % 1558 %/* 1559 % * component errors 1560 % */ 1561 enum md_comp_errno_t { 1562 MDE_CANT_FIND_COMP = 1, 1563 MDE_REPL_INVAL_STATE, 1564 MDE_COMP_TOO_SMALL, 1565 MDE_COMP_OPEN_ERR, 1566 MDE_RAID_COMP_ERRED, 1567 MDE_MAXIO, 1568 MDE_SP_COMP_OPEN_ERR 1569 }; 1570 1571 struct md_comp_error_t { 1572 md_comp_errno_t errnum; 1573 comp_t comp; 1574 }; 1575 1576 % 1577 %/* 1578 % * hotspare pool errors 1579 % */ 1580 enum md_hsp_errno_t { 1581 MDE_HSP_CREATE_FAILURE = 1, 1582 MDE_HSP_IN_USE, 1583 MDE_INVAL_HSP, 1584 MDE_HSP_BUSY, 1585 MDE_HSP_REF, 1586 MDE_HSP_ALREADY_SETUP, 1587 MDE_BAD_HSP, 1588 MDE_HSP_UNIT_TOO_LARGE 1589 }; 1590 1591 struct md_hsp_error_t { 1592 md_hsp_errno_t errnum; 1593 hsp_t hsp; 1594 }; 1595 1596 % 1597 %/* 1598 % * hotspare errors 1599 % */ 1600 enum md_hs_errno_t { 1601 MDE_HS_RESVD = 1, 1602 MDE_HS_CREATE_FAILURE, 1603 MDE_HS_INUSE, 1604 MDE_HS_UNIT_TOO_LARGE 1605 }; 1606 1607 struct md_hs_error_t { 1608 md_hs_errno_t errnum; 1609 hs_t hs; 1610 }; 1611 1612 % 1613 %/* 1614 % * MDDB errors 1615 % */ 1616 enum md_mddb_errno_t { 1617 MDE_TOOMANY_REPLICAS = 1, 1618 MDE_REPLICA_TOOSMALL, 1619 MDE_NOTVERIFIED, 1620 MDE_DB_INVALID, 1621 MDE_DB_EXISTS, 1622 MDE_DB_MASTER, 1623 MDE_DB_TOOSMALL, 1624 MDE_DB_NORECORD, 1625 MDE_DB_NOSPACE, 1626 MDE_DB_NOTNOW, 1627 MDE_DB_NODB, 1628 MDE_DB_NOTOWNER, 1629 MDE_DB_STALE, 1630 MDE_DB_TOOFEW, 1631 MDE_DB_TAGDATA, 1632 MDE_DB_ACCOK, 1633 MDE_DB_NTAGDATA, 1634 MDE_DB_ACCNOTOK, 1635 MDE_DB_NOLOCBLK, 1636 MDE_DB_NOLOCNMS, 1637 MDE_DB_NODIRBLK, 1638 MDE_DB_NOTAGREC, 1639 MDE_DB_NOTAG, 1640 MDE_DB_BLKRANGE 1641 }; 1642 1643 % 1644 struct md_mddb_error_t { 1645 md_mddb_errno_t errnum; 1646 minor_t mnum; /* associated metadevice */ 1647 set_t setno; 1648 u_int size; 1649 }; 1650 1651 % 1652 %/* 1653 % * diskset (ds) errors 1654 % */ 1655 enum md_ds_errno_t { 1656 MDE_DS_DUPHOST = 1, 1657 MDE_DS_NOTNODENAME, 1658 MDE_DS_SELFNOTIN, 1659 MDE_DS_NODEHASSET, 1660 MDE_DS_NODENOSET, 1661 MDE_DS_NOOWNER, 1662 MDE_DS_NOTOWNER, 1663 MDE_DS_NODEISNOTOWNER, 1664 MDE_DS_NODEINSET, 1665 MDE_DS_NODENOTINSET, 1666 MDE_DS_SETNUMBUSY, 1667 MDE_DS_SETNUMNOTAVAIL, 1668 MDE_DS_SETNAMEBUSY, 1669 MDE_DS_DRIVENOTCOMMON, 1670 MDE_DS_DRIVEINSET, 1671 MDE_DS_DRIVENOTINSET, 1672 MDE_DS_DRIVEINUSE, 1673 MDE_DS_DUPDRIVE, 1674 MDE_DS_INVALIDSETNAME, 1675 MDE_DS_HASDRIVES, 1676 MDE_DS_SIDENUMNOTAVAIL, 1677 MDE_DS_SETNAMETOOLONG, 1678 MDE_DS_NODENAMETOOLONG, 1679 MDE_DS_OHACANTDELSELF, 1680 MDE_DS_HOSTNOSIDE, 1681 MDE_DS_SETLOCKED, 1682 MDE_DS_ULKSBADKEY, 1683 MDE_DS_LKSBADKEY, 1684 MDE_DS_WRITEWITHSULK, 1685 MDE_DS_SETCLEANUP, 1686 MDE_DS_CANTDELSELF, 1687 MDE_DS_HASMED, 1688 MDE_DS_TOOMANYALIAS, 1689 MDE_DS_ISMED, 1690 MDE_DS_ISNOTMED, 1691 MDE_DS_INVALIDMEDNAME, 1692 MDE_DS_ALIASNOMATCH, 1693 MDE_DS_NOMEDONHOST, 1694 MDE_DS_CANTDELMASTER, 1695 MDE_DS_NOTINMEMBERLIST, 1696 MDE_DS_MNCANTDELSELF, 1697 MDE_DS_RPCVERSMISMATCH, 1698 MDE_DS_WITHDRAWMASTER, 1699 MDE_DS_COMMDCTL_SUSPEND_NYD, 1700 MDE_DS_COMMDCTL_SUSPEND_FAIL, 1701 MDE_DS_COMMDCTL_REINIT_FAIL, 1702 MDE_DS_COMMDCTL_RESUME_FAIL, 1703 MDE_DS_NOTNOW_RECONFIG, 1704 MDE_DS_NOTNOW_CMD, 1705 MDE_DS_COMMD_SEND_FAIL, 1706 MDE_DS_MASTER_ONLY, 1707 MDE_DS_DRIVENOTONHOST, 1708 MDE_DS_CANTRESNARF, 1709 MDE_DS_INSUFQUORUM, 1710 MDE_DS_EXTENDEDNM, 1711 MDE_DS_PARTIALSET, 1712 MDE_DS_SINGLEHOST, 1713 MDE_DS_AUTONOTSET, 1714 MDE_DS_INVALIDDEVID, 1715 MDE_DS_SETNOTIMP, 1716 MDE_DS_NOTSELFIDENTIFY 1717 }; 1718 1719 % 1720 #if !defined(_KERNEL) 1721 struct md_ds_error_t { 1722 md_ds_errno_t errnum; 1723 set_t setno; 1724 string node<>; 1725 string drive<>; 1726 }; 1727 #else /* _KERNEL */ 1728 struct md_ds_error_t { 1729 md_ds_errno_t errnum; 1730 set_t setno; 1731 u_int xnode; 1732 u_int xdrive; 1733 }; 1734 #endif /* !_KERNEL */ 1735 1736 % 1737 %/* 1738 % * fundamental error type 1739 % */ 1740 enum md_errclass_t { 1741 MDEC_VOID = 0, /* simple error */ 1742 MDEC_SYS, /* system errno */ 1743 MDEC_RPC, /* RPC errno */ 1744 MDEC_DEV, /* device error */ 1745 MDEC_USE, /* use error */ 1746 MDEC_MD, /* metadevice error */ 1747 MDEC_COMP, /* component error */ 1748 MDEC_HSP, /* hotspare pool error */ 1749 MDEC_HS, /* hotspare error */ 1750 MDEC_MDDB, /* metadevice database error */ 1751 MDEC_DS, /* diskset error */ 1752 MDEC_OVERLAP /* overlap error */ 1753 }; 1754 1755 % 1756 %/* 1757 % * error info 1758 % */ 1759 union md_error_info_t 1760 switch (md_errclass_t errclass) { 1761 case MDEC_VOID: 1762 md_void_error_t void_error; 1763 case MDEC_SYS: 1764 md_sys_error_t sys_error; 1765 case MDEC_RPC: 1766 md_rpc_error_t rpc_error; 1767 case MDEC_DEV: 1768 md_dev_error_t dev_error; 1769 case MDEC_USE: 1770 md_use_error_t use_error; 1771 case MDEC_MD: 1772 md_md_error_t md_error; 1773 case MDEC_COMP: 1774 md_comp_error_t comp_error; 1775 case MDEC_HSP: 1776 md_hsp_error_t hsp_error; 1777 case MDEC_HS: 1778 md_hs_error_t hs_error; 1779 case MDEC_MDDB: 1780 md_mddb_error_t mddb_error; 1781 case MDEC_DS: 1782 md_ds_error_t ds_error; 1783 case MDEC_OVERLAP: 1784 md_overlap_error_t overlap_error; 1785 }; 1786 1787 % 1788 #if !defined(_KERNEL) 1789 struct md_error_t { 1790 md_error_info_t info; /* specific info */ 1791 string host<>; /* hostname */ 1792 string extra<>; /* extra context info */ 1793 string name<>; /* file or device name */ 1794 }; 1795 #else /* _KERNEL */ 1796 struct md_error_t { 1797 md_error_info_t info; /* specific info */ 1798 u_int xhost; /* hostname */ 1799 u_int xextra; /* extra context info */ 1800 u_int xname; /* file or device name */ 1801 }; 1802 #endif /* !_KERNEL */ 1803 %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 1804 %#pragma pack() 1805 %#endif 1806 1807 #ifdef RPC_HDR 1808 % 1809 %/* 1810 % * Null error constant 1811 % */ 1812 %#define MDNULLERROR {{MDEC_VOID}, NULL, NULL, NULL} 1813 #endif /* RPC_HDR */ 1814 1815 #ifdef RPC_XDR 1816 %/* 1817 % * Constant null error struct. 1818 % */ 1819 %const md_error_t mdnullerror = MDNULLERROR; 1820 #endif /* RPC_XDR */ 1821 1822 #ifdef RPC_HDR 1823 % 1824 %/* 1825 % * External reference to constant null error struct. (declared in mdiox_xdr.c) 1826 % */ 1827 %extern const md_error_t mdnullerror; 1828 % 1829 %/* 1830 % * External declarations 1831 % */ 1832 %extern void mdclrerror(md_error_t *ep); /* clear error */ 1833 %extern int mdstealerror(md_error_t *to, md_error_t *from); 1834 % 1835 %#define mdiserror(ep, num) (((ep)->info.errclass == MDEC_VOID) &&\ 1836 % ((ep)->info.md_error_info_t_u.void_error.errnum == (num))) 1837 %#define mdisok(ep) mdiserror(ep, MDE_NONE) 1838 % 1839 %#define mdissyserror(ep, num) (((ep)->info.errclass == MDEC_SYS) && \ 1840 % ((ep)->info.md_error_info_t_u.sys_error.errnum == (num))) 1841 %#define mdisrpcerror(ep, num) (((ep)->info.errclass == MDEC_RPC) && \ 1842 % ((ep)->info.md_error_info_t_u.rpc_error.errnum == (num))) 1843 %#define mdisdeverror(ep, num) (((ep)->info.errclass == MDEC_DEV) && \ 1844 % ((ep)->info.md_error_info_t_u.dev_error.errnum == (num))) 1845 %#define mdisuseerror(ep, num) (((ep)->info.errclass == MDEC_USE) && \ 1846 % ((ep)->info.md_error_info_t_u.use_error.errnum == (num))) 1847 %#define mdismderror(ep, num) (((ep)->info.errclass == MDEC_MD) && \ 1848 % ((ep)->info.md_error_info_t_u.md_error.errnum == (num))) 1849 %#define mdiscomperror(ep, num) (((ep)->info.errclass == MDEC_COMP) &&\ 1850 % ((ep)->info.md_error_info_t_u.comp_error.errnum == (num))) 1851 %#define mdishsperror(ep, num) (((ep)->info.errclass == MDEC_HSP) && \ 1852 % ((ep)->info.md_error_info_t_u.hsp_error.errnum == (num))) 1853 %#define mdishserror(ep, num) (((ep)->info.errclass == MDEC_HS) && \ 1854 % ((ep)->info.md_error_info_t_u.hs_error.errnum == (num))) 1855 %#define mdismddberror(ep, num) (((ep)->info.errclass == MDEC_MDDB) &&\ 1856 % ((ep)->info.md_error_info_t_u.mddb_error.errnum == (num))) 1857 %#define mdisdserror(ep, num) (((ep)->info.errclass == MDEC_DS) && \ 1858 % ((ep)->info.md_error_info_t_u.ds_error.errnum == (num))) 1859 %#define mdisoverlaperror(ep, num) \ 1860 % (((ep)->info.errclass == MDEC_OVERLAP) && \ 1861 % ((ep)->info.md_error_info_t_u.ds_error.errnum == (num))) 1862 % 1863 %#define mdanysyserror(ep) ((ep)->info.errclass == MDEC_SYS) 1864 %#define mdanyrpcerror(ep) ((ep)->info.errclass == MDEC_RPC) 1865 %#define mdanydeverror(ep) ((ep)->info.errclass == MDEC_DEV) 1866 %#define mdanyuseerror(ep) ((ep)->info.errclass == MDEC_USE) 1867 %#define mdanymderror(ep) ((ep)->info.errclass == MDEC_MD) 1868 %#define mdanycomperror(ep) ((ep)->info.errclass == MDEC_COMP) 1869 %#define mdanyhsperror(ep) ((ep)->info.errclass == MDEC_HSP) 1870 %#define mdanyhserror(ep) ((ep)->info.errclass == MDEC_HS) 1871 %#define mdanymddberror(ep) ((ep)->info.errclass == MDEC_MDDB) 1872 %#define mdanydserror(ep) ((ep)->info.errclass == MDEC_DS) 1873 %#define mdanyoverlaperror(ep) ((ep)->info.errclass == MDEC_OVERLAP) 1874 % 1875 #ifdef _KERNEL 1876 % 1877 %extern int mderror(md_error_t *ep, md_void_errno_t errnum); 1878 %extern int mdsyserror(md_error_t *ep, int errnum); 1879 %extern int mddeverror(md_error_t *ep, md_dev_errno_t errnum, 1880 % md_dev64_t dev); 1881 %extern int mdmderror(md_error_t *ep, md_md_errno_t errnum, minor_t mnum); 1882 %extern int mdcomperror(md_error_t *ep, md_comp_errno_t errnum, 1883 % minor_t mnum, md_dev64_t dev); 1884 %extern int mdhsperror(md_error_t *ep, md_hsp_errno_t errnum, hsp_t hsp); 1885 %extern int mdhserror(md_error_t *ep, md_hs_errno_t errnum, 1886 % hsp_t hsp, md_dev64_t dev); 1887 %extern int mdmddberror(md_error_t *ep, md_mddb_errno_t errnum, 1888 % minor_t mnum, set_t setno); 1889 %extern int mddbstatus2error(md_error_t *ep, int status, minor_t mnum, 1890 % set_t setno); 1891 % 1892 #else /* ! _KERNEL */ 1893 % 1894 %extern int mderror(md_error_t *ep, md_void_errno_t errnum, char *name); 1895 %extern int mdsyserror(md_error_t *ep, int errnum, char *name); 1896 %extern int mdrpcerror(md_error_t *ep, CLIENT *clntp, char *host, 1897 % char *extra); 1898 %extern int mdrpccreateerror(md_error_t *ep, char *host, char *extra); 1899 %extern int mddeverror(md_error_t *ep, md_dev_errno_t errnum, 1900 % md_dev64_t dev, char *name); 1901 %extern int mduseerror(md_error_t *ep, md_use_errno_t errnum, 1902 % md_dev64_t dev, char *where, char *name); 1903 %extern int mdmderror(md_error_t *ep, md_md_errno_t errnum, minor_t mnum, 1904 % char *name); 1905 %extern int mdcomperror(md_error_t *ep, md_comp_errno_t errnum, 1906 % minor_t mnum, md_dev64_t dev, char *name); 1907 %extern int mdhsperror(md_error_t *ep, md_hsp_errno_t errnum, hsp_t hsp, 1908 % char *name); 1909 %extern int mdhserror(md_error_t *ep, md_hs_errno_t errnum, 1910 % hsp_t hsp, md_dev64_t dev, char *name); 1911 %extern int mdmddberror(md_error_t *ep, md_mddb_errno_t errnum, 1912 % minor_t mnum, set_t setno, size_t size, char *name); 1913 %extern int mddserror(md_error_t *ep, md_ds_errno_t errnum, set_t setno, 1914 % char *node, char *drive, char *name); 1915 %extern int mdoverlaperror(md_error_t *ep, md_overlap_errno_t errnum, 1916 % char *overlap, char *where, char *name); 1917 % 1918 %extern void mderrorextra(md_error_t *ep, char *extra); 1919 % 1920 #endif /* ! _KERNEL */ 1921 #endif /* RPC_HDR */ 1922 1923 /* 1924 * common unit structure 1925 */ 1926 struct mdc_unit { 1927 u_longlong_t un_revision; /* revision # (keep this a longlong) */ 1928 md_types_t un_type; /* type of record */ 1929 md_status_t un_status; /* status flags */ 1930 int un_parent_res; /* parent reserve index */ 1931 int un_child_res; /* child reserve index */ 1932 minor_t un_self_id; /* metadevice unit number */ 1933 mddb_recid_t un_record_id; /* db record id */ 1934 uint_t un_size; /* db record size for unit structure */ 1935 ushort_t un_flag; /* configuration info */ 1936 diskaddr_t un_total_blocks; /* external # blocks in metadevice */ 1937 diskaddr_t un_actual_tb; /* actual # blocks in metadevice */ 1938 uint_t un_nhead; /* saved value of # heads */ 1939 uint_t un_nsect; /* saved value of # sectors */ 1940 ushort_t un_rpm; /* saved value of rpm's */ 1941 ushort_t un_wr_reinstruct; /* worse case write reinstruct */ 1942 ushort_t un_rd_reinstruct; /* worse case read reinstruct */ 1943 mddb_recid_t un_vtoc_id; /* vtoc db record id */ 1944 md_stackcap_t un_capabilities; /* subdevice capabilities */ 1945 md_parent_t un_parent; /* -1 none, -2 many, positive unit # */ 1946 uint_t un_user_flags; /* provided for userland */ 1947 }; 1948 typedef struct mdc_unit mdc_unit_t; 1949 1950 /* 1951 * For old 32 bit format use only 1952 */ 1953 %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 1954 %#pragma pack(4) 1955 %#endif 1956 struct mdc_unit32_od { 1957 u_longlong_t un_revision; 1958 md_types_t un_type; 1959 md_status_t un_status; 1960 int un_parent_res; 1961 int un_child_res; 1962 minor_t un_self_id; 1963 mddb_recid_t un_record_id; 1964 uint_t un_size; 1965 ushort_t un_flag; 1966 daddr32_t un_total_blocks; /* external # blocks in metadevice */ 1967 daddr32_t un_actual_tb; /* actual # blocks in metadevice */ 1968 ushort_t un_nhead; 1969 ushort_t un_nsect; 1970 ushort_t un_rpm; 1971 ushort_t un_wr_reinstruct; 1972 ushort_t un_rd_reinstruct; 1973 mddb_recid_t un_vtoc_id; 1974 md_stackcap_t un_capabilities; 1975 md_parent_t un_parent; 1976 uint_t un_user_flags; 1977 }; 1978 typedef struct mdc_unit32_od mdc_unit32_od_t; 1979 1980 struct md_unit { 1981 mdc_unit_t c; /* common stuff */ 1982 }; 1983 typedef struct md_unit md_unit_t; 1984 1985 enum sp_status_t { 1986 MD_SP_CREATEPEND, /* soft partition creation in progress */ 1987 MD_SP_GROWPEND, /* attach operation in progress */ 1988 MD_SP_DELPEND, /* delete operation in progress */ 1989 MD_SP_OK, /* soft partition is stable */ 1990 MD_SP_ERR, /* soft partition is errored */ 1991 MD_SP_RECOVER, /* recovery operation in progess */ 1992 MD_SP_LAST /* always the last entry */ 1993 }; 1994 1995 /* soft partition offsets and lengths are specified in sectors */ 1996 typedef u_longlong_t sp_ext_offset_t; 1997 typedef u_longlong_t sp_ext_length_t; 1998 struct mp_ext { 1999 sp_ext_offset_t un_voff; /* virtual offset */ 2000 sp_ext_offset_t un_poff; /* physical offset */ 2001 sp_ext_length_t un_len; /* length of extent */ 2002 }; 2003 typedef struct mp_ext mp_ext_t; 2004 2005 /* 2006 * mp_unit32_od is for old 32 bit format only 2007 */ 2008 struct mp_unit32_od { 2009 mdc_unit32_od_t c; /* common unit structure */ 2010 mdkey_t un_key; /* namespace key */ 2011 dev32_t un_dev; /* device number */ 2012 sp_ext_offset_t un_start_blk; /* start block, incl reserved space */ 2013 sp_status_t un_status; /* sp status */ 2014 uint_t un_numexts; /* number of extents */ 2015 sp_ext_length_t un_length; /* total length (in sectors) */ 2016 /* extent array. NOTE: sized dynamically! */ 2017 mp_ext_t un_ext[1]; 2018 }; 2019 typedef struct mp_unit32_od mp_unit32_od_t; 2020 2021 /* 2022 * softpart unit structure 2023 */ 2024 struct mp_unit { 2025 mdc_unit_t c; /* common unit structure */ 2026 mdkey_t un_key; /* namespace key */ 2027 md_dev64_t un_dev; /* device number, 64 bit */ 2028 sp_ext_offset_t un_start_blk; /* start block, incl reserved space */ 2029 sp_status_t un_status; /* sp status */ 2030 uint_t un_numexts; /* number of extents */ 2031 sp_ext_length_t un_length; /* total length (in sectors) */ 2032 /* extent array. NOTE: sized dynamically! */ 2033 mp_ext_t un_ext[1]; 2034 }; 2035 typedef struct mp_unit mp_unit_t; 2036 2037 /* 2038 * ioctl structures used when passing ioctls via rpc.mdcommd 2039 */ 2040 struct md_driver { 2041 char md_drivername[MD_MAXDRVNM]; 2042 set_t md_setno; 2043 }; 2044 typedef struct md_driver md_driver_t; 2045 2046 %#define MD_DRIVER md_driver_t md_driver; 2047 #define MD_DRIVER md_driver_t md_driver; 2048 2049 struct md_set_params { 2050 MD_DRIVER 2051 md_error_t mde; 2052 minor_t mnum; 2053 md_types_t type; 2054 uint_t size; 2055 int options; 2056 uint64_t mdp; /* Contains pointer */ 2057 }; 2058 typedef struct md_set_params md_set_params_t; 2059 %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 2060 %#pragma pack() 2061 %#endif 2062 2063 2064