/*
* 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
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_MD_RAID_H
#define _SYS_MD_RAID_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* following bits are used in status word in the common section
* of unit structure: un_status
*/
/*
* These are the major constants for the definition of a raid device
*/
/*
* Note: magic is needed only to set rpw_magic, not rpw_magic_ext!
*/
rpw64->rpw_devstart = \
rpw64->rpw_pwstart = \
} else { \
raid_pwhdr32_od_t *rpw32 = \
(raid_pwhdr32_od_t *)(void *)(buf); \
rpw32->rpw_devstart = \
rpw32->rpw_pwstart = \
} \
}
}
typedef struct mr_scoreboard {
int sb_column;
int sb_flags;
void *sb_cs;
typedef struct mr_pw_reserve {
int pw_column;
int pw_free;
#pragma pack(4)
#endif
typedef struct mr_column {
} mr_column_t;
/*
* mr_column32_od is for old 32 bit format only
*/
typedef struct mr_column32_od {
/*
* Incore only elements structures
*/
typedef struct mr_column_ic {
/*
* Do not rearrange elements as mutexes must be aligned on
* an 8 byte boundary. Element _t_un_linlck_mx corresponds to
* _t_un_linlck_cv and element _t_un_mx corresponds to _t_un_cv
*/
typedef struct mr_unit_ic {
} mr_unit_ic_t;
typedef struct mr_unit {
mdc_unit_t c;
int un_raid_res;
long long un_pwid;
/*
* This union has to begin at an 8 byte aligned address.
* If not, this structure has different sizes in 32 / 64 bit
* environments, since in a 64 bit environment the compiler
* adds paddings before a long long, if it doesn't start at an 8byte
* aligned address.
* Be careful if you add or remove structure elements before it!
*/
union {
struct {
int _t_un_resync_index;
} _resync;
struct {
} _init;
} _t_un;
/*
* This union has to begin at an 8 byte aligned address.
* Be careful if you add or remove structure elements before it!
*/
union {
} un_mr_ic;
} mr_unit_t;
/*
* For old 32 bit format use only
*/
typedef struct mr_unit32_od {
long long un_pwid;
union {
struct {
int _t_un_resync_index;
} _resync;
struct {
} _init;
} _t_un;
/*
* This spot is 8 byte aligned!!!
* Don't change this arrangement.
*/
union {
struct {
} _mric;
struct {
} _lckmx;
} _unic;
short xx_un_linlck_cv;
short xx_un_cv;
typedef struct raid_pwhdr {
int rpw_columnnum;
long long rpw_id;
} raid_pwhdr_t;
/*
* For old 32 bit pre-write area
*/
typedef struct raid_pwhdr32_od {
int rpw_columnnum;
long long rpw_id;
#pragma pack()
#endif
#ifdef _KERNEL
/*
* the buffer header is only bp_mapin if it is needed. It is needed on
* all writes and on some reads. ps_mapin is non zero if the buffer is
* maped in. ps_mapin_mx protect ps_mapin. The protocol for usage is
*
* 1) check for non-zero and continue if non-zero
* 2) aquire the ps_mapin_mx
* 3) recheck for non-zero and continue if non-zero
* 4) bp_mapin
* 5) set ps_mapin to non-zero
* 6) drop ps_mapin_mx
*
* the reason for this is to avoid the mutex when possible.
*/
int ps_flags;
int ps_error;
int ps_frags;
int ps_pwfrags;
} md_raidps_t;
/* flags for parent save area */
/*
* used in cs_state to describe the type of io operation in progress
*/
enum raid_io_stage {
};
typedef struct md_raidcbuf {
int cbuf_column;
int cbuf_sum;
int cbuf_pwslot;
int cbuf_flags;
typedef struct md_raidcs {
int cs_flags;
void (*cs_call)();
void (*cs_error_call)();
void (*cs_retry_call)();
long long cs_pwid;
int cs_dcolumn;
int cs_dpwslot;
int cs_pcolumn;
int cs_ppwslot;
int cs_loop;
int cs_frags;
int cs_strategy_flag;
void *cs_strategy_private;
int cs_error;
int cs_resync_check;
int cs_rstate;
/* Add new structure members HERE!! */
/* DO NOT add struture members here; cs_dbuf is dynamically sized */
} md_raidcs_t;
/* value definitions for cs_resync_check */
/* value definitions for cs_flags */
/* value definitions for cs_pflags or cs_dflags */
/* value definitions for gcs_flags */
/* returned value from raid_replay() */
typedef struct raid_rplybuf {
typedef struct raid_rplylst {
long long rpl_id;
int rpl_column1;
int rpl_column2;
/* Externals from raid.c */
extern int raid_build_incore(void *, int);
/* Externals from raid_ioctl.c */
/* rename named service functions */
/* redefinitions of the union shared by resync and init */
extern intptr_t raid_hotspares();
int oflags);
int resync_thread);
int colindex);
int colindex);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MD_RAID_H */