1*fcf3ce44SJohn Forte /* 2*fcf3ce44SJohn Forte * CDDL HEADER START 3*fcf3ce44SJohn Forte * 4*fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5*fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6*fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7*fcf3ce44SJohn Forte * 8*fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10*fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11*fcf3ce44SJohn Forte * and limitations under the License. 12*fcf3ce44SJohn Forte * 13*fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14*fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16*fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17*fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18*fcf3ce44SJohn Forte * 19*fcf3ce44SJohn Forte * CDDL HEADER END 20*fcf3ce44SJohn Forte */ 21*fcf3ce44SJohn Forte /* 22*fcf3ce44SJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*fcf3ce44SJohn Forte * Use is subject to license terms. 24*fcf3ce44SJohn Forte */ 25*fcf3ce44SJohn Forte 26*fcf3ce44SJohn Forte #ifndef _SV_H 27*fcf3ce44SJohn Forte #define _SV_H 28*fcf3ce44SJohn Forte 29*fcf3ce44SJohn Forte #ifdef __cplusplus 30*fcf3ce44SJohn Forte extern "C" { 31*fcf3ce44SJohn Forte #endif 32*fcf3ce44SJohn Forte 33*fcf3ce44SJohn Forte 34*fcf3ce44SJohn Forte /* 35*fcf3ce44SJohn Forte * Storage Volume Character and Block Driver (SV) 36*fcf3ce44SJohn Forte * Public header file. 37*fcf3ce44SJohn Forte * SPARC case 1998/036. 38*fcf3ce44SJohn Forte * PSARC case 1999/023. 39*fcf3ce44SJohn Forte */ 40*fcf3ce44SJohn Forte 41*fcf3ce44SJohn Forte #define SV_MAXPATH NSC_MAXPATH 42*fcf3ce44SJohn Forte #define SV_DEVICE "/dev/sv" 43*fcf3ce44SJohn Forte 44*fcf3ce44SJohn Forte 45*fcf3ce44SJohn Forte /* 46*fcf3ce44SJohn Forte * Ioctl structures 47*fcf3ce44SJohn Forte */ 48*fcf3ce44SJohn Forte 49*fcf3ce44SJohn Forte typedef struct sv_name_s { 50*fcf3ce44SJohn Forte char svn_path[SV_MAXPATH]; /* path to underlying raw device */ 51*fcf3ce44SJohn Forte time_t svn_timestamp; /* timestamp of successful enable */ 52*fcf3ce44SJohn Forte int svn_nblocks; /* size of device */ 53*fcf3ce44SJohn Forte int svn_mode; /* NSC_DEVICE | NSC_CACHE */ 54*fcf3ce44SJohn Forte } sv_name_t; 55*fcf3ce44SJohn Forte 56*fcf3ce44SJohn Forte 57*fcf3ce44SJohn Forte #ifdef _KERNEL 58*fcf3ce44SJohn Forte 59*fcf3ce44SJohn Forte typedef struct sv_name32_s { 60*fcf3ce44SJohn Forte char svn_path[SV_MAXPATH]; /* path to underlying raw device */ 61*fcf3ce44SJohn Forte int32_t svn_timestamp; /* timestamp of successful enable */ 62*fcf3ce44SJohn Forte int32_t svn_nblocks; /* size of device */ 63*fcf3ce44SJohn Forte int32_t svn_mode; /* NSC_DEVICE | NSC_CACHE */ 64*fcf3ce44SJohn Forte } sv_name32_t; 65*fcf3ce44SJohn Forte 66*fcf3ce44SJohn Forte #endif /* _KERNEL */ 67*fcf3ce44SJohn Forte 68*fcf3ce44SJohn Forte 69*fcf3ce44SJohn Forte typedef struct sv_list_s { 70*fcf3ce44SJohn Forte spcs_s_info_t svl_error; /* Error information */ 71*fcf3ce44SJohn Forte time_t svl_timestamp; /* time of successful {en,dis}able */ 72*fcf3ce44SJohn Forte int svl_count; /* Count of elements in svl_names */ 73*fcf3ce44SJohn Forte int svl_maxdevs; /* Max # of devices that can be used */ 74*fcf3ce44SJohn Forte sv_name_t *svl_names; /* pointer to names array */ 75*fcf3ce44SJohn Forte } sv_list_t; 76*fcf3ce44SJohn Forte 77*fcf3ce44SJohn Forte 78*fcf3ce44SJohn Forte #ifdef _KERNEL 79*fcf3ce44SJohn Forte 80*fcf3ce44SJohn Forte typedef struct sv_list32_s { 81*fcf3ce44SJohn Forte spcs_s_info32_t svl_error; /* Error information */ 82*fcf3ce44SJohn Forte int32_t svl_timestamp; /* time of successful {en,dis}able */ 83*fcf3ce44SJohn Forte int32_t svl_count; /* Count of elements in svl_names */ 84*fcf3ce44SJohn Forte int32_t svl_maxdevs; /* Max # of devices that can be used */ 85*fcf3ce44SJohn Forte uint32_t svl_names; /* pointer to names array */ 86*fcf3ce44SJohn Forte } sv_list32_t; 87*fcf3ce44SJohn Forte 88*fcf3ce44SJohn Forte #endif /* _KERNEL */ 89*fcf3ce44SJohn Forte 90*fcf3ce44SJohn Forte 91*fcf3ce44SJohn Forte typedef struct sv_conf_s { 92*fcf3ce44SJohn Forte spcs_s_info_t svc_error; /* Error information */ 93*fcf3ce44SJohn Forte char svc_path[SV_MAXPATH]; /* path to underlying raw device */ 94*fcf3ce44SJohn Forte int svc_flag; /* NSC_DEVICE | NSC_CACHE */ 95*fcf3ce44SJohn Forte major_t svc_major; /* major_t of underlying raw device */ 96*fcf3ce44SJohn Forte minor_t svc_minor; /* minor_t of underlying raw device */ 97*fcf3ce44SJohn Forte } sv_conf_t; 98*fcf3ce44SJohn Forte 99*fcf3ce44SJohn Forte #ifdef _KERNEL 100*fcf3ce44SJohn Forte 101*fcf3ce44SJohn Forte typedef struct sv_conf32_s { 102*fcf3ce44SJohn Forte spcs_s_info32_t svc_error; /* Error information */ 103*fcf3ce44SJohn Forte char svc_path[SV_MAXPATH]; /* path to underlying raw device */ 104*fcf3ce44SJohn Forte int32_t svc_flag; /* NSC_DEVICE | NSC_CACHE */ 105*fcf3ce44SJohn Forte major_t svc_major; /* major_t of underlying raw device */ 106*fcf3ce44SJohn Forte minor_t svc_minor; /* minor_t of underlying raw device */ 107*fcf3ce44SJohn Forte } sv_conf32_t; 108*fcf3ce44SJohn Forte 109*fcf3ce44SJohn Forte #endif /* _KERNEL */ 110*fcf3ce44SJohn Forte 111*fcf3ce44SJohn Forte 112*fcf3ce44SJohn Forte typedef struct sv_version_s { 113*fcf3ce44SJohn Forte spcs_s_info_t svv_error; /* Error information */ 114*fcf3ce44SJohn Forte int svv_major_rev; /* Major revision */ 115*fcf3ce44SJohn Forte int svv_minor_rev; /* Minor revision */ 116*fcf3ce44SJohn Forte int svv_micro_rev; /* Micro revision */ 117*fcf3ce44SJohn Forte int svv_baseline_rev; /* Baseline revision */ 118*fcf3ce44SJohn Forte } sv_version_t; 119*fcf3ce44SJohn Forte 120*fcf3ce44SJohn Forte #ifdef _KERNEL 121*fcf3ce44SJohn Forte 122*fcf3ce44SJohn Forte typedef struct sv_version32_s { 123*fcf3ce44SJohn Forte spcs_s_info32_t svv_error; /* Error information */ 124*fcf3ce44SJohn Forte int32_t svv_major_rev; /* Major revision */ 125*fcf3ce44SJohn Forte int32_t svv_minor_rev; /* Minor revision */ 126*fcf3ce44SJohn Forte int32_t svv_micro_rev; /* Micro revision */ 127*fcf3ce44SJohn Forte int32_t svv_baseline_rev; /* Baseline revision */ 128*fcf3ce44SJohn Forte } sv_version32_t; 129*fcf3ce44SJohn Forte 130*fcf3ce44SJohn Forte #endif /* _KERNEL */ 131*fcf3ce44SJohn Forte 132*fcf3ce44SJohn Forte 133*fcf3ce44SJohn Forte #ifdef _KERNEL 134*fcf3ce44SJohn Forte 135*fcf3ce44SJohn Forte /* 136*fcf3ce44SJohn Forte * SV guard devices. 137*fcf3ce44SJohn Forte */ 138*fcf3ce44SJohn Forte 139*fcf3ce44SJohn Forte typedef struct sv_guard_s { 140*fcf3ce44SJohn Forte int sg_magic; /* Magic # */ 141*fcf3ce44SJohn Forte int sg_version; /* Version # */ 142*fcf3ce44SJohn Forte char *sg_pathname; /* Pathname of device to guard */ 143*fcf3ce44SJohn Forte char *sg_module; /* Module name of client */ 144*fcf3ce44SJohn Forte int sg_kernel; /* Prevent user access if true */ 145*fcf3ce44SJohn Forte spcs_s_info_t sg_error; /* Error to be returned to client */ 146*fcf3ce44SJohn Forte } sv_guard_t; 147*fcf3ce44SJohn Forte 148*fcf3ce44SJohn Forte #define SV_SG_MAGIC 0x47554152 149*fcf3ce44SJohn Forte #define SV_SG_VERSION 1 150*fcf3ce44SJohn Forte 151*fcf3ce44SJohn Forte #endif /* _KERNEL */ 152*fcf3ce44SJohn Forte 153*fcf3ce44SJohn Forte 154*fcf3ce44SJohn Forte /* 155*fcf3ce44SJohn Forte * Ioctl numbers. 156*fcf3ce44SJohn Forte */ 157*fcf3ce44SJohn Forte 158*fcf3ce44SJohn Forte #define __SV__(x) (('S'<<16)|('V'<<8)|(x)) 159*fcf3ce44SJohn Forte 160*fcf3ce44SJohn Forte #define SVIOC_ENABLE __SV__(1) 161*fcf3ce44SJohn Forte #define SVIOC_DISABLE __SV__(2) 162*fcf3ce44SJohn Forte #define SVIOC_LIST __SV__(3) 163*fcf3ce44SJohn Forte #define SVIOC_VERSION __SV__(4) 164*fcf3ce44SJohn Forte #define SVIOC_UNLOAD __SV__(5) 165*fcf3ce44SJohn Forte 166*fcf3ce44SJohn Forte /* 167*fcf3ce44SJohn Forte * seconds to wait before unload, to drain lingering IOs. 168*fcf3ce44SJohn Forte */ 169*fcf3ce44SJohn Forte #define SV_WAIT_UNLOAD 10 170*fcf3ce44SJohn Forte 171*fcf3ce44SJohn Forte #ifdef __cplusplus 172*fcf3ce44SJohn Forte } 173*fcf3ce44SJohn Forte #endif 174*fcf3ce44SJohn Forte 175*fcf3ce44SJohn Forte #endif /* _SV_H */ 176