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