mdio.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS__MDIO_H
#define _SYS__MDIO_H
#pragma ident "%Z%%M% %I% %E% SMI"
#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
*/
#define MD_MIN2UNIT(m) ((m) & MD_UNIT_MASK)
#define MD_MIN2SET(m) ((m) >> MD_SET_SHIFT)
#define MD_SID(u) ((u)->c.un_self_id)
#define MD_RECID(u) ((u)->c.un_record_id)
#define MD_CAPAB(u) ((u)->c.un_capabilities)
((u) & MD_UNIT_MASK))
#define HSP_BITSID 31
/*
* for did stat ioctl
*/
#define MD_FIND_INVDID 0x01
#define MD_GET_INVDID 0x02
/*
* for setting the un_revision
*/
#define MD_32BIT_META_DEV 0
#define MD_64BIT_META_DEV 1
/*
* for trans EOF error messages
*/
#define MD_EOF_TRANS_MSG "Trans logging has been replaced by UFS" \
" Logging.\nSee mount_ufs(1M). Operation failed.\n"
#define MD_SHORT_EOF_TRANS_MSG "#Trans logging has been replaced by UFS" \
" Logging.\n#See mount_ufs(1M). Operation failed.\n"
#define MD_EOF_TRANS_WARNING "Existing Trans devices are not logging; they" \
"\npass data directly to the underlying device.\n"
#define MD_SHORT_EOF_TRANS_WARNING "#Existing Trans devices are not " \
"logging; they\n#pass data directly to the underlying device.\n"
/*
* miscname stuff
*/
#define MD_DRIVERNAMELEN 16
#define MD_PNTDRIVERNAME(from) \
/*
* 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 {
int force; /* Force reset */
/* soft partition status change parameters */
typedef struct md_sp_statusset {
int num_units; /* Number of units */
int new_status; /* New status */
int size; /* Array size */
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 {
int options; /* create a 64 or 32 bit device */
int size; /* Optional - size of new unit struct */
int nrows; /* Optional - original number of rows */
int npar; /* Optional - number of parents to lock */
/* if the didstat struct changes you will need to change the following macro */
typedef struct md_i_didstat {
int mode; /* find or get ? */
int cnt; /* return number of invalid devid's found */
int maxsz; /* return max size of invalid device id */
typedef struct mdnm_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 {
#define MD_MN_MM_SPAWN_THREAD 0x0004
#define MD_MN_MM_RES_OK 0 /* Success */
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 {
int msg_type; /* Type of message */
char rs_flags; /* flags */
char rs_first_time; /* set if first resync-next message */
/* flag values for rs_flags */
typedef struct md_mn_setcap_params {
typedef struct md_mkdev_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.
*/
#define MDDB_NLB 50
/*
* 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.
*/
#define MDDB_DEVID_CONV_PERC 5
typedef struct mddb_cfg_loc {
int l_flags;
char l_driver[MD_MAXDRVNM];
int l_devid_flags;
int l_devid_sz;
int l_old_devid_sz;
char l_minor_name[MDDB_MINOR_NAME_MAX];
typedef struct mddb_dtag {
int dt_id;
char dt_sn[MDDB_SN_LEN];
char dt_hn[MD_MAX_NODENAME_PLUS_1];
} mddb_dtag_t;
typedef struct mddb_dtag_lst {
struct mddb_dtag_lst *dtl_nx;
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 {
#define MED_TE_NM_LEN 64
typedef struct mddb_med_t_ent {
char med_te_nm[MED_TE_NM_LEN];
typedef struct mddb_med_t_parm {
int med_tp_nents; /* number of entries */
int med_tp_setup; /* setup flag */
typedef struct mddb_setmaster_config {
int c_magic; /* used to verify ioctl */
/*
*/
typedef struct mddb_setflags_config {
int sf_magic; /* used to verify ioctl */
int sf_setflags; /* Flag values */
typedef struct mddb_set_node_params {
typedef struct mddb_block_parm {
int c_blk_flags;
typedef struct mddb_parse_parm {
int c_parse_flags;
int c_lb_flags[MDDB_NLB];
typedef struct mddb_optrec_parm {
typedef struct mddb_config {
int c_id; /* used with getnext locator */
int c_dbcnt; /* number of dbs */
int c_dbmax; /* maximum number of dbs */
int c_flags;
int c_dbend; /* size of database */
int c_multi_node; /* set if multi_node set */
/* setname */
char c_setname[MD_MAX_SETNAME_PLUS_1];
/*
* Subcommands.
*/
typedef struct mddb_optloc {
int recid; /* really mddb_recid_t */
int li[2];
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 */
#define NODBNEEDED(c) ((c) == MD_IOCNOTIFY)
typedef struct md_resync_ioctl {
int ri_zerofill; /* Zerofill on lec read error */
int ri_percent_done; /* percent done current phase */
int ri_percent_dirty;
typedef struct md_rrsize {
} md_rrsize_t;
typedef enum replace_cmd {
typedef struct replace_params {
int has_label; /* has label flag of new device */
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
*/
#define TESTNAME_LEN 32
#define PROBE_SEMA(p) p->probe_sema
/*
* 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 {
int nmdevs; /* number of metadevices */
char test_name[TESTNAME_LEN];
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
*/
#define MD_SET_STAT_BITS "\020\001HALTED\002SNARFED\003SNARFING\004STALE" \
"\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 */