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 _SD_SAFESTORE_H 27*7836SJohn.Forte@Sun.COM #define _SD_SAFESTORE_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/nsc_thread.h> 34*7836SJohn.Forte@Sun.COM #ifdef DS_DDICT 35*7836SJohn.Forte@Sun.COM #include <sys/nsctl/contract.h> 36*7836SJohn.Forte@Sun.COM #endif 37*7836SJohn.Forte@Sun.COM #include <sys/nsctl/nsctl.h> 38*7836SJohn.Forte@Sun.COM #if defined(_KERNEL) || defined(_KMEMUSER) 39*7836SJohn.Forte@Sun.COM 40*7836SJohn.Forte@Sun.COM /* CSTYLED */ 41*7836SJohn.Forte@Sun.COM /**$ 42*7836SJohn.Forte@Sun.COM * token for a volume directory stream 43*7836SJohn.Forte@Sun.COM */ 44*7836SJohn.Forte@Sun.COM typedef struct ss_vdir_s { 45*7836SJohn.Forte@Sun.COM intptr_t opaque[6]; 46*7836SJohn.Forte@Sun.COM } ss_vdir_t; 47*7836SJohn.Forte@Sun.COM 48*7836SJohn.Forte@Sun.COM /* CSTYLED */ 49*7836SJohn.Forte@Sun.COM /**$ 50*7836SJohn.Forte@Sun.COM * token for a cache entry directory stream 51*7836SJohn.Forte@Sun.COM */ 52*7836SJohn.Forte@Sun.COM typedef struct ss_cdir_s { 53*7836SJohn.Forte@Sun.COM intptr_t opaque[6]; 54*7836SJohn.Forte@Sun.COM }ss_cdir_t; 55*7836SJohn.Forte@Sun.COM 56*7836SJohn.Forte@Sun.COM /* CSTYLED */ 57*7836SJohn.Forte@Sun.COM /**$ 58*7836SJohn.Forte@Sun.COM * token for a volume 59*7836SJohn.Forte@Sun.COM */ 60*7836SJohn.Forte@Sun.COM typedef struct ss_vol_s { 61*7836SJohn.Forte@Sun.COM intptr_t opaque; 62*7836SJohn.Forte@Sun.COM }ss_vol_t; 63*7836SJohn.Forte@Sun.COM 64*7836SJohn.Forte@Sun.COM /* CSTYLED */ 65*7836SJohn.Forte@Sun.COM /**$ 66*7836SJohn.Forte@Sun.COM * token for cache entry block and dirty bits 67*7836SJohn.Forte@Sun.COM */ 68*7836SJohn.Forte@Sun.COM typedef struct s_resource_s { 69*7836SJohn.Forte@Sun.COM intptr_t opaque; 70*7836SJohn.Forte@Sun.COM } ss_resource_t; 71*7836SJohn.Forte@Sun.COM 72*7836SJohn.Forte@Sun.COM /* CSTYLED */ 73*7836SJohn.Forte@Sun.COM /**$ 74*7836SJohn.Forte@Sun.COM * token for a list of cache safestore resources 75*7836SJohn.Forte@Sun.COM */ 76*7836SJohn.Forte@Sun.COM typedef struct ss_resourcelist_s { 77*7836SJohn.Forte@Sun.COM intptr_t opaque; 78*7836SJohn.Forte@Sun.COM }ss_resourcelist_t; 79*7836SJohn.Forte@Sun.COM 80*7836SJohn.Forte@Sun.COM 81*7836SJohn.Forte@Sun.COM /* CSTYLED */ 82*7836SJohn.Forte@Sun.COM /**$ 83*7836SJohn.Forte@Sun.COM * cache entry directory stream type specifier 84*7836SJohn.Forte@Sun.COM * 85*7836SJohn.Forte@Sun.COM * @field ck_type specifies all cache entries, cache entries for volume, node 86*7836SJohn.Forte@Sun.COM * @field ck_vol volume token if ck_type is CDIR_VOL 87*7836SJohn.Forte@Sun.COM * @field ck_node node id if ck_type is node CDIR_NODE 88*7836SJohn.Forte@Sun.COM */ 89*7836SJohn.Forte@Sun.COM typedef struct ss_cdirkey_s { 90*7836SJohn.Forte@Sun.COM uint_t ck_type; /* discriminator: see type defines below */ 91*7836SJohn.Forte@Sun.COM union { 92*7836SJohn.Forte@Sun.COM ss_vol_t *ck_vol; 93*7836SJohn.Forte@Sun.COM uint_t ck_node; 94*7836SJohn.Forte@Sun.COM } cdk_u; 95*7836SJohn.Forte@Sun.COM } ss_cdirkey_t; 96*7836SJohn.Forte@Sun.COM 97*7836SJohn.Forte@Sun.COM /* centry directory stream types */ 98*7836SJohn.Forte@Sun.COM #define CDIR_ALL 0 99*7836SJohn.Forte@Sun.COM #define CDIR_VOL 1 100*7836SJohn.Forte@Sun.COM #define CDIR_NODE 2 101*7836SJohn.Forte@Sun.COM 102*7836SJohn.Forte@Sun.COM /* BEGIN CSTYLED */ 103*7836SJohn.Forte@Sun.COM /**$ 104*7836SJohn.Forte@Sun.COM * exported cache entry info 105*7836SJohn.Forte@Sun.COM * 106*7836SJohn.Forte@Sun.COM * @field sc_cd the cache descriptor, associates this entry with a volume 107*7836SJohn.Forte@Sun.COM * @field sc_fpos file position in cache blocks 108*7836SJohn.Forte@Sun.COM * @field sc_dirty dirty bits, one for each fba in the cache block 109*7836SJohn.Forte@Sun.COM * @field sc_flag flags 110*7836SJohn.Forte@Sun.COM * @field sc_res safestore resource token for this cache entry 111*7836SJohn.Forte@Sun.COM * @see ss_voldata_t{} 112*7836SJohn.Forte@Sun.COM */ 113*7836SJohn.Forte@Sun.COM typedef struct ss_centry_info_s { 114*7836SJohn.Forte@Sun.COM int sc_cd; /* Cache descriptor */ 115*7836SJohn.Forte@Sun.COM nsc_off_t sc_fpos; /* File position */ 116*7836SJohn.Forte@Sun.COM int sc_dirty; /* Dirty mask */ 117*7836SJohn.Forte@Sun.COM int sc_flag; /* CC_PINNABLE | CC_PINNED */ 118*7836SJohn.Forte@Sun.COM ss_resource_t *sc_res; /* token for this centry */ 119*7836SJohn.Forte@Sun.COM } ss_centry_info_t; 120*7836SJohn.Forte@Sun.COM /* END CSTYLED */ 121*7836SJohn.Forte@Sun.COM 122*7836SJohn.Forte@Sun.COM 123*7836SJohn.Forte@Sun.COM /* CSTYLED */ 124*7836SJohn.Forte@Sun.COM /**$ 125*7836SJohn.Forte@Sun.COM * volume directory stream type specifier 126*7836SJohn.Forte@Sun.COM * 127*7836SJohn.Forte@Sun.COM * @field vk_type specifies all volume entries, entries for volume, node 128*7836SJohn.Forte@Sun.COM * @field vk_vol volume token if vk_type is VDIR_VOL 129*7836SJohn.Forte@Sun.COM * @field vk_node node id if vk_type is node VDIR_NODE 130*7836SJohn.Forte@Sun.COM */ 131*7836SJohn.Forte@Sun.COM typedef struct ss_vdirkey_s { 132*7836SJohn.Forte@Sun.COM uint_t vk_type; /* discriminator: see type defines below */ 133*7836SJohn.Forte@Sun.COM union { 134*7836SJohn.Forte@Sun.COM ss_vol_t *vk_vol; 135*7836SJohn.Forte@Sun.COM uint_t vk_node; 136*7836SJohn.Forte@Sun.COM } cdk_u; 137*7836SJohn.Forte@Sun.COM } ss_vdirkey_t; 138*7836SJohn.Forte@Sun.COM 139*7836SJohn.Forte@Sun.COM /* volume directory stream types */ 140*7836SJohn.Forte@Sun.COM #define VDIR_ALL 0 141*7836SJohn.Forte@Sun.COM #define VDIR_VOL 1 142*7836SJohn.Forte@Sun.COM #define VDIR_NODE 2 143*7836SJohn.Forte@Sun.COM 144*7836SJohn.Forte@Sun.COM /* CSTYLED */ 145*7836SJohn.Forte@Sun.COM /**$ 146*7836SJohn.Forte@Sun.COM * exported volume entry info 147*7836SJohn.Forte@Sun.COM * 148*7836SJohn.Forte@Sun.COM * @field sv_cd the cache descriptor 149*7836SJohn.Forte@Sun.COM * @field sv_vol the safestore volume token for this volume 150*7836SJohn.Forte@Sun.COM * @field sv_pinned volume has pinned blocks, holds node id 151*7836SJohn.Forte@Sun.COM * @field sv_attached node which has attached this volume 152*7836SJohn.Forte@Sun.COM * @field sv_volname path name 153*7836SJohn.Forte@Sun.COM * @field sv_devidsz length of device id, the sv_devid 154*7836SJohn.Forte@Sun.COM * @field sv_devid unique id for physical, i.e. non-volume-managed volumes 155*7836SJohn.Forte@Sun.COM */ 156*7836SJohn.Forte@Sun.COM typedef struct ss_voldata_s { 157*7836SJohn.Forte@Sun.COM int sv_cd; /* NOTE may need dual node map info */ 158*7836SJohn.Forte@Sun.COM ss_vol_t *sv_vol; /* volume token for this vol entry */ 159*7836SJohn.Forte@Sun.COM int sv_pinned; /* Device has failed/pinned blocks */ 160*7836SJohn.Forte@Sun.COM int sv_attached; /* Node which has device attached */ 161*7836SJohn.Forte@Sun.COM char sv_volname[NSC_MAXPATH]; /* Filename */ 162*7836SJohn.Forte@Sun.COM int sv_devidsz; /* unique dev id length */ 163*7836SJohn.Forte@Sun.COM uchar_t sv_devid[NSC_MAXPATH]; /* wwn id - physical devs only */ 164*7836SJohn.Forte@Sun.COM } ss_voldata_t; 165*7836SJohn.Forte@Sun.COM 166*7836SJohn.Forte@Sun.COM /* safestore media types */ 167*7836SJohn.Forte@Sun.COM 168*7836SJohn.Forte@Sun.COM /* CSTYLED */ 169*7836SJohn.Forte@Sun.COM /**% 170*7836SJohn.Forte@Sun.COM * safestore in RAM, useful but not very safe 171*7836SJohn.Forte@Sun.COM */ 172*7836SJohn.Forte@Sun.COM #define SS_M_RAM 0x00000001 173*7836SJohn.Forte@Sun.COM 174*7836SJohn.Forte@Sun.COM /* CSTYLED */ 175*7836SJohn.Forte@Sun.COM /**% 176*7836SJohn.Forte@Sun.COM * safestore in NVRAM on a single node 177*7836SJohn.Forte@Sun.COM */ 178*7836SJohn.Forte@Sun.COM #define SS_M_NV_SINGLENODE 0x00000002 179*7836SJohn.Forte@Sun.COM 180*7836SJohn.Forte@Sun.COM /* CSTYLED */ 181*7836SJohn.Forte@Sun.COM /**% 182*7836SJohn.Forte@Sun.COM * safestore in NVRAM on a dual node system. all data is store remotely. 183*7836SJohn.Forte@Sun.COM */ 184*7836SJohn.Forte@Sun.COM #define SS_M_NV_DUALNODE_NOMIRROR 0x00000004 185*7836SJohn.Forte@Sun.COM 186*7836SJohn.Forte@Sun.COM /* CSTYLED */ 187*7836SJohn.Forte@Sun.COM /**% 188*7836SJohn.Forte@Sun.COM * safestore in NVRAM on a dual node system. data is mirrored on both nodes. 189*7836SJohn.Forte@Sun.COM */ 190*7836SJohn.Forte@Sun.COM #define SS_M_NV_DUALNODE_MIRROR 0x00000008 191*7836SJohn.Forte@Sun.COM 192*7836SJohn.Forte@Sun.COM 193*7836SJohn.Forte@Sun.COM /* safestore data and metadata transport types */ 194*7836SJohn.Forte@Sun.COM 195*7836SJohn.Forte@Sun.COM /* CSTYLED */ 196*7836SJohn.Forte@Sun.COM /**% 197*7836SJohn.Forte@Sun.COM * data is transferred using STE connection 198*7836SJohn.Forte@Sun.COM */ 199*7836SJohn.Forte@Sun.COM #define SS_T_STE 0x00010000 200*7836SJohn.Forte@Sun.COM 201*7836SJohn.Forte@Sun.COM /* CSTYLED */ 202*7836SJohn.Forte@Sun.COM /**% 203*7836SJohn.Forte@Sun.COM * data is transferred using RPC 204*7836SJohn.Forte@Sun.COM */ 205*7836SJohn.Forte@Sun.COM #define SS_T_RPC 0x00020000 206*7836SJohn.Forte@Sun.COM 207*7836SJohn.Forte@Sun.COM /* CSTYLED */ 208*7836SJohn.Forte@Sun.COM /**% 209*7836SJohn.Forte@Sun.COM * no transport -- (single node) 210*7836SJohn.Forte@Sun.COM */ 211*7836SJohn.Forte@Sun.COM #define SS_T_NONE 0x08000000 212*7836SJohn.Forte@Sun.COM 213*7836SJohn.Forte@Sun.COM #define SS_MEDIA_MASK 0x0000ffff 214*7836SJohn.Forte@Sun.COM #define SS_TRANSPORT_MASK 0xffff0000 215*7836SJohn.Forte@Sun.COM 216*7836SJohn.Forte@Sun.COM #define _SD_NO_NET 0 217*7836SJohn.Forte@Sun.COM #define _SD_NO_NETADDR 0 218*7836SJohn.Forte@Sun.COM #define _SD_NO_HOST -1 219*7836SJohn.Forte@Sun.COM #define _SD_NO_CD -1 220*7836SJohn.Forte@Sun.COM 221*7836SJohn.Forte@Sun.COM /* config settings */ 222*7836SJohn.Forte@Sun.COM #define SS_UNCONFIGURED 0 223*7836SJohn.Forte@Sun.COM #define SS_INITTED 1 224*7836SJohn.Forte@Sun.COM #define SS_CONFIGURED 2 225*7836SJohn.Forte@Sun.COM 226*7836SJohn.Forte@Sun.COM /* error return for safestore ops */ 227*7836SJohn.Forte@Sun.COM #define SS_ERR -1 228*7836SJohn.Forte@Sun.COM #define SS_OK 0 229*7836SJohn.Forte@Sun.COM #define SS_EOF 1 230*7836SJohn.Forte@Sun.COM 231*7836SJohn.Forte@Sun.COM /* config flag */ 232*7836SJohn.Forte@Sun.COM #define SS_GENPATTERN 1 233*7836SJohn.Forte@Sun.COM 234*7836SJohn.Forte@Sun.COM /* 235*7836SJohn.Forte@Sun.COM * convenience macros. should they be implemented in ss_ctl()? 236*7836SJohn.Forte@Sun.COM */ 237*7836SJohn.Forte@Sun.COM 238*7836SJohn.Forte@Sun.COM /* is safestore on a single node? */ 239*7836SJohn.Forte@Sun.COM #define SAFESTORE_LOCAL(ssp) ((ssp) && (ssp->ssop_type & SS_T_NONE)) 240*7836SJohn.Forte@Sun.COM 241*7836SJohn.Forte@Sun.COM /* is safestore really safe or is it just RAM? */ 242*7836SJohn.Forte@Sun.COM #define SAFESTORE_SAFE(ssp) ((ssp) && !(ssp->ssop_type & SS_M_RAM)) 243*7836SJohn.Forte@Sun.COM 244*7836SJohn.Forte@Sun.COM /* is recovery needed with this safestore module? */ 245*7836SJohn.Forte@Sun.COM #define SAFESTORE_RECOVERY(ssp) ((ssp) && \ 246*7836SJohn.Forte@Sun.COM (ssp->ssop_flags & SS_RECOVERY_NEEDED)) 247*7836SJohn.Forte@Sun.COM 248*7836SJohn.Forte@Sun.COM /* CSTYLED */ 249*7836SJohn.Forte@Sun.COM /**$ 250*7836SJohn.Forte@Sun.COM * configuration structure provided by safestore client 251*7836SJohn.Forte@Sun.COM * 252*7836SJohn.Forte@Sun.COM * @field ssc_configured set by safestore module to indicate config completed 253*7836SJohn.Forte@Sun.COM * @field ssc_ss_psize safestore internal page size, set by ss module 254*7836SJohn.Forte@Sun.COM * @field ssc_client_psize callers page size 255*7836SJohn.Forte@Sun.COM * @field ssc_wsize cache size in bytes: amount of data that can be safestored 256*7836SJohn.Forte@Sun.COM * @field ssc_maxfiles maximum number of volumes 257*7836SJohn.Forte@Sun.COM * @field ssc_pattern initialization pattern if any 258*7836SJohn.Forte@Sun.COM * @field ssc_flag use ssc_pattern if this is SS_GENPATTERN 259*7836SJohn.Forte@Sun.COM */ 260*7836SJohn.Forte@Sun.COM typedef struct ss_common_config_s { 261*7836SJohn.Forte@Sun.COM uint_t ssc_configured; 262*7836SJohn.Forte@Sun.COM uint_t ssc_ss_psize; /* safestore internal page size */ 263*7836SJohn.Forte@Sun.COM uint_t ssc_client_psize; /* client page size */ 264*7836SJohn.Forte@Sun.COM uint_t ssc_wsize; /* Write cache size in bytes */ 265*7836SJohn.Forte@Sun.COM int ssc_maxfiles; /* max files */ 266*7836SJohn.Forte@Sun.COM uint_t ssc_pattern; /* initialization pattern */ 267*7836SJohn.Forte@Sun.COM uint_t ssc_flag; 268*7836SJohn.Forte@Sun.COM } ss_common_config_t; 269*7836SJohn.Forte@Sun.COM 270*7836SJohn.Forte@Sun.COM /* BEGIN CSTYLED */ 271*7836SJohn.Forte@Sun.COM /**$ 272*7836SJohn.Forte@Sun.COM * safestore operations structure 273*7836SJohn.Forte@Sun.COM * 274*7836SJohn.Forte@Sun.COM * @field ssop_name description of this module. 275*7836SJohn.Forte@Sun.COM * @field ssop_type media type OR'd with transport type 276*7836SJohn.Forte@Sun.COM * @field ssop_flags SS_RECOVERY_NEEDED 277*7836SJohn.Forte@Sun.COM * @field ssop_configure configure the module 278*7836SJohn.Forte@Sun.COM * @field ssop_deconfigure deconfigure the module 279*7836SJohn.Forte@Sun.COM * @field ssop_getvdir get a volume directory stream according to type 280*7836SJohn.Forte@Sun.COM * @field ssop_getvdirent get next entry in a volume directory stream 281*7836SJohn.Forte@Sun.COM * @field ssop_getvol get the data for a volume 282*7836SJohn.Forte@Sun.COM * @field ssop_setvol set the data for a volume 283*7836SJohn.Forte@Sun.COM * @field ssop_getcdir get cache entry directory stream according to type 284*7836SJohn.Forte@Sun.COM * @field ssop_getcdirent get next cache entry in stream 285*7836SJohn.Forte@Sun.COM * @field ssop_allocresource allocate safestore resources from free list 286*7836SJohn.Forte@Sun.COM * @field ssop_deallocresource deallocate, i.e. free, a safestore resource 287*7836SJohn.Forte@Sun.COM * @field ssop_getresource get next resource in resource list 288*7836SJohn.Forte@Sun.COM * @field ssop_getcentry get metadata for a cache entry 289*7836SJohn.Forte@Sun.COM * @field ssop_setcentry set the metadata for a cache entry 290*7836SJohn.Forte@Sun.COM * @field ssop_read_cblock read the actual data for a cache entry 291*7836SJohn.Forte@Sun.COM * @field ssop_write_cblock write the data for a cache entry 292*7836SJohn.Forte@Sun.COM * @field ssop_ctl module entry point for everything else, e.g. stats 293*7836SJohn.Forte@Sun.COM * 294*7836SJohn.Forte@Sun.COM * @see ss_vdirkey_t{} 295*7836SJohn.Forte@Sun.COM * @see ss_voldata_t{} 296*7836SJohn.Forte@Sun.COM * @see ss_cdirkey_t{} 297*7836SJohn.Forte@Sun.COM * @see ss_resourcelist_t{} 298*7836SJohn.Forte@Sun.COM * @see ss_resource_t{} 299*7836SJohn.Forte@Sun.COM * @see ss_centry_info_t{} 300*7836SJohn.Forte@Sun.COM */ 301*7836SJohn.Forte@Sun.COM typedef struct safestore_ops_s { 302*7836SJohn.Forte@Sun.COM char *ssop_name; 303*7836SJohn.Forte@Sun.COM uint_t ssop_type; /* media type OR'd with transport type */ 304*7836SJohn.Forte@Sun.COM uint_t ssop_flags; /* recovery needed, etc */ 305*7836SJohn.Forte@Sun.COM int (* ssop_configure)(ss_common_config_t *, spcs_s_info_t); 306*7836SJohn.Forte@Sun.COM int (* ssop_deconfigure)(int); 307*7836SJohn.Forte@Sun.COM int (* ssop_getvdir)(const ss_vdirkey_t *, ss_vdir_t *); 308*7836SJohn.Forte@Sun.COM int (* ssop_getvdirent)(const ss_vdir_t *, ss_voldata_t *); 309*7836SJohn.Forte@Sun.COM int (* ssop_getvol)(ss_voldata_t *); 310*7836SJohn.Forte@Sun.COM int (* ssop_setvol)(const ss_voldata_t *); 311*7836SJohn.Forte@Sun.COM int (* ssop_getcdir)(const ss_cdirkey_t *, ss_cdir_t *); 312*7836SJohn.Forte@Sun.COM int (* ssop_getcdirent)(ss_cdir_t *, ss_centry_info_t *); 313*7836SJohn.Forte@Sun.COM int (* ssop_allocresource)(int, int *, ss_resourcelist_t **); 314*7836SJohn.Forte@Sun.COM void (* ssop_deallocresource)(ss_resource_t *); 315*7836SJohn.Forte@Sun.COM int (* ssop_getresource)(ss_resourcelist_t **, ss_resource_t **); 316*7836SJohn.Forte@Sun.COM int (* ssop_getcentry)(ss_centry_info_t *); 317*7836SJohn.Forte@Sun.COM int (* ssop_setcentry)(const ss_centry_info_t *); 318*7836SJohn.Forte@Sun.COM int (* ssop_read_cblock)(const ss_resource_t *, void *, int, int); 319*7836SJohn.Forte@Sun.COM int (* ssop_write_cblock)(const ss_resource_t *, 320*7836SJohn.Forte@Sun.COM const void *, int, int); 321*7836SJohn.Forte@Sun.COM int (* ssop_ctl)(uint_t, uintptr_t); 322*7836SJohn.Forte@Sun.COM } safestore_ops_t; 323*7836SJohn.Forte@Sun.COM /* END CSTYLED */ 324*7836SJohn.Forte@Sun.COM 325*7836SJohn.Forte@Sun.COM /* ssop_flags */ 326*7836SJohn.Forte@Sun.COM /* 327*7836SJohn.Forte@Sun.COM * no writes permitted when this bit is set in ssop flags field 328*7836SJohn.Forte@Sun.COM * (single node nvram mostly) 329*7836SJohn.Forte@Sun.COM */ 330*7836SJohn.Forte@Sun.COM #define SS_RECOVERY_NEEDED 1 331*7836SJohn.Forte@Sun.COM 332*7836SJohn.Forte@Sun.COM /* safestore operations */ 333*7836SJohn.Forte@Sun.COM 334*7836SJohn.Forte@Sun.COM /* BEGIN CSTYLED */ 335*7836SJohn.Forte@Sun.COM /**# 336*7836SJohn.Forte@Sun.COM * SSOP_CONFIGURE() configure a safestore module 337*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 338*7836SJohn.Forte@Sun.COM * @param cfg a pointer to ss_common_config_t, initialized by caller 339*7836SJohn.Forte@Sun.COM * @param kstatus unistat spcs_s_info_t 340*7836SJohn.Forte@Sun.COM * @return SS_OK successful, errno otherwise 341*7836SJohn.Forte@Sun.COM * 342*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 343*7836SJohn.Forte@Sun.COM * @see sst_open() 344*7836SJohn.Forte@Sun.COM * @see ss_common_config_t{} 345*7836SJohn.Forte@Sun.COM */ 346*7836SJohn.Forte@Sun.COM #define SSOP_CONFIGURE(ssp, cfg, kstatus) \ 347*7836SJohn.Forte@Sun.COM ((ssp)->ssop_configure(cfg, kstatus)) 348*7836SJohn.Forte@Sun.COM 349*7836SJohn.Forte@Sun.COM /**# 350*7836SJohn.Forte@Sun.COM * SSOP_DECONFIGURE deconfigure a safestore module 351*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 352*7836SJohn.Forte@Sun.COM * @param dirty integer flag, if set it signifies there is pinned data 353*7836SJohn.Forte@Sun.COM * @return SS_OK success, SS_ERR otherwise 354*7836SJohn.Forte@Sun.COM * 355*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 356*7836SJohn.Forte@Sun.COM */ 357*7836SJohn.Forte@Sun.COM #define SSOP_DECONFIGURE(ssp, dirty) ((ssp)->ssop_deconfigure(dirty)) 358*7836SJohn.Forte@Sun.COM 359*7836SJohn.Forte@Sun.COM 360*7836SJohn.Forte@Sun.COM /* volume directory functions */ 361*7836SJohn.Forte@Sun.COM 362*7836SJohn.Forte@Sun.COM /**# 363*7836SJohn.Forte@Sun.COM * SSOP_GETVDIR get a volume directory stream according to type 364*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 365*7836SJohn.Forte@Sun.COM * @param key pointer to ss_vdirkey_t initialized by caller 366*7836SJohn.Forte@Sun.COM * @param vdir pointer to ss_vdir_t owned by caller 367*7836SJohn.Forte@Sun.COM * @return SS_OK success, SS_ERR otherwise 368*7836SJohn.Forte@Sun.COM * 369*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 370*7836SJohn.Forte@Sun.COM * @see ss_vdirkey_t{} 371*7836SJohn.Forte@Sun.COM * @see ss_vdir_t{} 372*7836SJohn.Forte@Sun.COM */ 373*7836SJohn.Forte@Sun.COM #define SSOP_GETVDIR(ssp, key, vdir) ((ssp)->ssop_getvdir(key, vdir)) 374*7836SJohn.Forte@Sun.COM 375*7836SJohn.Forte@Sun.COM /**# 376*7836SJohn.Forte@Sun.COM * SSOP_GETVDIRENT get next volume in a volume directory stream 377*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 378*7836SJohn.Forte@Sun.COM * @param vdir pointer to a properly initialized ss_vdir_t obtained 379*7836SJohn.Forte@Sun.COM * from a successsful SSOP_GETVDIR() call 380*7836SJohn.Forte@Sun.COM * @param voldata pointer to ss_voldata_t owned by caller, filled 381*7836SJohn.Forte@Sun.COM * in with valid data on successful return 382*7836SJohn.Forte@Sun.COM * @return SS_OK success 383*7836SJohn.Forte@Sun.COM * SS_EOF if no more elements in stream, 384*7836SJohn.Forte@Sun.COM * SS_ERR otherwise 385*7836SJohn.Forte@Sun.COM * 386*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 387*7836SJohn.Forte@Sun.COM * @see sst_open() 388*7836SJohn.Forte@Sun.COM * @see ss_vdir_t{} 389*7836SJohn.Forte@Sun.COM * @see ss_voldata_t{} 390*7836SJohn.Forte@Sun.COM * @see SSOP_GETVDIR() 391*7836SJohn.Forte@Sun.COM */ 392*7836SJohn.Forte@Sun.COM #define SSOP_GETVDIRENT(ssp, vdir, voldata) \ 393*7836SJohn.Forte@Sun.COM ((ssp)->ssop_getvdirent(vdir, voldata)) 394*7836SJohn.Forte@Sun.COM 395*7836SJohn.Forte@Sun.COM /* volume accessor functions */ 396*7836SJohn.Forte@Sun.COM 397*7836SJohn.Forte@Sun.COM /**# 398*7836SJohn.Forte@Sun.COM * SSOP_GETVOL get the volume data for a particular volume 399*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 400*7836SJohn.Forte@Sun.COM * @param voldata pointer to ss_voldata_t owned by caller, field sv_vol 401*7836SJohn.Forte@Sun.COM * must be initialized with a valid ss_vol_t, normally 402*7836SJohn.Forte@Sun.COM * obtained from a successful SSOP_GETVDIRENT() call. 403*7836SJohn.Forte@Sun.COM * the rest of the structure is filled with valid volume data 404*7836SJohn.Forte@Sun.COM * on successful return 405*7836SJohn.Forte@Sun.COM * @return SS_OK if data read successfully 406*7836SJohn.Forte@Sun.COM * SS_ERR otherwise 407*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 408*7836SJohn.Forte@Sun.COM * @see sst_open() 409*7836SJohn.Forte@Sun.COM * @see ss_voldata_t{} 410*7836SJohn.Forte@Sun.COM * @see ss_vol_t{} 411*7836SJohn.Forte@Sun.COM * @see SSOP_GETVDIRENT() 412*7836SJohn.Forte@Sun.COM */ 413*7836SJohn.Forte@Sun.COM #define SSOP_GETVOL(ssp, voldata) ((ssp)->ssop_getvol(voldata)) 414*7836SJohn.Forte@Sun.COM 415*7836SJohn.Forte@Sun.COM 416*7836SJohn.Forte@Sun.COM /**# 417*7836SJohn.Forte@Sun.COM * SSOP_SETVOL set the volume data for a particular volume 418*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 419*7836SJohn.Forte@Sun.COM * @param voldata pointer to ss_voldata_t owned by caller, field sv_vol 420*7836SJohn.Forte@Sun.COM * must be initialized with a valid ss_vol_t, obtained from 421*7836SJohn.Forte@Sun.COM * a successful SSOP_GETVDIRENT() call. the remaining 422*7836SJohn.Forte@Sun.COM * fields of the structure are written to safestore 423*7836SJohn.Forte@Sun.COM * @return SS_OK if data saved successfully 424*7836SJohn.Forte@Sun.COM * SS_ERR otherwise 425*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 426*7836SJohn.Forte@Sun.COM * @see sst_open() 427*7836SJohn.Forte@Sun.COM * @see ss_voldata_t{} 428*7836SJohn.Forte@Sun.COM * @see ss_vol_t{} 429*7836SJohn.Forte@Sun.COM * @see SSOP_GETVDIRENT() 430*7836SJohn.Forte@Sun.COM */ 431*7836SJohn.Forte@Sun.COM #define SSOP_SETVOL(ssp, voldata) ((ssp)->ssop_setvol(voldata)) 432*7836SJohn.Forte@Sun.COM 433*7836SJohn.Forte@Sun.COM /* centry directory functions */ 434*7836SJohn.Forte@Sun.COM 435*7836SJohn.Forte@Sun.COM /**# 436*7836SJohn.Forte@Sun.COM * SSOP_GETCDIR get a cache entry stream accroding to type 437*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 438*7836SJohn.Forte@Sun.COM * @param key pointer to a ss_cdirkey_t initialized by caller 439*7836SJohn.Forte@Sun.COM * @param cdir pointer to ss_cdir_t owned by caller 440*7836SJohn.Forte@Sun.COM * @return SS_OK success, SS_ERR otherwise 441*7836SJohn.Forte@Sun.COM * 442*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 443*7836SJohn.Forte@Sun.COM * @see sst_open() 444*7836SJohn.Forte@Sun.COM * @see ss_cdirkey_t{} 445*7836SJohn.Forte@Sun.COM * @ see ss_cdir_t{} 446*7836SJohn.Forte@Sun.COM */ 447*7836SJohn.Forte@Sun.COM #define SSOP_GETCDIR(ssp, key, cdir) \ 448*7836SJohn.Forte@Sun.COM ((ssp)->ssop_getcdir(key, cdir)) 449*7836SJohn.Forte@Sun.COM 450*7836SJohn.Forte@Sun.COM /**# 451*7836SJohn.Forte@Sun.COM * SSOP_GETCDIRENT get next cache entry in a cache entry stream 452*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 453*7836SJohn.Forte@Sun.COM * @param cdir pointer to valid ss_cdirkey_t obtained from a 454*7836SJohn.Forte@Sun.COM * successsful SSOP_GETCDIR call 455*7836SJohn.Forte@Sun.COM * @param voldata pointer to ss_voldata_t owned by caller, filled 456*7836SJohn.Forte@Sun.COM * in with valid data on successful return 457*7836SJohn.Forte@Sun.COM * @return SS_OK success 458*7836SJohn.Forte@Sun.COM * SS_EOF if no more elements in stream, 459*7836SJohn.Forte@Sun.COM * SS_ERR otherwise 460*7836SJohn.Forte@Sun.COM * 461*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 462*7836SJohn.Forte@Sun.COM * @see sst_open() 463*7836SJohn.Forte@Sun.COM * @see ss_vdirkey_t{} 464*7836SJohn.Forte@Sun.COM * @see ss_voldata_t{} 465*7836SJohn.Forte@Sun.COM * @see SSOP_GETVDIR() 466*7836SJohn.Forte@Sun.COM */ 467*7836SJohn.Forte@Sun.COM #define SSOP_GETCDIRENT(ssp, cdir, centry) \ 468*7836SJohn.Forte@Sun.COM ((ssp)->ssop_getcdirent(cdir, centry)) 469*7836SJohn.Forte@Sun.COM 470*7836SJohn.Forte@Sun.COM /* cache entry alloc functions */ 471*7836SJohn.Forte@Sun.COM 472*7836SJohn.Forte@Sun.COM /**# 473*7836SJohn.Forte@Sun.COM * SSOP_ALLOCRESOURCE allocate safestore resources from the free list 474*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 475*7836SJohn.Forte@Sun.COM * @param count number of resources, that is data blocks, needed 476*7836SJohn.Forte@Sun.COM * @param stall integer pointer to stall count, no blocks available. used only 477*7836SJohn.Forte@Sun.COM * when _sd_wblk_sync === 0 478*7836SJohn.Forte@Sun.COM * @param reslist pointer to pointer to ss_resourcelist_t. points to valid 479*7836SJohn.Forte@Sun.COM * resource list on successful return 480*7836SJohn.Forte@Sun.COM * @return SS_OK success 481*7836SJohn.Forte@Sun.COM * SS_ERR otherwise 482*7836SJohn.Forte@Sun.COM * 483*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 484*7836SJohn.Forte@Sun.COM * @see ss_resourcelist_t{} 485*7836SJohn.Forte@Sun.COM * @see SSOP_DEALLOCRESOURCE() 486*7836SJohn.Forte@Sun.COM * @see SSOP_GETRESOURCE() 487*7836SJohn.Forte@Sun.COM */ 488*7836SJohn.Forte@Sun.COM #define SSOP_ALLOCRESOURCE(ssp, count, stall, reslist) \ 489*7836SJohn.Forte@Sun.COM ((ssp)->ssop_allocresource(count, stall, reslist)) 490*7836SJohn.Forte@Sun.COM 491*7836SJohn.Forte@Sun.COM /**# 492*7836SJohn.Forte@Sun.COM * SSOP_DEALLOCRESOURCE deallocate, i.e. release, a single safestore resource 493*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 494*7836SJohn.Forte@Sun.COM * @param res pointer to ss_resource_t to be released 495*7836SJohn.Forte@Sun.COM * @return void 496*7836SJohn.Forte@Sun.COM * 497*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 498*7836SJohn.Forte@Sun.COM * @see ss_resource_t{} 499*7836SJohn.Forte@Sun.COM * @see SSOP_ALLOCRESOURCE() 500*7836SJohn.Forte@Sun.COM * @see SSOP_GETRESOURCE() 501*7836SJohn.Forte@Sun.COM */ 502*7836SJohn.Forte@Sun.COM #define SSOP_DEALLOCRESOURCE(ssp, res) \ 503*7836SJohn.Forte@Sun.COM ((ssp)->ssop_deallocresource(res)) 504*7836SJohn.Forte@Sun.COM 505*7836SJohn.Forte@Sun.COM /**# 506*7836SJohn.Forte@Sun.COM * SSOP_GETRESOURCE get the next safestore resource in a list 507*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 508*7836SJohn.Forte@Sun.COM * @param reslist pointer to pointer to ss_resourcelist_t obtained from 509*7836SJohn.Forte@Sun.COM * a successful call to SSOP_ALLOCRESOURCE() 510*7836SJohn.Forte@Sun.COM * @param res pointer to pointer to ss_resource_t. points to a valid 511*7836SJohn.Forte@Sun.COM * on successful resource 512*7836SJohn.Forte@Sun.COM * @return SS_OK success 513*7836SJohn.Forte@Sun.COM * SS_EOF if no more resources in list 514*7836SJohn.Forte@Sun.COM * SS_ERR otherwise 515*7836SJohn.Forte@Sun.COM * 516*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 517*7836SJohn.Forte@Sun.COM * @see ss_resourcelist_t{} 518*7836SJohn.Forte@Sun.COM * @see ss_resource_t{} 519*7836SJohn.Forte@Sun.COM * @see SSOP_ALLOCRESOURCE() 520*7836SJohn.Forte@Sun.COM * @see SSOP_DEALLOCRESOURCE() 521*7836SJohn.Forte@Sun.COM */ 522*7836SJohn.Forte@Sun.COM #define SSOP_GETRESOURCE(ssp, reslist, res) \ 523*7836SJohn.Forte@Sun.COM ((ssp)->ssop_getresource(reslist, res)) 524*7836SJohn.Forte@Sun.COM 525*7836SJohn.Forte@Sun.COM /* centry accessor functions */ 526*7836SJohn.Forte@Sun.COM 527*7836SJohn.Forte@Sun.COM 528*7836SJohn.Forte@Sun.COM /**# 529*7836SJohn.Forte@Sun.COM * SSOP_GETCENTRY read cache entry metadata for a particular cache entry 530*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 531*7836SJohn.Forte@Sun.COM * @param centry_info pointer to ss_centry_info_t owned by caller. 532*7836SJohn.Forte@Sun.COM * field sc_res must point to a valid ss_resource_t 533*7836SJohn.Forte@Sun.COM * obtained from a successful call to SSOP_GETRESOURCE(). 534*7836SJohn.Forte@Sun.COM * the rest of the structure is filled with valid 535*7836SJohn.Forte@Sun.COM * metadata on successful return 536*7836SJohn.Forte@Sun.COM * @return SS_OK if data was read successfully 537*7836SJohn.Forte@Sun.COM * SS_ERR otherwise 538*7836SJohn.Forte@Sun.COM * 539*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 540*7836SJohn.Forte@Sun.COM * @see sst_open() 541*7836SJohn.Forte@Sun.COM * @see ss_centry_info_t 542*7836SJohn.Forte@Sun.COM * @see ss_resource_t{} 543*7836SJohn.Forte@Sun.COM * @see SSOP_GETRESOURCE() 544*7836SJohn.Forte@Sun.COM */ 545*7836SJohn.Forte@Sun.COM #define SSOP_GETCENTRY(ssp, centry_info) \ 546*7836SJohn.Forte@Sun.COM ((ssp)->ssop_getcentry(centry_info)) 547*7836SJohn.Forte@Sun.COM 548*7836SJohn.Forte@Sun.COM /**# 549*7836SJohn.Forte@Sun.COM * SSOP_SETCENTRY write cache entry metadata for a particular cache entry 550*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 551*7836SJohn.Forte@Sun.COM * @param centry_info pointer to ss_centry_info_t owned by caller. 552*7836SJohn.Forte@Sun.COM * field sc_res must point to a valid ss_resource_t 553*7836SJohn.Forte@Sun.COM * obtained from a successful call to SSOP_GETRESOURCE(). 554*7836SJohn.Forte@Sun.COM * the remaining fields of the structured are written 555*7836SJohn.Forte@Sun.COM * to safestore. 556*7836SJohn.Forte@Sun.COM * @return SS_OK if data was written successfully 557*7836SJohn.Forte@Sun.COM * SS_ERR otherwise 558*7836SJohn.Forte@Sun.COM * 559*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 560*7836SJohn.Forte@Sun.COM * @see sst_open() 561*7836SJohn.Forte@Sun.COM * @see ss_centry_info_t{} 562*7836SJohn.Forte@Sun.COM * @see ss_resource_t{} 563*7836SJohn.Forte@Sun.COM * @see SSOP_GETRESOURCE() 564*7836SJohn.Forte@Sun.COM */ 565*7836SJohn.Forte@Sun.COM #define SSOP_SETCENTRY(ssp, centry_info) \ 566*7836SJohn.Forte@Sun.COM ((ssp)->ssop_setcentry(centry_info)) 567*7836SJohn.Forte@Sun.COM 568*7836SJohn.Forte@Sun.COM /* cache data block read/write and ctl */ 569*7836SJohn.Forte@Sun.COM 570*7836SJohn.Forte@Sun.COM 571*7836SJohn.Forte@Sun.COM /**# 572*7836SJohn.Forte@Sun.COM * SSOP_READ_CBLOCK read cache data for a particular cache entry 573*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 574*7836SJohn.Forte@Sun.COM * @param resource pointer to ss_resource_t obtained from a successful 575*7836SJohn.Forte@Sun.COM * call to SSOP_GETRESOURCE(). 576*7836SJohn.Forte@Sun.COM * @param buf buffer to hold the data 577*7836SJohn.Forte@Sun.COM * @param nbyte number of bytes to read 578*7836SJohn.Forte@Sun.COM * @param srcoffset byte location from beginning of the cache block 579*7836SJohn.Forte@Sun.COM * represented by resource to read the data from 580*7836SJohn.Forte@Sun.COM * 581*7836SJohn.Forte@Sun.COM * @return SS_OK if data was read successfully 582*7836SJohn.Forte@Sun.COM * SS_ERR otherwise 583*7836SJohn.Forte@Sun.COM * 584*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 585*7836SJohn.Forte@Sun.COM * @see sst_open() 586*7836SJohn.Forte@Sun.COM * @see ss_resource_t{} 587*7836SJohn.Forte@Sun.COM * @see SSOP_GETRESOURCE() 588*7836SJohn.Forte@Sun.COM */ 589*7836SJohn.Forte@Sun.COM #define SSOP_READ_CBLOCK(ssp, resource, buf, nbyte, srcoffset) \ 590*7836SJohn.Forte@Sun.COM ((ssp)->ssop_read_cblock(resource, buf, nbyte, srcoffset)) 591*7836SJohn.Forte@Sun.COM /**# 592*7836SJohn.Forte@Sun.COM * SSOP_WRITE_CBLOCK write cache data for a particular cache entry 593*7836SJohn.Forte@Sun.COM * @param ssp a safestore_ops_t pointer obtained from sst_open() 594*7836SJohn.Forte@Sun.COM * @param resource pointer to ss_resource_t obtained from a successful 595*7836SJohn.Forte@Sun.COM * call to SSOP_GETRESOURCE(). 596*7836SJohn.Forte@Sun.COM * @param buf buffer to hold the data 597*7836SJohn.Forte@Sun.COM * @param nbyte number of bytes to write 598*7836SJohn.Forte@Sun.COM * @param destoffset byte location from beginning the cache block 599*7836SJohn.Forte@Sun.COM * represented by resource to write the data to 600*7836SJohn.Forte@Sun.COM * 601*7836SJohn.Forte@Sun.COM * @return SS_OK if data was read successfully 602*7836SJohn.Forte@Sun.COM * SS_ERR otherwise 603*7836SJohn.Forte@Sun.COM * 604*7836SJohn.Forte@Sun.COM * @see safestore_ops_t{} 605*7836SJohn.Forte@Sun.COM * @see sst_open() 606*7836SJohn.Forte@Sun.COM * @see ss_resource_t{} 607*7836SJohn.Forte@Sun.COM * @see SSOP_GETRESOURCE() 608*7836SJohn.Forte@Sun.COM */ 609*7836SJohn.Forte@Sun.COM #define SSOP_WRITE_CBLOCK(ssp, resource, buf, nbyte, destoffset) \ 610*7836SJohn.Forte@Sun.COM ((ssp)->ssop_write_cblock(resource, buf, nbyte, destoffset)) 611*7836SJohn.Forte@Sun.COM 612*7836SJohn.Forte@Sun.COM /**# 613*7836SJohn.Forte@Sun.COM * SSOP_CTL perform a safestore control function 614*7836SJohn.Forte@Sun.COM * @param cmd integer specifying the command to execute, e.g. SSIOC_STATS. 615*7836SJohn.Forte@Sun.COM * some commands may be specific to a safestore module type 616*7836SJohn.Forte@Sun.COM * @param arg a uintptr_t that has additional information that is 617*7836SJohn.Forte@Sun.COM * needed by the safestore module to perform the command. it 618*7836SJohn.Forte@Sun.COM * may be an int or a pionter to a module specifc structure. 619*7836SJohn.Forte@Sun.COM * @return SS_OK success 620*7836SJohn.Forte@Sun.COM * errno otherwise 621*7836SJohn.Forte@Sun.COM */ 622*7836SJohn.Forte@Sun.COM #define SSOP_CTL(ssp, cmd, arg) ((ssp)->ssop_ctl(cmd, arg)) 623*7836SJohn.Forte@Sun.COM 624*7836SJohn.Forte@Sun.COM /* END CSTYLED */ 625*7836SJohn.Forte@Sun.COM 626*7836SJohn.Forte@Sun.COM /* general control definitions supported by safestore modules */ 627*7836SJohn.Forte@Sun.COM 628*7836SJohn.Forte@Sun.COM #define SSCTL(x) (('S'<< 16)|('S'<< 8)|(x)) 629*7836SJohn.Forte@Sun.COM 630*7836SJohn.Forte@Sun.COM #define SSIOC_STATS SSCTL(1) 631*7836SJohn.Forte@Sun.COM #define SSIOC_SETFLAG SSCTL(2) 632*7836SJohn.Forte@Sun.COM 633*7836SJohn.Forte@Sun.COM /* structure definitions */ 634*7836SJohn.Forte@Sun.COM 635*7836SJohn.Forte@Sun.COM typedef struct ssioc_stats_s { 636*7836SJohn.Forte@Sun.COM int wq_inq; /* write queue count */ 637*7836SJohn.Forte@Sun.COM } ssioc_stats_t; 638*7836SJohn.Forte@Sun.COM 639*7836SJohn.Forte@Sun.COM extern void sst_init(); 640*7836SJohn.Forte@Sun.COM extern void sst_register_mod(safestore_ops_t *); 641*7836SJohn.Forte@Sun.COM extern void sst_unregister_mod(safestore_ops_t *); 642*7836SJohn.Forte@Sun.COM extern safestore_ops_t *sst_open(uint_t, ...); 643*7836SJohn.Forte@Sun.COM extern int sst_close(safestore_ops_t *); 644*7836SJohn.Forte@Sun.COM 645*7836SJohn.Forte@Sun.COM extern safestore_ops_t *sdbc_safestore; 646*7836SJohn.Forte@Sun.COM 647*7836SJohn.Forte@Sun.COM extern int _sd_centry_shift; 648*7836SJohn.Forte@Sun.COM 649*7836SJohn.Forte@Sun.COM #endif /* _KERNEL */ 650*7836SJohn.Forte@Sun.COM 651*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 652*7836SJohn.Forte@Sun.COM } 653*7836SJohn.Forte@Sun.COM #endif 654*7836SJohn.Forte@Sun.COM 655*7836SJohn.Forte@Sun.COM #endif /* _SD_SAFESTORE_H */ 656