usr/src/lib/libraidcfg/common/raidcfg.h
changeset 3622 eed77e5fc4ad
parent 3457 95f0a08d05e5
child 7233 ca680b47401f
equal deleted inserted replaced
3621:2cbc0f92c696 3622:eed77e5fc4ad
       
     1 /*
       
     2  * CDDL HEADER START
       
     3  *
       
     4  * The contents of this file are subject to the terms of the
       
     5  * Common Development and Distribution License (the "License").
       
     6  * You may not use this file except in compliance with the License.
       
     7  *
       
     8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
     9  * or http://www.opensolaris.org/os/licensing.
       
    10  * See the License for the specific language governing permissions
       
    11  * and limitations under the License.
       
    12  *
       
    13  * When distributing Covered Code, include this CDDL HEADER in each
       
    14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    15  * If applicable, add the following below this CDDL HEADER, with the
       
    16  * fields enclosed by brackets "[]" replaced with your own identifying
       
    17  * information: Portions Copyright [yyyy] [name of copyright owner]
       
    18  *
       
    19  * CDDL HEADER END
       
    20  */
       
    21 
       
    22 /*
       
    23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
       
    24  * Use is subject to license terms.
       
    25  */
       
    26 
       
    27 #ifndef	_RAIDCFG_H
       
    28 #define	_RAIDCFG_H
       
    29 
       
    30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
       
    31 
       
    32 #include <sys/types.h>
       
    33 #include <raidcfg_spi.h>
       
    34 
       
    35 #ifdef	__cplusplus
       
    36 extern "C" {
       
    37 #endif
       
    38 
       
    39 /*
       
    40  * Reserved Raid object IDs;
       
    41  * ID 0 is reserved for root object;
       
    42  * ID 0 also stands for NONE OBJECT.
       
    43  */
       
    44 #define	OBJ_SYSTEM		0
       
    45 #define	OBJ_NONE		0
       
    46 
       
    47 typedef	int raid_obj_handle_t;
       
    48 
       
    49 /*
       
    50  * API data structure definition
       
    51  */
       
    52 typedef	struct {
       
    53 	int	array_handle;
       
    54 	int	disk_handle;
       
    55 } raidcfg_hsp_relation_t;
       
    56 
       
    57 typedef	controller_attr_t	raidcfg_controller_t;
       
    58 typedef	array_attr_t		raidcfg_array_t;
       
    59 typedef	disk_attr_t		raidcfg_disk_t;
       
    60 
       
    61 typedef struct {
       
    62 	uint32_t	associated_id;
       
    63 	uint32_t	type;
       
    64 	array_tag_t	tag;
       
    65 } raidcfg_hsp_t;
       
    66 
       
    67 typedef	struct {
       
    68 	uint32_t	disk_id;
       
    69 	uint32_t	state;
       
    70 	uint64_t	offset;
       
    71 	uint64_t	size;
       
    72 	disk_tag_t	tag;
       
    73 } raidcfg_arraypart_t;
       
    74 
       
    75 typedef	diskseg_attr_t		raidcfg_diskseg_t;
       
    76 typedef	task_attr_t		raidcfg_task_t;
       
    77 
       
    78 /*
       
    79  * raidcfg common library APIs
       
    80  */
       
    81 const char *raidcfg_errstr(int);
       
    82 int raidcfg_get_controller(uint32_t);
       
    83 int raidcfg_get_array(int, uint64_t, uint64_t);
       
    84 int raidcfg_get_disk(int, disk_tag_t);
       
    85 int raidcfg_open_controller(int, char **);
       
    86 int raidcfg_close_controller(int, char **);
       
    87 int raidcfg_get_type(int);
       
    88 int raidcfg_get_attr(int, void *);
       
    89 int raidcfg_get_container(int);
       
    90 int raidcfg_list_head(int, raid_obj_type_id_t);
       
    91 int raidcfg_list_next(int);
       
    92 int raidcfg_set_attr(int, uint32_t, void *, char **);
       
    93 int raidcfg_set_hsp(int, raidcfg_hsp_relation_t *, char **);
       
    94 int raidcfg_unset_hsp(int, raidcfg_hsp_relation_t *, char **);
       
    95 int raidcfg_create_array(int, int *, uint32_t, uint64_t, uint32_t, char **);
       
    96 int raidcfg_delete_array(int, char **);
       
    97 int raidcfg_update_fw(int, char *, char **);
       
    98 
       
    99 #ifdef	__cplusplus
       
   100 }
       
   101 #endif
       
   102 
       
   103 #endif /* _RAIDCFG_H */