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