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_DEVICE_UTIL_H 28*0Sstevel@tonic-gate #define _LAYOUT_DEVICE_UTIL_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 38*0Sstevel@tonic-gate extern boolean_t is_alt_slice_name(char *name); 39*0Sstevel@tonic-gate extern boolean_t is_did_name(char *name); 40*0Sstevel@tonic-gate extern boolean_t is_did_slice_name(char *name); 41*0Sstevel@tonic-gate extern boolean_t is_did_disk_name(char *name); 42*0Sstevel@tonic-gate extern boolean_t is_ctd_name(char *name); 43*0Sstevel@tonic-gate extern boolean_t is_ctd_slice_name(char *name); 44*0Sstevel@tonic-gate extern boolean_t is_ctd_disk_name(char *name); 45*0Sstevel@tonic-gate extern boolean_t is_ctd_target_name(char *name); 46*0Sstevel@tonic-gate extern boolean_t is_ctd_ctrl_name(char *name); 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate extern int set_display_name(dm_descriptor_t desc, char *name); 49*0Sstevel@tonic-gate extern int get_display_name(dm_descriptor_t slice, char **name); 50*0Sstevel@tonic-gate 51*0Sstevel@tonic-gate extern int slice_get_by_name(char *name, dm_descriptor_t *slicep); 52*0Sstevel@tonic-gate extern int disk_get_by_name(char *name, dm_descriptor_t *diskp); 53*0Sstevel@tonic-gate extern int hba_get_by_name(char *name, dm_descriptor_t *hbap); 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate extern int extract_diskname(char *slicename, char **diskname); 56*0Sstevel@tonic-gate extern int extract_hbaname(char *slicename, char **hbaname); 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate extern int get_disk_for_named_slice(char *slicename, 59*0Sstevel@tonic-gate dm_descriptor_t *diskp); 60*0Sstevel@tonic-gate 61*0Sstevel@tonic-gate /* 62*0Sstevel@tonic-gate * functions to manipulate devices 63*0Sstevel@tonic-gate */ 64*0Sstevel@tonic-gate extern int group_similar_hbas(dlist_t *hbas, dlist_t **list); 65*0Sstevel@tonic-gate extern int hba_is_multiplex(dm_descriptor_t hba, boolean_t *bool); 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate extern int hba_set_n_avail_disks(dm_descriptor_t hba, uint16_t val); 68*0Sstevel@tonic-gate extern int hba_get_n_avail_disks(dm_descriptor_t hba, uint16_t *val); 69*0Sstevel@tonic-gate 70*0Sstevel@tonic-gate extern int hba_get_type(dm_descriptor_t hba, char **type); 71*0Sstevel@tonic-gate extern int hba_is_fast(dm_descriptor_t hba, boolean_t *bool); 72*0Sstevel@tonic-gate extern int hba_is_fast_20(dm_descriptor_t hba, boolean_t *bool); 73*0Sstevel@tonic-gate extern int hba_is_fast_40(dm_descriptor_t hba, boolean_t *bool); 74*0Sstevel@tonic-gate extern int hba_is_fast_80(dm_descriptor_t hba, boolean_t *bool); 75*0Sstevel@tonic-gate extern int hba_supports_protocol( 76*0Sstevel@tonic-gate dm_descriptor_t hba, char *attr, boolean_t *bool); 77*0Sstevel@tonic-gate extern int hba_supports_wide(dm_descriptor_t hba, boolean_t *bool); 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate extern int disk_get_available_slice_index( 80*0Sstevel@tonic-gate dm_descriptor_t diskp, uint32_t *index); 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gate extern int disk_get_hbas(dm_descriptor_t disk, dlist_t **list); 83*0Sstevel@tonic-gate extern int disk_get_paths(dm_descriptor_t disk, dlist_t **list); 84*0Sstevel@tonic-gate extern int disk_get_slices(dm_descriptor_t disk, dlist_t **list); 85*0Sstevel@tonic-gate extern int disk_get_aliases(dm_descriptor_t disk, dlist_t **list); 86*0Sstevel@tonic-gate extern int disk_get_blocksize(dm_descriptor_t disk, uint64_t *val); 87*0Sstevel@tonic-gate extern int disk_get_ncylinders(dm_descriptor_t disk, uint64_t *val); 88*0Sstevel@tonic-gate extern int disk_get_size_in_blocks(dm_descriptor_t disk, uint64_t *val); 89*0Sstevel@tonic-gate extern int disk_get_start_block(dm_descriptor_t disk, uint64_t *val); 90*0Sstevel@tonic-gate extern int disk_get_nheads(dm_descriptor_t disk, uint64_t *val); 91*0Sstevel@tonic-gate extern int disk_get_nsectors(dm_descriptor_t disk, uint64_t *val); 92*0Sstevel@tonic-gate extern int disk_get_is_efi(dm_descriptor_t disk, boolean_t *val); 93*0Sstevel@tonic-gate extern int disk_get_has_fdisk(dm_descriptor_t disk, boolean_t *val); 94*0Sstevel@tonic-gate extern int disk_get_has_solaris_partition(dm_descriptor_t disk, 95*0Sstevel@tonic-gate boolean_t *val); 96*0Sstevel@tonic-gate extern int disk_get_is_online(dm_descriptor_t disk, boolean_t *val); 97*0Sstevel@tonic-gate extern int disk_get_drive_type(dm_descriptor_t disk, uint32_t *val); 98*0Sstevel@tonic-gate extern int disk_get_media_type(dm_descriptor_t disk, uint32_t *type); 99*0Sstevel@tonic-gate extern int disk_reserve_index(dm_descriptor_t disk, uint16_t index); 100*0Sstevel@tonic-gate extern int disk_release_index(dm_descriptor_t disk, uint16_t index); 101*0Sstevel@tonic-gate 102*0Sstevel@tonic-gate extern int slice_get_hbas(dm_descriptor_t slice, dlist_t **list); 103*0Sstevel@tonic-gate extern int slice_get_disk(dm_descriptor_t slice, dm_descriptor_t *diskp); 104*0Sstevel@tonic-gate extern int slice_get_size(dm_descriptor_t slice, uint64_t *val); 105*0Sstevel@tonic-gate extern int slice_get_index(dm_descriptor_t slice, uint32_t *val); 106*0Sstevel@tonic-gate extern int slice_get_size_in_blocks(dm_descriptor_t slice, uint64_t *val); 107*0Sstevel@tonic-gate extern int slice_get_start_block(dm_descriptor_t slice, uint64_t *val); 108*0Sstevel@tonic-gate extern int slice_get_start(dm_descriptor_t slice, uint64_t *val); 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gate extern int slice_set_size(dm_descriptor_t slice, uint64_t size); 111*0Sstevel@tonic-gate extern int slice_set_size_in_blocks(dm_descriptor_t slice, uint64_t size); 112*0Sstevel@tonic-gate extern int slice_set_start_block(dm_descriptor_t slice, uint64_t start); 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gate /* 115*0Sstevel@tonic-gate * virtual slice utilities. 116*0Sstevel@tonic-gate */ 117*0Sstevel@tonic-gate extern int create_virtual_slices(dlist_t *unused); 118*0Sstevel@tonic-gate extern int add_virtual_slice(char *name, uint32_t index, 119*0Sstevel@tonic-gate uint64_t startblk, uint64_t sizeblks, dm_descriptor_t disk); 120*0Sstevel@tonic-gate 121*0Sstevel@tonic-gate extern void release_virtual_slices(); 122*0Sstevel@tonic-gate extern int get_virtual_slices(dlist_t **list); 123*0Sstevel@tonic-gate extern boolean_t is_virtual_slice(dm_descriptor_t slice); 124*0Sstevel@tonic-gate 125*0Sstevel@tonic-gate /* 126*0Sstevel@tonic-gate * shared error output functions for dm_descriptor_t objects 127*0Sstevel@tonic-gate */ 128*0Sstevel@tonic-gate extern void print_get_assoc_desc_error( 129*0Sstevel@tonic-gate dm_descriptor_t desc, char *which, int error); 130*0Sstevel@tonic-gate extern void print_get_desc_attr_error( 131*0Sstevel@tonic-gate dm_descriptor_t desc, char *devtype, char *attr, int error); 132*0Sstevel@tonic-gate 133*0Sstevel@tonic-gate extern void print_set_desc_attr_error( 134*0Sstevel@tonic-gate dm_descriptor_t desc, char *devtype, char *attr, int error); 135*0Sstevel@tonic-gate 136*0Sstevel@tonic-gate #ifdef __cplusplus 137*0Sstevel@tonic-gate } 138*0Sstevel@tonic-gate #endif 139*0Sstevel@tonic-gate 140*0Sstevel@tonic-gate #endif /* _LAYOUT_DEVICE_UTIL_H */ 141