xref: /titanic_41/usr/src/lib/libraidcfg/common/raidcfg.h (revision 23a1ccea6aac035f084a7a4cdc968687d1b02daf)
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 2008 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 #include <sys/types.h>
31 #include <raidcfg_spi.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * Reserved Raid object IDs;
39  * ID 0 is reserved for root object;
40  * ID 0 also stands for NONE OBJECT.
41  */
42 #define	OBJ_SYSTEM		0
43 #define	OBJ_NONE		0
44 
45 typedef	int raid_obj_handle_t;
46 
47 /*
48  * API data structure definition
49  */
50 typedef	struct {
51 	int	array_handle;
52 	int	disk_handle;
53 } raidcfg_hsp_relation_t;
54 
55 typedef	controller_attr_t	raidcfg_controller_t;
56 typedef	array_attr_t		raidcfg_array_t;
57 typedef	disk_attr_t		raidcfg_disk_t;
58 
59 typedef struct {
60 	uint32_t	associated_id;
61 	uint32_t	type;
62 	array_tag_t	tag;
63 } raidcfg_hsp_t;
64 
65 typedef	struct {
66 	uint32_t	disk_id;
67 	uint32_t	state;
68 	uint64_t	offset;
69 	uint64_t	size;
70 	disk_tag_t	tag;
71 } raidcfg_arraypart_t;
72 
73 typedef	diskseg_attr_t		raidcfg_diskseg_t;
74 typedef	task_attr_t		raidcfg_task_t;
75 typedef	property_attr_t		raidcfg_prop_t;
76 
77 /*
78  * raidcfg common library APIs
79  */
80 const char *raidcfg_errstr(int);
81 int raidcfg_get_controller(uint32_t);
82 int raidcfg_get_array(int, uint64_t, uint64_t);
83 int raidcfg_get_disk(int, disk_tag_t);
84 int raidcfg_open_controller(int, char **);
85 int raidcfg_close_controller(int, char **);
86 int raidcfg_get_type(int);
87 int raidcfg_get_attr(int, void *);
88 int raidcfg_get_container(int);
89 int raidcfg_list_head(int, raid_obj_type_id_t);
90 int raidcfg_list_next(int);
91 int raidcfg_set_attr(int, uint32_t, void *, char **);
92 int raidcfg_set_hsp(raidcfg_hsp_relation_t *, char **);
93 int raidcfg_unset_hsp(raidcfg_hsp_relation_t *, char **);
94 int raidcfg_create_array(int, int *, uint32_t, uint64_t, uint32_t, char **);
95 int raidcfg_delete_array(int, char **);
96 int raidcfg_update_fw(int, char *, char **);
97 
98 #ifdef	__cplusplus
99 }
100 #endif
101 
102 #endif /* _RAIDCFG_H */
103