# HG changeset patch # User jc156560 # Date 1170988329 28800 # Node ID eed77e5fc4ad5a65fc4455e9d1ec9bece2b6463c # Parent 2cbc0f92c696ece5817fe3439b589ba833fed66c 6519009 libraidcfg's headers and lint library stub have issues diff -r 2cbc0f92c696 -r eed77e5fc4ad usr/src/head/Makefile --- a/usr/src/head/Makefile Thu Feb 08 11:58:00 2007 -0800 +++ b/usr/src/head/Makefile Thu Feb 08 18:32:09 2007 -0800 @@ -136,8 +136,6 @@ pthread.h \ pw.h \ pwd.h \ - raidcfg.h \ - raidcfg_spi.h \ rctl.h \ re_comp.h \ regex.h \ diff -r 2cbc0f92c696 -r eed77e5fc4ad usr/src/head/raidcfg.h --- a/usr/src/head/raidcfg.h Thu Feb 08 11:58:00 2007 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _RAIDCFG_H -#define _RAIDCFG_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Reserved Raid object IDs; - * ID 0 is reserved for root object; - * ID 0 also stands for NONE OBJECT. - */ -#define OBJ_SYSTEM 0 -#define OBJ_NONE 0 - -typedef int raid_obj_handle_t; - -/* - * API data structure definition - */ -typedef struct { - int array_handle; - int disk_handle; -} raidcfg_hsp_relation_t; - -typedef controller_attr_t raidcfg_controller_t; -typedef array_attr_t raidcfg_array_t; -typedef disk_attr_t raidcfg_disk_t; - -typedef struct { - uint32_t associated_id; - uint32_t type; - array_tag_t tag; -} raidcfg_hsp_t; - -typedef struct { - uint32_t disk_id; - uint32_t state; - uint64_t offset; - uint64_t size; - disk_tag_t tag; -} raidcfg_arraypart_t; - -typedef diskseg_attr_t raidcfg_diskseg_t; -typedef task_attr_t raidcfg_task_t; - -/* - * raidcfg common library APIs - */ -const char *raidcfg_errstr(int); -int raidcfg_get_controller(uint32_t); -int raidcfg_get_array(int, uint64_t, uint64_t); -int raidcfg_get_disk(int, disk_tag_t); -int raidcfg_open_controller(int, char **); -int raidcfg_close_controller(int, char **); -int raidcfg_get_type(int); -int raidcfg_get_attr(int, void *); -int raidcfg_get_container(int); -int raidcfg_list_head(int, raid_obj_type_id_t); -int raidcfg_list_next(int); -int raidcfg_set_attr(int, uint32_t, void *, char **); -int raidcfg_set_hsp(int, raidcfg_hsp_relation_t *, char **); -int raidcfg_unset_hsp(int, raidcfg_hsp_relation_t *, char **); -int raidcfg_create_array(int, int *, uint32_t, uint64_t, uint32_t, char **); -int raidcfg_delete_array(int, char **); -int raidcfg_update_fw(int, char *, char **); - -#ifdef __cplusplus -} -#endif - -#endif /* _RAIDCFG_H */ diff -r 2cbc0f92c696 -r eed77e5fc4ad usr/src/head/raidcfg_spi.h --- a/usr/src/head/raidcfg_spi.h Thu Feb 08 11:58:00 2007 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,353 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_RAIDCFG_SPI_H -#define _SYS_RAIDCFG_SPI_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Controller capabilities - */ -#define RAID_CAP_RAID0 1 -#define RAID_CAP_RAID1 1 << 1 -#define RAID_CAP_RAID1E 1 << 2 -#define RAID_CAP_RAID5 1 << 3 -#define RAID_CAP_RAID10 1 << 4 -#define RAID_CAP_RAID50 1 << 5 -#define RAID_CAP_G_HSP 1 << 6 -#define RAID_CAP_L_HSP 1 << 7 -#define RAID_CAP_DISK_TRANS 1 << 8 -#define RAID_CAP_FULL_DISK_ONLY 1 << 9 -#define RAID_CAP_SMART_ALLOC 1 << 10 -#define RAID_CAP_ARRAY_ALIGN 1 << 11 - -/* - * General constants - */ -#define OBJ_SEPARATOR_BEGIN -1 -#define OBJ_SEPARATOR_END -2 - -#define OBJ_ATTR_NONE -1 - -/* - * Array RAID level definition - */ -#define RAID_LEVEL_0 1 -#define RAID_LEVEL_1 2 -#define RAID_LEVEL_1E 3 -#define RAID_LEVEL_5 4 -#define RAID_LEVEL_10 5 -#define RAID_LEVEL_50 6 - -/* - * Array cache write policy - */ -#define CACHE_WR_OFF 0 -#define CACHE_WR_ON 1 - -/* - * Array cache read policy - */ -#define CACHE_RD_OFF 0 -#define CACHE_RD_ON 1 - -/* - * Array status - */ -#define ARRAY_STATE_OPTIMAL 0 -#define ARRAY_STATE_DEGRADED 1 -#define ARRAY_STATE_FAILED 2 - -/* - * Disk state - */ -#define DISK_STATE_GOOD 0 -#define DISK_STATE_FAILED 1 - -/* - * Array part state - */ -#define ARRAYPART_STATE_GOOD 0 -#define ARRAYPART_STATE_MISSED 1 - -/* - * Disk segment state - */ -#define DISKSEG_STATE_GOOD 1 -#define DISKSEG_STATE_RESERVED 1 << 1 -#define DISKSEG_STATE_DEAD 1 << 2 -#define DISKSEG_STATE_NORMAL 1 << 3 - -/* - * Controller connection type - */ -#define TYPE_UNKNOWN 0 -#define TYPE_SCSI 1 -#define TYPE_SAS 2 - -#define RAID_TASK_SUSPEND 0 -#define RAID_TASK_RESUME 1 -#define RAID_TASK_TERMINATE 2 - -#define HSP_TYPE_GLOBAL 0 -#define HSP_TYPE_LOCAL 1 - -/* - * Sub-command of set attribute - */ -#define SET_CACHE_WR_PLY 0 -#define SET_CACHE_RD_PLY 1 - -/* - * Sub-commands for act method of object - */ -#define ACT_CONTROLLER_OPEN 0 -#define ACT_CONTROLLER_CLOSE 1 -#define ACT_CONTROLLER_FLASH_FW 2 - -/* - * Some definitions - */ -#define CONTROLLER_FW_LEN 32 -#define CONTROLLER_TYPE_LEN 32 - -#define DISK_VENDER_LEN 8 -#define DISK_PRODUCT_LEN 16 -#define DISK_REV_LEN 4 - -#define DISK_ID(c, id, l) ((c) << 7 | (l) << 4 | (id)) -#define BUS(disk_id) ((disk_id) >> 7) -#define TARGET(disk_id) ((disk_id) & 0xf) -#define LUN(disk_id) (((disk_id) >> 4) & 0x7) - -#define ARRAY_ID(id, l) ((l) << 16 | (id)) -#define ARRAY_TARGET(array_id) ((array_id) & 0xffff) -#define ARRAY_LUN(array_id) ((array_id) >> 16) - -#define RDCFG_PLUGIN_V1 0x10000 -#define CFGDIR "/dev/cfg" -#define MAX_PATH_LEN 255 - -/* - * Mininum array part size: 256M - */ -#define ARRAYPART_MIN_SIZE (uint64_t)(1 << 28) - -/* - * Return code - */ -#define SUCCESS 0 -#define STD_IOCTL -1 -#define ERR_DRIVER_NOT_FOUND -2 -#define ERR_DRIVER_OPEN -3 -#define ERR_DRIVER_LOCK -4 -#define ERR_DRIVER_CLOSED -5 -#define ERR_DRIVER_ACROSS -6 -#define ERR_ARRAY_LEVEL -7 -#define ERR_ARRAY_SIZE -8 -#define ERR_ARRAY_STRIPE_SIZE -9 -#define ERR_ARRAY_CACHE_POLICY -10 -#define ERR_ARRAY_IN_USE -11 -#define ERR_ARRAY_TASK -12 -#define ERR_ARRAY_CONFIG -13 -#define ERR_ARRAY_DISKNUM -14 -#define ERR_ARRAY_LAYOUT -15 -#define ERR_ARRAY_AMOUNT -16 -#define ERR_DISK_STATE -17 -#define ERR_DISK_SPACE -18 -#define ERR_DISK_SEG_AMOUNT -19 -#define ERR_DISK_NOT_EMPTY -20 -#define ERR_DISK_TASK -21 -#define ERR_TASK_STATE -22 -#define ERR_OP_ILLEGAL -23 -#define ERR_OP_NO_IMPL -24 -#define ERR_OP_FAILED -25 -#define ERR_DEVICE_NOENT -26 -#define ERR_DEVICE_TYPE -27 -#define ERR_DEVICE_DUP -28 -#define ERR_DEVICE_OVERFLOW -29 -#define ERR_DEVICE_UNCLEAN -30 -#define ERR_DEVICE_INVALID -31 -#define ERR_NOMEM -32 -#define ERR_PRIV -33 -#define ERR_PLUGIN -34 - -/* - * Raid object types - */ -typedef enum { - OBJ_TYPE_SYSTEM, - OBJ_TYPE_CONTROLLER, - OBJ_TYPE_ARRAY, - OBJ_TYPE_DISK, - OBJ_TYPE_HSP, - OBJ_TYPE_ARRAY_PART, - OBJ_TYPE_DISK_SEG, - OBJ_TYPE_TASK, - OBJ_TYPE_ALL -} raid_obj_type_id_t; - -/* - * Task functions - */ -typedef enum { - TASK_FUNC_UNKNOWN, - TASK_FUNC_INIT, - TASK_FUNC_BUILD, - TASK_FUNC_VERIFY -} raidtask_func_t; - -/* - * Task state - */ -typedef enum { - TASK_STATE_UNKNOWN, - TASK_STATE_TERMINATED, - TASK_STATE_FAILED, - TASK_STATE_DONE, - TASK_STATE_RUNNING, - TASK_STATE_SUSPENDED -} raidtask_state_t; - -/* - * Attributes of all RAID objects - */ -typedef union { - uint64_t reserved[3]; - struct { - uint64_t target_id; - uint64_t lun; - } idl; -} array_tag_t; - -typedef union { - struct { - uint64_t bus; - uint64_t target_id; - uint64_t lun; - } cidl; -} disk_tag_t; - -typedef struct { - uint32_t controller_id; - uint32_t max_array_num; - uint32_t max_seg_per_disk; - uint32_t connection_type; - uint64_t capability; - char fw_version[CONTROLLER_FW_LEN]; - char controller_type[CONTROLLER_TYPE_LEN]; -} controller_attr_t; - -typedef struct { - uint32_t array_id; - uint32_t state; - array_tag_t tag; - uint64_t capacity; - uint32_t raid_level; - uint32_t stripe_size; - uint32_t write_policy; - uint32_t read_policy; -} array_attr_t; - -typedef struct { - uint32_t disk_id; - uint32_t state; - disk_tag_t tag; - uint64_t capacity; - char vendorid[DISK_VENDER_LEN]; - char productid[DISK_PRODUCT_LEN]; - char revision[DISK_REV_LEN]; -} disk_attr_t; - -typedef struct { - uint32_t associated_id; - uint32_t type; -} hsp_attr_t; - -typedef struct { - uint32_t disk_id; - uint32_t state; - uint64_t offset; - uint64_t size; -} arraypart_attr_t; - -typedef struct { - uint32_t seq_no; - uint32_t state; - uint64_t offset; - uint64_t size; -} diskseg_attr_t; - -typedef struct { - uint32_t task_id; - uint32_t task_func; - uint32_t task_state; - uint32_t progress; -} task_attr_t; - -typedef struct { - uint32_t array_id; - uint32_t disk_id; -} hsp_relation_t; - -/* - * Structure used to register plug-in modules - */ -typedef struct raid_lib_type { - uint32_t version; - struct raid_lib_type *next; - void *lib_handle; - const char *name; - - int (*open_controller)(uint32_t, char **); - int (*close_controller)(uint32_t, char **); - int (*compnum)(uint32_t, uint32_t, raid_obj_type_id_t, - raid_obj_type_id_t); - int (*complist)(uint32_t, uint32_t, raid_obj_type_id_t, - raid_obj_type_id_t, int, void *); - int (*get_attr)(uint32_t, uint32_t, uint32_t, raid_obj_type_id_t, - void *); - int (*set_attr)(uint32_t, uint32_t, uint32_t, uint32_t *, char **); - int (*array_create)(uint32_t, array_attr_t *, int, - arraypart_attr_t *, char **); - int (*array_delete)(uint32_t, uint32_t, char **); - int (*hsp_bind)(uint32_t, uint32_t, hsp_relation_t *, char **); - int (*hsp_unbind)(uint32_t, uint32_t, hsp_relation_t *, char **); - int (*flash_fw)(uint32_t, char *, uint32_t, char **); -} raid_lib_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_RAIDCFG_SPI_H */ diff -r 2cbc0f92c696 -r eed77e5fc4ad usr/src/lib/Makefile --- a/usr/src/lib/Makefile Thu Feb 08 11:58:00 2007 -0800 +++ b/usr/src/lib/Makefile Thu Feb 08 18:32:09 2007 -0800 @@ -362,6 +362,7 @@ libplot \ libpool \ libproc \ + libraidcfg \ librcm \ libscf \ libsip \ diff -r 2cbc0f92c696 -r eed77e5fc4ad usr/src/lib/libraidcfg/Makefile --- a/usr/src/lib/libraidcfg/Makefile Thu Feb 08 11:58:00 2007 -0800 +++ b/usr/src/lib/libraidcfg/Makefile Thu Feb 08 18:32:09 2007 -0800 @@ -30,6 +30,8 @@ include $(SRC)/lib/Makefile.lib +HDRS = raidcfg_spi.h raidcfg.h +HDRDIR = common SUBDIRS = $(MACH) $(BUILD64)SUBDIRS += $(MACH64) @@ -47,6 +49,10 @@ all clean clobber install lint: $(SUBDIRS) +install_h: $(ROOTHDRS) + +check: $(CHECKHDRS) + $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) diff -r 2cbc0f92c696 -r eed77e5fc4ad usr/src/lib/libraidcfg/common/llib-lraidcfg --- a/usr/src/lib/libraidcfg/common/llib-lraidcfg Thu Feb 08 11:58:00 2007 -0800 +++ b/usr/src/lib/libraidcfg/common/llib-lraidcfg Thu Feb 08 18:32:09 2007 -0800 @@ -18,8 +18,6 @@ * * CDDL HEADER END */ -/*LINTLIBRARY*/ -/*PROTOLIB1*/ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. @@ -28,95 +26,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" -#include - -const char * -raidcfg_errstr( - int err_code); - -int -raidcfg_get_controller( - uint32_t controller_id); - -int -raidcfg_get_array( - int controller_handle, - uint64_t target_id, - uint64_t lun); - -int -raidcfg_get_disk( - int controller_handle, - disk_tag_t tag); - -int -raidcfg_open_controller( - int handle, - char **plugin_err_str); - -int -raidcfg_close_controller( - int handle, - char **plugin_err_str); - -int -raidcfg_get_type( - int handle); - -int -raidcfg_get_attr( - int handle, - void *attr); - -int -raidcfg_get_container( - int handle); +/*LINTLIBRARY*/ +/*PROTOLIB1*/ -int -raidcfg_list_head( - int handle, - raid_obj_type_id_t type); - -int -raidcfg_list_next( - int handle); - -int -raidcfg_set_attr( - int handle, - uint32_t set_cmd, - void *value, - char **plugin_err_str); - -int -raidcfg_update_fw( - int handle, - char *file, - char **plugin_err_str); - -int -raidcfg_create_array( - int num_of_comps, - int *disk_handles, - uint32_t raid_level, - uint64_t size, - uint32_t stripe_size, - char **plugin_err_str); - -int -raidcfg_delete_array( - int array_handle, - char **plugin_err_str); - -int -raidcfg_set_hsp( - int num, - raidcfg_hsp_relation_t *hsp_relations, - char **plugin_err_str); - -int -raidcfg_unset_hsp( - int num, - raidcfg_hsp_relation_t *hsp_relations, - char **plugin_err_str); - +#include diff -r 2cbc0f92c696 -r eed77e5fc4ad usr/src/lib/libraidcfg/common/raidcfg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/lib/libraidcfg/common/raidcfg.h Thu Feb 08 18:32:09 2007 -0800 @@ -0,0 +1,103 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _RAIDCFG_H +#define _RAIDCFG_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Reserved Raid object IDs; + * ID 0 is reserved for root object; + * ID 0 also stands for NONE OBJECT. + */ +#define OBJ_SYSTEM 0 +#define OBJ_NONE 0 + +typedef int raid_obj_handle_t; + +/* + * API data structure definition + */ +typedef struct { + int array_handle; + int disk_handle; +} raidcfg_hsp_relation_t; + +typedef controller_attr_t raidcfg_controller_t; +typedef array_attr_t raidcfg_array_t; +typedef disk_attr_t raidcfg_disk_t; + +typedef struct { + uint32_t associated_id; + uint32_t type; + array_tag_t tag; +} raidcfg_hsp_t; + +typedef struct { + uint32_t disk_id; + uint32_t state; + uint64_t offset; + uint64_t size; + disk_tag_t tag; +} raidcfg_arraypart_t; + +typedef diskseg_attr_t raidcfg_diskseg_t; +typedef task_attr_t raidcfg_task_t; + +/* + * raidcfg common library APIs + */ +const char *raidcfg_errstr(int); +int raidcfg_get_controller(uint32_t); +int raidcfg_get_array(int, uint64_t, uint64_t); +int raidcfg_get_disk(int, disk_tag_t); +int raidcfg_open_controller(int, char **); +int raidcfg_close_controller(int, char **); +int raidcfg_get_type(int); +int raidcfg_get_attr(int, void *); +int raidcfg_get_container(int); +int raidcfg_list_head(int, raid_obj_type_id_t); +int raidcfg_list_next(int); +int raidcfg_set_attr(int, uint32_t, void *, char **); +int raidcfg_set_hsp(int, raidcfg_hsp_relation_t *, char **); +int raidcfg_unset_hsp(int, raidcfg_hsp_relation_t *, char **); +int raidcfg_create_array(int, int *, uint32_t, uint64_t, uint32_t, char **); +int raidcfg_delete_array(int, char **); +int raidcfg_update_fw(int, char *, char **); + +#ifdef __cplusplus +} +#endif + +#endif /* _RAIDCFG_H */ diff -r 2cbc0f92c696 -r eed77e5fc4ad usr/src/lib/libraidcfg/common/raidcfg_spi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/lib/libraidcfg/common/raidcfg_spi.h Thu Feb 08 18:32:09 2007 -0800 @@ -0,0 +1,353 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_RAIDCFG_SPI_H +#define _SYS_RAIDCFG_SPI_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Controller capabilities + */ +#define RAID_CAP_RAID0 1 +#define RAID_CAP_RAID1 1 << 1 +#define RAID_CAP_RAID1E 1 << 2 +#define RAID_CAP_RAID5 1 << 3 +#define RAID_CAP_RAID10 1 << 4 +#define RAID_CAP_RAID50 1 << 5 +#define RAID_CAP_G_HSP 1 << 6 +#define RAID_CAP_L_HSP 1 << 7 +#define RAID_CAP_DISK_TRANS 1 << 8 +#define RAID_CAP_FULL_DISK_ONLY 1 << 9 +#define RAID_CAP_SMART_ALLOC 1 << 10 +#define RAID_CAP_ARRAY_ALIGN 1 << 11 + +/* + * General constants + */ +#define OBJ_SEPARATOR_BEGIN -1 +#define OBJ_SEPARATOR_END -2 + +#define OBJ_ATTR_NONE -1 + +/* + * Array RAID level definition + */ +#define RAID_LEVEL_0 1 +#define RAID_LEVEL_1 2 +#define RAID_LEVEL_1E 3 +#define RAID_LEVEL_5 4 +#define RAID_LEVEL_10 5 +#define RAID_LEVEL_50 6 + +/* + * Array cache write policy + */ +#define CACHE_WR_OFF 0 +#define CACHE_WR_ON 1 + +/* + * Array cache read policy + */ +#define CACHE_RD_OFF 0 +#define CACHE_RD_ON 1 + +/* + * Array status + */ +#define ARRAY_STATE_OPTIMAL 0 +#define ARRAY_STATE_DEGRADED 1 +#define ARRAY_STATE_FAILED 2 + +/* + * Disk state + */ +#define DISK_STATE_GOOD 0 +#define DISK_STATE_FAILED 1 + +/* + * Array part state + */ +#define ARRAYPART_STATE_GOOD 0 +#define ARRAYPART_STATE_MISSED 1 + +/* + * Disk segment state + */ +#define DISKSEG_STATE_GOOD 1 +#define DISKSEG_STATE_RESERVED 1 << 1 +#define DISKSEG_STATE_DEAD 1 << 2 +#define DISKSEG_STATE_NORMAL 1 << 3 + +/* + * Controller connection type + */ +#define TYPE_UNKNOWN 0 +#define TYPE_SCSI 1 +#define TYPE_SAS 2 + +#define RAID_TASK_SUSPEND 0 +#define RAID_TASK_RESUME 1 +#define RAID_TASK_TERMINATE 2 + +#define HSP_TYPE_GLOBAL 0 +#define HSP_TYPE_LOCAL 1 + +/* + * Sub-command of set attribute + */ +#define SET_CACHE_WR_PLY 0 +#define SET_CACHE_RD_PLY 1 + +/* + * Sub-commands for act method of object + */ +#define ACT_CONTROLLER_OPEN 0 +#define ACT_CONTROLLER_CLOSE 1 +#define ACT_CONTROLLER_FLASH_FW 2 + +/* + * Some definitions + */ +#define CONTROLLER_FW_LEN 32 +#define CONTROLLER_TYPE_LEN 32 + +#define DISK_VENDER_LEN 8 +#define DISK_PRODUCT_LEN 16 +#define DISK_REV_LEN 4 + +#define DISK_ID(c, id, l) ((c) << 7 | (l) << 4 | (id)) +#define BUS(disk_id) ((disk_id) >> 7) +#define TARGET(disk_id) ((disk_id) & 0xf) +#define LUN(disk_id) (((disk_id) >> 4) & 0x7) + +#define ARRAY_ID(id, l) ((l) << 16 | (id)) +#define ARRAY_TARGET(array_id) ((array_id) & 0xffff) +#define ARRAY_LUN(array_id) ((array_id) >> 16) + +#define RDCFG_PLUGIN_V1 0x10000 +#define CFGDIR "/dev/cfg" +#define MAX_PATH_LEN 255 + +/* + * Mininum array part size: 256M + */ +#define ARRAYPART_MIN_SIZE (uint64_t)(1 << 28) + +/* + * Return code + */ +#define SUCCESS 0 +#define STD_IOCTL -1 +#define ERR_DRIVER_NOT_FOUND -2 +#define ERR_DRIVER_OPEN -3 +#define ERR_DRIVER_LOCK -4 +#define ERR_DRIVER_CLOSED -5 +#define ERR_DRIVER_ACROSS -6 +#define ERR_ARRAY_LEVEL -7 +#define ERR_ARRAY_SIZE -8 +#define ERR_ARRAY_STRIPE_SIZE -9 +#define ERR_ARRAY_CACHE_POLICY -10 +#define ERR_ARRAY_IN_USE -11 +#define ERR_ARRAY_TASK -12 +#define ERR_ARRAY_CONFIG -13 +#define ERR_ARRAY_DISKNUM -14 +#define ERR_ARRAY_LAYOUT -15 +#define ERR_ARRAY_AMOUNT -16 +#define ERR_DISK_STATE -17 +#define ERR_DISK_SPACE -18 +#define ERR_DISK_SEG_AMOUNT -19 +#define ERR_DISK_NOT_EMPTY -20 +#define ERR_DISK_TASK -21 +#define ERR_TASK_STATE -22 +#define ERR_OP_ILLEGAL -23 +#define ERR_OP_NO_IMPL -24 +#define ERR_OP_FAILED -25 +#define ERR_DEVICE_NOENT -26 +#define ERR_DEVICE_TYPE -27 +#define ERR_DEVICE_DUP -28 +#define ERR_DEVICE_OVERFLOW -29 +#define ERR_DEVICE_UNCLEAN -30 +#define ERR_DEVICE_INVALID -31 +#define ERR_NOMEM -32 +#define ERR_PRIV -33 +#define ERR_PLUGIN -34 + +/* + * Raid object types + */ +typedef enum { + OBJ_TYPE_SYSTEM, + OBJ_TYPE_CONTROLLER, + OBJ_TYPE_ARRAY, + OBJ_TYPE_DISK, + OBJ_TYPE_HSP, + OBJ_TYPE_ARRAY_PART, + OBJ_TYPE_DISK_SEG, + OBJ_TYPE_TASK, + OBJ_TYPE_ALL +} raid_obj_type_id_t; + +/* + * Task functions + */ +typedef enum { + TASK_FUNC_UNKNOWN, + TASK_FUNC_INIT, + TASK_FUNC_BUILD, + TASK_FUNC_VERIFY +} raidtask_func_t; + +/* + * Task state + */ +typedef enum { + TASK_STATE_UNKNOWN, + TASK_STATE_TERMINATED, + TASK_STATE_FAILED, + TASK_STATE_DONE, + TASK_STATE_RUNNING, + TASK_STATE_SUSPENDED +} raidtask_state_t; + +/* + * Attributes of all RAID objects + */ +typedef union { + uint64_t reserved[3]; + struct { + uint64_t target_id; + uint64_t lun; + } idl; +} array_tag_t; + +typedef union { + struct { + uint64_t bus; + uint64_t target_id; + uint64_t lun; + } cidl; +} disk_tag_t; + +typedef struct { + uint32_t controller_id; + uint32_t max_array_num; + uint32_t max_seg_per_disk; + uint32_t connection_type; + uint64_t capability; + char fw_version[CONTROLLER_FW_LEN]; + char controller_type[CONTROLLER_TYPE_LEN]; +} controller_attr_t; + +typedef struct { + uint32_t array_id; + uint32_t state; + array_tag_t tag; + uint64_t capacity; + uint32_t raid_level; + uint32_t stripe_size; + uint32_t write_policy; + uint32_t read_policy; +} array_attr_t; + +typedef struct { + uint32_t disk_id; + uint32_t state; + disk_tag_t tag; + uint64_t capacity; + char vendorid[DISK_VENDER_LEN]; + char productid[DISK_PRODUCT_LEN]; + char revision[DISK_REV_LEN]; +} disk_attr_t; + +typedef struct { + uint32_t associated_id; + uint32_t type; +} hsp_attr_t; + +typedef struct { + uint32_t disk_id; + uint32_t state; + uint64_t offset; + uint64_t size; +} arraypart_attr_t; + +typedef struct { + uint32_t seq_no; + uint32_t state; + uint64_t offset; + uint64_t size; +} diskseg_attr_t; + +typedef struct { + uint32_t task_id; + uint32_t task_func; + uint32_t task_state; + uint32_t progress; +} task_attr_t; + +typedef struct { + uint32_t array_id; + uint32_t disk_id; +} hsp_relation_t; + +/* + * Structure used to register plug-in modules + */ +typedef struct raid_lib_type { + uint32_t version; + struct raid_lib_type *next; + void *lib_handle; + const char *name; + + int (*open_controller)(uint32_t, char **); + int (*close_controller)(uint32_t, char **); + int (*compnum)(uint32_t, uint32_t, raid_obj_type_id_t, + raid_obj_type_id_t); + int (*complist)(uint32_t, uint32_t, raid_obj_type_id_t, + raid_obj_type_id_t, int, void *); + int (*get_attr)(uint32_t, uint32_t, uint32_t, raid_obj_type_id_t, + void *); + int (*set_attr)(uint32_t, uint32_t, uint32_t, uint32_t *, char **); + int (*array_create)(uint32_t, array_attr_t *, int, + arraypart_attr_t *, char **); + int (*array_delete)(uint32_t, uint32_t, char **); + int (*hsp_bind)(uint32_t, uint32_t, hsp_relation_t *, char **); + int (*hsp_unbind)(uint32_t, uint32_t, hsp_relation_t *, char **); + int (*flash_fw)(uint32_t, char *, uint32_t, char **); +} raid_lib_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_RAIDCFG_SPI_H */ diff -r 2cbc0f92c696 -r eed77e5fc4ad usr/src/tools/abi/etc/exceptions --- a/usr/src/tools/abi/etc/exceptions Thu Feb 08 11:58:00 2007 -0800 +++ b/usr/src/tools/abi/etc/exceptions Thu Feb 08 18:32:09 2007 -0800 @@ -410,6 +410,9 @@ PSARC 2002/762: RULE W3: lib/sparcv9/libtsol.so.2 PSARC 2002/762: RULE W3: lib/amd64/libtsol.so.2 6289029: RULE W3: lib/libdlpi.so.1 +PSARC 2005/204: RULE W3: usr/lib/libraidcfg.so.1 +PSARC 2005/204: RULE W3: usr/lib/amd64/libraidcfg.so.1 +PSARC 2005/204: RULE W3: usr/lib/sparcv9/libraidcfg.so.1 ############################################# # WARNINGs exempted from RULE W4 (See RULES section of intf_check manpage)