summaryrefslogtreecommitdiff
path: root/usr/src/cmd/lvm/metassist/common/volume_devconfig.h
blob: 3898554591bd10171438004c18f5aa81df40cc6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_VOLUME_DEVCONFIG_H
#define	_VOLUME_DEVCONFIG_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef __cplusplus
extern "C" {
#endif

#include <libnvpair.h>
#include "volume_dlist.h"
#include <sys/lvm/md_mdiox.h>

/*
 * String constants for XML element/attribute names.
 */
#define	ELEMENT_AVAILABLE		"available"
#define	ELEMENT_COMMENT			"comment"
#define	ELEMENT_CONCAT			"concat"
#define	ELEMENT_DISK			"disk"
#define	ELEMENT_DISKSET			"diskset"
#define	ELEMENT_HSP			"hsp"
#define	ELEMENT_L10N			"localization"
#define	ELEMENT_MESSAGE			"message"
#define	ELEMENT_MIRROR			"mirror"
#define	ELEMENT_PARAM			"param"
#define	ELEMENT_SLICE			"slice"
#define	ELEMENT_STRIPE			"stripe"
#define	ELEMENT_TEXT			"text"
#define	ELEMENT_UNAVAILABLE		"unavailable"
#define	ELEMENT_VARIABLE		"variable"
#define	ELEMENT_VOLUME			"volume"
#define	ELEMENT_VOLUMECONFIG		"volume-config"
#define	ELEMENT_VOLUMEDEFAULTS		"volume-defaults"
#define	ELEMENT_VOLUMEREQUEST		"volume-request"

#define	ATTR_LANG			"xml:lang"
#define	ATTR_MESSAGEID			"msgid"
#define	ATTR_MIRROR_NSUBMIRRORS		"nsubmirrors"
#define	ATTR_MIRROR_PASSNUM		"passnum"
#define	ATTR_MIRROR_READ		"read"
#define	ATTR_MIRROR_WRITE		"write"
#define	ATTR_NAME			"name"
#define	ATTR_SELECT			"select"
#define	ATTR_SIZEINBLOCKS		"sizeinblocks"
#define	ATTR_SIZEINBYTES		"size"
#define	ATTR_SLICE_INDEX		"index"
#define	ATTR_SLICE_STARTSECTOR		"startsector"
#define	ATTR_STRIPE_INTERLACE		"interlace"
#define	ATTR_STRIPE_MAXCOMP		"maxcomp"
#define	ATTR_STRIPE_MINCOMP		"mincomp"
#define	ATTR_TYPE			"type"
#define	ATTR_VOLUME_CREATE		"create"
#define	ATTR_VOLUME_DATAPATHS		"datapaths"
#define	ATTR_VOLUME_FAULTRECOVERY	"faultrecovery"
#define	ATTR_VOLUME_REDUNDANCY		"redundancy"
#define	ATTR_VOLUME_USEHSP		"usehsp"

#define	NAME_L10N_MESSAGE_FILE		"msgfile"
#define	NAME_LANG			"lang"

/*
 * Limits for attributes
 */
#define	MIN_NSTRIPE_COMP	1
#define	MIN_SIZE		0
#define	MIN_SIZE_IN_BLOCKS	0
#define	MIN_NDATAPATHS		1
#define	MAX_NDATAPATHS		4

/* Attribute requested but not set */
#define	ERR_ATTR_UNSET	-10001

/*
 * Enumeration defining physical or logical device types
 */
typedef enum {
	TYPE_UNKNOWN = 0,
	TYPE_CONCAT = 1,
	TYPE_CONTROLLER,
	TYPE_DISKSET,
	TYPE_DRIVE,
	TYPE_EXTENT,
	TYPE_HOST,
	TYPE_HSP,
	TYPE_MIRROR,
	TYPE_RAID5,
	TYPE_SLICE,
	TYPE_SOFTPART,
	TYPE_STRIPE,
	TYPE_TRANS,
	TYPE_VOLUME
} component_type_t;

/*
 * enumerated constants for SVM Mirror read strategies
 */
typedef enum {
	MIRROR_READ_ROUNDROBIN = 0,
	MIRROR_READ_GEOMETRIC,
	MIRROR_READ_FIRST
} mirror_read_strategy_t;

/*
 * enumerated constants for SVM Mirror write strategies
 */
typedef enum {
	MIRROR_WRITE_PARALLEL = 0,
	MIRROR_WRITE_SERIAL
} mirror_write_strategy_t;

/*
 * devconfig_t - struct to hold a device configuration hierarchy
 */
typedef struct devconfig {

	/* Attributes of this device */
	nvlist_t *attributes;

	/*
	 * Available devices for use in construction of this device
	 * and its subcomponents
	 */
	char **available;

	/*
	 * Unavailable devices for use in construction of this device
	 * and its subcomponents
	 */
	char **unavailable;

	/*
	 * Subcomponents (devconfig_t) of this device
	 */
	dlist_t *components;
} devconfig_t;

/*
 * Function prototypes
 */

/*
 * Constructor: Create a devconfig_t struct.  This devconfig_t must be
 * freed with free_devconfig().
 *
 * @param       devconfig
 *              RETURN: a new devconfig_t
 *
 * @param       type
 *              the type of devconfig_t to create
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int new_devconfig(devconfig_t **devconfig, component_type_t type);

/*
 * Free memory (recursively) allocated to a devconfig_t struct
 *
 * @param       arg
 *              pointer to the devconfig_t to be freed
 */
extern void free_devconfig(void *arg);

/*
 * Check the type of the given device.
 *
 * @param       device
 *              the device whose type to check
 *
 * @param       type
 *              the type of the device against which to compare
 *
 * @return      B_TRUE if the device is of the given type, B_FALSE
 *              otherwise
 */
extern boolean_t devconfig_isA(devconfig_t *device, component_type_t type);

/*
 * Get the first component of the given type from the given
 * devconfig_t.  Create the component if create is B_TRUE.
 *
 * @return      ENOENT
 *              if the requested component does not exist and its
 *              creation was not requested
 *
 * @return      0
 *              if the requested component exists or was created
 *
 * @return      non-zero
 *              if the requested component did not exist and could not
 *              be created
 */
extern int devconfig_get_component(devconfig_t *device,
	component_type_t type, devconfig_t **component, boolean_t create);

/*
 * Set the available devices for use in creating this device
 *
 * @param       device
 *              a devconfig_t representing the device to modify
 *
 * @param       available
 *              A NULL-terminated array of device names
 */
extern void devconfig_set_available(devconfig_t *device, char **available);

/*
 * Get the available devices for use in creating this device
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @return      available
 *              A NULL-terminated array of device names
 */
extern char ** devconfig_get_available(devconfig_t *device);

/*
 * Set the unavailable devices which may not be used in creating this
 * device
 *
 * @param       device
 *              a devconfig_t representing the device to modify
 *
 * @param       available
 *              A NULL-terminated array of device names
 */
extern void devconfig_set_unavailable(devconfig_t *device, char **unavailable);

/*
 * Get the unavailable devices for use in creating this device
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @return      unavailable
 *              A NULL-terminated array of device names
 */
extern char ** devconfig_get_unavailable(devconfig_t *device);

/*
 * Set the subcomponent devices of a given device
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       components
 *              A dlist_t containing devconfig_t devices
 */
extern void devconfig_set_components(devconfig_t *device, dlist_t *components);

/*
 * Get the subcomponent devices of a given device
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @return      A dlist_t containing devconfig_t devices
 */
extern dlist_t *devconfig_get_components(devconfig_t *device);

/*
 * Set the device name
 *
 * @param       device
 *              a devconfig_t representing the device to modify
 *
 * @param       name
 *              the value to set as the device name
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_name(devconfig_t *device, char *name);

/*
 * Set the disk set name
 *
 * @param       diskset
 *              a devconfig_t representing the diskset to modify
 *
 * @param       name
 *              the value to set as the device name
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_diskset_name(devconfig_t *diskset, char *name);

/*
 * Set the device name
 *
 * @param       hsp
 *              a devconfig_t representing the hsp to modify
 *
 * @param       name
 *              the value to set as the device name
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_hsp_name(devconfig_t *hsp, char *name);

/*
 * Set the device name
 *
 * @param       volume
 *              a devconfig_t representing the volume to modify
 *
 * @param       name
 *              the value to set as the device name
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_volume_name(devconfig_t *volume, char *name);

/*
 * Get the device name
 *
 * @param       volume
 *              a devconfig_t representing the volume to examine
 *
 * @param       name
 *              RETURN: the device name
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_name(devconfig_t *device, char **name);

/*
 * Set the device type
 *
 * @param       device
 *              a devconfig_t representing the device to modify
 *
 * @param       type
 *              the value to set as the device type
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_type(devconfig_t *device, component_type_t type);

/*
 * Get the device type
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       type
 *              RETURN: the device type
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_type(devconfig_t *device, component_type_t *type);

/*
 * Set the device size (for volume, mirror, stripe, concat) in bytes
 *
 * Note that size in bytes in a 64-bit field cannot hold the size that
 * can be accessed in a 16 byte CDB.  Since CDBs operate on blocks,
 * the max capacity is 2^73 bytes with 512 byte blocks.
 *
 * @param       device
 *              a devconfig_t representing the device to modify
 *
 * @param       size_in_bytes
 *              the value to set as the device size in bytes
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_size(devconfig_t *device, uint64_t size_in_bytes);

/*
 * Get the device size (for volume, mirror, stripe, concat) in bytes
 *
 * Note that size in bytes in a 64-bit field cannot hold the size that
 * can be accessed in a 16 byte CDB.  Since CDBs operate on blocks,
 * the max capacity is 2^73 bytes with 512 byte blocks.
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       size_in_bytes
 *              RETURN: the device size in bytes
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_size(devconfig_t *device, uint64_t *size_in_bytes);

/*
 * Set the device size in blocks
 *
 * @param       device
 *              a devconfig_t representing the device to modify
 *
 * @param       type
 *              the value to set as the device size in blocks
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_size_in_blocks(
	devconfig_t *device, uint64_t size_in_blocks);

/*
 * Get the device size in blocks
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       size_in_blocks
 *              RETURN: the device size in blocks
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_size_in_blocks(
	devconfig_t *device, uint64_t *size_in_blocks);

/*
 * Set the the slice index
 *
 * @param       slice
 *              a devconfig_t representing the slice to modify
 *
 * @param       index
 *              the value to set as the the slice index
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_slice_index(devconfig_t *slice, uint16_t index);

/*
 * Get the slice index
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       index
 *              RETURN: the slice index
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_slice_index(devconfig_t *slice, uint16_t *index);

/*
 * Set the the slice start block
 *
 * @param       slice
 *              a devconfig_t representing the slice to modify
 *
 * @param       start_block
 *              the value to set as the the slice start block
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_slice_start_block(
	devconfig_t *slice, uint64_t start_block);

/*
 * Get the slice start block
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       start_block
 *              RETURN: the slice start block
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_slice_start_block(
	devconfig_t *slice, uint64_t *start_block);

/*
 * Set the number of subcomponents in mirror
 *
 * @param       mirror
 *              a devconfig_t representing the mirror to modify
 *
 * @param       nsubs
 *              the value to set as the number of subcomponents in
 *              mirror
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_mirror_nsubs(devconfig_t *mirror, uint16_t nsubs);

/*
 * Get number of subcomponents in mirror
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       nsubs
 *              RETURN: number of subcomponents in mirror
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_mirror_nsubs(devconfig_t *mirror, uint16_t *nsubs);

/*
 * Set the read strategy for mirror
 *
 * @param       mirror
 *              a devconfig_t representing the mirror to modify
 *
 * @param       read
 *              the value to set as the read strategy for mirror
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_mirror_read(
	devconfig_t *mirror, mirror_read_strategy_t read);

/*
 * Get read strategy for mirror
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       read
 *              RETURN: read strategy for mirror
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_mirror_read(
	devconfig_t *mirror, mirror_read_strategy_t *read);

/*
 * Set the write strategy for mirror
 *
 * @param       mirror
 *              a devconfig_t representing the mirror to modify
 *
 * @param       write
 *              the value to set as the write strategy for mirror
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_mirror_write(
	devconfig_t *mirror, mirror_write_strategy_t write);

/*
 * Get write strategy for mirror
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       write
 *              RETURN: write strategy for mirror
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_mirror_write(
	devconfig_t *mirror, mirror_write_strategy_t *write);

/*
 * Set the resync pass for mirror
 *
 * @param       mirror
 *              a devconfig_t representing the mirror to modify
 *
 * @param       pass
 *              the value to set as the resync pass for mirror
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_mirror_pass(devconfig_t *mirror, uint16_t pass);

/*
 * Get resync pass for mirror
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       pass
 *              RETURN: resync pass for mirror
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_mirror_pass(devconfig_t *mirror, uint16_t *pass);

/*
 * Set the minimum number of components in stripe
 *
 * @param       stripe
 *              a devconfig_t representing the stripe to modify
 *
 * @param       mincomp
 *              the value to set as the minimum number of components
 *              in stripe
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_stripe_mincomp(devconfig_t *stripe, uint16_t mincomp);

/*
 * Get minimum number of components in stripe
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       mincomp
 *              RETURN: minimum number of components in stripe
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_stripe_mincomp(devconfig_t *stripe, uint16_t *mincomp);

/*
 * Set the maximum number of components in stripe
 *
 * @param       stripe
 *              a devconfig_t representing the stripe to modify
 *
 * @param       maxcomp
 *              the value to set as the maximum number of components
 *              in stripe
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_stripe_maxcomp(devconfig_t *stripe, uint16_t maxcomp);

/*
 * Get maximum number of components in stripe
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       maxcomp
 *              RETURN: maximum number of components in stripe
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_stripe_maxcomp(devconfig_t *stripe, uint16_t *maxcomp);

/*
 * Set the stripe interlace
 *
 * @param       stripe
 *              a devconfig_t representing the stripe to modify
 *
 * @param       interlace
 *              the value to set as the stripe interlace
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_stripe_interlace(
	devconfig_t *stripe, uint64_t interlace);

/*
 * Get stripe interlace
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       interlace
 *              RETURN: stripe interlace
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_stripe_interlace(
	devconfig_t *stripe, uint64_t *interlace);

/*
 * Set the redundancy level for a volume.
 *
 * @param       volume
 *              a devconfig_t representing the volume to modify
 *
 * @param       rlevel
 *              If 0, a stripe will be created.  If > 0, a mirror with
 *              this number of submirrors will be created.
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_volume_redundancy_level(
	devconfig_t *volume, uint16_t rlevel);

/*
 * Get the redundancy level for a volume.
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       rlevel
 *              RETURN: the redundancy level for a volume
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_volume_redundancy_level(
	devconfig_t *volume, uint16_t *rlevel);

/*
 * Set the number of paths in volume
 *
 * @param       volume
 *              a devconfig_t representing the volume to modify
 *
 * @param       npaths
 *              the value to set as the number of paths in volume
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_volume_npaths(devconfig_t *volume, uint16_t npaths);

/*
 * Get number of paths in volume
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       npaths
 *              RETURN: number of paths in volume
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_volume_npaths(devconfig_t *volume, uint16_t *npaths);

/*
 * Set the HSP creation option (for volume, stripe, concat, mirror)
 *
 * @param       volume
 *              a devconfig_t representing the volume to modify
 *
 * @param       usehsp
 *              the value to set as the HSP creation option
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_set_volume_usehsp(devconfig_t *volume, boolean_t usehsp);

/*
 * Get HSP creation option (for volume, stripe, concat, mirror)
 *
 * @param       device
 *              a devconfig_t representing the device to examine
 *
 * @param       usehsp
 *              RETURN: HSP creation option (for volume, stripe,
 *              concat, mirror)
 *
 * @return      0
 *              if successful
 *
 * @return      non-zero
 *              if an error occurred.  Use get_error_string() to
 *              retrieve the associated error message.
 */
extern int devconfig_get_volume_usehsp(devconfig_t *volume, boolean_t *usehsp);

/*
 * Get the string representation of the volume's type
 *
 * @param       type
 *              a valid component_type_t
 *
 * @return      an internationalized string representing the given
 *              type
 */
extern char *devconfig_type_to_str(component_type_t type);

/*
 * Get the string representation of the mirror's read strategy
 *
 * @param       read
 *              a valid mirror_read_strategy_t
 *
 * @return      an internationalized string representing the given
 *              read strategy
 */
extern char *devconfig_read_strategy_to_str(mirror_read_strategy_t read);

/*
 * Get the string representation of the mirror's write strategy
 *
 * @param       write
 *              a valid mirror_write_strategy_t
 *
 * @return      an internationalized string representing the given
 *              write strategy
 */
extern char *devconfig_write_strategy_to_str(mirror_write_strategy_t write);

#ifdef DEBUG
/*
 * Dump the contents of a devconfig_t struct to stdout.
 *
 * @param       device
 *              the devconfig_t to examine
 *
 * @param       prefix
 *              a prefix string to print before each line
 */
extern void devconfig_dump(devconfig_t *device, char *prefix);
#endif /* DEBUG */

#ifdef __cplusplus
}
#endif

#endif /* _VOLUME_DEVCONFIG_H */