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 _LAYOUT_SLICE_H 28*0Sstevel@tonic-gate #define _LAYOUT_SLICE_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 "libdiskmgt.h" 37*0Sstevel@tonic-gate #include "volume_devconfig.h" 38*0Sstevel@tonic-gate #include "volume_dlist.h" 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate /* 41*0Sstevel@tonic-gate * struct to track which slices need to be explicitly "removed" from 42*0Sstevel@tonic-gate * the system before applying any metassist updates/changes. 43*0Sstevel@tonic-gate */ 44*0Sstevel@tonic-gate typedef struct { 45*0Sstevel@tonic-gate char *slice_name; 46*0Sstevel@tonic-gate uint32_t slice_index; 47*0Sstevel@tonic-gate } rmvdslice_t; 48*0Sstevel@tonic-gate 49*0Sstevel@tonic-gate extern void release_slices_to_remove(); 50*0Sstevel@tonic-gate extern dlist_t *get_slices_to_remove(); 51*0Sstevel@tonic-gate extern int add_slice_to_remove(char *name, uint32_t index); 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate /* 54*0Sstevel@tonic-gate * struct to track which slices have been explicitly modified 55*0Sstevel@tonic-gate * during the layout process... 56*0Sstevel@tonic-gate * 57*0Sstevel@tonic-gate * src_slice_desc is the dm_descriptor_t of the slice which provided the 58*0Sstevel@tonic-gate * space (this is only relevant to slices that have been created by 59*0Sstevel@tonic-gate * taking space from some other "source" slice). 60*0Sstevel@tonic-gate * slice_devconfig is the devconfig_t struct with the modified slice properties. 61*0Sstevel@tonic-gate * times_modified is the number of times the slice has been modified 62*0Sstevel@tonic-gate * (this is only relevant to slices that have been resized to 63*0Sstevel@tonic-gate * provide space for new slices) 64*0Sstevel@tonic-gate * volume_component is used to control when the slice_devcfg is freed. 65*0Sstevel@tonic-gate * if volume_component is B_TRUE, the devconfig is returned as part 66*0Sstevel@tonic-gate * of the result of layout and so cannot be freed by 67*0Sstevel@tonic-gate * release_modified_slices. 68*0Sstevel@tonic-gate */ 69*0Sstevel@tonic-gate typedef struct { 70*0Sstevel@tonic-gate dm_descriptor_t src_slice_desc; 71*0Sstevel@tonic-gate devconfig_t *slice_devcfg; 72*0Sstevel@tonic-gate int times_modified; 73*0Sstevel@tonic-gate boolean_t volume_component; 74*0Sstevel@tonic-gate } modslice_t; 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate extern dlist_t *get_modified_slices(); 77*0Sstevel@tonic-gate extern int release_modified_slices(); 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate extern int make_slicename_for_diskname_and_index( 80*0Sstevel@tonic-gate char *diskname, 81*0Sstevel@tonic-gate uint16_t index, 82*0Sstevel@tonic-gate char **slicename); 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate extern int assemble_modified_slice( 85*0Sstevel@tonic-gate dm_descriptor_t src_slice_desc, 86*0Sstevel@tonic-gate char *mod_name, 87*0Sstevel@tonic-gate uint32_t mod_index, 88*0Sstevel@tonic-gate uint64_t mod_stblk, 89*0Sstevel@tonic-gate uint64_t mod_nblks, 90*0Sstevel@tonic-gate uint64_t mod_size, 91*0Sstevel@tonic-gate devconfig_t **mod_slice); 92*0Sstevel@tonic-gate 93*0Sstevel@tonic-gate extern int choose_slice( 94*0Sstevel@tonic-gate uint64_t nbytes, 95*0Sstevel@tonic-gate uint16_t npaths, 96*0Sstevel@tonic-gate dlist_t *slices, 97*0Sstevel@tonic-gate dlist_t *used, 98*0Sstevel@tonic-gate dlist_t *used_hbas, 99*0Sstevel@tonic-gate dlist_t *used_disks, 100*0Sstevel@tonic-gate boolean_t unused_disk, 101*0Sstevel@tonic-gate boolean_t nbytes_is_min, 102*0Sstevel@tonic-gate boolean_t add_extra_cyl, 103*0Sstevel@tonic-gate devconfig_t **chosen); 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate extern int create_devconfig_for_slice( 106*0Sstevel@tonic-gate dm_descriptor_t slice, 107*0Sstevel@tonic-gate devconfig_t **newslice); 108*0Sstevel@tonic-gate 109*0Sstevel@tonic-gate extern int destroy_new_slice( 110*0Sstevel@tonic-gate devconfig_t *vol); 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate /* 113*0Sstevel@tonic-gate * accessors for the list of used slice names for named diskset. 114*0Sstevel@tonic-gate */ 115*0Sstevel@tonic-gate extern int is_used_slice(dm_descriptor_t slice, boolean_t *is_used); 116*0Sstevel@tonic-gate extern int add_used_slice_by_name(char *slicename); 117*0Sstevel@tonic-gate extern int remove_used_slice_by_name(char *slicename); 118*0Sstevel@tonic-gate extern int add_used_slice(dm_descriptor_t slice); 119*0Sstevel@tonic-gate extern void release_used_slices(); 120*0Sstevel@tonic-gate extern int disk_has_used_slice(dm_descriptor_t disk, boolean_t *inuse); 121*0Sstevel@tonic-gate 122*0Sstevel@tonic-gate /* 123*0Sstevel@tonic-gate * accessors to track slices reserved for use in explicit 124*0Sstevel@tonic-gate * volume requests 125*0Sstevel@tonic-gate */ 126*0Sstevel@tonic-gate extern int add_reserved_slice(dm_descriptor_t slice); 127*0Sstevel@tonic-gate extern int is_reserved_slice(dm_descriptor_t slice, boolean_t *is_rsvd); 128*0Sstevel@tonic-gate extern int get_reserved_slices(dlist_t **list); 129*0Sstevel@tonic-gate extern void release_reserved_slices(); 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate #ifdef __cplusplus 132*0Sstevel@tonic-gate } 133*0Sstevel@tonic-gate #endif 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate #endif /* _LAYOUT_SLICE_H */ 136