| @@ -1,353 +1,361 @@ | | | @@ -1,353 +1,361 @@ |
1 | /* $NetBSD: dm.h,v 1.5 2009/01/02 00:42:31 haad Exp $ */ | | 1 | /* $NetBSD: dm.h,v 1.6 2009/01/02 11:03:24 haad Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Adam Hamsik. | | 8 | * by Adam Hamsik. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
15 | * 2. Redistributions in binary form must reproduce the above copyright | | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in the | | 16 | * notice, this list of conditions and the following disclaimer in the |
17 | * documentation and/or other materials provided with the distribution. | | 17 | * documentation and/or other materials provided with the distribution. |
18 | * | | 18 | * |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #ifndef _DM_DEV_H_ | | 32 | #ifndef _DM_DEV_H_ |
33 | #define _DM_DEV_H_ | | 33 | #define _DM_DEV_H_ |
34 | | | 34 | |
35 | | | 35 | |
36 | #ifdef _KERNEL | | 36 | #ifdef _KERNEL |
37 | | | 37 | |
38 | #include <sys/errno.h> | | 38 | #include <sys/errno.h> |
39 | | | 39 | |
40 | #include <sys/atomic.h> | | 40 | #include <sys/atomic.h> |
41 | #include <sys/condvar.h> | | 41 | #include <sys/condvar.h> |
42 | #include <sys/mutex.h> | | 42 | #include <sys/mutex.h> |
43 | #include <sys/rwlock.h> | | 43 | #include <sys/rwlock.h> |
44 | #include <sys/queue.h> | | 44 | #include <sys/queue.h> |
45 | | | 45 | |
46 | #define DM_MAX_TYPE_NAME 16 | | 46 | #define DM_MAX_TYPE_NAME 16 |
47 | #define DM_NAME_LEN 128 | | 47 | #define DM_NAME_LEN 128 |
48 | #define DM_UUID_LEN 129 | | 48 | #define DM_UUID_LEN 129 |
49 | | | 49 | |
50 | #define DM_VERSION_MAJOR 4 | | 50 | #define DM_VERSION_MAJOR 4 |
51 | #define DM_VERSION_MINOR 13 | | 51 | #define DM_VERSION_MINOR 13 |
52 | #define DM_VERSION_PATCHLEVEL 0 | | 52 | #define DM_VERSION_PATCHLEVEL 0 |
53 | | | 53 | |
54 | /*** Internal device-mapper structures ***/ | | 54 | /*** Internal device-mapper structures ***/ |
55 | | | 55 | |
56 | /* | | 56 | /* |
57 | * A table entry describes a physical range of the logical volume. | | 57 | * A table entry describes a physical range of the logical volume. |
58 | */ | | 58 | */ |
59 | #define MAX_TARGET_STRING_LEN 32 | | 59 | #define MAX_TARGET_STRING_LEN 32 |
60 | | | 60 | |
61 | /* | | 61 | /* |
62 | * A device mapper table is a list of physical ranges plus the mapping target | | 62 | * A device mapper table is a list of physical ranges plus the mapping target |
63 | * applied to them. | | 63 | * applied to them. |
64 | */ | | 64 | */ |
65 | | | 65 | |
66 | typedef struct dm_table_entry { | | 66 | typedef struct dm_table_entry { |
67 | struct dm_dev *dm_dev; /* backlink */ | | 67 | struct dm_dev *dm_dev; /* backlink */ |
68 | uint64_t start; | | 68 | uint64_t start; |
69 | uint64_t length; | | 69 | uint64_t length; |
70 | | | 70 | |
71 | struct dm_target *target; /* Link to table target. */ | | 71 | struct dm_target *target; /* Link to table target. */ |
72 | void *target_config; /* Target specific data. */ | | 72 | void *target_config; /* Target specific data. */ |
73 | SLIST_ENTRY(dm_table_entry) next; | | 73 | SLIST_ENTRY(dm_table_entry) next; |
74 | } dm_table_entry_t; | | 74 | } dm_table_entry_t; |
75 | | | 75 | |
76 | SLIST_HEAD(dm_table, dm_table_entry); | | 76 | SLIST_HEAD(dm_table, dm_table_entry); |
77 | | | 77 | |
78 | typedef struct dm_table dm_table_t; | | 78 | typedef struct dm_table dm_table_t; |
79 | | | 79 | |
80 | typedef struct dm_table_head { | | 80 | typedef struct dm_table_head { |
81 | /* Current active table is selected with this. */ | | 81 | /* Current active table is selected with this. */ |
82 | int cur_active_table; | | 82 | int cur_active_table; |
83 | struct dm_table tables[2]; | | 83 | struct dm_table tables[2]; |
84 | | | 84 | |
85 | kmutex_t table_mtx; | | 85 | kmutex_t table_mtx; |
86 | kcondvar_t table_cv; /*IO waiting cv */ | | 86 | kcondvar_t table_cv; /*IO waiting cv */ |
87 | | | 87 | |
88 | uint32_t io_cnt; | | 88 | uint32_t io_cnt; |
89 | } dm_table_head_t; | | 89 | } dm_table_head_t; |
90 | | | 90 | |
91 | #define MAX_DEV_NAME 32 | | 91 | #define MAX_DEV_NAME 32 |
92 | | | 92 | |
93 | /* | | 93 | /* |
94 | * This structure is used to store opened vnodes for disk with name. | | 94 | * This structure is used to store opened vnodes for disk with name. |
95 | * I need this because devices can be opened only once, but I can | | 95 | * I need this because devices can be opened only once, but I can |
96 | * have more then one device on one partition. | | 96 | * have more then one device on one partition. |
97 | */ | | 97 | */ |
98 | | | 98 | |
99 | typedef struct dm_pdev { | | 99 | typedef struct dm_pdev { |
100 | char name[MAX_DEV_NAME]; | | 100 | char name[MAX_DEV_NAME]; |
101 | | | 101 | |
102 | struct vnode *pdev_vnode; | | 102 | struct vnode *pdev_vnode; |
103 | int ref_cnt; /* reference counter for users ofthis pdev */ | | 103 | int ref_cnt; /* reference counter for users ofthis pdev */ |
104 | | | 104 | |
105 | SLIST_ENTRY(dm_pdev) next_pdev; | | 105 | SLIST_ENTRY(dm_pdev) next_pdev; |
106 | } dm_pdev_t; | | 106 | } dm_pdev_t; |
107 | | | 107 | |
108 | /* | | 108 | /* |
109 | * This structure is called for every device-mapper device. | | 109 | * This structure is called for every device-mapper device. |
110 | * It points to SLIST of device tables and mirrored, snapshoted etc. devices. | | 110 | * It points to SLIST of device tables and mirrored, snapshoted etc. devices. |
111 | */ | | 111 | */ |
112 | TAILQ_HEAD(dm_dev_head, dm_dev) dm_devs; | | 112 | TAILQ_HEAD(dm_dev_head, dm_dev) dm_devs; |
113 | | | 113 | |
114 | typedef struct dm_dev { | | 114 | typedef struct dm_dev { |
115 | char name[DM_NAME_LEN]; | | 115 | char name[DM_NAME_LEN]; |
116 | char uuid[DM_UUID_LEN]; | | 116 | char uuid[DM_UUID_LEN]; |
117 | | | 117 | |
118 | int minor; | | 118 | int minor; |
119 | uint32_t flags; /* store communication protocol flags */ | | 119 | uint32_t flags; /* store communication protocol flags */ |
120 | | | 120 | |
121 | kmutex_t dev_mtx; /* mutex for generall device lock */ | | 121 | kmutex_t dev_mtx; /* mutex for generall device lock */ |
122 | kcondvar_t dev_cv; /* cv for between ioctl synchronisation */ | | 122 | kcondvar_t dev_cv; /* cv for between ioctl synchronisation */ |
123 | | | 123 | |
124 | uint32_t event_nr; | | 124 | uint32_t event_nr; |
125 | uint32_t ref_cnt; | | 125 | uint32_t ref_cnt; |
126 | | | 126 | |
127 | uint32_t dev_type; | | 127 | uint32_t dev_type; |
128 | | | 128 | |
129 | dm_table_head_t table_head; | | 129 | dm_table_head_t table_head; |
130 | | | 130 | |
131 | struct dm_dev_head upcalls; | | 131 | struct dm_dev_head upcalls; |
132 | | | 132 | |
133 | struct disklabel *dk_label; /* Disklabel for this table. */ | | 133 | struct disklabel *dk_label; /* Disklabel for this table. */ |
134 | | | 134 | |
135 | TAILQ_ENTRY(dm_dev) next_upcall; /* LIST of mirrored, snapshoted devices. */ | | 135 | TAILQ_ENTRY(dm_dev) next_upcall; /* LIST of mirrored, snapshoted devices. */ |
136 | | | 136 | |
137 | TAILQ_ENTRY(dm_dev) next_devlist; /* Major device list. */ | | 137 | TAILQ_ENTRY(dm_dev) next_devlist; /* Major device list. */ |
138 | } dm_dev_t; | | 138 | } dm_dev_t; |
139 | | | 139 | |
140 | /* Device types used for upcalls */ | | 140 | /* Device types used for upcalls */ |
141 | #define DM_ZERO_DEV (1 << 0) | | 141 | #define DM_ZERO_DEV (1 << 0) |
142 | #define DM_ERROR_DEV (1 << 1) | | 142 | #define DM_ERROR_DEV (1 << 1) |
143 | #define DM_LINEAR_DEV (1 << 2) | | 143 | #define DM_LINEAR_DEV (1 << 2) |
144 | #define DM_MIRROR_DEV (1 << 3) | | 144 | #define DM_MIRROR_DEV (1 << 3) |
145 | #define DM_STRIPE_DEV (1 << 4) | | 145 | #define DM_STRIPE_DEV (1 << 4) |
146 | #define DM_SNAPSHOT_DEV (1 << 5) | | 146 | #define DM_SNAPSHOT_DEV (1 << 5) |
147 | #define DM_SNAPSHOT_ORIG_DEV (1 << 6) | | 147 | #define DM_SNAPSHOT_ORIG_DEV (1 << 6) |
148 | #define DM_SPARE_DEV (1 << 7) | | 148 | #define DM_SPARE_DEV (1 << 7) |
149 | /* Set this device type only during dev remove ioctl. */ | | 149 | /* Set this device type only during dev remove ioctl. */ |
150 | #define DM_DELETING_DEV (1 << 8) | | 150 | #define DM_DELETING_DEV (1 << 8) |
151 | | | 151 | |
152 | | | 152 | |
153 | /* for zero, error : dm_target->target_config == NULL */ | | 153 | /* for zero, error : dm_target->target_config == NULL */ |
154 | | | 154 | |
155 | /* | | 155 | /* |
156 | * Target config is initiated with target_init function. | | 156 | * Target config is initiated with target_init function. |
157 | */ | | 157 | */ |
158 | | | 158 | |
159 | /* for linear : */ | | 159 | /* for linear : */ |
160 | typedef struct target_linear_config { | | 160 | typedef struct target_linear_config { |
161 | dm_pdev_t *pdev; | | 161 | dm_pdev_t *pdev; |
162 | uint64_t offset; | | 162 | uint64_t offset; |
163 | } dm_target_linear_config_t; | | 163 | } dm_target_linear_config_t; |
164 | | | 164 | |
165 | | | 165 | |
166 | /* for mirror : */ | | 166 | /* for mirror : */ |
167 | typedef struct target_mirror_config { | | 167 | typedef struct target_mirror_config { |
168 | #define MAX_MIRROR_COPIES 4 | | 168 | #define MAX_MIRROR_COPIES 4 |
169 | dm_pdev_t *orig; | | 169 | dm_pdev_t *orig; |
170 | dm_pdev_t *copies[MAX_MIRROR_COPIES]; | | 170 | dm_pdev_t *copies[MAX_MIRROR_COPIES]; |
171 | | | 171 | |
172 | /* copied blocks bitmaps administration etc*/ | | 172 | /* copied blocks bitmaps administration etc*/ |
173 | dm_pdev_t *log_pdev; /* for administration */ | | 173 | dm_pdev_t *log_pdev; /* for administration */ |
174 | uint64_t log_regionsize; /* blocksize of mirror */ | | 174 | uint64_t log_regionsize; /* blocksize of mirror */ |
175 | | | 175 | |
176 | /* list of parts that still need copied etc.; run length encoded? */ | | 176 | /* list of parts that still need copied etc.; run length encoded? */ |
177 | } dm_target_mirror_config_t; | | 177 | } dm_target_mirror_config_t; |
178 | | | 178 | |
179 | | | 179 | |
180 | /* for snapshot : */ | | 180 | /* for snapshot : */ |
181 | typedef struct target_snapshot_config { | | 181 | typedef struct target_snapshot_config { |
182 | dm_pdev_t *tsc_snap_dev; | | 182 | dm_pdev_t *tsc_snap_dev; |
183 | /* cow dev is set only for persistent snapshot devices */ | | 183 | /* cow dev is set only for persistent snapshot devices */ |
184 | dm_pdev_t *tsc_cow_dev; | | 184 | dm_pdev_t *tsc_cow_dev; |
185 | | | 185 | |
186 | uint64_t tsc_chunk_size; | | 186 | uint64_t tsc_chunk_size; |
187 | uint32_t tsc_persistent_dev; | | 187 | uint32_t tsc_persistent_dev; |
188 | } dm_target_snapshot_config_t; | | 188 | } dm_target_snapshot_config_t; |
189 | | | 189 | |
190 | /* for snapshot-origin devices */ | | 190 | /* for snapshot-origin devices */ |
191 | typedef struct target_snapshot_origin_config { | | 191 | typedef struct target_snapshot_origin_config { |
192 | dm_pdev_t *tsoc_real_dev; | | 192 | dm_pdev_t *tsoc_real_dev; |
193 | /* list of snapshots ? */ | | 193 | /* list of snapshots ? */ |
194 | } dm_target_snapshot_origin_config_t; | | 194 | } dm_target_snapshot_origin_config_t; |
195 | | | 195 | |
196 | /* constant dm_target structures for error, zero, linear, stripes etc. */ | | 196 | /* constant dm_target structures for error, zero, linear, stripes etc. */ |
197 | typedef struct dm_target { | | 197 | typedef struct dm_target { |
198 | char name[DM_MAX_TYPE_NAME]; | | 198 | char name[DM_MAX_TYPE_NAME]; |
199 | /* Initialize target_config area */ | | 199 | /* Initialize target_config area */ |
200 | int (*init)(dm_dev_t *, void **, char *); | | 200 | int (*init)(dm_dev_t *, void **, char *); |
201 | | | 201 | |
202 | /* Destroy target_config area */ | | 202 | /* Destroy target_config area */ |
203 | int (*destroy)(dm_table_entry_t *); | | 203 | int (*destroy)(dm_table_entry_t *); |
204 | | | 204 | |
205 | int (*deps) (dm_table_entry_t *, prop_array_t); | | 205 | int (*deps) (dm_table_entry_t *, prop_array_t); |
206 | /* | | 206 | /* |
207 | * Status routine is called to get params string, which is target | | 207 | * Status routine is called to get params string, which is target |
208 | * specific. When dm_table_status_ioctl is called with flag | | 208 | * specific. When dm_table_status_ioctl is called with flag |
209 | * DM_STATUS_TABLE_FLAG I have to sent params string back. | | 209 | * DM_STATUS_TABLE_FLAG I have to sent params string back. |
210 | */ | | 210 | */ |
211 | char * (*status)(void *); | | 211 | char * (*status)(void *); |
212 | int (*strategy)(dm_table_entry_t *, struct buf *); | | 212 | int (*strategy)(dm_table_entry_t *, struct buf *); |
213 | int (*upcall)(dm_table_entry_t *, struct buf *); | | 213 | int (*upcall)(dm_table_entry_t *, struct buf *); |
214 | | | 214 | |
215 | uint32_t version[3]; | | 215 | uint32_t version[3]; |
216 | int ref_cnt; | | 216 | int ref_cnt; |
217 | | | 217 | |
218 | TAILQ_ENTRY(dm_target) dm_target_next; | | 218 | TAILQ_ENTRY(dm_target) dm_target_next; |
219 | } dm_target_t; | | 219 | } dm_target_t; |
220 | | | 220 | |
221 | /* Interface structures */ | | 221 | /* Interface structures */ |
222 | | | 222 | |
223 | /* | | 223 | /* |
224 | * This structure is used to translate command sent to kernel driver in | | 224 | * This structure is used to translate command sent to kernel driver in |
225 | * <key>command</key> | | 225 | * <key>command</key> |
226 | * <value></value> | | 226 | * <value></value> |
227 | * to function which I can call. | | 227 | * to function which I can call. |
228 | */ | | 228 | */ |
229 | struct cmd_function { | | 229 | struct cmd_function { |
230 | const char *cmd; | | 230 | const char *cmd; |
231 | int (*fn)(prop_dictionary_t); | | 231 | int (*fn)(prop_dictionary_t); |
232 | }; | | 232 | }; |
233 | | | 233 | |
234 | /* device-mapper */ | | 234 | /* device-mapper */ |
235 | void dmgetdisklabel(struct disklabel *, dm_table_head_t *); | | 235 | void dmgetdisklabel(struct disklabel *, dm_table_head_t *); |
236 | | | 236 | |
237 | /* dm_ioctl.c */ | | 237 | /* dm_ioctl.c */ |
238 | int dm_dev_create_ioctl(prop_dictionary_t); | | 238 | int dm_dev_create_ioctl(prop_dictionary_t); |
239 | int dm_dev_list_ioctl(prop_dictionary_t); | | 239 | int dm_dev_list_ioctl(prop_dictionary_t); |
240 | int dm_dev_remove_ioctl(prop_dictionary_t); | | 240 | int dm_dev_remove_ioctl(prop_dictionary_t); |
241 | int dm_dev_rename_ioctl(prop_dictionary_t); | | 241 | int dm_dev_rename_ioctl(prop_dictionary_t); |
242 | int dm_dev_resume_ioctl(prop_dictionary_t); | | 242 | int dm_dev_resume_ioctl(prop_dictionary_t); |
243 | int dm_dev_status_ioctl(prop_dictionary_t); | | 243 | int dm_dev_status_ioctl(prop_dictionary_t); |
244 | int dm_dev_suspend_ioctl(prop_dictionary_t); | | 244 | int dm_dev_suspend_ioctl(prop_dictionary_t); |
245 | | | 245 | |
246 | int dm_check_version(prop_dictionary_t); | | 246 | int dm_check_version(prop_dictionary_t); |
247 | int dm_get_version_ioctl(prop_dictionary_t); | | 247 | int dm_get_version_ioctl(prop_dictionary_t); |
248 | int dm_list_versions_ioctl(prop_dictionary_t); | | 248 | int dm_list_versions_ioctl(prop_dictionary_t); |
249 | | | 249 | |
250 | int dm_table_clear_ioctl(prop_dictionary_t); | | 250 | int dm_table_clear_ioctl(prop_dictionary_t); |
251 | int dm_table_deps_ioctl(prop_dictionary_t); | | 251 | int dm_table_deps_ioctl(prop_dictionary_t); |
252 | int dm_table_load_ioctl(prop_dictionary_t); | | 252 | int dm_table_load_ioctl(prop_dictionary_t); |
253 | int dm_table_status_ioctl(prop_dictionary_t); | | 253 | int dm_table_status_ioctl(prop_dictionary_t); |
254 | | | 254 | |
255 | /* dm_target.c */ | | 255 | /* dm_target.c */ |
256 | dm_target_t* dm_target_alloc(const char *); | | 256 | dm_target_t* dm_target_alloc(const char *); |
257 | int dm_target_destroy(void); | | 257 | int dm_target_destroy(void); |
258 | int dm_target_insert(dm_target_t *); | | 258 | int dm_target_insert(dm_target_t *); |
259 | prop_array_t dm_target_prop_list(void); | | 259 | prop_array_t dm_target_prop_list(void); |
260 | dm_target_t* dm_target_lookup(const char *); | | 260 | dm_target_t* dm_target_lookup(const char *); |
261 | int dm_target_rem(char *); | | 261 | int dm_target_rem(char *); |
262 | void dm_target_unbusy(dm_target_t *); | | 262 | void dm_target_unbusy(dm_target_t *); |
263 | void dm_target_busy(dm_target_t *); | | 263 | void dm_target_busy(dm_target_t *); |
264 | | | 264 | |
265 | /* XXX temporally add */ | | 265 | /* XXX temporally add */ |
266 | int dm_target_init(void); | | 266 | int dm_target_init(void); |
267 | | | 267 | |
268 | /* dm_target_zero.c */ | | 268 | /* dm_target_zero.c */ |
269 | int dm_target_zero_init(dm_dev_t *, void**, char *); | | 269 | int dm_target_zero_init(dm_dev_t *, void**, char *); |
270 | char * dm_target_zero_status(void *); | | 270 | char * dm_target_zero_status(void *); |
271 | int dm_target_zero_strategy(dm_table_entry_t *, struct buf *); | | 271 | int dm_target_zero_strategy(dm_table_entry_t *, struct buf *); |
272 | int dm_target_zero_destroy(dm_table_entry_t *); | | 272 | int dm_target_zero_destroy(dm_table_entry_t *); |
273 | int dm_target_zero_deps(dm_table_entry_t *, prop_array_t); | | 273 | int dm_target_zero_deps(dm_table_entry_t *, prop_array_t); |
274 | int dm_target_zero_upcall(dm_table_entry_t *, struct buf *); | | 274 | int dm_target_zero_upcall(dm_table_entry_t *, struct buf *); |
275 | | | 275 | |
276 | /* dm_target_error.c */ | | 276 | /* dm_target_error.c */ |
277 | int dm_target_error_init(dm_dev_t *, void**, char *); | | 277 | int dm_target_error_init(dm_dev_t *, void**, char *); |
278 | char * dm_target_error_status(void *); | | 278 | char * dm_target_error_status(void *); |
279 | int dm_target_error_strategy(dm_table_entry_t *, struct buf *); | | 279 | int dm_target_error_strategy(dm_table_entry_t *, struct buf *); |
280 | int dm_target_error_deps(dm_table_entry_t *, prop_array_t); | | 280 | int dm_target_error_deps(dm_table_entry_t *, prop_array_t); |
281 | int dm_target_error_destroy(dm_table_entry_t *); | | 281 | int dm_target_error_destroy(dm_table_entry_t *); |
282 | int dm_target_error_upcall(dm_table_entry_t *, struct buf *); | | 282 | int dm_target_error_upcall(dm_table_entry_t *, struct buf *); |
283 | | | 283 | |
284 | /* dm_target_linear.c */ | | 284 | /* dm_target_linear.c */ |
285 | int dm_target_linear_init(dm_dev_t *, void**, char *); | | 285 | int dm_target_linear_init(dm_dev_t *, void**, char *); |
286 | char * dm_target_linear_status(void *); | | 286 | char * dm_target_linear_status(void *); |
287 | int dm_target_linear_strategy(dm_table_entry_t *, struct buf *); | | 287 | int dm_target_linear_strategy(dm_table_entry_t *, struct buf *); |
288 | int dm_target_linear_deps(dm_table_entry_t *, prop_array_t); | | 288 | int dm_target_linear_deps(dm_table_entry_t *, prop_array_t); |
289 | int dm_target_linear_destroy(dm_table_entry_t *); | | 289 | int dm_target_linear_destroy(dm_table_entry_t *); |
290 | int dm_target_linear_upcall(dm_table_entry_t *, struct buf *); | | 290 | int dm_target_linear_upcall(dm_table_entry_t *, struct buf *); |
291 | | | 291 | |
292 | /* Generic function used to convert char to string */ | | 292 | /* Generic function used to convert char to string */ |
293 | uint64_t atoi(const char *); | | 293 | uint64_t atoi(const char *); |
294 | | | 294 | |
| | | 295 | /* dm_target_mirror.c */ |
| | | 296 | int dm_target_mirror_init(dm_dev_t *, void**, char *); |
| | | 297 | char * dm_target_mirror_status(void *); |
| | | 298 | int dm_target_mirror_strategy(dm_table_entry_t *, struct buf *); |
| | | 299 | int dm_target_mirror_deps(dm_table_entry_t *, prop_array_t); |
| | | 300 | int dm_target_mirror_destroy(dm_table_entry_t *); |
| | | 301 | int dm_target_mirror_upcall(dm_table_entry_t *, struct buf *); |
| | | 302 | |
295 | /* dm_target_stripe.c */ | | 303 | /* dm_target_stripe.c */ |
296 | int dm_target_stripe_init(dm_dev_t *, void**, char *); | | 304 | int dm_target_stripe_init(dm_dev_t *, void**, char *); |
297 | char * dm_target_stripe_status(void *); | | 305 | char * dm_target_stripe_status(void *); |
298 | int dm_target_stripe_strategy(dm_table_entry_t *, struct buf *); | | 306 | int dm_target_stripe_strategy(dm_table_entry_t *, struct buf *); |
299 | int dm_target_stripe_deps(dm_table_entry_t *, prop_array_t); | | 307 | int dm_target_stripe_deps(dm_table_entry_t *, prop_array_t); |
300 | int dm_target_stripe_destroy(dm_table_entry_t *); | | 308 | int dm_target_stripe_destroy(dm_table_entry_t *); |
301 | int dm_target_stripe_upcall(dm_table_entry_t *, struct buf *); | | 309 | int dm_target_stripe_upcall(dm_table_entry_t *, struct buf *); |
302 | | | 310 | |
303 | /* dm_target_snapshot.c */ | | 311 | /* dm_target_snapshot.c */ |
304 | int dm_target_snapshot_init(dm_dev_t *, void**, char *); | | 312 | int dm_target_snapshot_init(dm_dev_t *, void**, char *); |
305 | char * dm_target_snapshot_status(void *); | | 313 | char * dm_target_snapshot_status(void *); |
306 | int dm_target_snapshot_strategy(dm_table_entry_t *, struct buf *); | | 314 | int dm_target_snapshot_strategy(dm_table_entry_t *, struct buf *); |
307 | int dm_target_snapshot_deps(dm_table_entry_t *, prop_array_t); | | 315 | int dm_target_snapshot_deps(dm_table_entry_t *, prop_array_t); |
308 | int dm_target_snapshot_destroy(dm_table_entry_t *); | | 316 | int dm_target_snapshot_destroy(dm_table_entry_t *); |
309 | int dm_target_snapshot_upcall(dm_table_entry_t *, struct buf *); | | 317 | int dm_target_snapshot_upcall(dm_table_entry_t *, struct buf *); |
310 | | | 318 | |
311 | /* dm snapshot origin driver */ | | 319 | /* dm snapshot origin driver */ |
312 | int dm_target_snapshot_orig_init(dm_dev_t *, void**, char *); | | 320 | int dm_target_snapshot_orig_init(dm_dev_t *, void**, char *); |
313 | char * dm_target_snapshot_orig_status(void *); | | 321 | char * dm_target_snapshot_orig_status(void *); |
314 | int dm_target_snapshot_orig_strategy(dm_table_entry_t *, struct buf *); | | 322 | int dm_target_snapshot_orig_strategy(dm_table_entry_t *, struct buf *); |
315 | int dm_target_snapshot_orig_deps(dm_table_entry_t *, prop_array_t); | | 323 | int dm_target_snapshot_orig_deps(dm_table_entry_t *, prop_array_t); |
316 | int dm_target_snapshot_orig_destroy(dm_table_entry_t *); | | 324 | int dm_target_snapshot_orig_destroy(dm_table_entry_t *); |
317 | int dm_target_snapshot_orig_upcall(dm_table_entry_t *, struct buf *); | | 325 | int dm_target_snapshot_orig_upcall(dm_table_entry_t *, struct buf *); |
318 | | | 326 | |
319 | /* dm_table.c */ | | 327 | /* dm_table.c */ |
320 | #define DM_TABLE_ACTIVE 0 | | 328 | #define DM_TABLE_ACTIVE 0 |
321 | #define DM_TABLE_INACTIVE 1 | | 329 | #define DM_TABLE_INACTIVE 1 |
322 | | | 330 | |
323 | int dm_table_destroy(dm_table_head_t *, uint8_t); | | 331 | int dm_table_destroy(dm_table_head_t *, uint8_t); |
324 | uint64_t dm_table_size(dm_table_head_t *); | | 332 | uint64_t dm_table_size(dm_table_head_t *); |
325 | dm_table_t * dm_table_get_entry(dm_table_head_t *, uint8_t); | | 333 | dm_table_t * dm_table_get_entry(dm_table_head_t *, uint8_t); |
326 | int dm_table_get_target_count(dm_table_head_t *, uint8_t); | | 334 | int dm_table_get_target_count(dm_table_head_t *, uint8_t); |
327 | void dm_table_release(dm_table_head_t *, uint8_t s); | | 335 | void dm_table_release(dm_table_head_t *, uint8_t s); |
328 | void dm_table_switch_tables(dm_table_head_t *); | | 336 | void dm_table_switch_tables(dm_table_head_t *); |
329 | void dm_table_head_init(dm_table_head_t *); | | 337 | void dm_table_head_init(dm_table_head_t *); |
330 | void dm_table_head_destroy(dm_table_head_t *); | | 338 | void dm_table_head_destroy(dm_table_head_t *); |
331 | | | 339 | |
332 | /* dm_dev.c */ | | 340 | /* dm_dev.c */ |
333 | dm_dev_t* dm_dev_alloc(void); | | 341 | dm_dev_t* dm_dev_alloc(void); |
334 | void dm_dev_busy(dm_dev_t *); | | 342 | void dm_dev_busy(dm_dev_t *); |
335 | int dm_dev_destroy(void); | | 343 | int dm_dev_destroy(void); |
336 | int dm_dev_free(dm_dev_t *); | | 344 | int dm_dev_free(dm_dev_t *); |
337 | int dm_dev_init(void); | | 345 | int dm_dev_init(void); |
338 | int dm_dev_insert(dm_dev_t *); | | 346 | int dm_dev_insert(dm_dev_t *); |
339 | dm_dev_t* dm_dev_lookup(const char *, const char *, int); | | 347 | dm_dev_t* dm_dev_lookup(const char *, const char *, int); |
340 | prop_array_t dm_dev_prop_list(void); | | 348 | prop_array_t dm_dev_prop_list(void); |
341 | dm_dev_t* dm_dev_rem(const char *, const char *, int); | | 349 | dm_dev_t* dm_dev_rem(const char *, const char *, int); |
342 | /*int dm_dev_test_minor(int);*/ | | 350 | /*int dm_dev_test_minor(int);*/ |
343 | void dm_dev_unbusy(dm_dev_t *); | | 351 | void dm_dev_unbusy(dm_dev_t *); |
344 | | | 352 | |
345 | /* dm_pdev.c */ | | 353 | /* dm_pdev.c */ |
346 | int dm_pdev_decr(dm_pdev_t *); | | 354 | int dm_pdev_decr(dm_pdev_t *); |
347 | int dm_pdev_destroy(void); | | 355 | int dm_pdev_destroy(void); |
348 | int dm_pdev_init(void); | | 356 | int dm_pdev_init(void); |
349 | dm_pdev_t* dm_pdev_insert(const char *); | | 357 | dm_pdev_t* dm_pdev_insert(const char *); |
350 | | | 358 | |
351 | #endif /*_KERNEL*/ | | 359 | #endif /*_KERNEL*/ |
352 | | | 360 | |
353 | #endif /*_DM_DEV_H_*/ | | 361 | #endif /*_DM_DEV_H_*/ |