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