1*7836SJohn.Forte@Sun.COM /* 2*7836SJohn.Forte@Sun.COM * CDDL HEADER START 3*7836SJohn.Forte@Sun.COM * 4*7836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the 5*7836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License"). 6*7836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License. 7*7836SJohn.Forte@Sun.COM * 8*7836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*7836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*7836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions 11*7836SJohn.Forte@Sun.COM * and limitations under the License. 12*7836SJohn.Forte@Sun.COM * 13*7836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*7836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*7836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*7836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*7836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*7836SJohn.Forte@Sun.COM * 19*7836SJohn.Forte@Sun.COM * CDDL HEADER END 20*7836SJohn.Forte@Sun.COM */ 21*7836SJohn.Forte@Sun.COM /* 22*7836SJohn.Forte@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*7836SJohn.Forte@Sun.COM * Use is subject to license terms. 24*7836SJohn.Forte@Sun.COM */ 25*7836SJohn.Forte@Sun.COM 26*7836SJohn.Forte@Sun.COM #ifndef _RDC_IOCTL_H 27*7836SJohn.Forte@Sun.COM #define _RDC_IOCTL_H 28*7836SJohn.Forte@Sun.COM 29*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 30*7836SJohn.Forte@Sun.COM extern "C" { 31*7836SJohn.Forte@Sun.COM #endif 32*7836SJohn.Forte@Sun.COM 33*7836SJohn.Forte@Sun.COM #include <sys/unistat/spcs_s.h> 34*7836SJohn.Forte@Sun.COM #include <sys/nsctl/nsctl.h> 35*7836SJohn.Forte@Sun.COM #ifndef DS_DDICT 36*7836SJohn.Forte@Sun.COM #include <rpc/rpc.h> 37*7836SJohn.Forte@Sun.COM #endif 38*7836SJohn.Forte@Sun.COM 39*7836SJohn.Forte@Sun.COM #ifdef _SunOS_5_6 40*7836SJohn.Forte@Sun.COM #define netbuf32 netbuf 41*7836SJohn.Forte@Sun.COM #include <sys/nsctl/model.h> 42*7836SJohn.Forte@Sun.COM #endif 43*7836SJohn.Forte@Sun.COM 44*7836SJohn.Forte@Sun.COM typedef struct _rdc_ioctl_s { 45*7836SJohn.Forte@Sun.COM long arg0; 46*7836SJohn.Forte@Sun.COM long arg1; 47*7836SJohn.Forte@Sun.COM long arg2; 48*7836SJohn.Forte@Sun.COM long arg3; 49*7836SJohn.Forte@Sun.COM long arg4; 50*7836SJohn.Forte@Sun.COM long magic; 51*7836SJohn.Forte@Sun.COM spcs_s_info_t ustatus; 52*7836SJohn.Forte@Sun.COM long pad[1]; 53*7836SJohn.Forte@Sun.COM } _rdc_ioctl_t; 54*7836SJohn.Forte@Sun.COM 55*7836SJohn.Forte@Sun.COM #ifdef _SYSCALL32 56*7836SJohn.Forte@Sun.COM typedef struct _rdc_ioctl32_s { 57*7836SJohn.Forte@Sun.COM int32_t arg0; 58*7836SJohn.Forte@Sun.COM int32_t arg1; 59*7836SJohn.Forte@Sun.COM int32_t arg2; 60*7836SJohn.Forte@Sun.COM int32_t arg3; 61*7836SJohn.Forte@Sun.COM int32_t arg4; 62*7836SJohn.Forte@Sun.COM int32_t magic; 63*7836SJohn.Forte@Sun.COM spcs_s_info32_t ustatus; 64*7836SJohn.Forte@Sun.COM int32_t pad[1]; 65*7836SJohn.Forte@Sun.COM } _rdc_ioctl32_t; 66*7836SJohn.Forte@Sun.COM #endif /* _SYSCALL32 */ 67*7836SJohn.Forte@Sun.COM 68*7836SJohn.Forte@Sun.COM /* 69*7836SJohn.Forte@Sun.COM * Ioctl command numbers 70*7836SJohn.Forte@Sun.COM */ 71*7836SJohn.Forte@Sun.COM 72*7836SJohn.Forte@Sun.COM #define _RDCI_(x) (('R'<<16)|('D'<<8)|(x)) 73*7836SJohn.Forte@Sun.COM 74*7836SJohn.Forte@Sun.COM /* 75*7836SJohn.Forte@Sun.COM * Generic rdc ioctl arguments structure. 76*7836SJohn.Forte@Sun.COM * Individual ioctl's will use 0-n of these arguments. 77*7836SJohn.Forte@Sun.COM * 78*7836SJohn.Forte@Sun.COM * Each rdc ioctl is described first by the command number 79*7836SJohn.Forte@Sun.COM * e.g. #define RDC_CONFIG _RDCI_(0) 80*7836SJohn.Forte@Sun.COM * 81*7836SJohn.Forte@Sun.COM * Followed by a description of each argument (if any). 82*7836SJohn.Forte@Sun.COM * Each argument is on a single line. 83*7836SJohn.Forte@Sun.COM * 84*7836SJohn.Forte@Sun.COM */ 85*7836SJohn.Forte@Sun.COM 86*7836SJohn.Forte@Sun.COM #define RDC_CONFIG _RDCI_(0) 87*7836SJohn.Forte@Sun.COM /* 88*7836SJohn.Forte@Sun.COM * rdc_config_t *user_configuration; 89*7836SJohn.Forte@Sun.COM */ 90*7836SJohn.Forte@Sun.COM 91*7836SJohn.Forte@Sun.COM #define RDC_ENABLE_SVR _RDCI_(1) 92*7836SJohn.Forte@Sun.COM /* 93*7836SJohn.Forte@Sun.COM * rdc_svc_args_t *daemon_configuration; 94*7836SJohn.Forte@Sun.COM */ 95*7836SJohn.Forte@Sun.COM 96*7836SJohn.Forte@Sun.COM #define RDC_STATUS _RDCI_(2) 97*7836SJohn.Forte@Sun.COM /* 98*7836SJohn.Forte@Sun.COM * rdc_status_t *rdc_status; 99*7836SJohn.Forte@Sun.COM */ 100*7836SJohn.Forte@Sun.COM 101*7836SJohn.Forte@Sun.COM #define RDC_VERSION _RDCI_(3) 102*7836SJohn.Forte@Sun.COM /* 103*7836SJohn.Forte@Sun.COM * rdc_version_t *rdc_version; 104*7836SJohn.Forte@Sun.COM */ 105*7836SJohn.Forte@Sun.COM 106*7836SJohn.Forte@Sun.COM #define RDC_LINK_DOWN _RDCI_(4) 107*7836SJohn.Forte@Sun.COM /* 108*7836SJohn.Forte@Sun.COM * char *rdc_host; 109*7836SJohn.Forte@Sun.COM */ 110*7836SJohn.Forte@Sun.COM 111*7836SJohn.Forte@Sun.COM #define RDC_SYNC_EVENT _RDCI_(5) 112*7836SJohn.Forte@Sun.COM /* 113*7836SJohn.Forte@Sun.COM * char *rdc_master; 114*7836SJohn.Forte@Sun.COM * char *rdc_group; 115*7836SJohn.Forte@Sun.COM */ 116*7836SJohn.Forte@Sun.COM 117*7836SJohn.Forte@Sun.COM #define RDC_POOL_CREATE _RDCI_(6) 118*7836SJohn.Forte@Sun.COM /* 119*7836SJohn.Forte@Sun.COM * struct svcpool_args * 120*7836SJohn.Forte@Sun.COM */ 121*7836SJohn.Forte@Sun.COM 122*7836SJohn.Forte@Sun.COM #define RDC_POOL_WAIT _RDCI_(7) 123*7836SJohn.Forte@Sun.COM /* 124*7836SJohn.Forte@Sun.COM * int id 125*7836SJohn.Forte@Sun.COM */ 126*7836SJohn.Forte@Sun.COM 127*7836SJohn.Forte@Sun.COM #define RDC_POOL_RUN _RDCI_(8) 128*7836SJohn.Forte@Sun.COM /* 129*7836SJohn.Forte@Sun.COM * int id 130*7836SJohn.Forte@Sun.COM */ 131*7836SJohn.Forte@Sun.COM #define RDC_BITMAPOP _RDCI_(9) 132*7836SJohn.Forte@Sun.COM 133*7836SJohn.Forte@Sun.COM #ifdef DEBUG 134*7836SJohn.Forte@Sun.COM #define RDC_ASYNC6 _RDCI_(20) /* send async message by hand */ 135*7836SJohn.Forte@Sun.COM #define RDC_CLRKSTAT _RDCI_(21) /* clear kstat_io structure */ 136*7836SJohn.Forte@Sun.COM #define RDC_STALL0 _RDCI_(22) /* stall sequence 0 on server */ 137*7836SJohn.Forte@Sun.COM #define RDC_READGEN _RDCI_(23) /* cause a read on server */ 138*7836SJohn.Forte@Sun.COM #endif 139*7836SJohn.Forte@Sun.COM 140*7836SJohn.Forte@Sun.COM 141*7836SJohn.Forte@Sun.COM #define MAX_RDC_HOST_SIZE 64 142*7836SJohn.Forte@Sun.COM 143*7836SJohn.Forte@Sun.COM /* 144*7836SJohn.Forte@Sun.COM * Change this when the ioctl structure changes 145*7836SJohn.Forte@Sun.COM */ 146*7836SJohn.Forte@Sun.COM #define RDC_MAGIC 0xf00d0001 147*7836SJohn.Forte@Sun.COM 148*7836SJohn.Forte@Sun.COM typedef struct rdc_addr { 149*7836SJohn.Forte@Sun.COM struct netbuf addr; 150*7836SJohn.Forte@Sun.COM char intf[MAX_RDC_HOST_SIZE]; 151*7836SJohn.Forte@Sun.COM char file[NSC_MAXPATH]; 152*7836SJohn.Forte@Sun.COM char bitmap[NSC_MAXPATH]; 153*7836SJohn.Forte@Sun.COM } rdc_addr_t; 154*7836SJohn.Forte@Sun.COM 155*7836SJohn.Forte@Sun.COM #ifdef _SYSCALL32 156*7836SJohn.Forte@Sun.COM struct rdc_addr32 { 157*7836SJohn.Forte@Sun.COM struct netbuf32 addr; 158*7836SJohn.Forte@Sun.COM char intf[MAX_RDC_HOST_SIZE]; 159*7836SJohn.Forte@Sun.COM char file[NSC_MAXPATH]; 160*7836SJohn.Forte@Sun.COM char bitmap[NSC_MAXPATH]; 161*7836SJohn.Forte@Sun.COM }; 162*7836SJohn.Forte@Sun.COM #endif /* _SYSCALL32 */ 163*7836SJohn.Forte@Sun.COM 164*7836SJohn.Forte@Sun.COM /* 165*7836SJohn.Forte@Sun.COM * User level rdc set structure - must be a multiple of 64bits long. 166*7836SJohn.Forte@Sun.COM */ 167*7836SJohn.Forte@Sun.COM typedef struct rdc_set { 168*7836SJohn.Forte@Sun.COM rdc_addr_t primary; 169*7836SJohn.Forte@Sun.COM rdc_addr_t secondary; 170*7836SJohn.Forte@Sun.COM struct knetconfig *netconfig; 171*7836SJohn.Forte@Sun.COM long align1; 172*7836SJohn.Forte@Sun.COM double alignfix; 173*7836SJohn.Forte@Sun.COM int flags; /* See RDC flags below */ 174*7836SJohn.Forte@Sun.COM int sync_flags; /* See RDC flags below */ 175*7836SJohn.Forte@Sun.COM int bmap_flags; /* See RDC flags below */ 176*7836SJohn.Forte@Sun.COM int mflags; /* RDC 1-to-many flags */ 177*7836SJohn.Forte@Sun.COM int index; /* 0 .. rdc_max_sets - 1 */ 178*7836SJohn.Forte@Sun.COM int bits_set; /* Bits set in bitmap */ 179*7836SJohn.Forte@Sun.COM int autosync; /* Autosync on (1) or off (0) */ 180*7836SJohn.Forte@Sun.COM int syshostid; /* for cluster integration */ 181*7836SJohn.Forte@Sun.COM int asyncthr; /* # of async threads */ 182*7836SJohn.Forte@Sun.COM int setid; /* unique set id for this set */ 183*7836SJohn.Forte@Sun.COM uint64_t sync_pos; /* Progress through sync */ 184*7836SJohn.Forte@Sun.COM uint64_t volume_size; /* Size of volume */ 185*7836SJohn.Forte@Sun.COM int64_t maxqfbas; /* max # of fbas on async q */ 186*7836SJohn.Forte@Sun.COM int64_t maxqitems; /* max # of items on async q */ 187*7836SJohn.Forte@Sun.COM char group_name[NSC_MAXPATH]; /* Group the set belongs to */ 188*7836SJohn.Forte@Sun.COM char direct_file[NSC_MAXPATH]; /* Local FCAL direct io file */ 189*7836SJohn.Forte@Sun.COM char disk_queue[NSC_MAXPATH]; /* Disk Queue for set|group */ 190*7836SJohn.Forte@Sun.COM } rdc_set_t; 191*7836SJohn.Forte@Sun.COM 192*7836SJohn.Forte@Sun.COM #ifdef _SYSCALL32 193*7836SJohn.Forte@Sun.COM struct rdc_set32 { 194*7836SJohn.Forte@Sun.COM struct rdc_addr32 primary; 195*7836SJohn.Forte@Sun.COM struct rdc_addr32 secondary; 196*7836SJohn.Forte@Sun.COM caddr32_t netconfig; 197*7836SJohn.Forte@Sun.COM int32_t align1; 198*7836SJohn.Forte@Sun.COM double alignfix; 199*7836SJohn.Forte@Sun.COM int32_t flags; /* See RDC flags below */ 200*7836SJohn.Forte@Sun.COM int32_t sync_flags; /* See RDC flags below */ 201*7836SJohn.Forte@Sun.COM int32_t bmap_flags; /* See RDC flags below */ 202*7836SJohn.Forte@Sun.COM int32_t mflags; /* RDC 1-to-many flags */ 203*7836SJohn.Forte@Sun.COM int32_t index; /* 0 .. rdc_max_sets - 1 */ 204*7836SJohn.Forte@Sun.COM int32_t bits_set; /* Bits set in bitmap */ 205*7836SJohn.Forte@Sun.COM int32_t autosync; /* Autosync on (1) or off (0) */ 206*7836SJohn.Forte@Sun.COM int32_t syshostid; /* for cluster integration */ 207*7836SJohn.Forte@Sun.COM int32_t asyncthr; /* # of async threads */ 208*7836SJohn.Forte@Sun.COM int32_t setid; /* unique set id for this set */ 209*7836SJohn.Forte@Sun.COM uint64_t sync_pos; /* Progress through sync */ 210*7836SJohn.Forte@Sun.COM uint64_t volume_size; /* Size of volume */ 211*7836SJohn.Forte@Sun.COM int64_t maxqfbas; /* max # of fbas on async q */ 212*7836SJohn.Forte@Sun.COM int64_t maxqitems; /* max # of items on async q */ 213*7836SJohn.Forte@Sun.COM char group_name[NSC_MAXPATH]; /* Group the set belongs to */ 214*7836SJohn.Forte@Sun.COM char direct_file[NSC_MAXPATH]; /* Local FCAL direct io file */ 215*7836SJohn.Forte@Sun.COM char disk_queue[NSC_MAXPATH]; /* Disk Queue for set|group */ 216*7836SJohn.Forte@Sun.COM }; 217*7836SJohn.Forte@Sun.COM #endif /* _SYSCALL32 */ 218*7836SJohn.Forte@Sun.COM 219*7836SJohn.Forte@Sun.COM /* 220*7836SJohn.Forte@Sun.COM * Parameter structure to pass to RDC_CONFIG 221*7836SJohn.Forte@Sun.COM */ 222*7836SJohn.Forte@Sun.COM 223*7836SJohn.Forte@Sun.COM typedef struct rdc_config { 224*7836SJohn.Forte@Sun.COM int command; /* RDC_CMD_XXX */ 225*7836SJohn.Forte@Sun.COM int options; /* RDC_OPT_XXX */ 226*7836SJohn.Forte@Sun.COM int pad[2]; /* Do NOT remove - 32/64-bit padding */ 227*7836SJohn.Forte@Sun.COM rdc_set_t rdc_set[1]; /* The rdc sets */ 228*7836SJohn.Forte@Sun.COM } rdc_config_t; 229*7836SJohn.Forte@Sun.COM 230*7836SJohn.Forte@Sun.COM #ifdef _SYSCALL32 231*7836SJohn.Forte@Sun.COM struct rdc_config32 { 232*7836SJohn.Forte@Sun.COM int32_t command; /* RDC_CMD_XXX */ 233*7836SJohn.Forte@Sun.COM int32_t options; /* RDC_OPT_XXX */ 234*7836SJohn.Forte@Sun.COM int32_t pad[2]; /* Do NOT remove - 32/64-bit padding */ 235*7836SJohn.Forte@Sun.COM struct rdc_set32 rdc_set[1]; /* The rdc sets */ 236*7836SJohn.Forte@Sun.COM }; 237*7836SJohn.Forte@Sun.COM #endif /* _SYSCALL32 */ 238*7836SJohn.Forte@Sun.COM 239*7836SJohn.Forte@Sun.COM #define RDC_BITMAPSET 0x01 240*7836SJohn.Forte@Sun.COM #define RDC_BITMAPOR 0x02 241*7836SJohn.Forte@Sun.COM typedef struct rdc_bitmap_op { 242*7836SJohn.Forte@Sun.COM nsc_off_t offset; /* byte offset within bitmap mod fba */ 243*7836SJohn.Forte@Sun.COM int32_t op; /* or/set operation */ 244*7836SJohn.Forte@Sun.COM char sechost[MAX_RDC_HOST_SIZE]; 245*7836SJohn.Forte@Sun.COM char secfile[NSC_MAXPATH]; 246*7836SJohn.Forte@Sun.COM int32_t len; /* length of bitmap in bytes */ 247*7836SJohn.Forte@Sun.COM unsigned long addr; /* address of bitmap in userland */ 248*7836SJohn.Forte@Sun.COM } rdc_bitmap_op_t; 249*7836SJohn.Forte@Sun.COM 250*7836SJohn.Forte@Sun.COM #ifdef _SYSCALL32 251*7836SJohn.Forte@Sun.COM typedef struct rdc_bitmap_op32 { 252*7836SJohn.Forte@Sun.COM nsc_off_t offset; 253*7836SJohn.Forte@Sun.COM int32_t op; 254*7836SJohn.Forte@Sun.COM char sechost[MAX_RDC_HOST_SIZE]; 255*7836SJohn.Forte@Sun.COM char secfile[NSC_MAXPATH]; 256*7836SJohn.Forte@Sun.COM int32_t len; 257*7836SJohn.Forte@Sun.COM uint32_t addr; 258*7836SJohn.Forte@Sun.COM } rdc_bitmap_op32_t; 259*7836SJohn.Forte@Sun.COM 260*7836SJohn.Forte@Sun.COM #endif /* _SYSCALL32 */ 261*7836SJohn.Forte@Sun.COM 262*7836SJohn.Forte@Sun.COM #ifdef DEBUG 263*7836SJohn.Forte@Sun.COM /* 264*7836SJohn.Forte@Sun.COM * structure to initiate an asynchronous send to the secondary, 265*7836SJohn.Forte@Sun.COM * so we can test the queuing code. 266*7836SJohn.Forte@Sun.COM */ 267*7836SJohn.Forte@Sun.COM typedef struct rdc_async6 { 268*7836SJohn.Forte@Sun.COM char sechost[MAX_RDC_HOST_SIZE]; 269*7836SJohn.Forte@Sun.COM char secfile[NSC_MAXPATH]; 270*7836SJohn.Forte@Sun.COM int pos; /* Position in file */ 271*7836SJohn.Forte@Sun.COM int len; 272*7836SJohn.Forte@Sun.COM int seq; 273*7836SJohn.Forte@Sun.COM int pat; /* fill data with this */ 274*7836SJohn.Forte@Sun.COM int idx; /* server returned index */ 275*7836SJohn.Forte@Sun.COM int spos; /* sub task start block */ 276*7836SJohn.Forte@Sun.COM int slen; /* sub task length */ 277*7836SJohn.Forte@Sun.COM int endind; /* set when last block in multi request */ 278*7836SJohn.Forte@Sun.COM } rdc_async6_t; 279*7836SJohn.Forte@Sun.COM /* 280*7836SJohn.Forte@Sun.COM * structure to initiate a read on the secondary, so we can test the 281*7836SJohn.Forte@Sun.COM * maxfba break up code. 282*7836SJohn.Forte@Sun.COM */ 283*7836SJohn.Forte@Sun.COM typedef struct rdc_readgen { 284*7836SJohn.Forte@Sun.COM char sechost[MAX_RDC_HOST_SIZE]; 285*7836SJohn.Forte@Sun.COM char secfile[NSC_MAXPATH]; 286*7836SJohn.Forte@Sun.COM int len; 287*7836SJohn.Forte@Sun.COM int pos; 288*7836SJohn.Forte@Sun.COM int idx; 289*7836SJohn.Forte@Sun.COM int flag; 290*7836SJohn.Forte@Sun.COM int rpcversion; 291*7836SJohn.Forte@Sun.COM void *data; /* where to place the data from the read */ 292*7836SJohn.Forte@Sun.COM } rdc_readgen_t; 293*7836SJohn.Forte@Sun.COM 294*7836SJohn.Forte@Sun.COM #ifdef _SYSCALL32 295*7836SJohn.Forte@Sun.COM typedef struct rdc_readgen32 { 296*7836SJohn.Forte@Sun.COM char sechost[MAX_RDC_HOST_SIZE]; 297*7836SJohn.Forte@Sun.COM char secfile[NSC_MAXPATH]; 298*7836SJohn.Forte@Sun.COM int len; 299*7836SJohn.Forte@Sun.COM int pos; 300*7836SJohn.Forte@Sun.COM int idx; 301*7836SJohn.Forte@Sun.COM int flag; 302*7836SJohn.Forte@Sun.COM int rpcversion; 303*7836SJohn.Forte@Sun.COM caddr32_t data; /* where to place the data from the read */ 304*7836SJohn.Forte@Sun.COM } rdc_readgen32_t; 305*7836SJohn.Forte@Sun.COM #endif 306*7836SJohn.Forte@Sun.COM #endif 307*7836SJohn.Forte@Sun.COM 308*7836SJohn.Forte@Sun.COM 309*7836SJohn.Forte@Sun.COM 310*7836SJohn.Forte@Sun.COM 311*7836SJohn.Forte@Sun.COM 312*7836SJohn.Forte@Sun.COM /* 313*7836SJohn.Forte@Sun.COM * Config ioctl commands 314*7836SJohn.Forte@Sun.COM */ 315*7836SJohn.Forte@Sun.COM #define RDC_CMD_ENABLE 1 /* New enable */ 316*7836SJohn.Forte@Sun.COM #define RDC_CMD_DISABLE 2 /* Complete disable */ 317*7836SJohn.Forte@Sun.COM #define RDC_CMD_RESUME 3 /* Local re-enable */ 318*7836SJohn.Forte@Sun.COM #define RDC_CMD_SUSPEND 4 /* Local clear */ 319*7836SJohn.Forte@Sun.COM #define RDC_CMD_LOG 5 /* Start logging mode */ 320*7836SJohn.Forte@Sun.COM #define RDC_CMD_COPY 6 /* Start synching */ 321*7836SJohn.Forte@Sun.COM #define RDC_CMD_RECONFIG 7 /* Change the rdc set */ 322*7836SJohn.Forte@Sun.COM #define RDC_CMD_TUNABLE 8 /* Change a tunable parameter */ 323*7836SJohn.Forte@Sun.COM #define RDC_CMD_WAIT 9 /* Wait for syncs to complete */ 324*7836SJohn.Forte@Sun.COM #define RDC_CMD_HEALTH 10 /* Return health state */ 325*7836SJohn.Forte@Sun.COM #define RDC_CMD_STATUS 11 /* Single set status */ 326*7836SJohn.Forte@Sun.COM #define RDC_CMD_RESET 12 /* reset error or failed status */ 327*7836SJohn.Forte@Sun.COM #define RDC_CMD_INITQ 14 /* initialise the disk queue */ 328*7836SJohn.Forte@Sun.COM #define RDC_CMD_FLUSHQ 15 /* flush queue for set */ 329*7836SJohn.Forte@Sun.COM #define RDC_CMD_ADDQ 16 /* add diskq to a set/group */ 330*7836SJohn.Forte@Sun.COM #define RDC_CMD_REMQ 17 /* nice remove a diskq from set/grp */ 331*7836SJohn.Forte@Sun.COM #define RDC_CMD_KILLQ 18 /* forced disgard of queue */ 332*7836SJohn.Forte@Sun.COM #define RDC_CMD_REPQ 19 /* replace queue */ 333*7836SJohn.Forte@Sun.COM 334*7836SJohn.Forte@Sun.COM 335*7836SJohn.Forte@Sun.COM 336*7836SJohn.Forte@Sun.COM 337*7836SJohn.Forte@Sun.COM 338*7836SJohn.Forte@Sun.COM /* 339*7836SJohn.Forte@Sun.COM * Config ioctl options 340*7836SJohn.Forte@Sun.COM */ 341*7836SJohn.Forte@Sun.COM #define RDC_OPT_SYNC 0x1 /* RDC_CMD_ENABLE, RDC_CMD_RESUME */ 342*7836SJohn.Forte@Sun.COM #define RDC_OPT_ASYNC 0x2 /* RDC_CMD_ENABLE, RDC_CMD_RESUME */ 343*7836SJohn.Forte@Sun.COM #define RDC_OPT_PRIMARY 0x4 /* All */ 344*7836SJohn.Forte@Sun.COM #define RDC_OPT_SECONDARY 0x8 /* All */ 345*7836SJohn.Forte@Sun.COM #define RDC_OPT_FORWARD 0x10 /* RDC_CMD_COPY */ 346*7836SJohn.Forte@Sun.COM #define RDC_OPT_REVERSE 0x20 /* RDC_CMD_COPY */ 347*7836SJohn.Forte@Sun.COM #define RDC_OPT_FULL 0x40 /* RDC_CMD_COPY */ 348*7836SJohn.Forte@Sun.COM #define RDC_OPT_UPDATE 0x80 /* RDC_CMD_COPY */ 349*7836SJohn.Forte@Sun.COM #define RDC_OPT_SETBMP 0x100 /* RDC_CMD_ENABLE */ 350*7836SJohn.Forte@Sun.COM #define RDC_OPT_CLRBMP 0x200 /* RDC_CMD_ENABLE */ 351*7836SJohn.Forte@Sun.COM #define RDC_OPT_REVERSE_ROLE 0x400 /* RDC_CMD_RECONFIG */ 352*7836SJohn.Forte@Sun.COM #define RDC_OPT_FORCE_QINIT 0x800 /* RDC_CMD_INITQ */ 353*7836SJohn.Forte@Sun.COM #define RDC_OPT_SET_QNOBLOCK 0x1000 /* RDC_CMD_TUNABLE */ 354*7836SJohn.Forte@Sun.COM #define RDC_OPT_CLR_QNOBLOCK 0x2000 /* RDC_CMD_TUNABLE */ 355*7836SJohn.Forte@Sun.COM #define RDC_OPT_FORCE_DISABLE 0x4000 /* RDC_CMD_DISABLE */ 356*7836SJohn.Forte@Sun.COM 357*7836SJohn.Forte@Sun.COM /* 358*7836SJohn.Forte@Sun.COM * RDC flags 359*7836SJohn.Forte@Sun.COM */ 360*7836SJohn.Forte@Sun.COM 361*7836SJohn.Forte@Sun.COM /* 362*7836SJohn.Forte@Sun.COM * Passed out by the kernel (status) 363*7836SJohn.Forte@Sun.COM */ 364*7836SJohn.Forte@Sun.COM #define RDC_ENABLED 0x2 /* RDC enabled */ 365*7836SJohn.Forte@Sun.COM #define RDC_PRIMARY 0x4 /* This node is the primary */ 366*7836SJohn.Forte@Sun.COM #define RDC_SLAVE 0x8 /* This node is target of the synch */ 367*7836SJohn.Forte@Sun.COM #define RDC_VOL_FAILED 0x10 /* Volume is failed */ 368*7836SJohn.Forte@Sun.COM #define RDC_BMP_FAILED 0x20 /* Bitmap is failed */ 369*7836SJohn.Forte@Sun.COM #define RDC_SYNC_NEEDED 0x40 /* Sync is needed */ 370*7836SJohn.Forte@Sun.COM #define RDC_RSYNC_NEEDED 0x80 /* Reverse sync is needed */ 371*7836SJohn.Forte@Sun.COM #define RDC_SYNCING 0x100 /* Synch in progress */ 372*7836SJohn.Forte@Sun.COM #define RDC_LOGGING 0x200 /* Logging */ 373*7836SJohn.Forte@Sun.COM #define RDC_FCAL_FAILED 0x400 /* Direct remote I/O failed */ 374*7836SJohn.Forte@Sun.COM #define RDC_ASYNC 0x800 /* Set is in async replicating mode */ 375*7836SJohn.Forte@Sun.COM #define RDC_FULL 0x1000 /* Full sync, not an update */ 376*7836SJohn.Forte@Sun.COM #define RDC_CLR_AFTERSYNC 0x2000 /* clr bitmap on secondary after sync */ 377*7836SJohn.Forte@Sun.COM #define RDC_DISKQ_FAILED 0x4000 /* Diskq I/O has failed */ 378*7836SJohn.Forte@Sun.COM #define RDC_QUEUING 0x8000 /* logging, but queueing to disk */ 379*7836SJohn.Forte@Sun.COM #ifndef RDC_QNOBLOCK 380*7836SJohn.Forte@Sun.COM #define RDC_QNOBLOCK 0x10000 381*7836SJohn.Forte@Sun.COM #endif 382*7836SJohn.Forte@Sun.COM #define RDC_SYNC_START 0 383*7836SJohn.Forte@Sun.COM #define RDC_SYNC_DONE 1 384*7836SJohn.Forte@Sun.COM #define RDC_RSYNC_START 2 385*7836SJohn.Forte@Sun.COM 386*7836SJohn.Forte@Sun.COM #ifdef _KERNEL 387*7836SJohn.Forte@Sun.COM 388*7836SJohn.Forte@Sun.COM /* 389*7836SJohn.Forte@Sun.COM * urdc->flags vs urdc->mflags usage: 390*7836SJohn.Forte@Sun.COM * 391*7836SJohn.Forte@Sun.COM * All flags are valid in urdc->flags, in which case the condition 392*7836SJohn.Forte@Sun.COM * holds for the specific urdc. 393*7836SJohn.Forte@Sun.COM * 394*7836SJohn.Forte@Sun.COM * The flags in RDC_MFLAGS can also be in urdc->mflags, in which case 395*7836SJohn.Forte@Sun.COM * the condition holds for a urdc somewhere on the many/multi chains 396*7836SJohn.Forte@Sun.COM * connected to this urdc. 397*7836SJohn.Forte@Sun.COM */ 398*7836SJohn.Forte@Sun.COM 399*7836SJohn.Forte@Sun.COM #define RDC_GROUP 0x7f8 /* Volume states that affect a group */ 400*7836SJohn.Forte@Sun.COM 401*7836SJohn.Forte@Sun.COM /* 402*7836SJohn.Forte@Sun.COM * Mask of volume flags that are valid in urdc->mflags 403*7836SJohn.Forte@Sun.COM */ 404*7836SJohn.Forte@Sun.COM #define RDC_MFLAGS (RDC_SLAVE | RDC_RSYNC_NEEDED) 405*7836SJohn.Forte@Sun.COM 406*7836SJohn.Forte@Sun.COM #define IS_SLAVE(urdc) (rdc_get_mflags(urdc) & RDC_SLAVE) 407*7836SJohn.Forte@Sun.COM 408*7836SJohn.Forte@Sun.COM /* 409*7836SJohn.Forte@Sun.COM * Mask of volume flags that are maintained in sync_flags not flags, 410*7836SJohn.Forte@Sun.COM * and protected by rdc_many_lock rather than the group lock. 411*7836SJohn.Forte@Sun.COM * This allows code that is operating on one set to change the flags 412*7836SJohn.Forte@Sun.COM * of another set. 413*7836SJohn.Forte@Sun.COM */ 414*7836SJohn.Forte@Sun.COM #define RDC_SFLAGS (RDC_SYNC_NEEDED | RDC_RSYNC_NEEDED | \ 415*7836SJohn.Forte@Sun.COM RDC_VOL_FAILED | RDC_CLR_AFTERSYNC) 416*7836SJohn.Forte@Sun.COM 417*7836SJohn.Forte@Sun.COM /* 418*7836SJohn.Forte@Sun.COM * Mask of volume flags that are maintained in bmap_flags not flags, 419*7836SJohn.Forte@Sun.COM * and protected by the bmapmutex rather than the group lock. 420*7836SJohn.Forte@Sun.COM */ 421*7836SJohn.Forte@Sun.COM #define RDC_BFLAGS RDC_BMP_FAILED 422*7836SJohn.Forte@Sun.COM 423*7836SJohn.Forte@Sun.COM #define RDC_VFLAGS (~(RDC_SFLAGS | RDC_BFLAGS)) 424*7836SJohn.Forte@Sun.COM 425*7836SJohn.Forte@Sun.COM #define RDC_SYNC_STATE_FLAGS (RDC_LOGGING | RDC_SYNCING | RDC_QUEUING | \ 426*7836SJohn.Forte@Sun.COM RDC_ASYNC) 427*7836SJohn.Forte@Sun.COM 428*7836SJohn.Forte@Sun.COM #define IS_ASYNC(urdc) (rdc_get_vflags(urdc) & RDC_ASYNC) 429*7836SJohn.Forte@Sun.COM #define IS_PRIMARY(urdc) (rdc_get_vflags(urdc) & RDC_PRIMARY) 430*7836SJohn.Forte@Sun.COM #define IS_SECONDARY(urdc) (!IS_PRIMARY(urdc)) 431*7836SJohn.Forte@Sun.COM #define IS_STATE(urdc, state) (rdc_get_vflags(urdc) & (state)) 432*7836SJohn.Forte@Sun.COM #define IS_REPLICATING(urdc) (!(rdc_get_vflags(urdc) & RDC_LOGGING) && \ 433*7836SJohn.Forte@Sun.COM !(rdc_get_vflags(urdc) & RDC_SYNCING)) 434*7836SJohn.Forte@Sun.COM 435*7836SJohn.Forte@Sun.COM #endif /* _KERNEL */ 436*7836SJohn.Forte@Sun.COM 437*7836SJohn.Forte@Sun.COM typedef struct rdc_status { 438*7836SJohn.Forte@Sun.COM int nset; /* Number of sets requested/enabled */ 439*7836SJohn.Forte@Sun.COM int maxsets; /* Max # of sets allowed today */ 440*7836SJohn.Forte@Sun.COM rdc_set_t rdc_set[1]; 441*7836SJohn.Forte@Sun.COM } rdc_status_t; 442*7836SJohn.Forte@Sun.COM 443*7836SJohn.Forte@Sun.COM #ifdef _SYSCALL32 444*7836SJohn.Forte@Sun.COM struct rdc_status32 { 445*7836SJohn.Forte@Sun.COM int32_t nset; /* Number of sets requested/enabled */ 446*7836SJohn.Forte@Sun.COM int32_t maxsets; /* Max # of sets allowed today */ 447*7836SJohn.Forte@Sun.COM struct rdc_set32 rdc_set[1]; 448*7836SJohn.Forte@Sun.COM }; 449*7836SJohn.Forte@Sun.COM #endif /* _SYSCALL32 */ 450*7836SJohn.Forte@Sun.COM 451*7836SJohn.Forte@Sun.COM typedef struct rdc_svc_args { 452*7836SJohn.Forte@Sun.COM int fd; /* Connection endpoint */ 453*7836SJohn.Forte@Sun.COM int nthr; /* Number of server threads */ 454*7836SJohn.Forte@Sun.COM char netid[128]; /* Identify transport */ 455*7836SJohn.Forte@Sun.COM struct netbuf addrmask; /* Address mask for host */ 456*7836SJohn.Forte@Sun.COM } rdc_svc_args_t; 457*7836SJohn.Forte@Sun.COM 458*7836SJohn.Forte@Sun.COM #ifdef _SYSCALL32 459*7836SJohn.Forte@Sun.COM struct rdc_svc_args32 { 460*7836SJohn.Forte@Sun.COM int32_t fd; 461*7836SJohn.Forte@Sun.COM int32_t nthr; 462*7836SJohn.Forte@Sun.COM char netid[128]; 463*7836SJohn.Forte@Sun.COM struct netbuf32 addrmask; 464*7836SJohn.Forte@Sun.COM }; 465*7836SJohn.Forte@Sun.COM #endif /* _SYSCALL32 */ 466*7836SJohn.Forte@Sun.COM 467*7836SJohn.Forte@Sun.COM typedef struct rdc_version { 468*7836SJohn.Forte@Sun.COM int major; /* Major release number */ 469*7836SJohn.Forte@Sun.COM int minor; /* Minor release number */ 470*7836SJohn.Forte@Sun.COM int micro; /* Micro release number */ 471*7836SJohn.Forte@Sun.COM int baseline; /* Baseline revison number */ 472*7836SJohn.Forte@Sun.COM } rdc_version_t; 473*7836SJohn.Forte@Sun.COM #ifdef _SYSCALL32 474*7836SJohn.Forte@Sun.COM typedef struct rdc_version32 { 475*7836SJohn.Forte@Sun.COM int32_t major; /* Major release number */ 476*7836SJohn.Forte@Sun.COM int32_t minor; /* Minor release number */ 477*7836SJohn.Forte@Sun.COM int32_t micro; /* Micro release number */ 478*7836SJohn.Forte@Sun.COM int32_t baseline; /* Baseline revison number */ 479*7836SJohn.Forte@Sun.COM } rdc_version32_t; 480*7836SJohn.Forte@Sun.COM #endif 481*7836SJohn.Forte@Sun.COM 482*7836SJohn.Forte@Sun.COM 483*7836SJohn.Forte@Sun.COM #if !defined(_KERNEL) 484*7836SJohn.Forte@Sun.COM 485*7836SJohn.Forte@Sun.COM #define RDC_IOCTL(cmd, a0, a1, a2, a3, a4, ustatus) \ 486*7836SJohn.Forte@Sun.COM rdc_ioctl((long)(cmd), (long)(a0), (long)(a1), (long)(a2), \ 487*7836SJohn.Forte@Sun.COM (long)(a3), (long)(a4), (ustatus)) 488*7836SJohn.Forte@Sun.COM 489*7836SJohn.Forte@Sun.COM extern int rdc_ioctl(long, long, long, long, long, long, spcs_s_info_t); 490*7836SJohn.Forte@Sun.COM extern int rdc_ioctl_simple(long, void *); 491*7836SJohn.Forte@Sun.COM 492*7836SJohn.Forte@Sun.COM #endif /* ! _KERNEL */ 493*7836SJohn.Forte@Sun.COM 494*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 495*7836SJohn.Forte@Sun.COM } 496*7836SJohn.Forte@Sun.COM #endif 497*7836SJohn.Forte@Sun.COM 498*7836SJohn.Forte@Sun.COM #endif /* _RDC_IOCTL_H */ 499