10Sstevel@tonic-gate %/* 20Sstevel@tonic-gate % * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 30Sstevel@tonic-gate % * Use is subject to license terms. 40Sstevel@tonic-gate % * 50Sstevel@tonic-gate % * CDDL HEADER START 60Sstevel@tonic-gate % * 70Sstevel@tonic-gate % * The contents of this file are subject to the terms of the 80Sstevel@tonic-gate % * Common Development and Distribution License, Version 1.0 only 90Sstevel@tonic-gate % * (the "License"). You may not use this file except in compliance 100Sstevel@tonic-gate % * with the License. 110Sstevel@tonic-gate % * 120Sstevel@tonic-gate % * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 130Sstevel@tonic-gate % * or http://www.opensolaris.org/os/licensing. 140Sstevel@tonic-gate % * See the License for the specific language governing permissions 150Sstevel@tonic-gate % * and limitations under the License. 160Sstevel@tonic-gate % * 170Sstevel@tonic-gate % * When distributing Covered Code, include this CDDL HEADER in each 180Sstevel@tonic-gate % * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 190Sstevel@tonic-gate % * If applicable, add the following below this CDDL HEADER, with the 200Sstevel@tonic-gate % * fields enclosed by brackets "[]" replaced with your own identifying 210Sstevel@tonic-gate % * information: Portions Copyright [yyyy] [name of copyright owner] 220Sstevel@tonic-gate % * 230Sstevel@tonic-gate % * CDDL HEADER END 240Sstevel@tonic-gate % */ 250Sstevel@tonic-gate % 260Sstevel@tonic-gate %#pragma ident "%Z%%M% %I% %E% SMI" 270Sstevel@tonic-gate % 280Sstevel@tonic-gate %/* 290Sstevel@tonic-gate % * MDD interface definitions 300Sstevel@tonic-gate % */ 310Sstevel@tonic-gate 320Sstevel@tonic-gate %/* pick up multihost ioctl definitions */ 330Sstevel@tonic-gate %#include <sys/lvm/md_mhdx.h> 340Sstevel@tonic-gate %/* get the basic XDR types */ 350Sstevel@tonic-gate %#include <sys/lvm/md_basic.h> 360Sstevel@tonic-gate %/* pick up device id information */ 370Sstevel@tonic-gate %#include <sys/dditypes.h> 380Sstevel@tonic-gate 390Sstevel@tonic-gate %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 400Sstevel@tonic-gate %/* 410Sstevel@tonic-gate % * NOTE: can't change these structures so make sure they are packed 420Sstevel@tonic-gate % * in the kernel. 430Sstevel@tonic-gate % */ 440Sstevel@tonic-gate %#pragma pack(4) 450Sstevel@tonic-gate %#endif 460Sstevel@tonic-gate % 470Sstevel@tonic-gate %/* 480Sstevel@tonic-gate % * fundamental types 490Sstevel@tonic-gate % */ 500Sstevel@tonic-gate % 510Sstevel@tonic-gate %/* 520Sstevel@tonic-gate % * 530Sstevel@tonic-gate % * NOTE: THESE ARE ON-DISK VALUES DO NOT CHANGE THE ORDER 540Sstevel@tonic-gate % */ 550Sstevel@tonic-gate enum mddb_type_t { 560Sstevel@tonic-gate MDDB_ALL, 570Sstevel@tonic-gate MDDB_NM_HDR, 580Sstevel@tonic-gate MDDB_NM, 590Sstevel@tonic-gate MDDB_SHR_NM, 600Sstevel@tonic-gate MDDB_VTOC, 610Sstevel@tonic-gate MDDB_USER, 620Sstevel@tonic-gate MDDB_DID_NM_HDR, 630Sstevel@tonic-gate MDDB_DID_NM, 640Sstevel@tonic-gate MDDB_DID_SHR_NM, 650Sstevel@tonic-gate MDDB_EFILABEL, 660Sstevel@tonic-gate MDDB_FIRST_MODID = 1000 670Sstevel@tonic-gate }; 680Sstevel@tonic-gate 690Sstevel@tonic-gate % 700Sstevel@tonic-gate %/* 710Sstevel@tonic-gate % * Configuration commands. 720Sstevel@tonic-gate % */ 730Sstevel@tonic-gate enum mddb_cfgcmd_t { 740Sstevel@tonic-gate MDDB_USEDEV, 750Sstevel@tonic-gate MDDB_NEWDEV, 760Sstevel@tonic-gate MDDB_DELDEV, 770Sstevel@tonic-gate MDDB_GETDEV, 780Sstevel@tonic-gate MDDB_ENDDEV, 790Sstevel@tonic-gate MDDB_GETDRVRNAME, 800Sstevel@tonic-gate MDDB_RELEASESET, 810Sstevel@tonic-gate MDDB_NEWSIDE, 820Sstevel@tonic-gate MDDB_DELSIDE, 830Sstevel@tonic-gate MDDB_SETDID, 840Sstevel@tonic-gate MDDB_LBINITTIME 850Sstevel@tonic-gate }; 860Sstevel@tonic-gate 870Sstevel@tonic-gate % 880Sstevel@tonic-gate %/* 890Sstevel@tonic-gate % * Return codes from DB record operations. 900Sstevel@tonic-gate % */ 910Sstevel@tonic-gate enum mddb_recstatus_t { 920Sstevel@tonic-gate MDDB_NORECORD, 930Sstevel@tonic-gate MDDB_NODATA, 940Sstevel@tonic-gate MDDB_OK, 950Sstevel@tonic-gate MDDB_STALE 960Sstevel@tonic-gate }; 970Sstevel@tonic-gate 980Sstevel@tonic-gate % 990Sstevel@tonic-gate %/* 1000Sstevel@tonic-gate % * Commands for DB accesses from user land. 1010Sstevel@tonic-gate % */ 1020Sstevel@tonic-gate enum mddb_usercmd_t { 1030Sstevel@tonic-gate MD_DB_GETNEXTREC, 1040Sstevel@tonic-gate MD_DB_COMMIT_ONE, 1050Sstevel@tonic-gate MD_DB_COMMIT_MANY, 1060Sstevel@tonic-gate MD_DB_GETDATA, 1070Sstevel@tonic-gate MD_DB_DELETE, 1080Sstevel@tonic-gate MD_DB_CREATE, 1090Sstevel@tonic-gate MD_DB_GETSTATUS, 1100Sstevel@tonic-gate MD_DB_GETSIZE, 1110Sstevel@tonic-gate MD_DB_SETDATA, 1120Sstevel@tonic-gate MD_DB_MAKEID 1130Sstevel@tonic-gate }; 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate % 1160Sstevel@tonic-gate %/* 1170Sstevel@tonic-gate % * MDDB_USER record subtypes, set records and drive records. 1180Sstevel@tonic-gate % * Node records (NR) used for Multinode Disksets. 1190Sstevel@tonic-gate % * The MDDB_UR_SR record subtype is associated with the structures 1200Sstevel@tonic-gate % * md_set_record and md_mnset_record. 1210Sstevel@tonic-gate % * The MDDB_UR_DR record subtype is associated with the structure 1220Sstevel@tonic-gate % * md_drive_record. 1230Sstevel@tonic-gate % * The MDDB_NR_DR record subtype is associated with the structure 1240Sstevel@tonic-gate % * md_mnnode_record. 1250Sstevel@tonic-gate % * The MDDB_UR_LR record subtype is associated with the structure 1260Sstevel@tonic-gate % * md_mn_changelog_record_t 1270Sstevel@tonic-gate % */ 1280Sstevel@tonic-gate enum mddb_userrec_t { 1290Sstevel@tonic-gate MDDB_UR_ALL, 1300Sstevel@tonic-gate MDDB_UR_SR, 1310Sstevel@tonic-gate MDDB_UR_DR, 1320Sstevel@tonic-gate MDDB_UR_NR, 1330Sstevel@tonic-gate MDDB_UR_LR 1340Sstevel@tonic-gate }; 1350Sstevel@tonic-gate 1360Sstevel@tonic-gate % 1370Sstevel@tonic-gate %/* 1380Sstevel@tonic-gate % * MDDB_USER record get commands. 1390Sstevel@tonic-gate % */ 1400Sstevel@tonic-gate enum md_ur_get_cmd_t { 1410Sstevel@tonic-gate MD_UR_GET_NEXT, 1420Sstevel@tonic-gate MD_UR_GET_WKEY 1430Sstevel@tonic-gate }; 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate % 1460Sstevel@tonic-gate %/* 1470Sstevel@tonic-gate % * These are the options for mddb_createrec() 1480Sstevel@tonic-gate % */ 1490Sstevel@tonic-gate enum md_create_rec_option_t { 1500Sstevel@tonic-gate MD_CRO_NOOPT = 0x000, 1510Sstevel@tonic-gate MD_CRO_OPTIMIZE = 0x001, 1520Sstevel@tonic-gate MD_CRO_32BIT = 0x002, 1530Sstevel@tonic-gate MD_CRO_64BIT = 0x004, 1540Sstevel@tonic-gate MD_CRO_STRIPE = 0x008, 1550Sstevel@tonic-gate MD_CRO_MIRROR = 0x010, 1560Sstevel@tonic-gate MD_CRO_RAID = 0x020, 1570Sstevel@tonic-gate MD_CRO_SOFTPART = 0x040, 1580Sstevel@tonic-gate MD_CRO_TRANS_MASTER = 0x080, 1590Sstevel@tonic-gate MD_CRO_TRANS_LOG = 0x100, 1600Sstevel@tonic-gate MD_CRO_HOTSPARE = 0x200, 1610Sstevel@tonic-gate MD_CRO_HOTSPARE_POOL = 0x400, 1620Sstevel@tonic-gate MD_CRO_CHANGELOG = 0x800 1630Sstevel@tonic-gate }; 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate % 1660Sstevel@tonic-gate %/* 1670Sstevel@tonic-gate % * This SKEW value is used to skew the sideno of 1680Sstevel@tonic-gate % * the share device names that are put into each 1690Sstevel@tonic-gate % * local set's namespace. This will prevent the 1700Sstevel@tonic-gate % * wrong name to be picked up via a devno, when 1710Sstevel@tonic-gate % * we really wanted a local device name. 1720Sstevel@tonic-gate % */ 1730Sstevel@tonic-gate const SKEW = 1; 1740Sstevel@tonic-gate 1750Sstevel@tonic-gate #ifdef RPC_XDR 1760Sstevel@tonic-gate % 1770Sstevel@tonic-gate %/* Start - Avoid duplicate definitions, but get the xdr calls right */ 1780Sstevel@tonic-gate %#if 0 1790Sstevel@tonic-gate #include "meta_arr.x" 1800Sstevel@tonic-gate %#endif /* 0 */ 1810Sstevel@tonic-gate %/* End - Avoid duplicate definitions, but get the xdr calls right */ 1820Sstevel@tonic-gate % 1830Sstevel@tonic-gate #endif /* RPC_XDR */ 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate const MD_DRIVE_RECORD_REVISION = 0x00010000; 1860Sstevel@tonic-gate 1870Sstevel@tonic-gate #ifdef RPC_HDR 1880Sstevel@tonic-gate % 1890Sstevel@tonic-gate %#define MD_DR_ADD 0x00000001U 1900Sstevel@tonic-gate %#define MD_DR_DEL 0x00000002U 1910Sstevel@tonic-gate %#define MD_DR_OK 0x80000000U 1920Sstevel@tonic-gate #endif /* RPC_HDR */ 1930Sstevel@tonic-gate 1940Sstevel@tonic-gate #if !defined(_KERNEL) 1950Sstevel@tonic-gate struct md_drive_record { 1960Sstevel@tonic-gate u_int dr_revision; /* revision level */ 1970Sstevel@tonic-gate u_int dr_flags; /* state flags */ 1980Sstevel@tonic-gate mddb_recid_t dr_selfid; /* db record id */ 1990Sstevel@tonic-gate md_timeval32_t dr_ctime; /* creation timestamp */ 2000Sstevel@tonic-gate u_long dr_genid; /* generation id */ 2010Sstevel@tonic-gate md_drive_record *dr_next; /* next ptr (Incore) */ 2020Sstevel@tonic-gate mddb_recid_t dr_nextrec; /* next record id */ 2030Sstevel@tonic-gate int dr_dbcnt; /* # of replica's */ 2040Sstevel@tonic-gate int dr_dbsize; /* replica size */ 2050Sstevel@tonic-gate mdkey_t dr_key; /* namespace key */ 2060Sstevel@tonic-gate }; 2070Sstevel@tonic-gate #else /* _KERNEL */ 2080Sstevel@tonic-gate struct md_drive_record { 2090Sstevel@tonic-gate u_int dr_revision; /* revision level */ 2100Sstevel@tonic-gate u_int dr_flags; /* state flags */ 2110Sstevel@tonic-gate mddb_recid_t dr_selfid; /* db record id */ 2120Sstevel@tonic-gate md_timeval32_t dr_ctime; /* creation timestamp */ 2130Sstevel@tonic-gate u_int dr_genid; /* generation id */ 2140Sstevel@tonic-gate u_int dr_next; /* next ptr (Incore) */ 2150Sstevel@tonic-gate mddb_recid_t dr_nextrec; /* next record id */ 2160Sstevel@tonic-gate int dr_dbcnt; /* # of replica's */ 2170Sstevel@tonic-gate int dr_dbsize; /* replica size */ 2180Sstevel@tonic-gate mdkey_t dr_key; /* namespace key */ 2190Sstevel@tonic-gate }; 2200Sstevel@tonic-gate #endif /* !_KERNEL */ 2210Sstevel@tonic-gate 2220Sstevel@tonic-gate #ifdef RPC_HDR 2230Sstevel@tonic-gate %/* 2240Sstevel@tonic-gate % * Actions that can be taken on a node record. 2250Sstevel@tonic-gate % * Used with routine upd_nr_flags. 2260Sstevel@tonic-gate % */ 2270Sstevel@tonic-gate % 2280Sstevel@tonic-gate %#define MD_NR_JOIN 0x00000001U /* Turn on JOIN flag */ 2290Sstevel@tonic-gate %#define MD_NR_WITHDRAW 0x00000002U /* Turn off JOIN flag */ 2300Sstevel@tonic-gate %#define MD_NR_SET 0x00000004U /* Set node flags in nodelist */ 2310Sstevel@tonic-gate %#define MD_NR_DEL 0x00000008U /* reset OK flag, set DEL */ 2320Sstevel@tonic-gate %#define MD_NR_OK 0x80000000U /* set OK flag; reset ADD */ 2330Sstevel@tonic-gate #endif /* RPC_HDR */ 2340Sstevel@tonic-gate 2350Sstevel@tonic-gate struct md_mnnode_record { 2360Sstevel@tonic-gate u_int nr_revision; /* revision level */ 2370Sstevel@tonic-gate u_int nr_flags; /* state flags */ 2380Sstevel@tonic-gate mddb_recid_t nr_selfid; /* db record id */ 2390Sstevel@tonic-gate md_timeval32_t nr_ctime; /* creation timestamp */ 2400Sstevel@tonic-gate u_long nr_genid; /* generation id */ 2410Sstevel@tonic-gate md_mnnode_record *nr_next; /* next ptr (Incore) */ 2420Sstevel@tonic-gate mddb_recid_t nr_nextrec; /* next node rec id */ 2430Sstevel@tonic-gate u_int nr_nodeid; /* node id */ 2440Sstevel@tonic-gate md_node_nm_t nr_nodename; /* node name */ 2450Sstevel@tonic-gate 2460Sstevel@tonic-gate }; 2470Sstevel@tonic-gate 2480Sstevel@tonic-gate const MD_MNNODE_RECORD_REVISION = 0x00000100; 2490Sstevel@tonic-gate 2500Sstevel@tonic-gate const MD_SET_RECORD_REVISION = 0x00010000; 2510Sstevel@tonic-gate 2520Sstevel@tonic-gate #ifdef RPC_HDR 2530Sstevel@tonic-gate % 2540Sstevel@tonic-gate %#define MD_SR_ADD 0x00000001U 2550Sstevel@tonic-gate %#define MD_SR_DEL 0x00000002U 2560Sstevel@tonic-gate %#define MD_SR_CHECK 0x00000004U 2570Sstevel@tonic-gate %#define MD_SR_CVT 0x00000008U 2580Sstevel@tonic-gate %#define MD_SR_LOCAL 0x00000010U 2590Sstevel@tonic-gate %#define MD_SR_MB_DEVID 0x10000000U 2600Sstevel@tonic-gate %#define MD_SR_AUTO_TAKE 0x20000000U 2610Sstevel@tonic-gate %#define MD_SR_MN 0x40000000U 2620Sstevel@tonic-gate %#define MD_SR_OK 0x80000000U 2630Sstevel@tonic-gate %#define MD_SR_STATE_FLAGS (MD_SR_ADD | \ 2640Sstevel@tonic-gate % MD_SR_DEL | \ 2650Sstevel@tonic-gate % MD_SR_CHECK | \ 2660Sstevel@tonic-gate % MD_SR_CVT | \ 2670Sstevel@tonic-gate % MD_SR_OK) 2680Sstevel@tonic-gate #endif /* RPC_HDR */ 2690Sstevel@tonic-gate 2700Sstevel@tonic-gate #if !defined(_KERNEL) 2710Sstevel@tonic-gate struct md_set_record { 2720Sstevel@tonic-gate u_int sr_revision; /* revision level */ 2730Sstevel@tonic-gate u_int sr_flags; /* state flags */ 2740Sstevel@tonic-gate mddb_recid_t sr_selfid; /* db record id */ 2750Sstevel@tonic-gate #ifdef RPC_HDR 2760Sstevel@tonic-gate md_set_record *sr_next; /* next ptr (Incore) */ 2770Sstevel@tonic-gate #endif /* RPC_HDR */ 2780Sstevel@tonic-gate set_t sr_setno; /* set number */ 2790Sstevel@tonic-gate md_set_nm_t sr_setname; /* setname */ 2800Sstevel@tonic-gate md_timeval32_t sr_ctime; /* creation timestamp */ 2810Sstevel@tonic-gate u_long sr_genid; /* generation id */ 2820Sstevel@tonic-gate md_node_nm_arr_t sr_nodes; /* array of nodenames */ 2830Sstevel@tonic-gate md_drive_record *sr_drivechain; /* dr list (Incore) */ 2840Sstevel@tonic-gate mddb_recid_t sr_driverec; /* first dr record id */ 2850Sstevel@tonic-gate mhd_mhiargs_t sr_mhiargs; /* MH ioctl timeouts */ 2860Sstevel@tonic-gate md_h_arr_t sr_med; /* Mediator hosts */ 2870Sstevel@tonic-gate }; 2880Sstevel@tonic-gate #else /* _KERNEL */ 2890Sstevel@tonic-gate struct md_set_record { 2900Sstevel@tonic-gate u_int sr_revision; /* revision level */ 2910Sstevel@tonic-gate u_int sr_flags; /* state flags */ 2920Sstevel@tonic-gate mddb_recid_t sr_selfid; /* db record id */ 2930Sstevel@tonic-gate #ifdef RPC_HDR 2940Sstevel@tonic-gate u_int sr_next; /* next ptr (Incore) */ 2950Sstevel@tonic-gate #endif /* RPC_HDR */ 2960Sstevel@tonic-gate set_t sr_setno; /* set number */ 2970Sstevel@tonic-gate md_set_nm_t sr_setname; /* setname */ 2980Sstevel@tonic-gate md_timeval32_t sr_ctime; /* creation timestamp */ 2990Sstevel@tonic-gate u_int sr_genid; /* generation id */ 3000Sstevel@tonic-gate md_node_nm_arr_t sr_nodes; /* array of nodenames */ 3010Sstevel@tonic-gate u_int sr_drivechain; /* dr list (Incore) */ 3020Sstevel@tonic-gate mddb_recid_t sr_driverec; /* first dr record id */ 3030Sstevel@tonic-gate mhd_mhiargs_t sr_mhiargs; /* MH ioctl timeouts */ 3040Sstevel@tonic-gate md_h_arr_t sr_med; /* Mediator hosts */ 3050Sstevel@tonic-gate }; 3060Sstevel@tonic-gate #endif /* !_KERNEL */ 3070Sstevel@tonic-gate 3080Sstevel@tonic-gate struct md_mnset_record { 3090Sstevel@tonic-gate u_int sr_revision; /* revision level */ 3100Sstevel@tonic-gate u_int sr_flags; /* state flags */ 3110Sstevel@tonic-gate mddb_recid_t sr_selfid; /* db record id */ 3120Sstevel@tonic-gate #ifdef RPC_HDR 3130Sstevel@tonic-gate md_set_record *sr_next; /* next ptr (Incore) */ 3140Sstevel@tonic-gate #endif /* RPC_HDR */ 3150Sstevel@tonic-gate set_t sr_setno; /* set number */ 3160Sstevel@tonic-gate md_set_nm_t sr_setname; /* setname */ 3170Sstevel@tonic-gate md_timeval32_t sr_ctime; /* creation timestamp */ 3180Sstevel@tonic-gate u_long sr_genid; /* generation id */ 3190Sstevel@tonic-gate md_node_nm_arr_t sr_nodes_bw_compat; /* for compat with */ 3200Sstevel@tonic-gate /* md_set_record, */ 3210Sstevel@tonic-gate /* first node always */ 3220Sstevel@tonic-gate /* this node */ 3230Sstevel@tonic-gate md_drive_record *sr_drivechain; /* dr list (Incore) */ 3240Sstevel@tonic-gate mddb_recid_t sr_driverec; /* first dr record id */ 3250Sstevel@tonic-gate mhd_mhiargs_t sr_mhiargs; /* MH ioctl timeouts */ 3260Sstevel@tonic-gate md_h_arr_t sr_med; /* Mediator hosts */ 3270Sstevel@tonic-gate md_mnnode_record *sr_nodechain; /* node list (incore) */ 3280Sstevel@tonic-gate mddb_recid_t sr_noderec; /* first node rec id */ 3290Sstevel@tonic-gate md_node_nm_t sr_master_nodenm; /* Master nm (incore) */ 3300Sstevel@tonic-gate u_int sr_master_nodeid; /* Master id (incore) */ 3310Sstevel@tonic-gate u_int sr_mddb_min_size; /* min size of mddb */ 3320Sstevel@tonic-gate }; 3330Sstevel@tonic-gate 3340Sstevel@tonic-gate #ifdef RPC_HDR 3350Sstevel@tonic-gate % 3360Sstevel@tonic-gate %#define MD_SETOWNER_NO 0 3370Sstevel@tonic-gate %#define MD_SETOWNER_YES 1 3380Sstevel@tonic-gate %#define MD_SETOWNER_NONE 2 3390Sstevel@tonic-gate #endif /* RPC_HDR */ 3400Sstevel@tonic-gate 3410Sstevel@tonic-gate % 3420Sstevel@tonic-gate %/* Gate key type */ 3430Sstevel@tonic-gate struct md_setkey_t { 3440Sstevel@tonic-gate string sk_host<>; 3450Sstevel@tonic-gate set_t sk_setno; 3460Sstevel@tonic-gate string sk_setname<>; 3470Sstevel@tonic-gate md_timeval32_t sk_key; 3480Sstevel@tonic-gate #ifdef RPC_HDR 3490Sstevel@tonic-gate struct md_setkey_t *sk_next; 3500Sstevel@tonic-gate #endif /* RPC_HDR */ 3510Sstevel@tonic-gate }; 3520Sstevel@tonic-gate 3530Sstevel@tonic-gate % 3540Sstevel@tonic-gate %/* metadevice ID */ 3550Sstevel@tonic-gate typedef minor_t unit_t; 3560Sstevel@tonic-gate 3570Sstevel@tonic-gate % 3580Sstevel@tonic-gate %/* component ID */ 3590Sstevel@tonic-gate struct comp_t { 3600Sstevel@tonic-gate minor_t mnum; /* associated metadevice */ 3610Sstevel@tonic-gate md_dev64_t dev; 3620Sstevel@tonic-gate }; 3630Sstevel@tonic-gate 3640Sstevel@tonic-gate % 3650Sstevel@tonic-gate %/* hotspare pool ID */ 3660Sstevel@tonic-gate typedef u_int hsp_t; 3670Sstevel@tonic-gate 3680Sstevel@tonic-gate #ifdef RPC_HDR 3690Sstevel@tonic-gate % 3700Sstevel@tonic-gate %#define MD_HSP_NONE ((hsp_t)~0U) 3710Sstevel@tonic-gate #endif /* RPC_HDR */ 3720Sstevel@tonic-gate 3730Sstevel@tonic-gate % 3740Sstevel@tonic-gate %/* hotspare ID */ 3750Sstevel@tonic-gate struct hs_t { 3760Sstevel@tonic-gate hsp_t hsp; /* associated hotspare pool */ 3770Sstevel@tonic-gate md_dev64_t dev; /* device ID */ 3780Sstevel@tonic-gate }; 3790Sstevel@tonic-gate 3800Sstevel@tonic-gate % 3810Sstevel@tonic-gate %/* mnum or hsp */ 3820Sstevel@tonic-gate typedef u_int minor_or_hsp_t; 3830Sstevel@tonic-gate 3840Sstevel@tonic-gate % 3850Sstevel@tonic-gate %/* 3860Sstevel@tonic-gate % * name service stuff 3870Sstevel@tonic-gate % */ 3880Sstevel@tonic-gate const MD_MAXPREFIX = 127; 3890Sstevel@tonic-gate % 3900Sstevel@tonic-gate %#define MD_MAX_CTDLEN 64 3910Sstevel@tonic-gate 3920Sstevel@tonic-gate struct md_name_prefix { 3930Sstevel@tonic-gate u_char pre_len; 3940Sstevel@tonic-gate char pre_data[MD_MAXPREFIX]; 3950Sstevel@tonic-gate }; 3960Sstevel@tonic-gate 3970Sstevel@tonic-gate const MD_MAXSUFFIX = 40; 3980Sstevel@tonic-gate % 3990Sstevel@tonic-gate struct md_name_suffix { 4000Sstevel@tonic-gate u_char suf_prefix; 4010Sstevel@tonic-gate u_char suf_len; 4020Sstevel@tonic-gate char suf_data[MD_MAXSUFFIX]; 4030Sstevel@tonic-gate }; 4040Sstevel@tonic-gate 4050Sstevel@tonic-gate struct md_splitname { 4060Sstevel@tonic-gate md_name_prefix sn_prefix; 4070Sstevel@tonic-gate md_name_suffix sn_suffix; 4080Sstevel@tonic-gate }; 4090Sstevel@tonic-gate 4100Sstevel@tonic-gate #ifdef RPC_HDR 4110Sstevel@tonic-gate % 4120Sstevel@tonic-gate %#define SPN_PREFIX(spn) ((spn)->sn_prefix) 4130Sstevel@tonic-gate %#define SPN_SUFFIX(spn) ((spn)->sn_suffix) 4140Sstevel@tonic-gate #endif /* RPC_HDR */ 4150Sstevel@tonic-gate 4160Sstevel@tonic-gate % 4170Sstevel@tonic-gate %/* 4180Sstevel@tonic-gate % * Number of bits to represent a setno 4190Sstevel@tonic-gate % * this gives us all info to define masks and shifts ... 4200Sstevel@tonic-gate % * Also used for minor #, hsp id, recid mask and shifts. 4210Sstevel@tonic-gate % */ 4220Sstevel@tonic-gate const MD_BITSSET = 5; 4230Sstevel@tonic-gate const MD_DEFAULTSETS = 4; 4240Sstevel@tonic-gate % 4250Sstevel@tonic-gate #ifdef RPC_HDR 4260Sstevel@tonic-gate % 4270Sstevel@tonic-gate %#define MD_MAXSETS (1 << MD_BITSSET) 4280Sstevel@tonic-gate %#define MD_SETMASK (MD_MAXSETS - 1) 4290Sstevel@tonic-gate #endif /* RPC_HDR */ 4300Sstevel@tonic-gate 4310Sstevel@tonic-gate % 4320Sstevel@tonic-gate %/* 4330Sstevel@tonic-gate % * Define a file descriptor for lockfd 4340Sstevel@tonic-gate % * when the lock is not held. 4350Sstevel@tonic-gate % */ 4360Sstevel@tonic-gate const MD_NO_LOCK = -2; 4370Sstevel@tonic-gate 4380Sstevel@tonic-gate % 4390Sstevel@tonic-gate %/* 4400Sstevel@tonic-gate % * accumulated setname 4410Sstevel@tonic-gate % */ 4420Sstevel@tonic-gate struct mdsetname_t { 4430Sstevel@tonic-gate string setname<>; /* logical name */ 4440Sstevel@tonic-gate set_t setno; /* set number */ 4450Sstevel@tonic-gate #ifdef RPC_HDR 4460Sstevel@tonic-gate struct md_set_desc *setdesc; /* Cache set/drive desc */ 4470Sstevel@tonic-gate int lockfd; /* used by meta_lock_* */ 4480Sstevel@tonic-gate #endif /* RPC_HDR */ 4490Sstevel@tonic-gate }; 4500Sstevel@tonic-gate 4510Sstevel@tonic-gate struct mdsetnamelist_t { 4520Sstevel@tonic-gate mdsetnamelist_t *next; 4530Sstevel@tonic-gate mdsetname_t *sp; 4540Sstevel@tonic-gate }; 4550Sstevel@tonic-gate 4560Sstevel@tonic-gate % 4570Sstevel@tonic-gate %/* 4580Sstevel@tonic-gate % * device name 4590Sstevel@tonic-gate % */ 4600Sstevel@tonic-gate #ifdef RPC_HDR 4610Sstevel@tonic-gate %#define MD_FULLNAME_ONLY 0x0 4620Sstevel@tonic-gate %#define MD_BASICNAME_OK 0x1 4630Sstevel@tonic-gate %#define MD_BYPASS_DAEMON 0x2 4640Sstevel@tonic-gate % 4650Sstevel@tonic-gate %#define MD_SLICE0 0 4660Sstevel@tonic-gate %#define MD_SLICE6 6 4670Sstevel@tonic-gate %#define MD_SLICE7 7 4680Sstevel@tonic-gate % 4690Sstevel@tonic-gate %#define MD_MAX_PARTS 17 4700Sstevel@tonic-gate #endif /* RPC_HDR */ 4710Sstevel@tonic-gate 4720Sstevel@tonic-gate struct mdname_t { 4730Sstevel@tonic-gate #ifdef RPC_HDR 4740Sstevel@tonic-gate struct mddrivename_t *drivenamep; /* back pointer to drive */ 4750Sstevel@tonic-gate #endif /* RPC_HDR */ 4760Sstevel@tonic-gate string cname<>; /* cannonical name */ 4770Sstevel@tonic-gate string bname<>; /* block name */ 4780Sstevel@tonic-gate string rname<>; /* raw name */ 4790Sstevel@tonic-gate string devicesname<>; /* /devices name (or NULL) */ 4800Sstevel@tonic-gate string minor_name<>; /* minor name with respect to devid */ 4810Sstevel@tonic-gate md_dev64_t dev; /* major/minor (or NODEV64) */ 4820Sstevel@tonic-gate #ifdef RPC_HDR 4830Sstevel@tonic-gate mdkey_t key; /* namespace key (or MD_KEYBAD) */ 4840Sstevel@tonic-gate #endif /* RPC_HDR */ 4850Sstevel@tonic-gate diskaddr_t end_blk; /* end of database replicas (or -1) */ 4860Sstevel@tonic-gate diskaddr_t start_blk; /* usable start block (or -1) */ 4870Sstevel@tonic-gate }; 4880Sstevel@tonic-gate 4890Sstevel@tonic-gate %/* name structure (old style) */ 4900Sstevel@tonic-gate struct o_mdname_t { 4910Sstevel@tonic-gate #ifdef RPC_HDR 4920Sstevel@tonic-gate struct o_mddrivename_t *drivenamep; /* back pointer to drive */ 4930Sstevel@tonic-gate #endif /* RPC_HDR */ 4940Sstevel@tonic-gate string cname<>; /* cannonical name */ 4950Sstevel@tonic-gate string bname<>; /* block name */ 4960Sstevel@tonic-gate string rname<>; /* raw name */ 4970Sstevel@tonic-gate string devicesname<>; /* /devices name (or NULL) */ 4980Sstevel@tonic-gate dev_t dev; /* major/minor (or NODEV64) */ 4990Sstevel@tonic-gate #ifdef RPC_HDR 5000Sstevel@tonic-gate mdkey_t key; /* namespace key (or MD_KEYBAD) */ 5010Sstevel@tonic-gate #endif /* RPC_HDR */ 5020Sstevel@tonic-gate daddr_t end_blk; /* end of database replicas (or -1) */ 5030Sstevel@tonic-gate daddr_t start_blk; /* usable start block (or -1) */ 5040Sstevel@tonic-gate }; 5050Sstevel@tonic-gate 5060Sstevel@tonic-gate struct mdnamelist_t { 5070Sstevel@tonic-gate mdnamelist_t *next; 5080Sstevel@tonic-gate mdname_t *namep; 5090Sstevel@tonic-gate }; 5100Sstevel@tonic-gate 5110Sstevel@tonic-gate % 5120Sstevel@tonic-gate %/* 5130Sstevel@tonic-gate % * drive name 5140Sstevel@tonic-gate % */ 5150Sstevel@tonic-gate %/* name types */ 5160Sstevel@tonic-gate enum mdnmtype_t { 5170Sstevel@tonic-gate MDT_UNKNOWN = 0, /* unknown type */ 5180Sstevel@tonic-gate MDT_ACCES, /* could not access device */ 5190Sstevel@tonic-gate MDT_META, /* metadevice name */ 5200Sstevel@tonic-gate MDT_COMP, /* regular device name */ 5210Sstevel@tonic-gate MDT_FAST_META, /* metadevice name (partial) */ 5220Sstevel@tonic-gate MDT_FAST_COMP /* regular device name (partial) */ 5230Sstevel@tonic-gate }; 5240Sstevel@tonic-gate 5250Sstevel@tonic-gate %/* metadevice types */ 5260Sstevel@tonic-gate enum md_types_t { 5270Sstevel@tonic-gate MD_UNDEFINED = 0, 5280Sstevel@tonic-gate MD_DEVICE, 5290Sstevel@tonic-gate MD_METAMIRROR, 5300Sstevel@tonic-gate MD_METATRANS, 5310Sstevel@tonic-gate MD_METARAID, 5320Sstevel@tonic-gate MD_METASP 5330Sstevel@tonic-gate }; 5340Sstevel@tonic-gate 5350Sstevel@tonic-gate #ifdef RPC_HDR 5360Sstevel@tonic-gate % 5370Sstevel@tonic-gate %/* misc module names */ 5380Sstevel@tonic-gate %#define MD_STRIPE "md_stripe" 5390Sstevel@tonic-gate %#define MD_MIRROR "md_mirror" 5400Sstevel@tonic-gate %#define MD_TRANS "md_trans" 5410Sstevel@tonic-gate %#define MD_HOTSPARES "md_hotspares" 5420Sstevel@tonic-gate %#define MD_RAID "md_raid" 5430Sstevel@tonic-gate %#define MD_VERIFY "md_verify" 5440Sstevel@tonic-gate %#define MD_SP "md_sp" 5450Sstevel@tonic-gate %#define MD_NOTIFY "md_notify" 5460Sstevel@tonic-gate #endif /* RPC_HDR */ 5470Sstevel@tonic-gate 5480Sstevel@tonic-gate %/* generic device info */ 5490Sstevel@tonic-gate struct mdgeom_t { 5500Sstevel@tonic-gate u_int ncyl; 5510Sstevel@tonic-gate u_int nhead; 5520Sstevel@tonic-gate u_int nsect; 5530Sstevel@tonic-gate u_int rpm; 5540Sstevel@tonic-gate u_int write_reinstruct; 5550Sstevel@tonic-gate u_int read_reinstruct; 5560Sstevel@tonic-gate u_int blk_sz; 5570Sstevel@tonic-gate }; 5580Sstevel@tonic-gate 5590Sstevel@tonic-gate %/* generic device info (old style) */ 5600Sstevel@tonic-gate struct o_mdgeom_t { 5610Sstevel@tonic-gate u_int ncyl; 5620Sstevel@tonic-gate u_int nhead; 5630Sstevel@tonic-gate u_int nsect; 5640Sstevel@tonic-gate u_int rpm; 5650Sstevel@tonic-gate u_int write_reinstruct; 5660Sstevel@tonic-gate u_int read_reinstruct; 5670Sstevel@tonic-gate }; 5680Sstevel@tonic-gate 5690Sstevel@tonic-gate struct mdcinfo_t { 5700Sstevel@tonic-gate char cname[16]; /* controller driver name */ 5710Sstevel@tonic-gate mhd_ctlrtype_t ctype; /* controller type */ 5720Sstevel@tonic-gate u_int cnum; /* controller instance */ 5730Sstevel@tonic-gate u_int tray; /* SSA100 tray */ 5740Sstevel@tonic-gate u_int bus; /* SSA100 bus */ 5750Sstevel@tonic-gate u_longlong_t wwn; /* SSA100 World Wide Name */ 5760Sstevel@tonic-gate char dname[16]; /* disk driver name */ 5770Sstevel@tonic-gate u_int unit; /* disk instance */ 5780Sstevel@tonic-gate u_int maxtransfer; /* max I/O size (in blocks) */ 5790Sstevel@tonic-gate }; 5800Sstevel@tonic-gate 5810Sstevel@tonic-gate struct mdpart_t { 5820Sstevel@tonic-gate diskaddr_t start; /* start block */ 5830Sstevel@tonic-gate diskaddr_t size; /* size of partition (in blocks) */ 5840Sstevel@tonic-gate u_short tag; /* ID tag of partition */ 5850Sstevel@tonic-gate u_short flag; /* permission flags */ 5860Sstevel@tonic-gate diskaddr_t label; /* size of disk label (or 0) */ 5870Sstevel@tonic-gate }; 5880Sstevel@tonic-gate 5890Sstevel@tonic-gate %/* partition information (old style) */ 5900Sstevel@tonic-gate struct o_mdpart_t { 5910Sstevel@tonic-gate daddr_t start; /* start block */ 5920Sstevel@tonic-gate daddr_t size; /* size of partition (in blocks) */ 5930Sstevel@tonic-gate u_short tag; /* ID tag of partition */ 5940Sstevel@tonic-gate u_short flag; /* permission flags */ 5950Sstevel@tonic-gate daddr_t label; /* size of disk label (or 0) */ 5960Sstevel@tonic-gate }; 5970Sstevel@tonic-gate 5980Sstevel@tonic-gate struct mdvtoc_t { 5990Sstevel@tonic-gate u_int nparts; 6000Sstevel@tonic-gate diskaddr_t first_lba; /* for efi devices only */ 6010Sstevel@tonic-gate diskaddr_t last_lba; /* for efi devices only */ 6020Sstevel@tonic-gate diskaddr_t lbasize; /* for efi devices only */ 6030Sstevel@tonic-gate mdpart_t parts[MD_MAX_PARTS]; /* room for i386 too */ 6040Sstevel@tonic-gate char *typename; /* disk type (or NULL) */ 6050Sstevel@tonic-gate }; 6060Sstevel@tonic-gate 6070Sstevel@tonic-gate %/* vtoc information (old style) */ 6080Sstevel@tonic-gate struct o_mdvtoc_t { 6090Sstevel@tonic-gate char *typename; /* disk type (or NULL) */ 6100Sstevel@tonic-gate u_int nparts; 6110Sstevel@tonic-gate o_mdpart_t parts[16]; /* room for i386 too */ 6120Sstevel@tonic-gate }; 6130Sstevel@tonic-gate % 6140Sstevel@tonic-gate %/* 6150Sstevel@tonic-gate % * List of drivename cnames per side, 6160Sstevel@tonic-gate % * also the driver name, mnum (for slice 7). 6170Sstevel@tonic-gate % */ 6180Sstevel@tonic-gate struct mdsidenames_t { 6190Sstevel@tonic-gate mdsidenames_t *next; 6200Sstevel@tonic-gate side_t sideno; 6210Sstevel@tonic-gate minor_t mnum; 6220Sstevel@tonic-gate string dname<>; 6230Sstevel@tonic-gate string cname<>; 6240Sstevel@tonic-gate }; 6250Sstevel@tonic-gate 6260Sstevel@tonic-gate struct mddrivename_t { 6270Sstevel@tonic-gate #ifdef RPC_HDR 6280Sstevel@tonic-gate /* 6290Sstevel@tonic-gate * the following string is not used but is left in place so that 6300Sstevel@tonic-gate * it is not necessary to version the rpc interface that passes 6310Sstevel@tonic-gate * this structure. 6320Sstevel@tonic-gate */ 6330Sstevel@tonic-gate string not_used<>; 6340Sstevel@tonic-gate #endif /* RPC_HDR */ 6350Sstevel@tonic-gate string cname<>; /* canonical drive name */ 6360Sstevel@tonic-gate string rname<>; /* raw name */ 6370Sstevel@tonic-gate mdnmtype_t type; /* type of drive */ 6380Sstevel@tonic-gate string devid<>; /* Device Id of the drive */ 6390Sstevel@tonic-gate int errnum; /* errno for type == MDT_ACCES */ 6400Sstevel@tonic-gate mdgeom_t geom; /* disk geometry */ 6410Sstevel@tonic-gate mdcinfo_t cinfo; /* controller info */ 6420Sstevel@tonic-gate mdvtoc_t vtoc; /* volume table of contents info */ 6430Sstevel@tonic-gate mdname_t parts<>; /* partitions in drive */ 6440Sstevel@tonic-gate mdsidenames_t *side_names; /* list of names per side */ 6450Sstevel@tonic-gate mdkey_t side_names_key; /* key used to store the side names*/ 6460Sstevel@tonic-gate 6470Sstevel@tonic-gate string miscname<>; /* metadevice misc name */ 6480Sstevel@tonic-gate #ifdef RPC_HDR 6490Sstevel@tonic-gate struct md_common_t *unitp; /* metadevice unit structure */ 6500Sstevel@tonic-gate #endif /* RPC_HDR */ 6510Sstevel@tonic-gate }; 6520Sstevel@tonic-gate 6530Sstevel@tonic-gate %/* 6540Sstevel@tonic-gate % * old version of mddrivename_t that contains an old version of mdgeom_t, 6550Sstevel@tonic-gate % * mdvtoc_t and mdname_t (prefixed _o). 6560Sstevel@tonic-gate % */ 6570Sstevel@tonic-gate struct o_mddrivename_t { 6580Sstevel@tonic-gate #ifdef RPC_HDR 6590Sstevel@tonic-gate string cachenm<>; /* name used for cache lookups */ 6600Sstevel@tonic-gate #endif /* RPC_HDR */ 6610Sstevel@tonic-gate string cname<>; /* canonical drive name */ 6620Sstevel@tonic-gate string rname<>; /* raw name */ 6630Sstevel@tonic-gate mdnmtype_t type; /* type of drive */ 6640Sstevel@tonic-gate int errnum; /* errno for type == MDT_ACCES */ 6650Sstevel@tonic-gate o_mdgeom_t geom; /* disk geometry (old style) */ 6660Sstevel@tonic-gate mdcinfo_t cinfo; /* controller info */ 6670Sstevel@tonic-gate o_mdvtoc_t vtoc; /* vtoc info (old style) */ 6680Sstevel@tonic-gate o_mdname_t parts<>; /* partitions in drive (old style) */ 6690Sstevel@tonic-gate mdsidenames_t *side_names; /* list of names per side */ 6700Sstevel@tonic-gate mdkey_t side_names_key; /* key used to store the side names*/ 6710Sstevel@tonic-gate 6720Sstevel@tonic-gate string miscname<>; /* metadevice misc name */ 6730Sstevel@tonic-gate #ifdef RPC_HDR 6740Sstevel@tonic-gate struct md_common_t *unitp; /* metadevice unit structure */ 6750Sstevel@tonic-gate #endif /* RPC_HDR */ 6760Sstevel@tonic-gate }; 6770Sstevel@tonic-gate struct mddrivenamelist_t { 6780Sstevel@tonic-gate mddrivenamelist_t *next; 6790Sstevel@tonic-gate mddrivename_t *drivenamep; 6800Sstevel@tonic-gate }; 6810Sstevel@tonic-gate 6820Sstevel@tonic-gate % 6830Sstevel@tonic-gate %/* 6840Sstevel@tonic-gate % * replica struct 6850Sstevel@tonic-gate % */ 6860Sstevel@tonic-gate typedef u_int replica_flags_t; 6870Sstevel@tonic-gate #ifdef RPC_HDR 6880Sstevel@tonic-gate % 6890Sstevel@tonic-gate %#define MDDB_F_EREAD 0x00001 /* a read error occurred */ 6900Sstevel@tonic-gate %#define MDDB_F_TOOSMALL 0x00002 /* replica is too small to hold db */ 6910Sstevel@tonic-gate %#define MDDB_F_EFMT 0x00004 /* something is wrong with the data */ 6920Sstevel@tonic-gate %#define MDDB_F_EDATA 0x00008 /* error in data blocks */ 6930Sstevel@tonic-gate %#define MDDB_F_EMASTER 0x00010 /* error in master block(s) */ 6940Sstevel@tonic-gate %#define MDDB_F_ACTIVE 0x00020 /* this replica is currently in use */ 6950Sstevel@tonic-gate %#define MDDB_F_EWRITE 0x00040 /* a write error occurred */ 6960Sstevel@tonic-gate %#define MDDB_F_MASTER 0x00080 /* the copy which was used as input */ 6970Sstevel@tonic-gate %#define MDDB_F_SUSPECT 0x00100 /* replica write ability is suspect */ 6980Sstevel@tonic-gate %#define MDDB_F_PTCHED 0x00400 /* db location was patched in kernel */ 6990Sstevel@tonic-gate %#define MDDB_F_IOCTL 0x00800 /* db location passed in from ioctl */ 7000Sstevel@tonic-gate %#define MDDB_F_GOTTEN 0x01000 /* getdev has been done on this dev */ 7010Sstevel@tonic-gate %#define MDDB_F_LOCACC 0x02000 /* the locator has been accessed */ 7020Sstevel@tonic-gate %#define MDDB_F_UP2DATE 0x04000 /* this copy of db is up to date */ 7030Sstevel@tonic-gate %#define MDDB_F_OLDACT 0x08000 /* this copy was active previously */ 7040Sstevel@tonic-gate %#define MDDB_F_DELETED 0x10000 /* place holder in empty slot */ 7050Sstevel@tonic-gate %#define MDDB_F_TAGDATA 0x20000 /* Data is tagged */ 7060Sstevel@tonic-gate %#define MDDB_F_BADTAG 0x40000 /* Data tag was not valid */ 7070Sstevel@tonic-gate %#define MDDB_F_NODEVID 0x80000 /* No devid associated with replica */ 7080Sstevel@tonic-gate % 7090Sstevel@tonic-gate %/* 7100Sstevel@tonic-gate % * These are used in de_flags only 7110Sstevel@tonic-gate % * Do not change these values, they are stored on-disk 7120Sstevel@tonic-gate % */ 7130Sstevel@tonic-gate %#define MDDB_F_STRIPE 0x00001 /* record is a stripe record */ 7140Sstevel@tonic-gate %#define MDDB_F_MIRROR 0x00002 /* record is a mirror record */ 7150Sstevel@tonic-gate %#define MDDB_F_RAID 0x00004 /* record is a raid record */ 7160Sstevel@tonic-gate %#define MDDB_F_SOFTPART 0x00008 /* record is a sp record */ 7170Sstevel@tonic-gate %#define MDDB_F_TRANS_MASTER 0x00010 /* trans master record */ 7180Sstevel@tonic-gate %#define MDDB_F_TRANS_LOG 0x00020 /* trans log record */ 7190Sstevel@tonic-gate %#define MDDB_F_HOTSPARE 0x00040 /* hotspare record */ 7200Sstevel@tonic-gate %#define MDDB_F_HOTSPARE_POOL 0x00080 /* hotspare record */ 7210Sstevel@tonic-gate %#define MDDB_F_OPT 0x00200 /* optimization record */ 7220Sstevel@tonic-gate %#define MDDB_F_CHANGELOG 0x00400 /* change log record */ 7230Sstevel@tonic-gate 7240Sstevel@tonic-gate %/* used by metadb(1m) for printing */ 7250Sstevel@tonic-gate %#define MDDB_FLAGS_STRING "RSFDMaWm pc luo tBr" 7260Sstevel@tonic-gate %#define MDDB_FLAGS_LEN (strlen(MDDB_FLAGS_STRING)) 7270Sstevel@tonic-gate % 7280Sstevel@tonic-gate %/* 7290Sstevel@tonic-gate % * See meta_prbits() in SUNWmd/lib/libmeta/meta_print.c for a description of 7300Sstevel@tonic-gate % * the way this is used 7310Sstevel@tonic-gate % */ 7320Sstevel@tonic-gate %#define MDDB_F_BITNAMES "\020\001EREAD\002TOOSMALL\003EFMT\004EDATA" \ 7330Sstevel@tonic-gate % "\005EMASTER\006ACTIVE\007EWRITE\010MASTER" \ 7340Sstevel@tonic-gate % "\011SUSPECT\012OPT\013PTCHED\014IOCTL" \ 7350Sstevel@tonic-gate % "\015GOTTEN\016LOCACC\017UP2DATE\020OLDACT" \ 7360Sstevel@tonic-gate % "\021DELETED\022TAGDATA\023BADTAG\024NORELOC" 7370Sstevel@tonic-gate % 7380Sstevel@tonic-gate #endif /* RPC_HDR */ 7390Sstevel@tonic-gate 7400Sstevel@tonic-gate /* 7410Sstevel@tonic-gate * Refering to r_blkno and r_nblk: 7420Sstevel@tonic-gate * A replica will always be smaller than 1 Terabyte, so no need to 7430Sstevel@tonic-gate * change the ondisk structure to 64 bits. 7440Sstevel@tonic-gate */ 7450Sstevel@tonic-gate struct md_replica_t { 7460Sstevel@tonic-gate mdname_t *r_namep; 7470Sstevel@tonic-gate replica_flags_t r_flags; 7480Sstevel@tonic-gate daddr_t r_blkno; 7490Sstevel@tonic-gate daddr_t r_nblk; 7500Sstevel@tonic-gate ddi_devid_t r_devid; 7510Sstevel@tonic-gate char r_driver_name[MD_MAXDRVNM]; 7520Sstevel@tonic-gate char r_minor_name[MDDB_MINOR_NAME_MAX]; 7530Sstevel@tonic-gate }; 7540Sstevel@tonic-gate 7550Sstevel@tonic-gate struct md_replica_recerr_t { 7560Sstevel@tonic-gate int r_li; 7570Sstevel@tonic-gate int r_flags; 7580Sstevel@tonic-gate daddr32_t r_blkno; 7590Sstevel@tonic-gate minor_t r_mnum; 7600Sstevel@tonic-gate char r_driver_name[MD_MAXDRVNM]; 7610Sstevel@tonic-gate }; 7620Sstevel@tonic-gate 7630Sstevel@tonic-gate struct md_replicalist_t { 7640Sstevel@tonic-gate md_replicalist_t *rl_next; 7650Sstevel@tonic-gate md_replica_t *rl_repp; 7660Sstevel@tonic-gate }; 7670Sstevel@tonic-gate 7680Sstevel@tonic-gate % 7690Sstevel@tonic-gate %/* 7700Sstevel@tonic-gate % * set/drive structs exposed by the library routines 7710Sstevel@tonic-gate % */ 7720Sstevel@tonic-gate struct md_drive_desc { 7730Sstevel@tonic-gate md_timeval32_t dd_ctime; /* creation time */ 7740Sstevel@tonic-gate u_long dd_genid; /* generation id */ 7750Sstevel@tonic-gate u_int dd_flags; /* state flags */ 7760Sstevel@tonic-gate md_drive_desc *dd_next; /* next drive */ 7770Sstevel@tonic-gate mddrivename_t *dd_dnp; /* drive name ptr */ 7780Sstevel@tonic-gate int dd_dbcnt; /* # of replicas */ 7790Sstevel@tonic-gate int dd_dbsize; /* size of replica */ 7800Sstevel@tonic-gate }; 7810Sstevel@tonic-gate 7820Sstevel@tonic-gate % 7830Sstevel@tonic-gate %/* 7840Sstevel@tonic-gate % * set/drive structs exposed by the library routines (old style) 7850Sstevel@tonic-gate % */ 7860Sstevel@tonic-gate struct o_md_drive_desc { 7870Sstevel@tonic-gate md_timeval32_t dd_ctime; /* creation time */ 7880Sstevel@tonic-gate u_long dd_genid; /* generation id */ 7890Sstevel@tonic-gate u_int dd_flags; /* state flags */ 7900Sstevel@tonic-gate o_md_drive_desc *dd_next; /* next drive */ 7910Sstevel@tonic-gate o_mddrivename_t *dd_dnp; /* drive name ptr */ 7920Sstevel@tonic-gate int dd_dbcnt; /* # of replicas */ 7930Sstevel@tonic-gate int dd_dbsize; /* size of replica */ 7940Sstevel@tonic-gate }; 7950Sstevel@tonic-gate 7960Sstevel@tonic-gate struct md_mnnode_desc { 7970Sstevel@tonic-gate md_timeval32_t nd_ctime; /* creation time */ 7980Sstevel@tonic-gate u_long nd_genid; /* generation id */ 7990Sstevel@tonic-gate u_int nd_flags; /* state flags */ 8000Sstevel@tonic-gate md_mnnode_desc *nd_next; /* next node */ 8010Sstevel@tonic-gate md_mnnode_nm_t nd_nodename; /* name of node */ 8020Sstevel@tonic-gate u_int nd_nodeid; /* id of node */ 8030Sstevel@tonic-gate md_mnnode_nm_t nd_priv_ic; /* priv interconnect */ 8040Sstevel@tonic-gate /* nodename */ 8050Sstevel@tonic-gate }; 8060Sstevel@tonic-gate 8070Sstevel@tonic-gate struct md_set_desc { 8080Sstevel@tonic-gate md_timeval32_t sd_ctime; /* creation time */ 8090Sstevel@tonic-gate u_long sd_genid; /* generation id */ 8100Sstevel@tonic-gate set_t sd_setno; /* set number */ 8110Sstevel@tonic-gate u_int sd_flags; /* state flags */ 8120Sstevel@tonic-gate md_node_nm_arr_t sd_nodes; /* array of nodenames */ 8130Sstevel@tonic-gate /* for !MN_disksets */ 8140Sstevel@tonic-gate int sd_isown[MD_MAXSIDES]; /* bool for is owner? */ 8150Sstevel@tonic-gate md_h_arr_t sd_med; /* Mediator hosts */ 8160Sstevel@tonic-gate md_drive_desc *sd_drvs; /* drive list */ 8170Sstevel@tonic-gate u_int sd_mn_am_i_master; 8180Sstevel@tonic-gate u_int sd_mn_numnodes; /* # of nodes in list */ 8190Sstevel@tonic-gate md_mnnode_desc *sd_nodelist; /* MN node list */ 8200Sstevel@tonic-gate /* for MN_disksets */ 8210Sstevel@tonic-gate md_node_nm_t sd_mn_master_nodenm; /* Master node name */ 8220Sstevel@tonic-gate u_int sd_mn_master_nodeid; /* Master node id */ 8230Sstevel@tonic-gate md_mnnode_desc *sd_mn_mynode; /* shortcut to me */ 8240Sstevel@tonic-gate md_mnnode_desc *sd_mn_masternode; /* shortcut to master */ 8250Sstevel@tonic-gate }; 8260Sstevel@tonic-gate 8270Sstevel@tonic-gate %/* 8280Sstevel@tonic-gate % * Defines to determine if diskset is a Multinode diskset. 8290Sstevel@tonic-gate % * The sd_flags field in the md_set_desc structure is never manipulated 8300Sstevel@tonic-gate % * directly but is always a copy of the set record's sr_flags field, so 8310Sstevel@tonic-gate % * the same define (MD_SR_MN) can be used for both sd_flags and sr_flags. 8320Sstevel@tonic-gate % * The set record is of the structure type md_set_record if a regular diskset 8330Sstevel@tonic-gate % * or type md_mnset_record for a Multinode diskset. 8340Sstevel@tonic-gate %*/ 8350Sstevel@tonic-gate %#define MD_MNSET_DESC(sd) (((sd)->sd_flags & MD_SR_MN) ? 1 : 0) 8360Sstevel@tonic-gate %#define MD_MNSET_REC(sr) (((sr)->sr_flags & MD_SR_MN) ? 1 : 0) 8370Sstevel@tonic-gate %#define MD_MNDR_REC(dr) (((dr)->dr_flags & MD_DR_MN) ? 1 : 0) 8380Sstevel@tonic-gate 8390Sstevel@tonic-gate %/* 8400Sstevel@tonic-gate % * Define to determine if diskset is a Auto-Take diskset. 8410Sstevel@tonic-gate %*/ 8420Sstevel@tonic-gate %#define MD_ATSET_DESC(sd) (((sd)->sd_flags & MD_SR_AUTO_TAKE) ? 1 : 0) 8430Sstevel@tonic-gate 8440Sstevel@tonic-gate %/* 8450Sstevel@tonic-gate % * Define to set the alive flag for a node. A node is alive if it 8460Sstevel@tonic-gate % * is in the multi_node membership list. 8470Sstevel@tonic-gate % */ 8480Sstevel@tonic-gate %#define MD_MN_NODE_ALIVE 0x0001 8490Sstevel@tonic-gate 8500Sstevel@tonic-gate %/* 8510Sstevel@tonic-gate % * Define to set the own flag for a node. A node is an owner of the diskset 8520Sstevel@tonic-gate % * if that node has snarf'd in the mddb. 8530Sstevel@tonic-gate % */ 8540Sstevel@tonic-gate %#define MD_MN_NODE_OWN 0x0002 8550Sstevel@tonic-gate 8560Sstevel@tonic-gate %/* 8570Sstevel@tonic-gate % * Defines to set the add, delete and ok states of a node. The add state is 8580Sstevel@tonic-gate % * set at the beginning of the addition of a node to a diskset. The 8590Sstevel@tonic-gate % * delete state is set at the beginning of a deletion of a node from a diskset. 8600Sstevel@tonic-gate % * The OK state is set (and the add state reset) when that node is 8610Sstevel@tonic-gate % * functional in the diskset. 8620Sstevel@tonic-gate % * Rollback join flag is used on an error condition when deleting the last 8630Sstevel@tonic-gate % * disk from a diskset. rpc.metad should never see this flag. 8640Sstevel@tonic-gate % * NOSET flag is used on an error condition during a reconfig cycle when 8650Sstevel@tonic-gate % * the set has been removed from this node. rpc.metad should just ignore 8660Sstevel@tonic-gate % * this flag. 8670Sstevel@tonic-gate % */ 8680Sstevel@tonic-gate %#define MD_MN_NODE_ADD 0x0004 8690Sstevel@tonic-gate %#define MD_MN_NODE_DEL 0x0008 8700Sstevel@tonic-gate %#define MD_MN_NODE_OK 0x0010 8710Sstevel@tonic-gate %#define MD_MN_NODE_RB_JOIN 0x0020 8720Sstevel@tonic-gate %#define MD_MN_NODE_NOSET 0x0040 8730Sstevel@tonic-gate 8740Sstevel@tonic-gate %/* 8750Sstevel@tonic-gate % * Define for invalid node id. Used specifically to set mn set record 8760Sstevel@tonic-gate % * master nodeid to invalid when no master can be determined. 8770Sstevel@tonic-gate % */ 8780Sstevel@tonic-gate %#define MD_MN_INVALID_NID 0xfffffffful /* invalid node id */ 8790Sstevel@tonic-gate 8800Sstevel@tonic-gate % 8810Sstevel@tonic-gate %/* 8820Sstevel@tonic-gate % * set description (old style) 8830Sstevel@tonic-gate % */ 8840Sstevel@tonic-gate struct o_md_set_desc { 8850Sstevel@tonic-gate md_timeval32_t sd_ctime; /* creation time */ 8860Sstevel@tonic-gate u_long sd_genid; /* generation id */ 8870Sstevel@tonic-gate set_t sd_setno; /* set number */ 8880Sstevel@tonic-gate u_int sd_flags; /* state flags */ 8890Sstevel@tonic-gate md_node_nm_arr_t sd_nodes; /* array of nodenames */ 8900Sstevel@tonic-gate int sd_isown[MD_MAXSIDES]; /* bool for is owner? */ 8910Sstevel@tonic-gate md_h_arr_t sd_med; /* Mediator hosts */ 8920Sstevel@tonic-gate o_md_drive_desc *sd_drvs; /* drive list */ 8930Sstevel@tonic-gate }; 8940Sstevel@tonic-gate 8950Sstevel@tonic-gate % 8960Sstevel@tonic-gate %/* 8970Sstevel@tonic-gate % * hotspare pool name 8980Sstevel@tonic-gate % */ 8990Sstevel@tonic-gate struct mdhspname_t { 9000Sstevel@tonic-gate string hspname<>; /* hotspare pool name */ 9010Sstevel@tonic-gate hsp_t hsp; /* number */ 9020Sstevel@tonic-gate 9030Sstevel@tonic-gate #ifdef RPC_HDR 9040Sstevel@tonic-gate struct md_hsp_t *unitp; /* hotspare pool unit structure */ 9050Sstevel@tonic-gate #endif /* RPC_HDR */ 9060Sstevel@tonic-gate }; 9070Sstevel@tonic-gate 9080Sstevel@tonic-gate struct mdhspnamelist_t { 9090Sstevel@tonic-gate mdhspnamelist_t *next; 9100Sstevel@tonic-gate mdhspname_t *hspnamep; 9110Sstevel@tonic-gate }; 9120Sstevel@tonic-gate 9130Sstevel@tonic-gate % 9140Sstevel@tonic-gate %/* 9150Sstevel@tonic-gate % * generic metadevice descriptions for status and init 9160Sstevel@tonic-gate % */ 9170Sstevel@tonic-gate % 9180Sstevel@tonic-gate 9190Sstevel@tonic-gate %/* 9200Sstevel@tonic-gate % * following used with un_status 9210Sstevel@tonic-gate % * bottom 16 bits are global definitions 9220Sstevel@tonic-gate % * top 16 bits are defined by sub device 9230Sstevel@tonic-gate % */ 9240Sstevel@tonic-gate typedef u_int md_status_t; 9250Sstevel@tonic-gate #ifdef RPC_HDR 9260Sstevel@tonic-gate % 9270Sstevel@tonic-gate %#define MD_UN_GROW_PENDING 0x0008 /* grow mirror pending */ 9280Sstevel@tonic-gate %#define MD_UN_BEING_RESET 0x0040 /* reset at snarf time */ 9290Sstevel@tonic-gate #endif /* RPC_HDR */ 9300Sstevel@tonic-gate % 9310Sstevel@tonic-gate %/* 9320Sstevel@tonic-gate % * following are used with un_parent 9330Sstevel@tonic-gate % * MD_NO_PARENT - Not a sub-device. 9340Sstevel@tonic-gate % * MD_MULTI_PARENT - A sub-device with one or more parents, like a log. 9350Sstevel@tonic-gate % * other - A sub-device with only one parent, like a submirror. 9360Sstevel@tonic-gate % * The number is the parent's unit number. 9370Sstevel@tonic-gate % */ 9380Sstevel@tonic-gate typedef unit_t md_parent_t; 9390Sstevel@tonic-gate #ifdef RPC_HDR 9400Sstevel@tonic-gate % 9410Sstevel@tonic-gate %#define MD_NO_PARENT 0xffffffffu 9420Sstevel@tonic-gate %#define MD_MULTI_PARENT 0xfffffffeu 9430Sstevel@tonic-gate %#define MD_HAS_PARENT(p) ((p) != MD_NO_PARENT) 9440Sstevel@tonic-gate #endif /* RPC_HDR */ 9450Sstevel@tonic-gate 9460Sstevel@tonic-gate typedef u_int md_stackcap_t; 9470Sstevel@tonic-gate #ifdef RPC_HDR 9480Sstevel@tonic-gate % 9490Sstevel@tonic-gate %#define MD_CANT_PARENT 0x00 /* cannot have a parent */ 9500Sstevel@tonic-gate %#define MD_CAN_PARENT 0x01 /* can have a parent */ 9510Sstevel@tonic-gate %#define MD_CAN_SUB_MIRROR 0x02 /* can be a sub-mirror */ 9520Sstevel@tonic-gate %#define MD_CAN_META_CHILD 0x04 /* can have metadev. children */ 9530Sstevel@tonic-gate %#define MD_CAN_SP 0x08 /* can be soft partitioned */ 9540Sstevel@tonic-gate 9550Sstevel@tonic-gate #endif /* RPC_HDR */ 9560Sstevel@tonic-gate 9570Sstevel@tonic-gate /* common to all metadevices */ 9580Sstevel@tonic-gate struct md_common_t { 9590Sstevel@tonic-gate mdname_t *namep; 9600Sstevel@tonic-gate md_types_t type; 9610Sstevel@tonic-gate md_status_t state; 9620Sstevel@tonic-gate md_stackcap_t capabilities; 9630Sstevel@tonic-gate md_parent_t parent; 9640Sstevel@tonic-gate diskaddr_t size; 9650Sstevel@tonic-gate u_long user_flags; 9660Sstevel@tonic-gate u_longlong_t revision; 9670Sstevel@tonic-gate }; 9680Sstevel@tonic-gate 9690Sstevel@tonic-gate % 9700Sstevel@tonic-gate %/* 9710Sstevel@tonic-gate % * stripe 9720Sstevel@tonic-gate % */ 9730Sstevel@tonic-gate /* 9740Sstevel@tonic-gate * ioctl stuff 9750Sstevel@tonic-gate */ 9760Sstevel@tonic-gate struct ms_params_t { 9770Sstevel@tonic-gate int change_hsp_id; 9780Sstevel@tonic-gate hsp_t hsp_id; 9790Sstevel@tonic-gate }; 9800Sstevel@tonic-gate 9810Sstevel@tonic-gate /* 9820Sstevel@tonic-gate * unit structure 9830Sstevel@tonic-gate */ 9840Sstevel@tonic-gate typedef u_int comp_state_t; 9850Sstevel@tonic-gate #ifdef RPC_HDR 9860Sstevel@tonic-gate % 9870Sstevel@tonic-gate %#define CS_OKAY 0x0001 9880Sstevel@tonic-gate %#define CS_ERRED 0x0002 9890Sstevel@tonic-gate %#define CS_RESYNC 0x0004 9900Sstevel@tonic-gate %#define CS_LAST_ERRED 0x0008 9910Sstevel@tonic-gate % 9920Sstevel@tonic-gate %/* interlace values (in bytes) */ 9930Sstevel@tonic-gate %#define MININTERLACE (16 * 512) 9940Sstevel@tonic-gate %#define MAXINTERLACE (100 * 1024 * 1024) 9950Sstevel@tonic-gate #endif /* RPC_HDR */ 9960Sstevel@tonic-gate 9970Sstevel@tonic-gate struct md_comp_t { 9980Sstevel@tonic-gate mdname_t *compnamep; 9990Sstevel@tonic-gate mdname_t *hsnamep; 10000Sstevel@tonic-gate comp_state_t state; 10010Sstevel@tonic-gate u_int lasterrcnt; 10020Sstevel@tonic-gate md_timeval32_t timestamp; 10030Sstevel@tonic-gate }; 10040Sstevel@tonic-gate 10050Sstevel@tonic-gate struct md_row_t { 10060Sstevel@tonic-gate diskaddr_t interlace; 10070Sstevel@tonic-gate diskaddr_t row_size; 10080Sstevel@tonic-gate md_comp_t comps<>; 10090Sstevel@tonic-gate }; 10100Sstevel@tonic-gate 10110Sstevel@tonic-gate struct md_stripe_t { 10120Sstevel@tonic-gate md_common_t common; 10130Sstevel@tonic-gate mdhspname_t *hspnamep; 10140Sstevel@tonic-gate md_row_t rows<>; 10150Sstevel@tonic-gate }; 10160Sstevel@tonic-gate 10170Sstevel@tonic-gate % 10180Sstevel@tonic-gate %/* 10190Sstevel@tonic-gate % * soft partition 10200Sstevel@tonic-gate % */ 10210Sstevel@tonic-gate typedef uint64_t xsp_offset_t; 10220Sstevel@tonic-gate typedef uint64_t xsp_length_t; 10230Sstevel@tonic-gate typedef u_int xsp_status_t; 10240Sstevel@tonic-gate % 10250Sstevel@tonic-gate %#define SP_INIT 0x0001 10260Sstevel@tonic-gate %#define SP_OK 0x0002 10270Sstevel@tonic-gate %#define SP_LASTERR 0x0004 10280Sstevel@tonic-gate % 10290Sstevel@tonic-gate /* 10300Sstevel@tonic-gate * unit structure 10310Sstevel@tonic-gate */ 10320Sstevel@tonic-gate 10330Sstevel@tonic-gate struct md_sp_ext_t { 10340Sstevel@tonic-gate xsp_offset_t voff; 10350Sstevel@tonic-gate xsp_offset_t poff; 10360Sstevel@tonic-gate xsp_length_t len; 10370Sstevel@tonic-gate }; 10380Sstevel@tonic-gate 10390Sstevel@tonic-gate struct md_sp_t { 10400Sstevel@tonic-gate md_common_t common; 10410Sstevel@tonic-gate mdname_t *compnamep; /* name of this component */ 10420Sstevel@tonic-gate xsp_status_t status; /* state of this soft partition */ 10430Sstevel@tonic-gate md_sp_ext_t ext<>; 10440Sstevel@tonic-gate }; 10450Sstevel@tonic-gate 10460Sstevel@tonic-gate % 10470Sstevel@tonic-gate %/* 10480Sstevel@tonic-gate % * mirror 10490Sstevel@tonic-gate % */ 10500Sstevel@tonic-gate /* 10510Sstevel@tonic-gate * ioctl stuff 10520Sstevel@tonic-gate */ 10530Sstevel@tonic-gate enum mm_wr_opt_t { 10540Sstevel@tonic-gate WR_PARALLEL = 0, /* write submirrors in parallel */ 10550Sstevel@tonic-gate WR_SERIAL /* write submirrors one at a time */ 10560Sstevel@tonic-gate }; 10570Sstevel@tonic-gate 10580Sstevel@tonic-gate enum mm_rd_opt_t { 10590Sstevel@tonic-gate RD_LOAD_BAL = 0, /* read submirrors roundrobin */ 10600Sstevel@tonic-gate RD_GEOMETRY, /* read submirrors geometrically */ 10610Sstevel@tonic-gate RD_FIRST /* read first submirror */ 10620Sstevel@tonic-gate }; 10630Sstevel@tonic-gate 10640Sstevel@tonic-gate typedef short mm_pass_num_t; 10650Sstevel@tonic-gate const MD_PASS_DEFAULT = 1; 10660Sstevel@tonic-gate const MD_PASS_MAX = 9; 10670Sstevel@tonic-gate 10680Sstevel@tonic-gate struct mm_params_t { 10690Sstevel@tonic-gate int change_read_option; 10700Sstevel@tonic-gate mm_rd_opt_t read_option; 10710Sstevel@tonic-gate int change_write_option; 10720Sstevel@tonic-gate mm_wr_opt_t write_option; 10730Sstevel@tonic-gate int change_pass_num; 10740Sstevel@tonic-gate mm_pass_num_t pass_num; 10750Sstevel@tonic-gate }; 10760Sstevel@tonic-gate 10770Sstevel@tonic-gate /* 10780Sstevel@tonic-gate * unit structure 10790Sstevel@tonic-gate */ 10800Sstevel@tonic-gate typedef u_int sm_state_t; 10810Sstevel@tonic-gate #ifdef RPC_HDR 10820Sstevel@tonic-gate % 10830Sstevel@tonic-gate %#define SMS_UNUSED 0x0000 10840Sstevel@tonic-gate %#define SMS_RUNNING 0x0001 10850Sstevel@tonic-gate %#define SMS_COMP_ERRED 0x0002 10860Sstevel@tonic-gate %#define SMS_COMP_RESYNC 0x0004 10870Sstevel@tonic-gate %#define SMS_ATTACHED 0x0008 10880Sstevel@tonic-gate %#define SMS_ATTACHED_RESYNC 0x0010 10890Sstevel@tonic-gate %#define SMS_OFFLINE 0x0020 10900Sstevel@tonic-gate %#define SMS_OFFLINE_RESYNC 0x0040 10910Sstevel@tonic-gate %#define SMS_ALL_ERRED 0x0080 10920Sstevel@tonic-gate %#define SMS_INUSE (0xffff) 10930Sstevel@tonic-gate %#define SMS_LIMPING (SMS_COMP_ERRED | SMS_COMP_RESYNC) 10940Sstevel@tonic-gate %#define SMS_IGNORE 0x4000 10950Sstevel@tonic-gate #endif /* RPC_HDR */ 10960Sstevel@tonic-gate 10970Sstevel@tonic-gate typedef u_int sm_flags_t; 10980Sstevel@tonic-gate #ifdef RPC_HDR 10990Sstevel@tonic-gate % 11000Sstevel@tonic-gate %#define MD_SM_RESYNC_TARGET 0x0001 11010Sstevel@tonic-gate %#define MD_SM_FAILFAST 0x0002 11020Sstevel@tonic-gate #endif /* RPC_HDR */ 11030Sstevel@tonic-gate 11040Sstevel@tonic-gate struct md_submirror_t { 11050Sstevel@tonic-gate mdname_t *submirnamep; 11060Sstevel@tonic-gate sm_state_t state; 11070Sstevel@tonic-gate sm_flags_t flags; 11080Sstevel@tonic-gate md_timeval32_t timestamp; 11090Sstevel@tonic-gate }; 11100Sstevel@tonic-gate 11110Sstevel@tonic-gate #ifdef RPC_HDR 11120Sstevel@tonic-gate % 11130Sstevel@tonic-gate %#define MD_UN_RESYNC_ACTIVE 0x00010000 11140Sstevel@tonic-gate %#define MD_UN_WAR 0x00020000 11150Sstevel@tonic-gate %#define MD_UN_OFFLINE_SM 0x00040000 11160Sstevel@tonic-gate %#define MD_UN_OPT_NOT_DONE 0x00080000 11170Sstevel@tonic-gate %#define MD_UN_KEEP_DIRTY (MD_UN_OFFLINE_SM | MD_UN_OPT_NOT_DONE) 11180Sstevel@tonic-gate %#define MD_UN_RESYNC_CANCEL 0x00100000 11190Sstevel@tonic-gate %#define MD_UN_REPLAYED 0x00200000 11200Sstevel@tonic-gate %#define MD_UN_RENAMING 0x00400000 11210Sstevel@tonic-gate %#define MD_UN_MOD_INPROGRESS (MD_UN_RESYNC_ACTIVE | \ 11220Sstevel@tonic-gate % MD_UN_OPT_NOT_DONE | \ 11230Sstevel@tonic-gate % MD_UN_RENAMING) 11240Sstevel@tonic-gate #endif /* RPC_HDR */ 11250Sstevel@tonic-gate 11260Sstevel@tonic-gate const NMIRROR = 4; 11270Sstevel@tonic-gate struct md_mirror_t { 11280Sstevel@tonic-gate md_common_t common; 11290Sstevel@tonic-gate mm_rd_opt_t read_option; 11300Sstevel@tonic-gate mm_wr_opt_t write_option; 11310Sstevel@tonic-gate mm_pass_num_t pass_num; 11320Sstevel@tonic-gate int percent_done; 11330Sstevel@tonic-gate int percent_dirty; 11340Sstevel@tonic-gate md_submirror_t submirrors[NMIRROR]; 11350Sstevel@tonic-gate }; 11360Sstevel@tonic-gate 11370Sstevel@tonic-gate 11380Sstevel@tonic-gate % 11390Sstevel@tonic-gate %/* 11400Sstevel@tonic-gate % * trans 11410Sstevel@tonic-gate % */ 11420Sstevel@tonic-gate %/* 11430Sstevel@tonic-gate % * unit structure 11440Sstevel@tonic-gate % */ 11450Sstevel@tonic-gate typedef u_int mt_flags_t; 11460Sstevel@tonic-gate #ifdef RPC_HDR 11470Sstevel@tonic-gate % 11480Sstevel@tonic-gate %#define TRANS_NEED_OPEN 0x0001 /* subdevs are unopened */ 11490Sstevel@tonic-gate %#define TRANS_OPENED 0x0002 /* open at snarf succeeded */ 11500Sstevel@tonic-gate %#define TRANS_DETACHING 0x0004 /* detaching the log */ 11510Sstevel@tonic-gate %#define TRANS_DETACHED 0x0008 /* log successfully detached */ 11520Sstevel@tonic-gate %#define TRANS_DETACH_SKIP 0x0010 /* already processed; skip */ 11530Sstevel@tonic-gate %#define TRANS_ATTACHING 0x0020 /* attaching the log */ 11540Sstevel@tonic-gate %#define TRANS_ROLL_ON_WRITE 0x0040 /* roll on physio write */ 11550Sstevel@tonic-gate %#define TRANS_NEED_SCANROLL 0x0080 /* roll on physio write */ 11560Sstevel@tonic-gate #endif /* RPC_HDR */ 11570Sstevel@tonic-gate 11580Sstevel@tonic-gate typedef u_int mt_l_error_t; 11590Sstevel@tonic-gate #ifdef RPC_HDR 11600Sstevel@tonic-gate % 11610Sstevel@tonic-gate %#define LDL_ERROR 0x0001 /* error state */ 11620Sstevel@tonic-gate %#define LDL_HERROR 0x0002 /* hard error state */ 11630Sstevel@tonic-gate %#define LDL_ANYERROR 0x0003 /* any error state */ 11640Sstevel@tonic-gate %#define LDL_NOERROR 0x0004 /* dont error transition during scan */ 11650Sstevel@tonic-gate %#define LDL_SAVERROR 0x0008 /* transition to error after scan */ 11660Sstevel@tonic-gate #endif /* RPC_HDR */ 11670Sstevel@tonic-gate 11680Sstevel@tonic-gate typedef u_int mt_debug_t; /* values in md_trans.h */ 11690Sstevel@tonic-gate 11700Sstevel@tonic-gate struct md_trans_t { 11710Sstevel@tonic-gate md_common_t common; 11720Sstevel@tonic-gate mdname_t *masternamep; 11730Sstevel@tonic-gate mdname_t *lognamep; 11740Sstevel@tonic-gate mt_flags_t flags; 11750Sstevel@tonic-gate md_timeval32_t timestamp; 11760Sstevel@tonic-gate mt_l_error_t log_error; 11770Sstevel@tonic-gate md_timeval32_t log_timestamp; 11780Sstevel@tonic-gate daddr_t log_size; 11790Sstevel@tonic-gate mt_debug_t debug; 11800Sstevel@tonic-gate }; 11810Sstevel@tonic-gate 11820Sstevel@tonic-gate 11830Sstevel@tonic-gate 11840Sstevel@tonic-gate % 11850Sstevel@tonic-gate %/* 11860Sstevel@tonic-gate % * RAID 11870Sstevel@tonic-gate % */ 11880Sstevel@tonic-gate /* 11890Sstevel@tonic-gate * ioctl stuff 11900Sstevel@tonic-gate */ 11910Sstevel@tonic-gate struct mr_params_t { 11920Sstevel@tonic-gate int change_hsp_id; 11930Sstevel@tonic-gate hsp_t hsp_id; 11940Sstevel@tonic-gate }; 11950Sstevel@tonic-gate 11960Sstevel@tonic-gate /* 11970Sstevel@tonic-gate * unit structure 11980Sstevel@tonic-gate */ 11990Sstevel@tonic-gate enum rcs_state_t { 12000Sstevel@tonic-gate RCS_UNUSED = 0x0, 12010Sstevel@tonic-gate RCS_INIT = 0x1, 12020Sstevel@tonic-gate RCS_OKAY = 0x2, 12030Sstevel@tonic-gate RCS_ERRED = 0x4, 12040Sstevel@tonic-gate RCS_LAST_ERRED = 0x8, 12050Sstevel@tonic-gate RCS_RESYNC = 0x10, 12060Sstevel@tonic-gate RCS_INIT_ERRED = 0x20, 12070Sstevel@tonic-gate RCS_REGEN = 0x40 12080Sstevel@tonic-gate }; 12090Sstevel@tonic-gate 12100Sstevel@tonic-gate typedef u_int rcs_flags_t; 12110Sstevel@tonic-gate #ifdef RPC_HDR 12120Sstevel@tonic-gate % 12130Sstevel@tonic-gate %#define MD_RAID_DEV_ISOPEN 0x00001 12140Sstevel@tonic-gate %#define MD_RAID_ALT_ISOPEN 0x00002 12150Sstevel@tonic-gate %#define MD_RAID_RESYNC 0x00004 12160Sstevel@tonic-gate %#define MD_RAID_RESYNC_ERRED 0x00008 12170Sstevel@tonic-gate %#define MD_RAID_FORCE_REPLACE 0x00010 12180Sstevel@tonic-gate %#define MD_RAID_WRITE_ALT 0x00020 12190Sstevel@tonic-gate %#define MD_RAID_DEV_ERRED 0x00040 12200Sstevel@tonic-gate %#define MD_RAID_COPY_RESYNC 0x00080 12210Sstevel@tonic-gate %#define MD_RAID_REGEN_RESYNC 0x00100 12220Sstevel@tonic-gate %#define MD_RAID_DEV_PROBEOPEN 0x00200 12230Sstevel@tonic-gate %#define MD_RAID_HAS_LABEL 0x40000 12240Sstevel@tonic-gate #endif /* RPC_HDR */ 12250Sstevel@tonic-gate 12260Sstevel@tonic-gate struct md_raidcol_t { 12270Sstevel@tonic-gate mdname_t *colnamep; 12280Sstevel@tonic-gate mdname_t *hsnamep; 12290Sstevel@tonic-gate rcs_state_t state; 12300Sstevel@tonic-gate rcs_flags_t flags; 12310Sstevel@tonic-gate md_timeval32_t timestamp; 12320Sstevel@tonic-gate }; 12330Sstevel@tonic-gate 12340Sstevel@tonic-gate enum rus_state_t { 12350Sstevel@tonic-gate RUS_UNUSED = 0x0, 12360Sstevel@tonic-gate RUS_INIT = 0x1, 12370Sstevel@tonic-gate RUS_OKAY = 0x2, 12380Sstevel@tonic-gate RUS_ERRED = 0x4, 12390Sstevel@tonic-gate RUS_LAST_ERRED = 0x8, 12400Sstevel@tonic-gate RUS_DOI = 0x10, 12410Sstevel@tonic-gate RUS_REGEN = 0x20 12420Sstevel@tonic-gate }; 12430Sstevel@tonic-gate 12440Sstevel@tonic-gate typedef u_int md_riflags_t; 12450Sstevel@tonic-gate #ifdef RPC_HDR 12460Sstevel@tonic-gate % 12470Sstevel@tonic-gate %#define MD_RI_INPROGRESS 0x0001 12480Sstevel@tonic-gate %#define MD_GROW_INPROGRESS 0x0002 12490Sstevel@tonic-gate %#define MD_RI_BLOCK 0x0004 12500Sstevel@tonic-gate %#define MD_RI_UNBLOCK 0x0008 12510Sstevel@tonic-gate %#define MD_RI_KILL 0x0010 12520Sstevel@tonic-gate %#define MD_RI_BLOCK_OWNER 0x0020 12530Sstevel@tonic-gate %#define MD_RI_SHUTDOWN 0x0040 12540Sstevel@tonic-gate %#define MD_RI_NO_WAIT 0x0080 12550Sstevel@tonic-gate %#define MD_RI_RESYNC_FORCE_MNSTART 0x0100 12560Sstevel@tonic-gate #endif /* RPC_HDR */ 12570Sstevel@tonic-gate 12580Sstevel@tonic-gate const MD_RAID_MIN = 3; 12590Sstevel@tonic-gate struct md_raid_t { 12600Sstevel@tonic-gate md_common_t common; 12610Sstevel@tonic-gate rus_state_t state; 12620Sstevel@tonic-gate md_timeval32_t timestamp; 12630Sstevel@tonic-gate diskaddr_t interlace; 12640Sstevel@tonic-gate diskaddr_t column_size; 12650Sstevel@tonic-gate size_t orig_ncol; 12660Sstevel@tonic-gate mdhspname_t *hspnamep; 12670Sstevel@tonic-gate md_riflags_t resync_flags; 12680Sstevel@tonic-gate int percent_dirty; 12690Sstevel@tonic-gate int percent_done; 12700Sstevel@tonic-gate int pw_count; 12710Sstevel@tonic-gate md_raidcol_t cols<>; 12720Sstevel@tonic-gate }; 12730Sstevel@tonic-gate 12740Sstevel@tonic-gate % 12750Sstevel@tonic-gate %/* 12760Sstevel@tonic-gate % * shared 12770Sstevel@tonic-gate % */ 12780Sstevel@tonic-gate /* 12790Sstevel@tonic-gate * unit structure 12800Sstevel@tonic-gate */ 12810Sstevel@tonic-gate struct md_shared_t { 12820Sstevel@tonic-gate md_common_t common; 12830Sstevel@tonic-gate }; 12840Sstevel@tonic-gate 12850Sstevel@tonic-gate % 12860Sstevel@tonic-gate %/* 12870Sstevel@tonic-gate % * hotspare 12880Sstevel@tonic-gate % */ 12890Sstevel@tonic-gate /* 12900Sstevel@tonic-gate * ioctl stuff 12910Sstevel@tonic-gate */ 12920Sstevel@tonic-gate enum hotspare_states_t { 12930Sstevel@tonic-gate HSS_UNUSED, HSS_AVAILABLE, HSS_RESERVED, HSS_BROKEN 12940Sstevel@tonic-gate }; 12950Sstevel@tonic-gate 12960Sstevel@tonic-gate /* 12970Sstevel@tonic-gate * unit structure 12980Sstevel@tonic-gate */ 12990Sstevel@tonic-gate struct md_hs_t { 13000Sstevel@tonic-gate mdname_t *hsnamep; 13010Sstevel@tonic-gate hotspare_states_t state; 13020Sstevel@tonic-gate diskaddr_t size; 13030Sstevel@tonic-gate md_timeval32_t timestamp; 13040Sstevel@tonic-gate u_longlong_t revision; 13050Sstevel@tonic-gate }; 13060Sstevel@tonic-gate 13070Sstevel@tonic-gate struct md_hsp_t { 13080Sstevel@tonic-gate mdhspname_t *hspnamep; 13090Sstevel@tonic-gate u_int refcount; 13100Sstevel@tonic-gate md_hs_t hotspares<>; 13110Sstevel@tonic-gate }; 13120Sstevel@tonic-gate 13130Sstevel@tonic-gate % 13140Sstevel@tonic-gate %/* 13150Sstevel@tonic-gate % * specific error info 13160Sstevel@tonic-gate % */ 13170Sstevel@tonic-gate % 13180Sstevel@tonic-gate %/* 13190Sstevel@tonic-gate % * simple errors 13200Sstevel@tonic-gate % */ 13210Sstevel@tonic-gate enum md_void_errno_t { 13220Sstevel@tonic-gate MDE_NONE = 0, 13230Sstevel@tonic-gate MDE_UNIT_NOT_FOUND, 13240Sstevel@tonic-gate MDE_DUPDRIVE, 13250Sstevel@tonic-gate MDE_INVAL_HSOP, 13260Sstevel@tonic-gate MDE_NO_SET, /* no such set */ 13270Sstevel@tonic-gate MDE_SET_DIFF, /* setname changed on command line */ 13280Sstevel@tonic-gate MDE_BAD_RD_OPT, /* bad mirror read option */ 13290Sstevel@tonic-gate MDE_BAD_WR_OPT, /* bad mirror write option */ 13300Sstevel@tonic-gate MDE_BAD_PASS_NUM, /* bad mirror pass number */ 13310Sstevel@tonic-gate MDE_BAD_INTERLACE, /* bad stripe interlace */ 13320Sstevel@tonic-gate MDE_NO_HSPS, /* couldn't find any hotspare pools */ 13330Sstevel@tonic-gate MDE_NOTENOUGH_DB, /* Too few replicas */ 13340Sstevel@tonic-gate MDE_DELDB_NOTALLOWED, /* last replica in ds cannot be del in metadb */ 13350Sstevel@tonic-gate MDE_DEL_VALIDDB_NOTALLOWED, /* last valid replica cannot be del */ 13360Sstevel@tonic-gate MDE_SYSTEM_FILE, /* /etc/system file error */ 13370Sstevel@tonic-gate MDE_MDDB_FILE, /* /etc/lvm/mddb.cf file error */ 13380Sstevel@tonic-gate MDE_MDDB_CKSUM, /* /etc/lvm/mddb.cf checksum error */ 13390Sstevel@tonic-gate MDE_VFSTAB_FILE, /* /etc/vfstab file error */ 13400Sstevel@tonic-gate MDE_NOSLICE, /* metaslicename() with sliceno to big */ 13410Sstevel@tonic-gate MDE_SYNTAX, /* metainit syntax error */ 13420Sstevel@tonic-gate MDE_OPTION, /* metainit options error */ 13430Sstevel@tonic-gate MDE_TAKE_OWN, /* take ownership failed */ 13440Sstevel@tonic-gate MDE_NOT_DRIVENAME, /* not in drivename syntax */ 13450Sstevel@tonic-gate MDE_RESERVED, /* device is reserved by another host */ 13460Sstevel@tonic-gate MDE_DVERSION, /* driver version out of sync */ 13470Sstevel@tonic-gate MDE_MVERSION, /* MDDB version out of sync */ 13480Sstevel@tonic-gate MDE_TESTERROR, /* Test Error Message */ 13490Sstevel@tonic-gate MDE_BAD_ORIG_NCOL, /* bad RAID original column count */ 13500Sstevel@tonic-gate MDE_RAID_INVALID, /* attempt to use -k on invalid device */ 13510Sstevel@tonic-gate MDE_MED_ERROR, /* mediator error */ 13520Sstevel@tonic-gate MDE_TOOMANYMED, /* Too many mediators specified */ 13530Sstevel@tonic-gate MDE_NOMED, /* No mediators */ 13540Sstevel@tonic-gate MDE_ONLYNODENAME, /* Only the nodename is needed */ 13550Sstevel@tonic-gate MDE_RAID_BAD_PW_CNT, /* bad prewrite count specified */ 13560Sstevel@tonic-gate MDE_DEVID_TOOBIG, /* Devid size is greater than allowed */ 13570Sstevel@tonic-gate MDE_NOPERM, /* No permission - not root */ 13580Sstevel@tonic-gate MDE_NODEVID, /* No device id for given devt */ 13590Sstevel@tonic-gate MDE_NOROOT, /* No root in /etc/mnttab */ 13600Sstevel@tonic-gate MDE_EOF_TRANS, /* trans logging eof'd */ 13610Sstevel@tonic-gate MDE_BAD_RESYNC_OPT, /* bad mirror resync option */ 13620Sstevel@tonic-gate MDE_NOT_MN, /* option only valid within a multi-node set */ 13630Sstevel@tonic-gate MDE_ABR_SET, /* invalid operation for ABR mirror */ 13640Sstevel@tonic-gate MDE_INVAL_MNOP, /* Invalid operation on MN diskset */ 13650Sstevel@tonic-gate MDE_MNSET_NOTRANS, /* Trans metadevice not supported in MN set */ 13660Sstevel@tonic-gate MDE_MNSET_NORAID, /* RAID metadevice not supported in MN set */ 13670Sstevel@tonic-gate MDE_FORCE_DEL_ALL_DRV, /* Must use -f flag to delete all drives */ 13680Sstevel@tonic-gate MDE_STRIPE_TRUNC_SINGLE, /* single component stripe truncation */ 13690Sstevel@tonic-gate MDE_STRIPE_TRUNC_MULTIPLE, /* multiple component stripe trun */ 13700Sstevel@tonic-gate MDE_SMF_FAIL, /* service management facility error */ 13710Sstevel@tonic-gate MDE_SMF_NO_SERVICE /* service not enabled in SMF */ 13720Sstevel@tonic-gate }; 13730Sstevel@tonic-gate 13740Sstevel@tonic-gate struct md_void_error_t { 13750Sstevel@tonic-gate md_void_errno_t errnum; 13760Sstevel@tonic-gate }; 13770Sstevel@tonic-gate 13780Sstevel@tonic-gate % 13790Sstevel@tonic-gate %/* 13800Sstevel@tonic-gate % * system errors 13810Sstevel@tonic-gate % */ 13820Sstevel@tonic-gate struct md_sys_error_t { 13830Sstevel@tonic-gate int errnum; 13840Sstevel@tonic-gate }; 13850Sstevel@tonic-gate 13860Sstevel@tonic-gate % 13870Sstevel@tonic-gate %/* 13880Sstevel@tonic-gate % * RPC errors 13890Sstevel@tonic-gate % */ 13900Sstevel@tonic-gate struct md_rpc_error_t { 13910Sstevel@tonic-gate enum clnt_stat errnum; 13920Sstevel@tonic-gate }; 13930Sstevel@tonic-gate 13940Sstevel@tonic-gate % 13950Sstevel@tonic-gate %/* 13960Sstevel@tonic-gate % * device errors 13970Sstevel@tonic-gate % */ 13980Sstevel@tonic-gate enum md_dev_errno_t { 13990Sstevel@tonic-gate MDE_INVAL_HS = 1, 14000Sstevel@tonic-gate MDE_FIX_INVAL_STATE, 14010Sstevel@tonic-gate MDE_FIX_INVAL_HS_STATE, 14020Sstevel@tonic-gate MDE_NOT_META, 14030Sstevel@tonic-gate MDE_IS_META, 14040Sstevel@tonic-gate MDE_IS_SWAPPED, 14050Sstevel@tonic-gate MDE_NAME_SPACE, 14060Sstevel@tonic-gate MDE_IN_SHARED_SET, 14070Sstevel@tonic-gate MDE_NOT_IN_SET, 14080Sstevel@tonic-gate MDE_NOT_DISK, 14090Sstevel@tonic-gate MDE_CANT_CONFIRM, 14100Sstevel@tonic-gate MDE_INVALID_PART, 14110Sstevel@tonic-gate MDE_HAS_MDDB, 14120Sstevel@tonic-gate MDE_NO_DB, /* Replica not on device given */ 14130Sstevel@tonic-gate MDE_CANTVERIFY_VTOC, 14140Sstevel@tonic-gate MDE_NOT_LOCAL, 14150Sstevel@tonic-gate MDE_DEVICES_NAME, 14160Sstevel@tonic-gate MDE_REPCOMP_INVAL, /* replica slice not allowed in "set" metadevs */ 14170Sstevel@tonic-gate MDE_REPCOMP_ONLY, /* only replica slice diskset replicas */ 14180Sstevel@tonic-gate MDE_INV_ROOT, /* Invalid root device for this operation */ 14190Sstevel@tonic-gate MDE_MULTNM, /* Multiple entries for device in namespace */ 14200Sstevel@tonic-gate MDE_TOO_MANY_PARTS, /* dev has more than MD_MAX_PARTS partitions */ 14210Sstevel@tonic-gate MDE_REPART_REPLICA, /* replica slice would move with repartitioning */ 14220Sstevel@tonic-gate MDE_IS_DUMP /* device already in use as dump device */ 14230Sstevel@tonic-gate }; 14240Sstevel@tonic-gate 14250Sstevel@tonic-gate struct md_dev_error_t { 14260Sstevel@tonic-gate md_dev_errno_t errnum; 14270Sstevel@tonic-gate md_dev64_t dev; /* 64 bit fixed size */ 14280Sstevel@tonic-gate }; 14290Sstevel@tonic-gate 14300Sstevel@tonic-gate % 14310Sstevel@tonic-gate %/* 14320Sstevel@tonic-gate % * overlap errors 14330Sstevel@tonic-gate % */ 14340Sstevel@tonic-gate enum md_overlap_errno_t { 14350Sstevel@tonic-gate MDE_OVERLAP_MOUNTED = 1, 14360Sstevel@tonic-gate MDE_OVERLAP_SWAP, 14370Sstevel@tonic-gate MDE_OVERLAP_DUMP 14380Sstevel@tonic-gate }; 14390Sstevel@tonic-gate 14400Sstevel@tonic-gate % 14410Sstevel@tonic-gate 14420Sstevel@tonic-gate #if !defined(_KERNEL) 14430Sstevel@tonic-gate struct md_overlap_error_t { 14440Sstevel@tonic-gate md_overlap_errno_t errnum; 14450Sstevel@tonic-gate string where<>; 14460Sstevel@tonic-gate string overlap<>; 14470Sstevel@tonic-gate }; 14480Sstevel@tonic-gate #else 14490Sstevel@tonic-gate struct md_overlap_error_t { 14500Sstevel@tonic-gate md_overlap_errno_t errnum; 14510Sstevel@tonic-gate u_int xwhere; 14520Sstevel@tonic-gate u_int xoverlap; 14530Sstevel@tonic-gate }; 14540Sstevel@tonic-gate #endif /* !_KERNEL */ 14550Sstevel@tonic-gate 14560Sstevel@tonic-gate % 14570Sstevel@tonic-gate %/* 14580Sstevel@tonic-gate % * use errors 14590Sstevel@tonic-gate % */ 14600Sstevel@tonic-gate enum md_use_errno_t { 14610Sstevel@tonic-gate MDE_IS_MOUNTED = 1, 14620Sstevel@tonic-gate MDE_ALREADY, 1463*127Shshaw MDE_OVERLAP, 1464*127Shshaw MDE_SAME_DEVID 14650Sstevel@tonic-gate }; 14660Sstevel@tonic-gate 14670Sstevel@tonic-gate % 14680Sstevel@tonic-gate #if !defined(_KERNEL) 14690Sstevel@tonic-gate struct md_use_error_t { 14700Sstevel@tonic-gate md_use_errno_t errnum; 14710Sstevel@tonic-gate md_dev64_t dev; 14720Sstevel@tonic-gate string where<>; 14730Sstevel@tonic-gate }; 14740Sstevel@tonic-gate #else 14750Sstevel@tonic-gate struct md_use_error_t { 14760Sstevel@tonic-gate md_use_errno_t errnum; 14770Sstevel@tonic-gate md_dev64_t dev; 14780Sstevel@tonic-gate u_int xwhere; 14790Sstevel@tonic-gate }; 14800Sstevel@tonic-gate #endif 14810Sstevel@tonic-gate 14820Sstevel@tonic-gate % 14830Sstevel@tonic-gate %/* 14840Sstevel@tonic-gate % * metadevice errors 14850Sstevel@tonic-gate % */ 14860Sstevel@tonic-gate enum md_md_errno_t { 14870Sstevel@tonic-gate MDE_INVAL_UNIT = 1, 14880Sstevel@tonic-gate MDE_UNIT_NOT_SETUP, 14890Sstevel@tonic-gate MDE_UNIT_ALREADY_SETUP, 14900Sstevel@tonic-gate MDE_NOT_MM, 14910Sstevel@tonic-gate MDE_NOT_ENOUGH_DBS, 14920Sstevel@tonic-gate MDE_IS_SM, 14930Sstevel@tonic-gate MDE_IS_OPEN, 14940Sstevel@tonic-gate MDE_C_WITH_INVAL_SM, 14950Sstevel@tonic-gate MDE_RESYNC_ACTIVE, 14960Sstevel@tonic-gate MDE_LAST_SM_RE, 14970Sstevel@tonic-gate MDE_MIRROR_FULL, 14980Sstevel@tonic-gate MDE_IN_USE, 14990Sstevel@tonic-gate MDE_SM_TOO_SMALL, 15000Sstevel@tonic-gate MDE_NO_LABELED_SM, 15010Sstevel@tonic-gate MDE_SM_OPEN_ERR, 15020Sstevel@tonic-gate MDE_CANT_FIND_SM, 15030Sstevel@tonic-gate MDE_LAST_SM, 15040Sstevel@tonic-gate MDE_NO_READABLE_SM, 15050Sstevel@tonic-gate MDE_SM_FAILED_COMPS, 15060Sstevel@tonic-gate MDE_ILLEGAL_SM_STATE, 15070Sstevel@tonic-gate MDE_RR_ALLOC_ERROR, 15080Sstevel@tonic-gate MDE_MIRROR_OPEN_FAILURE, 15090Sstevel@tonic-gate MDE_MIRROR_THREAD_FAILURE, 15100Sstevel@tonic-gate MDE_GROW_DELAYED, 15110Sstevel@tonic-gate MDE_NOT_MT, 15120Sstevel@tonic-gate MDE_HS_IN_USE, 15130Sstevel@tonic-gate MDE_HAS_LOG, 15140Sstevel@tonic-gate MDE_UNKNOWN_TYPE, 15150Sstevel@tonic-gate MDE_NOT_STRIPE, 15160Sstevel@tonic-gate MDE_NOT_RAID, 15170Sstevel@tonic-gate MDE_NROWS, 15180Sstevel@tonic-gate MDE_NCOMPS, 15190Sstevel@tonic-gate MDE_NSUBMIRS, 15200Sstevel@tonic-gate MDE_BAD_STRIPE, 15210Sstevel@tonic-gate MDE_BAD_MIRROR, 15220Sstevel@tonic-gate MDE_BAD_TRANS, 15230Sstevel@tonic-gate MDE_BAD_RAID, 15240Sstevel@tonic-gate MDE_RAID_OPEN_FAILURE, 15250Sstevel@tonic-gate MDE_RAID_THREAD_FAILURE, 15260Sstevel@tonic-gate MDE_RAID_NEED_FORCE, 15270Sstevel@tonic-gate MDE_NO_LOG, 15280Sstevel@tonic-gate MDE_RAID_DOI, 15290Sstevel@tonic-gate MDE_RAID_LAST_ERRED, 15300Sstevel@tonic-gate MDE_RAID_NOT_OKAY, 15310Sstevel@tonic-gate MDE_RENAME_BUSY, 15320Sstevel@tonic-gate MDE_RENAME_SOURCE_BAD, 15330Sstevel@tonic-gate MDE_RENAME_TARGET_BAD, 15340Sstevel@tonic-gate MDE_RENAME_TARGET_UNRELATED, 15350Sstevel@tonic-gate MDE_RENAME_CONFIG_ERROR, 15360Sstevel@tonic-gate MDE_RENAME_ORDER, 15370Sstevel@tonic-gate MDE_RECOVER_FAILED, 15380Sstevel@tonic-gate MDE_NOT_SP, 15390Sstevel@tonic-gate MDE_SP_NOSPACE, 15400Sstevel@tonic-gate MDE_SP_BADWMREAD, 15410Sstevel@tonic-gate MDE_SP_BADWMWRITE, 15420Sstevel@tonic-gate MDE_SP_BADWMMAGIC, 15430Sstevel@tonic-gate MDE_SP_BADWMCRC, 15440Sstevel@tonic-gate MDE_SP_OVERLAP, 15450Sstevel@tonic-gate MDE_SP_BAD_LENGTH, 15460Sstevel@tonic-gate MDE_UNIT_TOO_LARGE, 15470Sstevel@tonic-gate MDE_LOG_TOO_LARGE, 15480Sstevel@tonic-gate MDE_SP_NOSP, 15490Sstevel@tonic-gate MDE_IN_UNAVAIL_STATE 15500Sstevel@tonic-gate }; 15510Sstevel@tonic-gate 15520Sstevel@tonic-gate struct md_md_error_t { 15530Sstevel@tonic-gate md_md_errno_t errnum; 15540Sstevel@tonic-gate minor_t mnum; 15550Sstevel@tonic-gate }; 15560Sstevel@tonic-gate 15570Sstevel@tonic-gate % 15580Sstevel@tonic-gate %/* 15590Sstevel@tonic-gate % * component errors 15600Sstevel@tonic-gate % */ 15610Sstevel@tonic-gate enum md_comp_errno_t { 15620Sstevel@tonic-gate MDE_CANT_FIND_COMP = 1, 15630Sstevel@tonic-gate MDE_REPL_INVAL_STATE, 15640Sstevel@tonic-gate MDE_COMP_TOO_SMALL, 15650Sstevel@tonic-gate MDE_COMP_OPEN_ERR, 15660Sstevel@tonic-gate MDE_RAID_COMP_ERRED, 15670Sstevel@tonic-gate MDE_MAXIO, 15680Sstevel@tonic-gate MDE_SP_COMP_OPEN_ERR 15690Sstevel@tonic-gate }; 15700Sstevel@tonic-gate 15710Sstevel@tonic-gate struct md_comp_error_t { 15720Sstevel@tonic-gate md_comp_errno_t errnum; 15730Sstevel@tonic-gate comp_t comp; 15740Sstevel@tonic-gate }; 15750Sstevel@tonic-gate 15760Sstevel@tonic-gate % 15770Sstevel@tonic-gate %/* 15780Sstevel@tonic-gate % * hotspare pool errors 15790Sstevel@tonic-gate % */ 15800Sstevel@tonic-gate enum md_hsp_errno_t { 15810Sstevel@tonic-gate MDE_HSP_CREATE_FAILURE = 1, 15820Sstevel@tonic-gate MDE_HSP_IN_USE, 15830Sstevel@tonic-gate MDE_INVAL_HSP, 15840Sstevel@tonic-gate MDE_HSP_BUSY, 15850Sstevel@tonic-gate MDE_HSP_REF, 15860Sstevel@tonic-gate MDE_HSP_ALREADY_SETUP, 15870Sstevel@tonic-gate MDE_BAD_HSP, 15880Sstevel@tonic-gate MDE_HSP_UNIT_TOO_LARGE 15890Sstevel@tonic-gate }; 15900Sstevel@tonic-gate 15910Sstevel@tonic-gate struct md_hsp_error_t { 15920Sstevel@tonic-gate md_hsp_errno_t errnum; 15930Sstevel@tonic-gate hsp_t hsp; 15940Sstevel@tonic-gate }; 15950Sstevel@tonic-gate 15960Sstevel@tonic-gate % 15970Sstevel@tonic-gate %/* 15980Sstevel@tonic-gate % * hotspare errors 15990Sstevel@tonic-gate % */ 16000Sstevel@tonic-gate enum md_hs_errno_t { 16010Sstevel@tonic-gate MDE_HS_RESVD = 1, 16020Sstevel@tonic-gate MDE_HS_CREATE_FAILURE, 16030Sstevel@tonic-gate MDE_HS_INUSE, 16040Sstevel@tonic-gate MDE_HS_UNIT_TOO_LARGE 16050Sstevel@tonic-gate }; 16060Sstevel@tonic-gate 16070Sstevel@tonic-gate struct md_hs_error_t { 16080Sstevel@tonic-gate md_hs_errno_t errnum; 16090Sstevel@tonic-gate hs_t hs; 16100Sstevel@tonic-gate }; 16110Sstevel@tonic-gate 16120Sstevel@tonic-gate % 16130Sstevel@tonic-gate %/* 16140Sstevel@tonic-gate % * MDDB errors 16150Sstevel@tonic-gate % */ 16160Sstevel@tonic-gate enum md_mddb_errno_t { 16170Sstevel@tonic-gate MDE_TOOMANY_REPLICAS = 1, 16180Sstevel@tonic-gate MDE_REPLICA_TOOSMALL, 16190Sstevel@tonic-gate MDE_NOTVERIFIED, 16200Sstevel@tonic-gate MDE_DB_INVALID, 16210Sstevel@tonic-gate MDE_DB_EXISTS, 16220Sstevel@tonic-gate MDE_DB_MASTER, 16230Sstevel@tonic-gate MDE_DB_TOOSMALL, 16240Sstevel@tonic-gate MDE_DB_NORECORD, 16250Sstevel@tonic-gate MDE_DB_NOSPACE, 16260Sstevel@tonic-gate MDE_DB_NOTNOW, 16270Sstevel@tonic-gate MDE_DB_NODB, 16280Sstevel@tonic-gate MDE_DB_NOTOWNER, 16290Sstevel@tonic-gate MDE_DB_STALE, 16300Sstevel@tonic-gate MDE_DB_TOOFEW, 16310Sstevel@tonic-gate MDE_DB_TAGDATA, 16320Sstevel@tonic-gate MDE_DB_ACCOK, 16330Sstevel@tonic-gate MDE_DB_NTAGDATA, 16340Sstevel@tonic-gate MDE_DB_ACCNOTOK, 16350Sstevel@tonic-gate MDE_DB_NOLOCBLK, 16360Sstevel@tonic-gate MDE_DB_NOLOCNMS, 16370Sstevel@tonic-gate MDE_DB_NODIRBLK, 16380Sstevel@tonic-gate MDE_DB_NOTAGREC, 16390Sstevel@tonic-gate MDE_DB_NOTAG, 16400Sstevel@tonic-gate MDE_DB_BLKRANGE 16410Sstevel@tonic-gate }; 16420Sstevel@tonic-gate 16430Sstevel@tonic-gate % 16440Sstevel@tonic-gate struct md_mddb_error_t { 16450Sstevel@tonic-gate md_mddb_errno_t errnum; 16460Sstevel@tonic-gate minor_t mnum; /* associated metadevice */ 16470Sstevel@tonic-gate set_t setno; 16480Sstevel@tonic-gate u_int size; 16490Sstevel@tonic-gate }; 16500Sstevel@tonic-gate 16510Sstevel@tonic-gate % 16520Sstevel@tonic-gate %/* 16530Sstevel@tonic-gate % * diskset (ds) errors 16540Sstevel@tonic-gate % */ 16550Sstevel@tonic-gate enum md_ds_errno_t { 16560Sstevel@tonic-gate MDE_DS_DUPHOST = 1, 16570Sstevel@tonic-gate MDE_DS_NOTNODENAME, 16580Sstevel@tonic-gate MDE_DS_SELFNOTIN, 16590Sstevel@tonic-gate MDE_DS_NODEHASSET, 16600Sstevel@tonic-gate MDE_DS_NODENOSET, 16610Sstevel@tonic-gate MDE_DS_NOOWNER, 16620Sstevel@tonic-gate MDE_DS_NOTOWNER, 16630Sstevel@tonic-gate MDE_DS_NODEISNOTOWNER, 16640Sstevel@tonic-gate MDE_DS_NODEINSET, 16650Sstevel@tonic-gate MDE_DS_NODENOTINSET, 16660Sstevel@tonic-gate MDE_DS_SETNUMBUSY, 16670Sstevel@tonic-gate MDE_DS_SETNUMNOTAVAIL, 16680Sstevel@tonic-gate MDE_DS_SETNAMEBUSY, 16690Sstevel@tonic-gate MDE_DS_DRIVENOTCOMMON, 16700Sstevel@tonic-gate MDE_DS_DRIVEINSET, 16710Sstevel@tonic-gate MDE_DS_DRIVENOTINSET, 16720Sstevel@tonic-gate MDE_DS_DRIVEINUSE, 16730Sstevel@tonic-gate MDE_DS_DUPDRIVE, 16740Sstevel@tonic-gate MDE_DS_INVALIDSETNAME, 16750Sstevel@tonic-gate MDE_DS_HASDRIVES, 16760Sstevel@tonic-gate MDE_DS_SIDENUMNOTAVAIL, 16770Sstevel@tonic-gate MDE_DS_SETNAMETOOLONG, 16780Sstevel@tonic-gate MDE_DS_NODENAMETOOLONG, 16790Sstevel@tonic-gate MDE_DS_OHACANTDELSELF, 16800Sstevel@tonic-gate MDE_DS_HOSTNOSIDE, 16810Sstevel@tonic-gate MDE_DS_SETLOCKED, 16820Sstevel@tonic-gate MDE_DS_ULKSBADKEY, 16830Sstevel@tonic-gate MDE_DS_LKSBADKEY, 16840Sstevel@tonic-gate MDE_DS_WRITEWITHSULK, 16850Sstevel@tonic-gate MDE_DS_SETCLEANUP, 16860Sstevel@tonic-gate MDE_DS_CANTDELSELF, 16870Sstevel@tonic-gate MDE_DS_HASMED, 16880Sstevel@tonic-gate MDE_DS_TOOMANYALIAS, 16890Sstevel@tonic-gate MDE_DS_ISMED, 16900Sstevel@tonic-gate MDE_DS_ISNOTMED, 16910Sstevel@tonic-gate MDE_DS_INVALIDMEDNAME, 16920Sstevel@tonic-gate MDE_DS_ALIASNOMATCH, 16930Sstevel@tonic-gate MDE_DS_NOMEDONHOST, 16940Sstevel@tonic-gate MDE_DS_CANTDELMASTER, 16950Sstevel@tonic-gate MDE_DS_NOTINMEMBERLIST, 16960Sstevel@tonic-gate MDE_DS_MNCANTDELSELF, 16970Sstevel@tonic-gate MDE_DS_RPCVERSMISMATCH, 16980Sstevel@tonic-gate MDE_DS_WITHDRAWMASTER, 16990Sstevel@tonic-gate MDE_DS_COMMDCTL_SUSPEND_NYD, 17000Sstevel@tonic-gate MDE_DS_COMMDCTL_SUSPEND_FAIL, 17010Sstevel@tonic-gate MDE_DS_COMMDCTL_REINIT_FAIL, 17020Sstevel@tonic-gate MDE_DS_COMMDCTL_RESUME_FAIL, 17030Sstevel@tonic-gate MDE_DS_NOTNOW_RECONFIG, 17040Sstevel@tonic-gate MDE_DS_NOTNOW_CMD, 17050Sstevel@tonic-gate MDE_DS_COMMD_SEND_FAIL, 17060Sstevel@tonic-gate MDE_DS_MASTER_ONLY, 17070Sstevel@tonic-gate MDE_DS_DRIVENOTONHOST, 17080Sstevel@tonic-gate MDE_DS_CANTRESNARF, 17090Sstevel@tonic-gate MDE_DS_INSUFQUORUM, 17100Sstevel@tonic-gate MDE_DS_EXTENDEDNM, 17110Sstevel@tonic-gate MDE_DS_PARTIALSET, 17120Sstevel@tonic-gate MDE_DS_SINGLEHOST, 17130Sstevel@tonic-gate MDE_DS_AUTONOTSET, 17140Sstevel@tonic-gate MDE_DS_INVALIDDEVID, 17150Sstevel@tonic-gate MDE_DS_SETNOTIMP, 17160Sstevel@tonic-gate MDE_DS_NOTSELFIDENTIFY 17170Sstevel@tonic-gate }; 17180Sstevel@tonic-gate 17190Sstevel@tonic-gate % 17200Sstevel@tonic-gate #if !defined(_KERNEL) 17210Sstevel@tonic-gate struct md_ds_error_t { 17220Sstevel@tonic-gate md_ds_errno_t errnum; 17230Sstevel@tonic-gate set_t setno; 17240Sstevel@tonic-gate string node<>; 17250Sstevel@tonic-gate string drive<>; 17260Sstevel@tonic-gate }; 17270Sstevel@tonic-gate #else /* _KERNEL */ 17280Sstevel@tonic-gate struct md_ds_error_t { 17290Sstevel@tonic-gate md_ds_errno_t errnum; 17300Sstevel@tonic-gate set_t setno; 17310Sstevel@tonic-gate u_int xnode; 17320Sstevel@tonic-gate u_int xdrive; 17330Sstevel@tonic-gate }; 17340Sstevel@tonic-gate #endif /* !_KERNEL */ 17350Sstevel@tonic-gate 17360Sstevel@tonic-gate % 17370Sstevel@tonic-gate %/* 17380Sstevel@tonic-gate % * fundamental error type 17390Sstevel@tonic-gate % */ 17400Sstevel@tonic-gate enum md_errclass_t { 17410Sstevel@tonic-gate MDEC_VOID = 0, /* simple error */ 17420Sstevel@tonic-gate MDEC_SYS, /* system errno */ 17430Sstevel@tonic-gate MDEC_RPC, /* RPC errno */ 17440Sstevel@tonic-gate MDEC_DEV, /* device error */ 17450Sstevel@tonic-gate MDEC_USE, /* use error */ 17460Sstevel@tonic-gate MDEC_MD, /* metadevice error */ 17470Sstevel@tonic-gate MDEC_COMP, /* component error */ 17480Sstevel@tonic-gate MDEC_HSP, /* hotspare pool error */ 17490Sstevel@tonic-gate MDEC_HS, /* hotspare error */ 17500Sstevel@tonic-gate MDEC_MDDB, /* metadevice database error */ 17510Sstevel@tonic-gate MDEC_DS, /* diskset error */ 17520Sstevel@tonic-gate MDEC_OVERLAP /* overlap error */ 17530Sstevel@tonic-gate }; 17540Sstevel@tonic-gate 17550Sstevel@tonic-gate % 17560Sstevel@tonic-gate %/* 17570Sstevel@tonic-gate % * error info 17580Sstevel@tonic-gate % */ 17590Sstevel@tonic-gate union md_error_info_t 17600Sstevel@tonic-gate switch (md_errclass_t errclass) { 17610Sstevel@tonic-gate case MDEC_VOID: 17620Sstevel@tonic-gate md_void_error_t void_error; 17630Sstevel@tonic-gate case MDEC_SYS: 17640Sstevel@tonic-gate md_sys_error_t sys_error; 17650Sstevel@tonic-gate case MDEC_RPC: 17660Sstevel@tonic-gate md_rpc_error_t rpc_error; 17670Sstevel@tonic-gate case MDEC_DEV: 17680Sstevel@tonic-gate md_dev_error_t dev_error; 17690Sstevel@tonic-gate case MDEC_USE: 17700Sstevel@tonic-gate md_use_error_t use_error; 17710Sstevel@tonic-gate case MDEC_MD: 17720Sstevel@tonic-gate md_md_error_t md_error; 17730Sstevel@tonic-gate case MDEC_COMP: 17740Sstevel@tonic-gate md_comp_error_t comp_error; 17750Sstevel@tonic-gate case MDEC_HSP: 17760Sstevel@tonic-gate md_hsp_error_t hsp_error; 17770Sstevel@tonic-gate case MDEC_HS: 17780Sstevel@tonic-gate md_hs_error_t hs_error; 17790Sstevel@tonic-gate case MDEC_MDDB: 17800Sstevel@tonic-gate md_mddb_error_t mddb_error; 17810Sstevel@tonic-gate case MDEC_DS: 17820Sstevel@tonic-gate md_ds_error_t ds_error; 17830Sstevel@tonic-gate case MDEC_OVERLAP: 17840Sstevel@tonic-gate md_overlap_error_t overlap_error; 17850Sstevel@tonic-gate }; 17860Sstevel@tonic-gate 17870Sstevel@tonic-gate % 17880Sstevel@tonic-gate #if !defined(_KERNEL) 17890Sstevel@tonic-gate struct md_error_t { 17900Sstevel@tonic-gate md_error_info_t info; /* specific info */ 17910Sstevel@tonic-gate string host<>; /* hostname */ 17920Sstevel@tonic-gate string extra<>; /* extra context info */ 17930Sstevel@tonic-gate string name<>; /* file or device name */ 17940Sstevel@tonic-gate }; 17950Sstevel@tonic-gate #else /* _KERNEL */ 17960Sstevel@tonic-gate struct md_error_t { 17970Sstevel@tonic-gate md_error_info_t info; /* specific info */ 17980Sstevel@tonic-gate u_int xhost; /* hostname */ 17990Sstevel@tonic-gate u_int xextra; /* extra context info */ 18000Sstevel@tonic-gate u_int xname; /* file or device name */ 18010Sstevel@tonic-gate }; 18020Sstevel@tonic-gate #endif /* !_KERNEL */ 18030Sstevel@tonic-gate %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 18040Sstevel@tonic-gate %#pragma pack() 18050Sstevel@tonic-gate %#endif 18060Sstevel@tonic-gate 18070Sstevel@tonic-gate #ifdef RPC_HDR 18080Sstevel@tonic-gate % 18090Sstevel@tonic-gate %/* 18100Sstevel@tonic-gate % * Null error constant 18110Sstevel@tonic-gate % */ 18120Sstevel@tonic-gate %#define MDNULLERROR {{MDEC_VOID}, NULL, NULL, NULL} 18130Sstevel@tonic-gate #endif /* RPC_HDR */ 18140Sstevel@tonic-gate 18150Sstevel@tonic-gate #ifdef RPC_XDR 18160Sstevel@tonic-gate %/* 18170Sstevel@tonic-gate % * Constant null error struct. 18180Sstevel@tonic-gate % */ 18190Sstevel@tonic-gate %const md_error_t mdnullerror = MDNULLERROR; 18200Sstevel@tonic-gate #endif /* RPC_XDR */ 18210Sstevel@tonic-gate 18220Sstevel@tonic-gate #ifdef RPC_HDR 18230Sstevel@tonic-gate % 18240Sstevel@tonic-gate %/* 18250Sstevel@tonic-gate % * External reference to constant null error struct. (declared in mdiox_xdr.c) 18260Sstevel@tonic-gate % */ 18270Sstevel@tonic-gate %extern const md_error_t mdnullerror; 18280Sstevel@tonic-gate % 18290Sstevel@tonic-gate %/* 18300Sstevel@tonic-gate % * External declarations 18310Sstevel@tonic-gate % */ 18320Sstevel@tonic-gate %extern void mdclrerror(md_error_t *ep); /* clear error */ 18330Sstevel@tonic-gate %extern int mdstealerror(md_error_t *to, md_error_t *from); 18340Sstevel@tonic-gate % 18350Sstevel@tonic-gate %#define mdiserror(ep, num) (((ep)->info.errclass == MDEC_VOID) &&\ 18360Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.void_error.errnum == (num))) 18370Sstevel@tonic-gate %#define mdisok(ep) mdiserror(ep, MDE_NONE) 18380Sstevel@tonic-gate % 18390Sstevel@tonic-gate %#define mdissyserror(ep, num) (((ep)->info.errclass == MDEC_SYS) && \ 18400Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.sys_error.errnum == (num))) 18410Sstevel@tonic-gate %#define mdisrpcerror(ep, num) (((ep)->info.errclass == MDEC_RPC) && \ 18420Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.rpc_error.errnum == (num))) 18430Sstevel@tonic-gate %#define mdisdeverror(ep, num) (((ep)->info.errclass == MDEC_DEV) && \ 18440Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.dev_error.errnum == (num))) 18450Sstevel@tonic-gate %#define mdisuseerror(ep, num) (((ep)->info.errclass == MDEC_USE) && \ 18460Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.use_error.errnum == (num))) 18470Sstevel@tonic-gate %#define mdismderror(ep, num) (((ep)->info.errclass == MDEC_MD) && \ 18480Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.md_error.errnum == (num))) 18490Sstevel@tonic-gate %#define mdiscomperror(ep, num) (((ep)->info.errclass == MDEC_COMP) &&\ 18500Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.comp_error.errnum == (num))) 18510Sstevel@tonic-gate %#define mdishsperror(ep, num) (((ep)->info.errclass == MDEC_HSP) && \ 18520Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.hsp_error.errnum == (num))) 18530Sstevel@tonic-gate %#define mdishserror(ep, num) (((ep)->info.errclass == MDEC_HS) && \ 18540Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.hs_error.errnum == (num))) 18550Sstevel@tonic-gate %#define mdismddberror(ep, num) (((ep)->info.errclass == MDEC_MDDB) &&\ 18560Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.mddb_error.errnum == (num))) 18570Sstevel@tonic-gate %#define mdisdserror(ep, num) (((ep)->info.errclass == MDEC_DS) && \ 18580Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.ds_error.errnum == (num))) 18590Sstevel@tonic-gate %#define mdisoverlaperror(ep, num) \ 18600Sstevel@tonic-gate % (((ep)->info.errclass == MDEC_OVERLAP) && \ 18610Sstevel@tonic-gate % ((ep)->info.md_error_info_t_u.ds_error.errnum == (num))) 18620Sstevel@tonic-gate % 18630Sstevel@tonic-gate %#define mdanysyserror(ep) ((ep)->info.errclass == MDEC_SYS) 18640Sstevel@tonic-gate %#define mdanyrpcerror(ep) ((ep)->info.errclass == MDEC_RPC) 18650Sstevel@tonic-gate %#define mdanydeverror(ep) ((ep)->info.errclass == MDEC_DEV) 18660Sstevel@tonic-gate %#define mdanyuseerror(ep) ((ep)->info.errclass == MDEC_USE) 18670Sstevel@tonic-gate %#define mdanymderror(ep) ((ep)->info.errclass == MDEC_MD) 18680Sstevel@tonic-gate %#define mdanycomperror(ep) ((ep)->info.errclass == MDEC_COMP) 18690Sstevel@tonic-gate %#define mdanyhsperror(ep) ((ep)->info.errclass == MDEC_HSP) 18700Sstevel@tonic-gate %#define mdanyhserror(ep) ((ep)->info.errclass == MDEC_HS) 18710Sstevel@tonic-gate %#define mdanymddberror(ep) ((ep)->info.errclass == MDEC_MDDB) 18720Sstevel@tonic-gate %#define mdanydserror(ep) ((ep)->info.errclass == MDEC_DS) 18730Sstevel@tonic-gate %#define mdanyoverlaperror(ep) ((ep)->info.errclass == MDEC_OVERLAP) 18740Sstevel@tonic-gate % 18750Sstevel@tonic-gate #ifdef _KERNEL 18760Sstevel@tonic-gate % 18770Sstevel@tonic-gate %extern int mderror(md_error_t *ep, md_void_errno_t errnum); 18780Sstevel@tonic-gate %extern int mdsyserror(md_error_t *ep, int errnum); 18790Sstevel@tonic-gate %extern int mddeverror(md_error_t *ep, md_dev_errno_t errnum, 18800Sstevel@tonic-gate % md_dev64_t dev); 18810Sstevel@tonic-gate %extern int mdmderror(md_error_t *ep, md_md_errno_t errnum, minor_t mnum); 18820Sstevel@tonic-gate %extern int mdcomperror(md_error_t *ep, md_comp_errno_t errnum, 18830Sstevel@tonic-gate % minor_t mnum, md_dev64_t dev); 18840Sstevel@tonic-gate %extern int mdhsperror(md_error_t *ep, md_hsp_errno_t errnum, hsp_t hsp); 18850Sstevel@tonic-gate %extern int mdhserror(md_error_t *ep, md_hs_errno_t errnum, 18860Sstevel@tonic-gate % hsp_t hsp, md_dev64_t dev); 18870Sstevel@tonic-gate %extern int mdmddberror(md_error_t *ep, md_mddb_errno_t errnum, 18880Sstevel@tonic-gate % minor_t mnum, set_t setno); 18890Sstevel@tonic-gate %extern int mddbstatus2error(md_error_t *ep, int status, minor_t mnum, 18900Sstevel@tonic-gate % set_t setno); 18910Sstevel@tonic-gate % 18920Sstevel@tonic-gate #else /* ! _KERNEL */ 18930Sstevel@tonic-gate % 18940Sstevel@tonic-gate %extern int mderror(md_error_t *ep, md_void_errno_t errnum, char *name); 18950Sstevel@tonic-gate %extern int mdsyserror(md_error_t *ep, int errnum, char *name); 18960Sstevel@tonic-gate %extern int mdrpcerror(md_error_t *ep, CLIENT *clntp, char *host, 18970Sstevel@tonic-gate % char *extra); 18980Sstevel@tonic-gate %extern int mdrpccreateerror(md_error_t *ep, char *host, char *extra); 18990Sstevel@tonic-gate %extern int mddeverror(md_error_t *ep, md_dev_errno_t errnum, 19000Sstevel@tonic-gate % md_dev64_t dev, char *name); 19010Sstevel@tonic-gate %extern int mduseerror(md_error_t *ep, md_use_errno_t errnum, 19020Sstevel@tonic-gate % md_dev64_t dev, char *where, char *name); 19030Sstevel@tonic-gate %extern int mdmderror(md_error_t *ep, md_md_errno_t errnum, minor_t mnum, 19040Sstevel@tonic-gate % char *name); 19050Sstevel@tonic-gate %extern int mdcomperror(md_error_t *ep, md_comp_errno_t errnum, 19060Sstevel@tonic-gate % minor_t mnum, md_dev64_t dev, char *name); 19070Sstevel@tonic-gate %extern int mdhsperror(md_error_t *ep, md_hsp_errno_t errnum, hsp_t hsp, 19080Sstevel@tonic-gate % char *name); 19090Sstevel@tonic-gate %extern int mdhserror(md_error_t *ep, md_hs_errno_t errnum, 19100Sstevel@tonic-gate % hsp_t hsp, md_dev64_t dev, char *name); 19110Sstevel@tonic-gate %extern int mdmddberror(md_error_t *ep, md_mddb_errno_t errnum, 19120Sstevel@tonic-gate % minor_t mnum, set_t setno, size_t size, char *name); 19130Sstevel@tonic-gate %extern int mddserror(md_error_t *ep, md_ds_errno_t errnum, set_t setno, 19140Sstevel@tonic-gate % char *node, char *drive, char *name); 19150Sstevel@tonic-gate %extern int mdoverlaperror(md_error_t *ep, md_overlap_errno_t errnum, 19160Sstevel@tonic-gate % char *overlap, char *where, char *name); 19170Sstevel@tonic-gate % 19180Sstevel@tonic-gate %extern void mderrorextra(md_error_t *ep, char *extra); 19190Sstevel@tonic-gate % 19200Sstevel@tonic-gate #endif /* ! _KERNEL */ 19210Sstevel@tonic-gate #endif /* RPC_HDR */ 19220Sstevel@tonic-gate 19230Sstevel@tonic-gate /* 19240Sstevel@tonic-gate * common unit structure 19250Sstevel@tonic-gate */ 19260Sstevel@tonic-gate struct mdc_unit { 19270Sstevel@tonic-gate u_longlong_t un_revision; /* revision # (keep this a longlong) */ 19280Sstevel@tonic-gate md_types_t un_type; /* type of record */ 19290Sstevel@tonic-gate md_status_t un_status; /* status flags */ 19300Sstevel@tonic-gate int un_parent_res; /* parent reserve index */ 19310Sstevel@tonic-gate int un_child_res; /* child reserve index */ 19320Sstevel@tonic-gate minor_t un_self_id; /* metadevice unit number */ 19330Sstevel@tonic-gate mddb_recid_t un_record_id; /* db record id */ 19340Sstevel@tonic-gate uint_t un_size; /* db record size for unit structure */ 19350Sstevel@tonic-gate ushort_t un_flag; /* configuration info */ 19360Sstevel@tonic-gate diskaddr_t un_total_blocks; /* external # blocks in metadevice */ 19370Sstevel@tonic-gate diskaddr_t un_actual_tb; /* actual # blocks in metadevice */ 19380Sstevel@tonic-gate uint_t un_nhead; /* saved value of # heads */ 19390Sstevel@tonic-gate uint_t un_nsect; /* saved value of # sectors */ 19400Sstevel@tonic-gate ushort_t un_rpm; /* saved value of rpm's */ 19410Sstevel@tonic-gate ushort_t un_wr_reinstruct; /* worse case write reinstruct */ 19420Sstevel@tonic-gate ushort_t un_rd_reinstruct; /* worse case read reinstruct */ 19430Sstevel@tonic-gate mddb_recid_t un_vtoc_id; /* vtoc db record id */ 19440Sstevel@tonic-gate md_stackcap_t un_capabilities; /* subdevice capabilities */ 19450Sstevel@tonic-gate md_parent_t un_parent; /* -1 none, -2 many, positive unit # */ 19460Sstevel@tonic-gate uint_t un_user_flags; /* provided for userland */ 19470Sstevel@tonic-gate }; 19480Sstevel@tonic-gate typedef struct mdc_unit mdc_unit_t; 19490Sstevel@tonic-gate 19500Sstevel@tonic-gate /* 19510Sstevel@tonic-gate * For old 32 bit format use only 19520Sstevel@tonic-gate */ 19530Sstevel@tonic-gate %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 19540Sstevel@tonic-gate %#pragma pack(4) 19550Sstevel@tonic-gate %#endif 19560Sstevel@tonic-gate struct mdc_unit32_od { 19570Sstevel@tonic-gate u_longlong_t un_revision; 19580Sstevel@tonic-gate md_types_t un_type; 19590Sstevel@tonic-gate md_status_t un_status; 19600Sstevel@tonic-gate int un_parent_res; 19610Sstevel@tonic-gate int un_child_res; 19620Sstevel@tonic-gate minor_t un_self_id; 19630Sstevel@tonic-gate mddb_recid_t un_record_id; 19640Sstevel@tonic-gate uint_t un_size; 19650Sstevel@tonic-gate ushort_t un_flag; 19660Sstevel@tonic-gate daddr32_t un_total_blocks; /* external # blocks in metadevice */ 19670Sstevel@tonic-gate daddr32_t un_actual_tb; /* actual # blocks in metadevice */ 19680Sstevel@tonic-gate ushort_t un_nhead; 19690Sstevel@tonic-gate ushort_t un_nsect; 19700Sstevel@tonic-gate ushort_t un_rpm; 19710Sstevel@tonic-gate ushort_t un_wr_reinstruct; 19720Sstevel@tonic-gate ushort_t un_rd_reinstruct; 19730Sstevel@tonic-gate mddb_recid_t un_vtoc_id; 19740Sstevel@tonic-gate md_stackcap_t un_capabilities; 19750Sstevel@tonic-gate md_parent_t un_parent; 19760Sstevel@tonic-gate uint_t un_user_flags; 19770Sstevel@tonic-gate }; 19780Sstevel@tonic-gate typedef struct mdc_unit32_od mdc_unit32_od_t; 19790Sstevel@tonic-gate 19800Sstevel@tonic-gate struct md_unit { 19810Sstevel@tonic-gate mdc_unit_t c; /* common stuff */ 19820Sstevel@tonic-gate }; 19830Sstevel@tonic-gate typedef struct md_unit md_unit_t; 19840Sstevel@tonic-gate 19850Sstevel@tonic-gate enum sp_status_t { 19860Sstevel@tonic-gate MD_SP_CREATEPEND, /* soft partition creation in progress */ 19870Sstevel@tonic-gate MD_SP_GROWPEND, /* attach operation in progress */ 19880Sstevel@tonic-gate MD_SP_DELPEND, /* delete operation in progress */ 19890Sstevel@tonic-gate MD_SP_OK, /* soft partition is stable */ 19900Sstevel@tonic-gate MD_SP_ERR, /* soft partition is errored */ 19910Sstevel@tonic-gate MD_SP_RECOVER, /* recovery operation in progess */ 19920Sstevel@tonic-gate MD_SP_LAST /* always the last entry */ 19930Sstevel@tonic-gate }; 19940Sstevel@tonic-gate 19950Sstevel@tonic-gate /* soft partition offsets and lengths are specified in sectors */ 19960Sstevel@tonic-gate typedef u_longlong_t sp_ext_offset_t; 19970Sstevel@tonic-gate typedef u_longlong_t sp_ext_length_t; 19980Sstevel@tonic-gate struct mp_ext { 19990Sstevel@tonic-gate sp_ext_offset_t un_voff; /* virtual offset */ 20000Sstevel@tonic-gate sp_ext_offset_t un_poff; /* physical offset */ 20010Sstevel@tonic-gate sp_ext_length_t un_len; /* length of extent */ 20020Sstevel@tonic-gate }; 20030Sstevel@tonic-gate typedef struct mp_ext mp_ext_t; 20040Sstevel@tonic-gate 20050Sstevel@tonic-gate /* 20060Sstevel@tonic-gate * mp_unit32_od is for old 32 bit format only 20070Sstevel@tonic-gate */ 20080Sstevel@tonic-gate struct mp_unit32_od { 20090Sstevel@tonic-gate mdc_unit32_od_t c; /* common unit structure */ 20100Sstevel@tonic-gate mdkey_t un_key; /* namespace key */ 20110Sstevel@tonic-gate dev32_t un_dev; /* device number */ 20120Sstevel@tonic-gate sp_ext_offset_t un_start_blk; /* start block, incl reserved space */ 20130Sstevel@tonic-gate sp_status_t un_status; /* sp status */ 20140Sstevel@tonic-gate uint_t un_numexts; /* number of extents */ 20150Sstevel@tonic-gate sp_ext_length_t un_length; /* total length (in sectors) */ 20160Sstevel@tonic-gate /* extent array. NOTE: sized dynamically! */ 20170Sstevel@tonic-gate mp_ext_t un_ext[1]; 20180Sstevel@tonic-gate }; 20190Sstevel@tonic-gate typedef struct mp_unit32_od mp_unit32_od_t; 20200Sstevel@tonic-gate 20210Sstevel@tonic-gate /* 20220Sstevel@tonic-gate * softpart unit structure 20230Sstevel@tonic-gate */ 20240Sstevel@tonic-gate struct mp_unit { 20250Sstevel@tonic-gate mdc_unit_t c; /* common unit structure */ 20260Sstevel@tonic-gate mdkey_t un_key; /* namespace key */ 20270Sstevel@tonic-gate md_dev64_t un_dev; /* device number, 64 bit */ 20280Sstevel@tonic-gate sp_ext_offset_t un_start_blk; /* start block, incl reserved space */ 20290Sstevel@tonic-gate sp_status_t un_status; /* sp status */ 20300Sstevel@tonic-gate uint_t un_numexts; /* number of extents */ 20310Sstevel@tonic-gate sp_ext_length_t un_length; /* total length (in sectors) */ 20320Sstevel@tonic-gate /* extent array. NOTE: sized dynamically! */ 20330Sstevel@tonic-gate mp_ext_t un_ext[1]; 20340Sstevel@tonic-gate }; 20350Sstevel@tonic-gate typedef struct mp_unit mp_unit_t; 20360Sstevel@tonic-gate 20370Sstevel@tonic-gate /* 20380Sstevel@tonic-gate * ioctl structures used when passing ioctls via rpc.mdcommd 20390Sstevel@tonic-gate */ 20400Sstevel@tonic-gate struct md_driver { 20410Sstevel@tonic-gate char md_drivername[MD_MAXDRVNM]; 20420Sstevel@tonic-gate set_t md_setno; 20430Sstevel@tonic-gate }; 20440Sstevel@tonic-gate typedef struct md_driver md_driver_t; 20450Sstevel@tonic-gate 20460Sstevel@tonic-gate %#define MD_DRIVER md_driver_t md_driver; 20470Sstevel@tonic-gate #define MD_DRIVER md_driver_t md_driver; 20480Sstevel@tonic-gate 20490Sstevel@tonic-gate struct md_set_params { 20500Sstevel@tonic-gate MD_DRIVER 20510Sstevel@tonic-gate md_error_t mde; 20520Sstevel@tonic-gate minor_t mnum; 20530Sstevel@tonic-gate md_types_t type; 20540Sstevel@tonic-gate uint_t size; 20550Sstevel@tonic-gate int options; 20560Sstevel@tonic-gate uint64_t mdp; /* Contains pointer */ 20570Sstevel@tonic-gate }; 20580Sstevel@tonic-gate typedef struct md_set_params md_set_params_t; 20590Sstevel@tonic-gate %#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 20600Sstevel@tonic-gate %#pragma pack() 20610Sstevel@tonic-gate %#endif 20620Sstevel@tonic-gate 20630Sstevel@tonic-gate 2064