/*
* 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__MDIO_H
#define _SYS__MDIO_H
#include <sys/int_types.h>
#include <sys/dditypes.h>
#ifdef _KERNEL
#else /* !_KERNEL */
#include <mdiox.h>
#endif
#include <sys/ddipropdefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* driver version number
*/
((u) & MD_UNIT_MASK))
/*
* The following macros were added to support friendly names for hot spare
* pools. Before the addition of friendly names the hsp_self_id was merely
* the conbination of the set number and the hot spare pool number. With
* friendly names a NM record is created to hold the hot spare pool name.
* The hsp_self_id now becomes the set number shifted left plus the NM
* record key plus 1000. The number 1000 is used to collision between
* traditional hsp_self_ids and friendly name self ids. In traditional hot
* spare pool the hot spare pool number could never be grater than 999.
*
* HSP_ID_IS_FN(hspid) returns TRUE if the hot spare pool ID is the ID of
* a friendly named hsp. Will return FALSE otherwise.
* hspid may contain the set bits, since HSP_ID_IS_FN
* will call HSP_ID as part of doing its work.
*
* KEY_TO_HSP_ID(setno, reckey) constructs a hot spare pool ID (hsp_t) from
* a set number and a NM record key. The result is
* suitable for storing in the hsp_self_id member of a
* hot_spare_pool struct.
*
* HSP_ID_TO_KEY(hspid) returns the NM key that is encoded in the hot spare
* pool ID. MD_KEYBAD will be returned if hspid does
* not represent a friendly named hsp. hspid may
* contain the set bits, since HSP_ID_TO_KEY will call
* HSP_ID as part of doing its work.
*
* HSP_KEY_OK(reckey) Insures that the NM record key is not so large as
* to interfere with the set number bits in a hot
* spare pool self id. This macro will probably only
* be used in meta_hs_add.
*/
(key + HSP_FN_BASE))
/*
* for did stat ioctl
*/
/*
* for setting the un_revision, hsp_revision and hs_revision
*/
/*
* for trans EOF error messages
*/
" Logging.\nSee mount_ufs(1M). Operation failed.\n"
" Logging.\n#See mount_ufs(1M). Operation failed.\n"
"\npass data directly to the underlying device.\n"
"logging; they\n#pass data directly to the underlying device.\n"
/*
* for importing of disksets (IMP_LOAD)
*/
/*
* miscname stuff
*/
/*
* ioctl parameter structures
*/
#pragma pack(4)
#endif
typedef struct md_i_driverinfo {
typedef struct md_i_getnext {
typedef struct md_i_getnum {
int start;
int size;
typedef struct md_i_get {
int size;
} md_i_get_t;
typedef struct md_i_reset {
int force;
} md_i_reset_t;
/* soft partition reset parameters */
typedef struct md_sp_reset {
/* soft partition status change parameters */
typedef struct md_sp_statusset {
typedef struct md_sp_update_wm {
typedef struct md_sp_read_wm {
typedef struct md_set_userflags {
typedef struct md_stripe_params {
typedef struct md_raid_params {
typedef struct md_mirror_params {
typedef struct md_grow_params {
/* if the didstat struct changes you will need to change the following macro */
typedef struct md_i_didstat {
typedef struct mdnm_params {
typedef struct mdhspnm_params {
typedef struct md_getdevs_params {
int cnt;
typedef struct md_i_get_tstate {
typedef struct md_set_state_params {
typedef struct md_alloc_hotsp_params {
typedef struct md_suspend_wr_params {
typedef struct md_mn_req_owner {
typedef struct md_set_mmown_params {
md_mn_req_owner_t d; /* New owner */
typedef struct md_mn_own_status {
typedef struct md_mn_poke_hotspares {
typedef struct md_mn_rs_params {
/* flag values for rs_flags */
typedef struct md_mn_setcap_params {
typedef struct md_mkdev_params {
#define MDMN_RR_CLEAN_PARAMS_DATA(x) ((unsigned char *)(x) + \
sizeof (md_mn_rr_clean_params_t))
typedef struct md_mn_rr_clean_params {
/* actual data goes here */
typedef struct md_mn_rr_dirty_params {
/*
* Flags to coordinate sending device id between kernel and user space.
* To get devid from kernel:
* User calls ioctl with l_devid_flags set to GETSZ flag to get size of
* devid which is returned in the l_devid_sz field if the SZ flag is set.
* Then user allocs that size and sends same ioctl with SPACE flag set
* and l_devid_sz set to alloc'd size. Kernel either sets the NOSPACE
* flag (if alloc'd space is not big enough) or sets the VALID flag and
* fills in the devid.
*
* To send devid to kernel:
* User alloc's space for devid, fills in devid, sets (SPACE|VALID|SZ) flags
* and sets size of devid into l_devid_sz field.
*
* If MDDB_DEVID_SPACE is set, MDDB_DEVID_GETSZ is ignored.
* If no flags are set, devid information is ignored.
*/
/*
* Maximum number of replicas (or number of locator blocks) in set.
*/
/*
* maximum size of allowable bootlist property string - only used to
* read in and write out boolist property strings to conf files.
*/
/*
* Percentage of free space left in replica during conversion of non-devid
* style replica to devid style replica.
*/
typedef struct mddb_cfg_loc {
int l_flags;
int l_devid_flags;
int l_devid_sz;
int l_old_devid_sz;
typedef struct mddb_dtag {
int dt_id;
} mddb_dtag_t;
typedef struct mddb_dtag_lst {
typedef struct mddb_dtag_get_parm {
typedef struct mddb_dtag_use_parm {
int dtup_id;
typedef struct mddb_accept_parm {
typedef struct mddb_med_parm {
typedef struct mddb_med_upd_parm {
typedef struct mddb_med_t_ent {
typedef struct mddb_med_t_parm {
typedef struct mddb_setmaster_config {
/*
*/
typedef struct mddb_setflags_config {
typedef struct mddb_set_node_params {
typedef struct mddb_block_parm {
int c_blk_flags;
typedef struct mddb_parse_parm {
int c_parse_flags;
typedef struct mddb_optrec_parm {
typedef struct mddb_config {
int c_flags;
/* setname */
/*
* Subcommands.
*/
typedef struct mddb_optloc {
typedef struct md_gs_stat_parm {
typedef struct {
int setno;
int owns_set;
typedef enum md_rename_operation_t {
} md_renop_t;
typedef struct md_rename {
int revision;
struct {
} md_rename_t;
typedef struct md_regen_param {
/* Base ioctl's defined here */
/* Used in DEBUG_TEST code */
typedef struct md_resync_ioctl {
int ri_percent_dirty;
typedef struct md_rrsize {
} md_rrsize_t;
typedef enum replace_cmd {
typedef struct replace_params {
typedef struct md_i_off_on {
int force_offline;
typedef struct md_att_struct {
/* possible values for options above */
/* want to resync */
typedef struct md_detach_params {
int force_detach;
/*
* Structure for accessing the DB from user land.
*/
typedef struct mddb_userreq {
int ur_size;
/*
* Ioctl structure for MD_IOCISOPEN
*/
typedef struct md_isopen {
int isopen;
} md_isopen_t;
/*
* Ioctl structure for MD_MN_OPEN_TEST
* Can't use MD_IOCISOPEN, because it's a contracted inteface.
*/
typedef struct md_clu_open {
enum { MD_MN_LCU_CHECK = 0,
int clu_isopen;
/*
* Structure to push the message out from commd
* MAXPATHLEN macro is being overloaded to represent
* the line size of 1024 characters. i.e. no path
* is being passed.
*/
typedef struct md_mn_commd_err {
int size;
/*
* Ioctl structure for MD_IOCPROBE_DEV
*/
/*
* one used by user and the other by kernel, thereby hiding the semaphore
* /mutex pointer members from user, which should be the appropriate one.
*/
typedef struct md_probedev {
typedef struct md_probedev_impl {
/*
* Ioctl structure for MD_MN_GET_MIRROR_STATE
*/
typedef struct md_mn_get_mir_state {
#pragma pack()
#endif
/*
* Per set flags, stored in md_set[n].s_status
*/
/*
* See meta_prbits() in SUNWmd/lib/libmeta/meta_print.c for a description of
* the way this is used
*/
"\005NM_LOADED\006TAGDATA\007ACCOK\010TOOFEW" \
"\011USETAG\012ACCEPT\013OWNERSHIP\014BADTAG" \
"\015CLRTAG\016KEEPTAG\017PUSHLB\020MNSET" \
"\021DIDCLUP\022MNPARSE_BLK\023MN_NEWMAS_RC" \
"\024MN_START_RC\025IMPORT\026MIR_STATE_RC" \
"\027HOLD\030REPLICATED_IMPORT"
#ifdef __cplusplus
}
#endif
#endif /* _SYS__MDIO_H */