1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _VOLUME_DEVCONFIG_H 28*7c478bd9Sstevel@tonic-gate #define _VOLUME_DEVCONFIG_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <libnvpair.h> 37*7c478bd9Sstevel@tonic-gate #include "volume_dlist.h" 38*7c478bd9Sstevel@tonic-gate #include <sys/lvm/md_mdiox.h> 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate /* 41*7c478bd9Sstevel@tonic-gate * String constants for XML element/attribute names. 42*7c478bd9Sstevel@tonic-gate */ 43*7c478bd9Sstevel@tonic-gate #define ELEMENT_AVAILABLE "available" 44*7c478bd9Sstevel@tonic-gate #define ELEMENT_COMMENT "comment" 45*7c478bd9Sstevel@tonic-gate #define ELEMENT_CONCAT "concat" 46*7c478bd9Sstevel@tonic-gate #define ELEMENT_DISK "disk" 47*7c478bd9Sstevel@tonic-gate #define ELEMENT_DISKSET "diskset" 48*7c478bd9Sstevel@tonic-gate #define ELEMENT_HSP "hsp" 49*7c478bd9Sstevel@tonic-gate #define ELEMENT_L10N "localization" 50*7c478bd9Sstevel@tonic-gate #define ELEMENT_MESSAGE "message" 51*7c478bd9Sstevel@tonic-gate #define ELEMENT_MIRROR "mirror" 52*7c478bd9Sstevel@tonic-gate #define ELEMENT_PARAM "param" 53*7c478bd9Sstevel@tonic-gate #define ELEMENT_SLICE "slice" 54*7c478bd9Sstevel@tonic-gate #define ELEMENT_STRIPE "stripe" 55*7c478bd9Sstevel@tonic-gate #define ELEMENT_TEXT "text" 56*7c478bd9Sstevel@tonic-gate #define ELEMENT_UNAVAILABLE "unavailable" 57*7c478bd9Sstevel@tonic-gate #define ELEMENT_VARIABLE "variable" 58*7c478bd9Sstevel@tonic-gate #define ELEMENT_VOLUME "volume" 59*7c478bd9Sstevel@tonic-gate #define ELEMENT_VOLUMECONFIG "volume-config" 60*7c478bd9Sstevel@tonic-gate #define ELEMENT_VOLUMEDEFAULTS "volume-defaults" 61*7c478bd9Sstevel@tonic-gate #define ELEMENT_VOLUMEREQUEST "volume-request" 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate #define ATTR_LANG "xml:lang" 64*7c478bd9Sstevel@tonic-gate #define ATTR_MESSAGEID "msgid" 65*7c478bd9Sstevel@tonic-gate #define ATTR_MIRROR_NSUBMIRRORS "nsubmirrors" 66*7c478bd9Sstevel@tonic-gate #define ATTR_MIRROR_PASSNUM "passnum" 67*7c478bd9Sstevel@tonic-gate #define ATTR_MIRROR_READ "read" 68*7c478bd9Sstevel@tonic-gate #define ATTR_MIRROR_WRITE "write" 69*7c478bd9Sstevel@tonic-gate #define ATTR_NAME "name" 70*7c478bd9Sstevel@tonic-gate #define ATTR_SELECT "select" 71*7c478bd9Sstevel@tonic-gate #define ATTR_SIZEINBLOCKS "sizeinblocks" 72*7c478bd9Sstevel@tonic-gate #define ATTR_SIZEINBYTES "size" 73*7c478bd9Sstevel@tonic-gate #define ATTR_SLICE_INDEX "index" 74*7c478bd9Sstevel@tonic-gate #define ATTR_SLICE_STARTSECTOR "startsector" 75*7c478bd9Sstevel@tonic-gate #define ATTR_STRIPE_INTERLACE "interlace" 76*7c478bd9Sstevel@tonic-gate #define ATTR_STRIPE_MAXCOMP "maxcomp" 77*7c478bd9Sstevel@tonic-gate #define ATTR_STRIPE_MINCOMP "mincomp" 78*7c478bd9Sstevel@tonic-gate #define ATTR_TYPE "type" 79*7c478bd9Sstevel@tonic-gate #define ATTR_VOLUME_CREATE "create" 80*7c478bd9Sstevel@tonic-gate #define ATTR_VOLUME_DATAPATHS "datapaths" 81*7c478bd9Sstevel@tonic-gate #define ATTR_VOLUME_FAULTRECOVERY "faultrecovery" 82*7c478bd9Sstevel@tonic-gate #define ATTR_VOLUME_REDUNDANCY "redundancy" 83*7c478bd9Sstevel@tonic-gate #define ATTR_VOLUME_USEHSP "usehsp" 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate #define NAME_L10N_MESSAGE_FILE "msgfile" 86*7c478bd9Sstevel@tonic-gate #define NAME_LANG "lang" 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate /* 89*7c478bd9Sstevel@tonic-gate * Limits for attributes 90*7c478bd9Sstevel@tonic-gate */ 91*7c478bd9Sstevel@tonic-gate #define MIN_NSTRIPE_COMP 1 92*7c478bd9Sstevel@tonic-gate #define MIN_SIZE 0 93*7c478bd9Sstevel@tonic-gate #define MIN_SIZE_IN_BLOCKS 0 94*7c478bd9Sstevel@tonic-gate #define MIN_NDATAPATHS 1 95*7c478bd9Sstevel@tonic-gate #define MAX_NDATAPATHS 4 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate /* Attribute requested but not set */ 98*7c478bd9Sstevel@tonic-gate #define ERR_ATTR_UNSET -10001 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate /* 101*7c478bd9Sstevel@tonic-gate * Enumeration defining physical or logical device types 102*7c478bd9Sstevel@tonic-gate */ 103*7c478bd9Sstevel@tonic-gate typedef enum { 104*7c478bd9Sstevel@tonic-gate TYPE_UNKNOWN = 0, 105*7c478bd9Sstevel@tonic-gate TYPE_CONCAT = 1, 106*7c478bd9Sstevel@tonic-gate TYPE_CONTROLLER, 107*7c478bd9Sstevel@tonic-gate TYPE_DISKSET, 108*7c478bd9Sstevel@tonic-gate TYPE_DRIVE, 109*7c478bd9Sstevel@tonic-gate TYPE_EXTENT, 110*7c478bd9Sstevel@tonic-gate TYPE_HOST, 111*7c478bd9Sstevel@tonic-gate TYPE_HSP, 112*7c478bd9Sstevel@tonic-gate TYPE_MIRROR, 113*7c478bd9Sstevel@tonic-gate TYPE_RAID5, 114*7c478bd9Sstevel@tonic-gate TYPE_SLICE, 115*7c478bd9Sstevel@tonic-gate TYPE_SOFTPART, 116*7c478bd9Sstevel@tonic-gate TYPE_STRIPE, 117*7c478bd9Sstevel@tonic-gate TYPE_TRANS, 118*7c478bd9Sstevel@tonic-gate TYPE_VOLUME 119*7c478bd9Sstevel@tonic-gate } component_type_t; 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate /* 122*7c478bd9Sstevel@tonic-gate * enumerated constants for SVM Mirror read strategies 123*7c478bd9Sstevel@tonic-gate */ 124*7c478bd9Sstevel@tonic-gate typedef enum { 125*7c478bd9Sstevel@tonic-gate MIRROR_READ_ROUNDROBIN = 0, 126*7c478bd9Sstevel@tonic-gate MIRROR_READ_GEOMETRIC, 127*7c478bd9Sstevel@tonic-gate MIRROR_READ_FIRST 128*7c478bd9Sstevel@tonic-gate } mirror_read_strategy_t; 129*7c478bd9Sstevel@tonic-gate 130*7c478bd9Sstevel@tonic-gate /* 131*7c478bd9Sstevel@tonic-gate * enumerated constants for SVM Mirror write strategies 132*7c478bd9Sstevel@tonic-gate */ 133*7c478bd9Sstevel@tonic-gate typedef enum { 134*7c478bd9Sstevel@tonic-gate MIRROR_WRITE_PARALLEL = 0, 135*7c478bd9Sstevel@tonic-gate MIRROR_WRITE_SERIAL 136*7c478bd9Sstevel@tonic-gate } mirror_write_strategy_t; 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate /* 139*7c478bd9Sstevel@tonic-gate * devconfig_t - struct to hold a device configuration hierarchy 140*7c478bd9Sstevel@tonic-gate */ 141*7c478bd9Sstevel@tonic-gate typedef struct devconfig { 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate /* Attributes of this device */ 144*7c478bd9Sstevel@tonic-gate nvlist_t *attributes; 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate /* 147*7c478bd9Sstevel@tonic-gate * Available devices for use in construction of this device 148*7c478bd9Sstevel@tonic-gate * and its subcomponents 149*7c478bd9Sstevel@tonic-gate */ 150*7c478bd9Sstevel@tonic-gate char **available; 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate /* 153*7c478bd9Sstevel@tonic-gate * Unavailable devices for use in construction of this device 154*7c478bd9Sstevel@tonic-gate * and its subcomponents 155*7c478bd9Sstevel@tonic-gate */ 156*7c478bd9Sstevel@tonic-gate char **unavailable; 157*7c478bd9Sstevel@tonic-gate 158*7c478bd9Sstevel@tonic-gate /* 159*7c478bd9Sstevel@tonic-gate * Subcomponents (devconfig_t) of this device 160*7c478bd9Sstevel@tonic-gate */ 161*7c478bd9Sstevel@tonic-gate dlist_t *components; 162*7c478bd9Sstevel@tonic-gate } devconfig_t; 163*7c478bd9Sstevel@tonic-gate 164*7c478bd9Sstevel@tonic-gate /* 165*7c478bd9Sstevel@tonic-gate * Function prototypes 166*7c478bd9Sstevel@tonic-gate */ 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate /* 169*7c478bd9Sstevel@tonic-gate * Constructor: Create a devconfig_t struct. This devconfig_t must be 170*7c478bd9Sstevel@tonic-gate * freed with free_devconfig(). 171*7c478bd9Sstevel@tonic-gate * 172*7c478bd9Sstevel@tonic-gate * @param devconfig 173*7c478bd9Sstevel@tonic-gate * RETURN: a new devconfig_t 174*7c478bd9Sstevel@tonic-gate * 175*7c478bd9Sstevel@tonic-gate * @param type 176*7c478bd9Sstevel@tonic-gate * the type of devconfig_t to create 177*7c478bd9Sstevel@tonic-gate * 178*7c478bd9Sstevel@tonic-gate * @return 0 179*7c478bd9Sstevel@tonic-gate * if successful 180*7c478bd9Sstevel@tonic-gate * 181*7c478bd9Sstevel@tonic-gate * @return non-zero 182*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 183*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 184*7c478bd9Sstevel@tonic-gate */ 185*7c478bd9Sstevel@tonic-gate extern int new_devconfig(devconfig_t **devconfig, component_type_t type); 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate /* 188*7c478bd9Sstevel@tonic-gate * Free memory (recursively) allocated to a devconfig_t struct 189*7c478bd9Sstevel@tonic-gate * 190*7c478bd9Sstevel@tonic-gate * @param arg 191*7c478bd9Sstevel@tonic-gate * pointer to the devconfig_t to be freed 192*7c478bd9Sstevel@tonic-gate */ 193*7c478bd9Sstevel@tonic-gate extern void free_devconfig(void *arg); 194*7c478bd9Sstevel@tonic-gate 195*7c478bd9Sstevel@tonic-gate /* 196*7c478bd9Sstevel@tonic-gate * Check the type of the given device. 197*7c478bd9Sstevel@tonic-gate * 198*7c478bd9Sstevel@tonic-gate * @param device 199*7c478bd9Sstevel@tonic-gate * the device whose type to check 200*7c478bd9Sstevel@tonic-gate * 201*7c478bd9Sstevel@tonic-gate * @param type 202*7c478bd9Sstevel@tonic-gate * the type of the device against which to compare 203*7c478bd9Sstevel@tonic-gate * 204*7c478bd9Sstevel@tonic-gate * @return B_TRUE if the device is of the given type, B_FALSE 205*7c478bd9Sstevel@tonic-gate * otherwise 206*7c478bd9Sstevel@tonic-gate */ 207*7c478bd9Sstevel@tonic-gate extern boolean_t devconfig_isA(devconfig_t *device, component_type_t type); 208*7c478bd9Sstevel@tonic-gate 209*7c478bd9Sstevel@tonic-gate /* 210*7c478bd9Sstevel@tonic-gate * Get the first component of the given type from the given 211*7c478bd9Sstevel@tonic-gate * devconfig_t. Create the component if create is B_TRUE. 212*7c478bd9Sstevel@tonic-gate * 213*7c478bd9Sstevel@tonic-gate * @return ENOENT 214*7c478bd9Sstevel@tonic-gate * if the requested component does not exist and its 215*7c478bd9Sstevel@tonic-gate * creation was not requested 216*7c478bd9Sstevel@tonic-gate * 217*7c478bd9Sstevel@tonic-gate * @return 0 218*7c478bd9Sstevel@tonic-gate * if the requested component exists or was created 219*7c478bd9Sstevel@tonic-gate * 220*7c478bd9Sstevel@tonic-gate * @return non-zero 221*7c478bd9Sstevel@tonic-gate * if the requested component did not exist and could not 222*7c478bd9Sstevel@tonic-gate * be created 223*7c478bd9Sstevel@tonic-gate */ 224*7c478bd9Sstevel@tonic-gate extern int devconfig_get_component(devconfig_t *device, 225*7c478bd9Sstevel@tonic-gate component_type_t type, devconfig_t **component, boolean_t create); 226*7c478bd9Sstevel@tonic-gate 227*7c478bd9Sstevel@tonic-gate /* 228*7c478bd9Sstevel@tonic-gate * Set the available devices for use in creating this device 229*7c478bd9Sstevel@tonic-gate * 230*7c478bd9Sstevel@tonic-gate * @param device 231*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to modify 232*7c478bd9Sstevel@tonic-gate * 233*7c478bd9Sstevel@tonic-gate * @param available 234*7c478bd9Sstevel@tonic-gate * A NULL-terminated array of device names 235*7c478bd9Sstevel@tonic-gate */ 236*7c478bd9Sstevel@tonic-gate extern void devconfig_set_available(devconfig_t *device, char **available); 237*7c478bd9Sstevel@tonic-gate 238*7c478bd9Sstevel@tonic-gate /* 239*7c478bd9Sstevel@tonic-gate * Get the available devices for use in creating this device 240*7c478bd9Sstevel@tonic-gate * 241*7c478bd9Sstevel@tonic-gate * @param device 242*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 243*7c478bd9Sstevel@tonic-gate * 244*7c478bd9Sstevel@tonic-gate * @return available 245*7c478bd9Sstevel@tonic-gate * A NULL-terminated array of device names 246*7c478bd9Sstevel@tonic-gate */ 247*7c478bd9Sstevel@tonic-gate extern char ** devconfig_get_available(devconfig_t *device); 248*7c478bd9Sstevel@tonic-gate 249*7c478bd9Sstevel@tonic-gate /* 250*7c478bd9Sstevel@tonic-gate * Set the unavailable devices which may not be used in creating this 251*7c478bd9Sstevel@tonic-gate * device 252*7c478bd9Sstevel@tonic-gate * 253*7c478bd9Sstevel@tonic-gate * @param device 254*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to modify 255*7c478bd9Sstevel@tonic-gate * 256*7c478bd9Sstevel@tonic-gate * @param available 257*7c478bd9Sstevel@tonic-gate * A NULL-terminated array of device names 258*7c478bd9Sstevel@tonic-gate */ 259*7c478bd9Sstevel@tonic-gate extern void devconfig_set_unavailable(devconfig_t *device, char **unavailable); 260*7c478bd9Sstevel@tonic-gate 261*7c478bd9Sstevel@tonic-gate /* 262*7c478bd9Sstevel@tonic-gate * Get the unavailable devices for use in creating this device 263*7c478bd9Sstevel@tonic-gate * 264*7c478bd9Sstevel@tonic-gate * @param device 265*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 266*7c478bd9Sstevel@tonic-gate * 267*7c478bd9Sstevel@tonic-gate * @return unavailable 268*7c478bd9Sstevel@tonic-gate * A NULL-terminated array of device names 269*7c478bd9Sstevel@tonic-gate */ 270*7c478bd9Sstevel@tonic-gate extern char ** devconfig_get_unavailable(devconfig_t *device); 271*7c478bd9Sstevel@tonic-gate 272*7c478bd9Sstevel@tonic-gate /* 273*7c478bd9Sstevel@tonic-gate * Set the subcomponent devices of a given device 274*7c478bd9Sstevel@tonic-gate * 275*7c478bd9Sstevel@tonic-gate * @param device 276*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 277*7c478bd9Sstevel@tonic-gate * 278*7c478bd9Sstevel@tonic-gate * @param components 279*7c478bd9Sstevel@tonic-gate * A dlist_t containing devconfig_t devices 280*7c478bd9Sstevel@tonic-gate */ 281*7c478bd9Sstevel@tonic-gate extern void devconfig_set_components(devconfig_t *device, dlist_t *components); 282*7c478bd9Sstevel@tonic-gate 283*7c478bd9Sstevel@tonic-gate /* 284*7c478bd9Sstevel@tonic-gate * Get the subcomponent devices of a given device 285*7c478bd9Sstevel@tonic-gate * 286*7c478bd9Sstevel@tonic-gate * @param device 287*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 288*7c478bd9Sstevel@tonic-gate * 289*7c478bd9Sstevel@tonic-gate * @return A dlist_t containing devconfig_t devices 290*7c478bd9Sstevel@tonic-gate */ 291*7c478bd9Sstevel@tonic-gate extern dlist_t *devconfig_get_components(devconfig_t *device); 292*7c478bd9Sstevel@tonic-gate 293*7c478bd9Sstevel@tonic-gate /* 294*7c478bd9Sstevel@tonic-gate * Set the device name 295*7c478bd9Sstevel@tonic-gate * 296*7c478bd9Sstevel@tonic-gate * @param device 297*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to modify 298*7c478bd9Sstevel@tonic-gate * 299*7c478bd9Sstevel@tonic-gate * @param name 300*7c478bd9Sstevel@tonic-gate * the value to set as the device name 301*7c478bd9Sstevel@tonic-gate * 302*7c478bd9Sstevel@tonic-gate * @return 0 303*7c478bd9Sstevel@tonic-gate * if successful 304*7c478bd9Sstevel@tonic-gate * 305*7c478bd9Sstevel@tonic-gate * @return non-zero 306*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 307*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 308*7c478bd9Sstevel@tonic-gate */ 309*7c478bd9Sstevel@tonic-gate extern int devconfig_set_name(devconfig_t *device, char *name); 310*7c478bd9Sstevel@tonic-gate 311*7c478bd9Sstevel@tonic-gate /* 312*7c478bd9Sstevel@tonic-gate * Set the disk set name 313*7c478bd9Sstevel@tonic-gate * 314*7c478bd9Sstevel@tonic-gate * @param diskset 315*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the diskset to modify 316*7c478bd9Sstevel@tonic-gate * 317*7c478bd9Sstevel@tonic-gate * @param name 318*7c478bd9Sstevel@tonic-gate * the value to set as the device name 319*7c478bd9Sstevel@tonic-gate * 320*7c478bd9Sstevel@tonic-gate * @return 0 321*7c478bd9Sstevel@tonic-gate * if successful 322*7c478bd9Sstevel@tonic-gate * 323*7c478bd9Sstevel@tonic-gate * @return non-zero 324*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 325*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 326*7c478bd9Sstevel@tonic-gate */ 327*7c478bd9Sstevel@tonic-gate extern int devconfig_set_diskset_name(devconfig_t *diskset, char *name); 328*7c478bd9Sstevel@tonic-gate 329*7c478bd9Sstevel@tonic-gate /* 330*7c478bd9Sstevel@tonic-gate * Set the device name 331*7c478bd9Sstevel@tonic-gate * 332*7c478bd9Sstevel@tonic-gate * @param hsp 333*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the hsp to modify 334*7c478bd9Sstevel@tonic-gate * 335*7c478bd9Sstevel@tonic-gate * @param name 336*7c478bd9Sstevel@tonic-gate * the value to set as the device name 337*7c478bd9Sstevel@tonic-gate * 338*7c478bd9Sstevel@tonic-gate * @return 0 339*7c478bd9Sstevel@tonic-gate * if successful 340*7c478bd9Sstevel@tonic-gate * 341*7c478bd9Sstevel@tonic-gate * @return non-zero 342*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 343*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 344*7c478bd9Sstevel@tonic-gate */ 345*7c478bd9Sstevel@tonic-gate extern int devconfig_set_hsp_name(devconfig_t *hsp, char *name); 346*7c478bd9Sstevel@tonic-gate 347*7c478bd9Sstevel@tonic-gate /* 348*7c478bd9Sstevel@tonic-gate * Set the device name 349*7c478bd9Sstevel@tonic-gate * 350*7c478bd9Sstevel@tonic-gate * @param volume 351*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the volume to modify 352*7c478bd9Sstevel@tonic-gate * 353*7c478bd9Sstevel@tonic-gate * @param name 354*7c478bd9Sstevel@tonic-gate * the value to set as the device name 355*7c478bd9Sstevel@tonic-gate * 356*7c478bd9Sstevel@tonic-gate * @return 0 357*7c478bd9Sstevel@tonic-gate * if successful 358*7c478bd9Sstevel@tonic-gate * 359*7c478bd9Sstevel@tonic-gate * @return non-zero 360*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 361*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 362*7c478bd9Sstevel@tonic-gate */ 363*7c478bd9Sstevel@tonic-gate extern int devconfig_set_volume_name(devconfig_t *volume, char *name); 364*7c478bd9Sstevel@tonic-gate 365*7c478bd9Sstevel@tonic-gate /* 366*7c478bd9Sstevel@tonic-gate * Get the device name 367*7c478bd9Sstevel@tonic-gate * 368*7c478bd9Sstevel@tonic-gate * @param volume 369*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the volume to examine 370*7c478bd9Sstevel@tonic-gate * 371*7c478bd9Sstevel@tonic-gate * @param name 372*7c478bd9Sstevel@tonic-gate * RETURN: the device name 373*7c478bd9Sstevel@tonic-gate * 374*7c478bd9Sstevel@tonic-gate * @return 0 375*7c478bd9Sstevel@tonic-gate * if successful 376*7c478bd9Sstevel@tonic-gate * 377*7c478bd9Sstevel@tonic-gate * @return non-zero 378*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 379*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 380*7c478bd9Sstevel@tonic-gate */ 381*7c478bd9Sstevel@tonic-gate extern int devconfig_get_name(devconfig_t *device, char **name); 382*7c478bd9Sstevel@tonic-gate 383*7c478bd9Sstevel@tonic-gate /* 384*7c478bd9Sstevel@tonic-gate * Set the device type 385*7c478bd9Sstevel@tonic-gate * 386*7c478bd9Sstevel@tonic-gate * @param device 387*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to modify 388*7c478bd9Sstevel@tonic-gate * 389*7c478bd9Sstevel@tonic-gate * @param type 390*7c478bd9Sstevel@tonic-gate * the value to set as the device type 391*7c478bd9Sstevel@tonic-gate * 392*7c478bd9Sstevel@tonic-gate * @return 0 393*7c478bd9Sstevel@tonic-gate * if successful 394*7c478bd9Sstevel@tonic-gate * 395*7c478bd9Sstevel@tonic-gate * @return non-zero 396*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 397*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 398*7c478bd9Sstevel@tonic-gate */ 399*7c478bd9Sstevel@tonic-gate extern int devconfig_set_type(devconfig_t *device, component_type_t type); 400*7c478bd9Sstevel@tonic-gate 401*7c478bd9Sstevel@tonic-gate /* 402*7c478bd9Sstevel@tonic-gate * Get the device type 403*7c478bd9Sstevel@tonic-gate * 404*7c478bd9Sstevel@tonic-gate * @param device 405*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 406*7c478bd9Sstevel@tonic-gate * 407*7c478bd9Sstevel@tonic-gate * @param type 408*7c478bd9Sstevel@tonic-gate * RETURN: the device type 409*7c478bd9Sstevel@tonic-gate * 410*7c478bd9Sstevel@tonic-gate * @return 0 411*7c478bd9Sstevel@tonic-gate * if successful 412*7c478bd9Sstevel@tonic-gate * 413*7c478bd9Sstevel@tonic-gate * @return non-zero 414*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 415*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 416*7c478bd9Sstevel@tonic-gate */ 417*7c478bd9Sstevel@tonic-gate extern int devconfig_get_type(devconfig_t *device, component_type_t *type); 418*7c478bd9Sstevel@tonic-gate 419*7c478bd9Sstevel@tonic-gate /* 420*7c478bd9Sstevel@tonic-gate * Set the device size (for volume, mirror, stripe, concat) in bytes 421*7c478bd9Sstevel@tonic-gate * 422*7c478bd9Sstevel@tonic-gate * Note that size in bytes in a 64-bit field cannot hold the size that 423*7c478bd9Sstevel@tonic-gate * can be accessed in a 16 byte CDB. Since CDBs operate on blocks, 424*7c478bd9Sstevel@tonic-gate * the max capacity is 2^73 bytes with 512 byte blocks. 425*7c478bd9Sstevel@tonic-gate * 426*7c478bd9Sstevel@tonic-gate * @param device 427*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to modify 428*7c478bd9Sstevel@tonic-gate * 429*7c478bd9Sstevel@tonic-gate * @param size_in_bytes 430*7c478bd9Sstevel@tonic-gate * the value to set as the device size in bytes 431*7c478bd9Sstevel@tonic-gate * 432*7c478bd9Sstevel@tonic-gate * @return 0 433*7c478bd9Sstevel@tonic-gate * if successful 434*7c478bd9Sstevel@tonic-gate * 435*7c478bd9Sstevel@tonic-gate * @return non-zero 436*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 437*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 438*7c478bd9Sstevel@tonic-gate */ 439*7c478bd9Sstevel@tonic-gate extern int devconfig_set_size(devconfig_t *device, uint64_t size_in_bytes); 440*7c478bd9Sstevel@tonic-gate 441*7c478bd9Sstevel@tonic-gate /* 442*7c478bd9Sstevel@tonic-gate * Get the device size (for volume, mirror, stripe, concat) in bytes 443*7c478bd9Sstevel@tonic-gate * 444*7c478bd9Sstevel@tonic-gate * Note that size in bytes in a 64-bit field cannot hold the size that 445*7c478bd9Sstevel@tonic-gate * can be accessed in a 16 byte CDB. Since CDBs operate on blocks, 446*7c478bd9Sstevel@tonic-gate * the max capacity is 2^73 bytes with 512 byte blocks. 447*7c478bd9Sstevel@tonic-gate * 448*7c478bd9Sstevel@tonic-gate * @param device 449*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 450*7c478bd9Sstevel@tonic-gate * 451*7c478bd9Sstevel@tonic-gate * @param size_in_bytes 452*7c478bd9Sstevel@tonic-gate * RETURN: the device size in bytes 453*7c478bd9Sstevel@tonic-gate * 454*7c478bd9Sstevel@tonic-gate * @return 0 455*7c478bd9Sstevel@tonic-gate * if successful 456*7c478bd9Sstevel@tonic-gate * 457*7c478bd9Sstevel@tonic-gate * @return non-zero 458*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 459*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 460*7c478bd9Sstevel@tonic-gate */ 461*7c478bd9Sstevel@tonic-gate extern int devconfig_get_size(devconfig_t *device, uint64_t *size_in_bytes); 462*7c478bd9Sstevel@tonic-gate 463*7c478bd9Sstevel@tonic-gate /* 464*7c478bd9Sstevel@tonic-gate * Set the device size in blocks 465*7c478bd9Sstevel@tonic-gate * 466*7c478bd9Sstevel@tonic-gate * @param device 467*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to modify 468*7c478bd9Sstevel@tonic-gate * 469*7c478bd9Sstevel@tonic-gate * @param type 470*7c478bd9Sstevel@tonic-gate * the value to set as the device size in blocks 471*7c478bd9Sstevel@tonic-gate * 472*7c478bd9Sstevel@tonic-gate * @return 0 473*7c478bd9Sstevel@tonic-gate * if successful 474*7c478bd9Sstevel@tonic-gate * 475*7c478bd9Sstevel@tonic-gate * @return non-zero 476*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 477*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 478*7c478bd9Sstevel@tonic-gate */ 479*7c478bd9Sstevel@tonic-gate extern int devconfig_set_size_in_blocks( 480*7c478bd9Sstevel@tonic-gate devconfig_t *device, uint64_t size_in_blocks); 481*7c478bd9Sstevel@tonic-gate 482*7c478bd9Sstevel@tonic-gate /* 483*7c478bd9Sstevel@tonic-gate * Get the device size in blocks 484*7c478bd9Sstevel@tonic-gate * 485*7c478bd9Sstevel@tonic-gate * @param device 486*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 487*7c478bd9Sstevel@tonic-gate * 488*7c478bd9Sstevel@tonic-gate * @param size_in_blocks 489*7c478bd9Sstevel@tonic-gate * RETURN: the device size in blocks 490*7c478bd9Sstevel@tonic-gate * 491*7c478bd9Sstevel@tonic-gate * @return 0 492*7c478bd9Sstevel@tonic-gate * if successful 493*7c478bd9Sstevel@tonic-gate * 494*7c478bd9Sstevel@tonic-gate * @return non-zero 495*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 496*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 497*7c478bd9Sstevel@tonic-gate */ 498*7c478bd9Sstevel@tonic-gate extern int devconfig_get_size_in_blocks( 499*7c478bd9Sstevel@tonic-gate devconfig_t *device, uint64_t *size_in_blocks); 500*7c478bd9Sstevel@tonic-gate 501*7c478bd9Sstevel@tonic-gate /* 502*7c478bd9Sstevel@tonic-gate * Set the the slice index 503*7c478bd9Sstevel@tonic-gate * 504*7c478bd9Sstevel@tonic-gate * @param slice 505*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the slice to modify 506*7c478bd9Sstevel@tonic-gate * 507*7c478bd9Sstevel@tonic-gate * @param index 508*7c478bd9Sstevel@tonic-gate * the value to set as the the slice index 509*7c478bd9Sstevel@tonic-gate * 510*7c478bd9Sstevel@tonic-gate * @return 0 511*7c478bd9Sstevel@tonic-gate * if successful 512*7c478bd9Sstevel@tonic-gate * 513*7c478bd9Sstevel@tonic-gate * @return non-zero 514*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 515*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 516*7c478bd9Sstevel@tonic-gate */ 517*7c478bd9Sstevel@tonic-gate extern int devconfig_set_slice_index(devconfig_t *slice, uint16_t index); 518*7c478bd9Sstevel@tonic-gate 519*7c478bd9Sstevel@tonic-gate /* 520*7c478bd9Sstevel@tonic-gate * Get the slice index 521*7c478bd9Sstevel@tonic-gate * 522*7c478bd9Sstevel@tonic-gate * @param device 523*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 524*7c478bd9Sstevel@tonic-gate * 525*7c478bd9Sstevel@tonic-gate * @param index 526*7c478bd9Sstevel@tonic-gate * RETURN: the slice index 527*7c478bd9Sstevel@tonic-gate * 528*7c478bd9Sstevel@tonic-gate * @return 0 529*7c478bd9Sstevel@tonic-gate * if successful 530*7c478bd9Sstevel@tonic-gate * 531*7c478bd9Sstevel@tonic-gate * @return non-zero 532*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 533*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 534*7c478bd9Sstevel@tonic-gate */ 535*7c478bd9Sstevel@tonic-gate extern int devconfig_get_slice_index(devconfig_t *slice, uint16_t *index); 536*7c478bd9Sstevel@tonic-gate 537*7c478bd9Sstevel@tonic-gate /* 538*7c478bd9Sstevel@tonic-gate * Set the the slice start block 539*7c478bd9Sstevel@tonic-gate * 540*7c478bd9Sstevel@tonic-gate * @param slice 541*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the slice to modify 542*7c478bd9Sstevel@tonic-gate * 543*7c478bd9Sstevel@tonic-gate * @param start_block 544*7c478bd9Sstevel@tonic-gate * the value to set as the the slice start block 545*7c478bd9Sstevel@tonic-gate * 546*7c478bd9Sstevel@tonic-gate * @return 0 547*7c478bd9Sstevel@tonic-gate * if successful 548*7c478bd9Sstevel@tonic-gate * 549*7c478bd9Sstevel@tonic-gate * @return non-zero 550*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 551*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 552*7c478bd9Sstevel@tonic-gate */ 553*7c478bd9Sstevel@tonic-gate extern int devconfig_set_slice_start_block( 554*7c478bd9Sstevel@tonic-gate devconfig_t *slice, uint64_t start_block); 555*7c478bd9Sstevel@tonic-gate 556*7c478bd9Sstevel@tonic-gate /* 557*7c478bd9Sstevel@tonic-gate * Get the slice start block 558*7c478bd9Sstevel@tonic-gate * 559*7c478bd9Sstevel@tonic-gate * @param device 560*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 561*7c478bd9Sstevel@tonic-gate * 562*7c478bd9Sstevel@tonic-gate * @param start_block 563*7c478bd9Sstevel@tonic-gate * RETURN: the slice start block 564*7c478bd9Sstevel@tonic-gate * 565*7c478bd9Sstevel@tonic-gate * @return 0 566*7c478bd9Sstevel@tonic-gate * if successful 567*7c478bd9Sstevel@tonic-gate * 568*7c478bd9Sstevel@tonic-gate * @return non-zero 569*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 570*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 571*7c478bd9Sstevel@tonic-gate */ 572*7c478bd9Sstevel@tonic-gate extern int devconfig_get_slice_start_block( 573*7c478bd9Sstevel@tonic-gate devconfig_t *slice, uint64_t *start_block); 574*7c478bd9Sstevel@tonic-gate 575*7c478bd9Sstevel@tonic-gate /* 576*7c478bd9Sstevel@tonic-gate * Set the number of subcomponents in mirror 577*7c478bd9Sstevel@tonic-gate * 578*7c478bd9Sstevel@tonic-gate * @param mirror 579*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the mirror to modify 580*7c478bd9Sstevel@tonic-gate * 581*7c478bd9Sstevel@tonic-gate * @param nsubs 582*7c478bd9Sstevel@tonic-gate * the value to set as the number of subcomponents in 583*7c478bd9Sstevel@tonic-gate * mirror 584*7c478bd9Sstevel@tonic-gate * 585*7c478bd9Sstevel@tonic-gate * @return 0 586*7c478bd9Sstevel@tonic-gate * if successful 587*7c478bd9Sstevel@tonic-gate * 588*7c478bd9Sstevel@tonic-gate * @return non-zero 589*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 590*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 591*7c478bd9Sstevel@tonic-gate */ 592*7c478bd9Sstevel@tonic-gate extern int devconfig_set_mirror_nsubs(devconfig_t *mirror, uint16_t nsubs); 593*7c478bd9Sstevel@tonic-gate 594*7c478bd9Sstevel@tonic-gate /* 595*7c478bd9Sstevel@tonic-gate * Get number of subcomponents in mirror 596*7c478bd9Sstevel@tonic-gate * 597*7c478bd9Sstevel@tonic-gate * @param device 598*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 599*7c478bd9Sstevel@tonic-gate * 600*7c478bd9Sstevel@tonic-gate * @param nsubs 601*7c478bd9Sstevel@tonic-gate * RETURN: number of subcomponents in mirror 602*7c478bd9Sstevel@tonic-gate * 603*7c478bd9Sstevel@tonic-gate * @return 0 604*7c478bd9Sstevel@tonic-gate * if successful 605*7c478bd9Sstevel@tonic-gate * 606*7c478bd9Sstevel@tonic-gate * @return non-zero 607*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 608*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 609*7c478bd9Sstevel@tonic-gate */ 610*7c478bd9Sstevel@tonic-gate extern int devconfig_get_mirror_nsubs(devconfig_t *mirror, uint16_t *nsubs); 611*7c478bd9Sstevel@tonic-gate 612*7c478bd9Sstevel@tonic-gate /* 613*7c478bd9Sstevel@tonic-gate * Set the read strategy for mirror 614*7c478bd9Sstevel@tonic-gate * 615*7c478bd9Sstevel@tonic-gate * @param mirror 616*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the mirror to modify 617*7c478bd9Sstevel@tonic-gate * 618*7c478bd9Sstevel@tonic-gate * @param read 619*7c478bd9Sstevel@tonic-gate * the value to set as the read strategy for mirror 620*7c478bd9Sstevel@tonic-gate * 621*7c478bd9Sstevel@tonic-gate * @return 0 622*7c478bd9Sstevel@tonic-gate * if successful 623*7c478bd9Sstevel@tonic-gate * 624*7c478bd9Sstevel@tonic-gate * @return non-zero 625*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 626*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 627*7c478bd9Sstevel@tonic-gate */ 628*7c478bd9Sstevel@tonic-gate extern int devconfig_set_mirror_read( 629*7c478bd9Sstevel@tonic-gate devconfig_t *mirror, mirror_read_strategy_t read); 630*7c478bd9Sstevel@tonic-gate 631*7c478bd9Sstevel@tonic-gate /* 632*7c478bd9Sstevel@tonic-gate * Get read strategy for mirror 633*7c478bd9Sstevel@tonic-gate * 634*7c478bd9Sstevel@tonic-gate * @param device 635*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 636*7c478bd9Sstevel@tonic-gate * 637*7c478bd9Sstevel@tonic-gate * @param read 638*7c478bd9Sstevel@tonic-gate * RETURN: read strategy for mirror 639*7c478bd9Sstevel@tonic-gate * 640*7c478bd9Sstevel@tonic-gate * @return 0 641*7c478bd9Sstevel@tonic-gate * if successful 642*7c478bd9Sstevel@tonic-gate * 643*7c478bd9Sstevel@tonic-gate * @return non-zero 644*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 645*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 646*7c478bd9Sstevel@tonic-gate */ 647*7c478bd9Sstevel@tonic-gate extern int devconfig_get_mirror_read( 648*7c478bd9Sstevel@tonic-gate devconfig_t *mirror, mirror_read_strategy_t *read); 649*7c478bd9Sstevel@tonic-gate 650*7c478bd9Sstevel@tonic-gate /* 651*7c478bd9Sstevel@tonic-gate * Set the write strategy for mirror 652*7c478bd9Sstevel@tonic-gate * 653*7c478bd9Sstevel@tonic-gate * @param mirror 654*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the mirror to modify 655*7c478bd9Sstevel@tonic-gate * 656*7c478bd9Sstevel@tonic-gate * @param write 657*7c478bd9Sstevel@tonic-gate * the value to set as the write strategy for mirror 658*7c478bd9Sstevel@tonic-gate * 659*7c478bd9Sstevel@tonic-gate * @return 0 660*7c478bd9Sstevel@tonic-gate * if successful 661*7c478bd9Sstevel@tonic-gate * 662*7c478bd9Sstevel@tonic-gate * @return non-zero 663*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 664*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 665*7c478bd9Sstevel@tonic-gate */ 666*7c478bd9Sstevel@tonic-gate extern int devconfig_set_mirror_write( 667*7c478bd9Sstevel@tonic-gate devconfig_t *mirror, mirror_write_strategy_t write); 668*7c478bd9Sstevel@tonic-gate 669*7c478bd9Sstevel@tonic-gate /* 670*7c478bd9Sstevel@tonic-gate * Get write strategy for mirror 671*7c478bd9Sstevel@tonic-gate * 672*7c478bd9Sstevel@tonic-gate * @param device 673*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 674*7c478bd9Sstevel@tonic-gate * 675*7c478bd9Sstevel@tonic-gate * @param write 676*7c478bd9Sstevel@tonic-gate * RETURN: write strategy for mirror 677*7c478bd9Sstevel@tonic-gate * 678*7c478bd9Sstevel@tonic-gate * @return 0 679*7c478bd9Sstevel@tonic-gate * if successful 680*7c478bd9Sstevel@tonic-gate * 681*7c478bd9Sstevel@tonic-gate * @return non-zero 682*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 683*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 684*7c478bd9Sstevel@tonic-gate */ 685*7c478bd9Sstevel@tonic-gate extern int devconfig_get_mirror_write( 686*7c478bd9Sstevel@tonic-gate devconfig_t *mirror, mirror_write_strategy_t *write); 687*7c478bd9Sstevel@tonic-gate 688*7c478bd9Sstevel@tonic-gate /* 689*7c478bd9Sstevel@tonic-gate * Set the resync pass for mirror 690*7c478bd9Sstevel@tonic-gate * 691*7c478bd9Sstevel@tonic-gate * @param mirror 692*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the mirror to modify 693*7c478bd9Sstevel@tonic-gate * 694*7c478bd9Sstevel@tonic-gate * @param pass 695*7c478bd9Sstevel@tonic-gate * the value to set as the resync pass for mirror 696*7c478bd9Sstevel@tonic-gate * 697*7c478bd9Sstevel@tonic-gate * @return 0 698*7c478bd9Sstevel@tonic-gate * if successful 699*7c478bd9Sstevel@tonic-gate * 700*7c478bd9Sstevel@tonic-gate * @return non-zero 701*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 702*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 703*7c478bd9Sstevel@tonic-gate */ 704*7c478bd9Sstevel@tonic-gate extern int devconfig_set_mirror_pass(devconfig_t *mirror, uint16_t pass); 705*7c478bd9Sstevel@tonic-gate 706*7c478bd9Sstevel@tonic-gate /* 707*7c478bd9Sstevel@tonic-gate * Get resync pass for mirror 708*7c478bd9Sstevel@tonic-gate * 709*7c478bd9Sstevel@tonic-gate * @param device 710*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 711*7c478bd9Sstevel@tonic-gate * 712*7c478bd9Sstevel@tonic-gate * @param pass 713*7c478bd9Sstevel@tonic-gate * RETURN: resync pass for mirror 714*7c478bd9Sstevel@tonic-gate * 715*7c478bd9Sstevel@tonic-gate * @return 0 716*7c478bd9Sstevel@tonic-gate * if successful 717*7c478bd9Sstevel@tonic-gate * 718*7c478bd9Sstevel@tonic-gate * @return non-zero 719*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 720*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 721*7c478bd9Sstevel@tonic-gate */ 722*7c478bd9Sstevel@tonic-gate extern int devconfig_get_mirror_pass(devconfig_t *mirror, uint16_t *pass); 723*7c478bd9Sstevel@tonic-gate 724*7c478bd9Sstevel@tonic-gate /* 725*7c478bd9Sstevel@tonic-gate * Set the minimum number of components in stripe 726*7c478bd9Sstevel@tonic-gate * 727*7c478bd9Sstevel@tonic-gate * @param stripe 728*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the stripe to modify 729*7c478bd9Sstevel@tonic-gate * 730*7c478bd9Sstevel@tonic-gate * @param mincomp 731*7c478bd9Sstevel@tonic-gate * the value to set as the minimum number of components 732*7c478bd9Sstevel@tonic-gate * in stripe 733*7c478bd9Sstevel@tonic-gate * 734*7c478bd9Sstevel@tonic-gate * @return 0 735*7c478bd9Sstevel@tonic-gate * if successful 736*7c478bd9Sstevel@tonic-gate * 737*7c478bd9Sstevel@tonic-gate * @return non-zero 738*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 739*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 740*7c478bd9Sstevel@tonic-gate */ 741*7c478bd9Sstevel@tonic-gate extern int devconfig_set_stripe_mincomp(devconfig_t *stripe, uint16_t mincomp); 742*7c478bd9Sstevel@tonic-gate 743*7c478bd9Sstevel@tonic-gate /* 744*7c478bd9Sstevel@tonic-gate * Get minimum number of components in stripe 745*7c478bd9Sstevel@tonic-gate * 746*7c478bd9Sstevel@tonic-gate * @param device 747*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 748*7c478bd9Sstevel@tonic-gate * 749*7c478bd9Sstevel@tonic-gate * @param mincomp 750*7c478bd9Sstevel@tonic-gate * RETURN: minimum number of components in stripe 751*7c478bd9Sstevel@tonic-gate * 752*7c478bd9Sstevel@tonic-gate * @return 0 753*7c478bd9Sstevel@tonic-gate * if successful 754*7c478bd9Sstevel@tonic-gate * 755*7c478bd9Sstevel@tonic-gate * @return non-zero 756*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 757*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 758*7c478bd9Sstevel@tonic-gate */ 759*7c478bd9Sstevel@tonic-gate extern int devconfig_get_stripe_mincomp(devconfig_t *stripe, uint16_t *mincomp); 760*7c478bd9Sstevel@tonic-gate 761*7c478bd9Sstevel@tonic-gate /* 762*7c478bd9Sstevel@tonic-gate * Set the maximum number of components in stripe 763*7c478bd9Sstevel@tonic-gate * 764*7c478bd9Sstevel@tonic-gate * @param stripe 765*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the stripe to modify 766*7c478bd9Sstevel@tonic-gate * 767*7c478bd9Sstevel@tonic-gate * @param maxcomp 768*7c478bd9Sstevel@tonic-gate * the value to set as the maximum number of components 769*7c478bd9Sstevel@tonic-gate * in stripe 770*7c478bd9Sstevel@tonic-gate * 771*7c478bd9Sstevel@tonic-gate * @return 0 772*7c478bd9Sstevel@tonic-gate * if successful 773*7c478bd9Sstevel@tonic-gate * 774*7c478bd9Sstevel@tonic-gate * @return non-zero 775*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 776*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 777*7c478bd9Sstevel@tonic-gate */ 778*7c478bd9Sstevel@tonic-gate extern int devconfig_set_stripe_maxcomp(devconfig_t *stripe, uint16_t maxcomp); 779*7c478bd9Sstevel@tonic-gate 780*7c478bd9Sstevel@tonic-gate /* 781*7c478bd9Sstevel@tonic-gate * Get maximum number of components in stripe 782*7c478bd9Sstevel@tonic-gate * 783*7c478bd9Sstevel@tonic-gate * @param device 784*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 785*7c478bd9Sstevel@tonic-gate * 786*7c478bd9Sstevel@tonic-gate * @param maxcomp 787*7c478bd9Sstevel@tonic-gate * RETURN: maximum number of components in stripe 788*7c478bd9Sstevel@tonic-gate * 789*7c478bd9Sstevel@tonic-gate * @return 0 790*7c478bd9Sstevel@tonic-gate * if successful 791*7c478bd9Sstevel@tonic-gate * 792*7c478bd9Sstevel@tonic-gate * @return non-zero 793*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 794*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 795*7c478bd9Sstevel@tonic-gate */ 796*7c478bd9Sstevel@tonic-gate extern int devconfig_get_stripe_maxcomp(devconfig_t *stripe, uint16_t *maxcomp); 797*7c478bd9Sstevel@tonic-gate 798*7c478bd9Sstevel@tonic-gate /* 799*7c478bd9Sstevel@tonic-gate * Set the stripe interlace 800*7c478bd9Sstevel@tonic-gate * 801*7c478bd9Sstevel@tonic-gate * @param stripe 802*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the stripe to modify 803*7c478bd9Sstevel@tonic-gate * 804*7c478bd9Sstevel@tonic-gate * @param interlace 805*7c478bd9Sstevel@tonic-gate * the value to set as the stripe interlace 806*7c478bd9Sstevel@tonic-gate * 807*7c478bd9Sstevel@tonic-gate * @return 0 808*7c478bd9Sstevel@tonic-gate * if successful 809*7c478bd9Sstevel@tonic-gate * 810*7c478bd9Sstevel@tonic-gate * @return non-zero 811*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 812*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 813*7c478bd9Sstevel@tonic-gate */ 814*7c478bd9Sstevel@tonic-gate extern int devconfig_set_stripe_interlace( 815*7c478bd9Sstevel@tonic-gate devconfig_t *stripe, uint64_t interlace); 816*7c478bd9Sstevel@tonic-gate 817*7c478bd9Sstevel@tonic-gate /* 818*7c478bd9Sstevel@tonic-gate * Get stripe interlace 819*7c478bd9Sstevel@tonic-gate * 820*7c478bd9Sstevel@tonic-gate * @param device 821*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 822*7c478bd9Sstevel@tonic-gate * 823*7c478bd9Sstevel@tonic-gate * @param interlace 824*7c478bd9Sstevel@tonic-gate * RETURN: stripe interlace 825*7c478bd9Sstevel@tonic-gate * 826*7c478bd9Sstevel@tonic-gate * @return 0 827*7c478bd9Sstevel@tonic-gate * if successful 828*7c478bd9Sstevel@tonic-gate * 829*7c478bd9Sstevel@tonic-gate * @return non-zero 830*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 831*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 832*7c478bd9Sstevel@tonic-gate */ 833*7c478bd9Sstevel@tonic-gate extern int devconfig_get_stripe_interlace( 834*7c478bd9Sstevel@tonic-gate devconfig_t *stripe, uint64_t *interlace); 835*7c478bd9Sstevel@tonic-gate 836*7c478bd9Sstevel@tonic-gate /* 837*7c478bd9Sstevel@tonic-gate * Set the redundancy level for a volume. 838*7c478bd9Sstevel@tonic-gate * 839*7c478bd9Sstevel@tonic-gate * @param volume 840*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the volume to modify 841*7c478bd9Sstevel@tonic-gate * 842*7c478bd9Sstevel@tonic-gate * @param rlevel 843*7c478bd9Sstevel@tonic-gate * If 0, a stripe will be created. If > 0, a mirror with 844*7c478bd9Sstevel@tonic-gate * this number of submirrors will be created. 845*7c478bd9Sstevel@tonic-gate * 846*7c478bd9Sstevel@tonic-gate * @return 0 847*7c478bd9Sstevel@tonic-gate * if successful 848*7c478bd9Sstevel@tonic-gate * 849*7c478bd9Sstevel@tonic-gate * @return non-zero 850*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 851*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 852*7c478bd9Sstevel@tonic-gate */ 853*7c478bd9Sstevel@tonic-gate extern int devconfig_set_volume_redundancy_level( 854*7c478bd9Sstevel@tonic-gate devconfig_t *volume, uint16_t rlevel); 855*7c478bd9Sstevel@tonic-gate 856*7c478bd9Sstevel@tonic-gate /* 857*7c478bd9Sstevel@tonic-gate * Get the redundancy level for a volume. 858*7c478bd9Sstevel@tonic-gate * 859*7c478bd9Sstevel@tonic-gate * @param device 860*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 861*7c478bd9Sstevel@tonic-gate * 862*7c478bd9Sstevel@tonic-gate * @param rlevel 863*7c478bd9Sstevel@tonic-gate * RETURN: the redundancy level for a volume 864*7c478bd9Sstevel@tonic-gate * 865*7c478bd9Sstevel@tonic-gate * @return 0 866*7c478bd9Sstevel@tonic-gate * if successful 867*7c478bd9Sstevel@tonic-gate * 868*7c478bd9Sstevel@tonic-gate * @return non-zero 869*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 870*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 871*7c478bd9Sstevel@tonic-gate */ 872*7c478bd9Sstevel@tonic-gate extern int devconfig_get_volume_redundancy_level( 873*7c478bd9Sstevel@tonic-gate devconfig_t *volume, uint16_t *rlevel); 874*7c478bd9Sstevel@tonic-gate 875*7c478bd9Sstevel@tonic-gate /* 876*7c478bd9Sstevel@tonic-gate * Set the number of paths in volume 877*7c478bd9Sstevel@tonic-gate * 878*7c478bd9Sstevel@tonic-gate * @param volume 879*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the volume to modify 880*7c478bd9Sstevel@tonic-gate * 881*7c478bd9Sstevel@tonic-gate * @param npaths 882*7c478bd9Sstevel@tonic-gate * the value to set as the number of paths in volume 883*7c478bd9Sstevel@tonic-gate * 884*7c478bd9Sstevel@tonic-gate * @return 0 885*7c478bd9Sstevel@tonic-gate * if successful 886*7c478bd9Sstevel@tonic-gate * 887*7c478bd9Sstevel@tonic-gate * @return non-zero 888*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 889*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 890*7c478bd9Sstevel@tonic-gate */ 891*7c478bd9Sstevel@tonic-gate extern int devconfig_set_volume_npaths(devconfig_t *volume, uint16_t npaths); 892*7c478bd9Sstevel@tonic-gate 893*7c478bd9Sstevel@tonic-gate /* 894*7c478bd9Sstevel@tonic-gate * Get number of paths in volume 895*7c478bd9Sstevel@tonic-gate * 896*7c478bd9Sstevel@tonic-gate * @param device 897*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 898*7c478bd9Sstevel@tonic-gate * 899*7c478bd9Sstevel@tonic-gate * @param npaths 900*7c478bd9Sstevel@tonic-gate * RETURN: number of paths in volume 901*7c478bd9Sstevel@tonic-gate * 902*7c478bd9Sstevel@tonic-gate * @return 0 903*7c478bd9Sstevel@tonic-gate * if successful 904*7c478bd9Sstevel@tonic-gate * 905*7c478bd9Sstevel@tonic-gate * @return non-zero 906*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 907*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 908*7c478bd9Sstevel@tonic-gate */ 909*7c478bd9Sstevel@tonic-gate extern int devconfig_get_volume_npaths(devconfig_t *volume, uint16_t *npaths); 910*7c478bd9Sstevel@tonic-gate 911*7c478bd9Sstevel@tonic-gate /* 912*7c478bd9Sstevel@tonic-gate * Set the HSP creation option (for volume, stripe, concat, mirror) 913*7c478bd9Sstevel@tonic-gate * 914*7c478bd9Sstevel@tonic-gate * @param volume 915*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the volume to modify 916*7c478bd9Sstevel@tonic-gate * 917*7c478bd9Sstevel@tonic-gate * @param usehsp 918*7c478bd9Sstevel@tonic-gate * the value to set as the HSP creation option 919*7c478bd9Sstevel@tonic-gate * 920*7c478bd9Sstevel@tonic-gate * @return 0 921*7c478bd9Sstevel@tonic-gate * if successful 922*7c478bd9Sstevel@tonic-gate * 923*7c478bd9Sstevel@tonic-gate * @return non-zero 924*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 925*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 926*7c478bd9Sstevel@tonic-gate */ 927*7c478bd9Sstevel@tonic-gate extern int devconfig_set_volume_usehsp(devconfig_t *volume, boolean_t usehsp); 928*7c478bd9Sstevel@tonic-gate 929*7c478bd9Sstevel@tonic-gate /* 930*7c478bd9Sstevel@tonic-gate * Get HSP creation option (for volume, stripe, concat, mirror) 931*7c478bd9Sstevel@tonic-gate * 932*7c478bd9Sstevel@tonic-gate * @param device 933*7c478bd9Sstevel@tonic-gate * a devconfig_t representing the device to examine 934*7c478bd9Sstevel@tonic-gate * 935*7c478bd9Sstevel@tonic-gate * @param usehsp 936*7c478bd9Sstevel@tonic-gate * RETURN: HSP creation option (for volume, stripe, 937*7c478bd9Sstevel@tonic-gate * concat, mirror) 938*7c478bd9Sstevel@tonic-gate * 939*7c478bd9Sstevel@tonic-gate * @return 0 940*7c478bd9Sstevel@tonic-gate * if successful 941*7c478bd9Sstevel@tonic-gate * 942*7c478bd9Sstevel@tonic-gate * @return non-zero 943*7c478bd9Sstevel@tonic-gate * if an error occurred. Use get_error_string() to 944*7c478bd9Sstevel@tonic-gate * retrieve the associated error message. 945*7c478bd9Sstevel@tonic-gate */ 946*7c478bd9Sstevel@tonic-gate extern int devconfig_get_volume_usehsp(devconfig_t *volume, boolean_t *usehsp); 947*7c478bd9Sstevel@tonic-gate 948*7c478bd9Sstevel@tonic-gate /* 949*7c478bd9Sstevel@tonic-gate * Get the string representation of the volume's type 950*7c478bd9Sstevel@tonic-gate * 951*7c478bd9Sstevel@tonic-gate * @param type 952*7c478bd9Sstevel@tonic-gate * a valid component_type_t 953*7c478bd9Sstevel@tonic-gate * 954*7c478bd9Sstevel@tonic-gate * @return an internationalized string representing the given 955*7c478bd9Sstevel@tonic-gate * type 956*7c478bd9Sstevel@tonic-gate */ 957*7c478bd9Sstevel@tonic-gate extern char *devconfig_type_to_str(component_type_t type); 958*7c478bd9Sstevel@tonic-gate 959*7c478bd9Sstevel@tonic-gate /* 960*7c478bd9Sstevel@tonic-gate * Get the string representation of the mirror's read strategy 961*7c478bd9Sstevel@tonic-gate * 962*7c478bd9Sstevel@tonic-gate * @param read 963*7c478bd9Sstevel@tonic-gate * a valid mirror_read_strategy_t 964*7c478bd9Sstevel@tonic-gate * 965*7c478bd9Sstevel@tonic-gate * @return an internationalized string representing the given 966*7c478bd9Sstevel@tonic-gate * read strategy 967*7c478bd9Sstevel@tonic-gate */ 968*7c478bd9Sstevel@tonic-gate extern char *devconfig_read_strategy_to_str(mirror_read_strategy_t read); 969*7c478bd9Sstevel@tonic-gate 970*7c478bd9Sstevel@tonic-gate /* 971*7c478bd9Sstevel@tonic-gate * Get the string representation of the mirror's write strategy 972*7c478bd9Sstevel@tonic-gate * 973*7c478bd9Sstevel@tonic-gate * @param write 974*7c478bd9Sstevel@tonic-gate * a valid mirror_write_strategy_t 975*7c478bd9Sstevel@tonic-gate * 976*7c478bd9Sstevel@tonic-gate * @return an internationalized string representing the given 977*7c478bd9Sstevel@tonic-gate * write strategy 978*7c478bd9Sstevel@tonic-gate */ 979*7c478bd9Sstevel@tonic-gate extern char *devconfig_write_strategy_to_str(mirror_write_strategy_t write); 980*7c478bd9Sstevel@tonic-gate 981*7c478bd9Sstevel@tonic-gate #ifdef DEBUG 982*7c478bd9Sstevel@tonic-gate /* 983*7c478bd9Sstevel@tonic-gate * Dump the contents of a devconfig_t struct to stdout. 984*7c478bd9Sstevel@tonic-gate * 985*7c478bd9Sstevel@tonic-gate * @param device 986*7c478bd9Sstevel@tonic-gate * the devconfig_t to examine 987*7c478bd9Sstevel@tonic-gate * 988*7c478bd9Sstevel@tonic-gate * @param prefix 989*7c478bd9Sstevel@tonic-gate * a prefix string to print before each line 990*7c478bd9Sstevel@tonic-gate */ 991*7c478bd9Sstevel@tonic-gate extern void devconfig_dump(devconfig_t *device, char *prefix); 992*7c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 993*7c478bd9Sstevel@tonic-gate 994*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 995*7c478bd9Sstevel@tonic-gate } 996*7c478bd9Sstevel@tonic-gate #endif 997*7c478bd9Sstevel@tonic-gate 998*7c478bd9Sstevel@tonic-gate #endif /* _VOLUME_DEVCONFIG_H */ 999