diff options
-rw-r--r-- | drivers/md/dm.h | 89 | ||||
-rw-r--r-- | include/linux/device-mapper.h | 94 |
2 files changed, 93 insertions, 90 deletions
diff --git a/drivers/md/dm.h b/drivers/md/dm.h index 9a6023c9bc6b..8c03b634e62e 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h | |||
@@ -16,67 +16,6 @@ | |||
16 | #include <linux/blkdev.h> | 16 | #include <linux/blkdev.h> |
17 | #include <linux/hdreg.h> | 17 | #include <linux/hdreg.h> |
18 | 18 | ||
19 | #define DM_NAME "device-mapper" | ||
20 | |||
21 | #define DMERR(f, arg...) \ | ||
22 | printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) | ||
23 | #define DMERR_LIMIT(f, arg...) \ | ||
24 | do { \ | ||
25 | if (printk_ratelimit()) \ | ||
26 | printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " \ | ||
27 | f "\n", ## arg); \ | ||
28 | } while (0) | ||
29 | |||
30 | #define DMWARN(f, arg...) \ | ||
31 | printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) | ||
32 | #define DMWARN_LIMIT(f, arg...) \ | ||
33 | do { \ | ||
34 | if (printk_ratelimit()) \ | ||
35 | printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " \ | ||
36 | f "\n", ## arg); \ | ||
37 | } while (0) | ||
38 | |||
39 | #define DMINFO(f, arg...) \ | ||
40 | printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) | ||
41 | #define DMINFO_LIMIT(f, arg...) \ | ||
42 | do { \ | ||
43 | if (printk_ratelimit()) \ | ||
44 | printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f \ | ||
45 | "\n", ## arg); \ | ||
46 | } while (0) | ||
47 | |||
48 | #ifdef CONFIG_DM_DEBUG | ||
49 | # define DMDEBUG(f, arg...) \ | ||
50 | printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX " DEBUG: " f "\n", ## arg) | ||
51 | # define DMDEBUG_LIMIT(f, arg...) \ | ||
52 | do { \ | ||
53 | if (printk_ratelimit()) \ | ||
54 | printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX ": " f \ | ||
55 | "\n", ## arg); \ | ||
56 | } while (0) | ||
57 | #else | ||
58 | # define DMDEBUG(f, arg...) do {} while (0) | ||
59 | # define DMDEBUG_LIMIT(f, arg...) do {} while (0) | ||
60 | #endif | ||
61 | |||
62 | #define DMEMIT(x...) sz += ((sz >= maxlen) ? \ | ||
63 | 0 : scnprintf(result + sz, maxlen - sz, x)) | ||
64 | |||
65 | #define SECTOR_SHIFT 9 | ||
66 | |||
67 | /* | ||
68 | * Definitions of return values from target end_io function. | ||
69 | */ | ||
70 | #define DM_ENDIO_INCOMPLETE 1 | ||
71 | #define DM_ENDIO_REQUEUE 2 | ||
72 | |||
73 | /* | ||
74 | * Definitions of return values from target map function. | ||
75 | */ | ||
76 | #define DM_MAPIO_SUBMITTED 0 | ||
77 | #define DM_MAPIO_REMAPPED 1 | ||
78 | #define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE | ||
79 | |||
80 | /* | 19 | /* |
81 | * Suspend feature flags | 20 | * Suspend feature flags |
82 | */ | 21 | */ |
@@ -136,34 +75,6 @@ static inline int array_too_big(unsigned long fixed, unsigned long obj, | |||
136 | return (num > (ULONG_MAX - fixed) / obj); | 75 | return (num > (ULONG_MAX - fixed) / obj); |
137 | } | 76 | } |
138 | 77 | ||
139 | /* | ||
140 | * Ceiling(n / sz) | ||
141 | */ | ||
142 | #define dm_div_up(n, sz) (((n) + (sz) - 1) / (sz)) | ||
143 | |||
144 | #define dm_sector_div_up(n, sz) ( \ | ||
145 | { \ | ||
146 | sector_t _r = ((n) + (sz) - 1); \ | ||
147 | sector_div(_r, (sz)); \ | ||
148 | _r; \ | ||
149 | } \ | ||
150 | ) | ||
151 | |||
152 | /* | ||
153 | * ceiling(n / size) * size | ||
154 | */ | ||
155 | #define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz)) | ||
156 | |||
157 | static inline sector_t to_sector(unsigned long n) | ||
158 | { | ||
159 | return (n >> 9); | ||
160 | } | ||
161 | |||
162 | static inline unsigned long to_bytes(sector_t n) | ||
163 | { | ||
164 | return (n << 9); | ||
165 | } | ||
166 | |||
167 | int dm_split_args(int *argc, char ***argvp, char *input); | 78 | int dm_split_args(int *argc, char ***argvp, char *input); |
168 | 79 | ||
169 | /* | 80 | /* |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 4db23378cfb1..a68829e274fe 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2001 Sistina Software (UK) Limited. | 2 | * Copyright (C) 2001 Sistina Software (UK) Limited. |
3 | * Copyright (C) 2004 Red Hat, Inc. All rights reserved. | 3 | * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This file is released under the LGPL. | 5 | * This file is released under the LGPL. |
6 | */ | 6 | */ |
@@ -258,5 +258,97 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *t); | |||
258 | */ | 258 | */ |
259 | int dm_create_error_table(struct dm_table **result, struct mapped_device *md); | 259 | int dm_create_error_table(struct dm_table **result, struct mapped_device *md); |
260 | 260 | ||
261 | /*----------------------------------------------------------------- | ||
262 | * Macros. | ||
263 | *---------------------------------------------------------------*/ | ||
264 | #define DM_NAME "device-mapper" | ||
265 | |||
266 | #define DMERR(f, arg...) \ | ||
267 | printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) | ||
268 | #define DMERR_LIMIT(f, arg...) \ | ||
269 | do { \ | ||
270 | if (printk_ratelimit()) \ | ||
271 | printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " \ | ||
272 | f "\n", ## arg); \ | ||
273 | } while (0) | ||
274 | |||
275 | #define DMWARN(f, arg...) \ | ||
276 | printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) | ||
277 | #define DMWARN_LIMIT(f, arg...) \ | ||
278 | do { \ | ||
279 | if (printk_ratelimit()) \ | ||
280 | printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " \ | ||
281 | f "\n", ## arg); \ | ||
282 | } while (0) | ||
283 | |||
284 | #define DMINFO(f, arg...) \ | ||
285 | printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) | ||
286 | #define DMINFO_LIMIT(f, arg...) \ | ||
287 | do { \ | ||
288 | if (printk_ratelimit()) \ | ||
289 | printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f \ | ||
290 | "\n", ## arg); \ | ||
291 | } while (0) | ||
292 | |||
293 | #ifdef CONFIG_DM_DEBUG | ||
294 | # define DMDEBUG(f, arg...) \ | ||
295 | printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX " DEBUG: " f "\n", ## arg) | ||
296 | # define DMDEBUG_LIMIT(f, arg...) \ | ||
297 | do { \ | ||
298 | if (printk_ratelimit()) \ | ||
299 | printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX ": " f \ | ||
300 | "\n", ## arg); \ | ||
301 | } while (0) | ||
302 | #else | ||
303 | # define DMDEBUG(f, arg...) do {} while (0) | ||
304 | # define DMDEBUG_LIMIT(f, arg...) do {} while (0) | ||
305 | #endif | ||
306 | |||
307 | #define DMEMIT(x...) sz += ((sz >= maxlen) ? \ | ||
308 | 0 : scnprintf(result + sz, maxlen - sz, x)) | ||
309 | |||
310 | #define SECTOR_SHIFT 9 | ||
311 | |||
312 | /* | ||
313 | * Definitions of return values from target end_io function. | ||
314 | */ | ||
315 | #define DM_ENDIO_INCOMPLETE 1 | ||
316 | #define DM_ENDIO_REQUEUE 2 | ||
317 | |||
318 | /* | ||
319 | * Definitions of return values from target map function. | ||
320 | */ | ||
321 | #define DM_MAPIO_SUBMITTED 0 | ||
322 | #define DM_MAPIO_REMAPPED 1 | ||
323 | #define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE | ||
324 | |||
325 | /* | ||
326 | * Ceiling(n / sz) | ||
327 | */ | ||
328 | #define dm_div_up(n, sz) (((n) + (sz) - 1) / (sz)) | ||
329 | |||
330 | #define dm_sector_div_up(n, sz) ( \ | ||
331 | { \ | ||
332 | sector_t _r = ((n) + (sz) - 1); \ | ||
333 | sector_div(_r, (sz)); \ | ||
334 | _r; \ | ||
335 | } \ | ||
336 | ) | ||
337 | |||
338 | /* | ||
339 | * ceiling(n / size) * size | ||
340 | */ | ||
341 | #define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz)) | ||
342 | |||
343 | static inline sector_t to_sector(unsigned long n) | ||
344 | { | ||
345 | return (n >> SECTOR_SHIFT); | ||
346 | } | ||
347 | |||
348 | static inline unsigned long to_bytes(sector_t n) | ||
349 | { | ||
350 | return (n << SECTOR_SHIFT); | ||
351 | } | ||
352 | |||
261 | #endif /* __KERNEL__ */ | 353 | #endif /* __KERNEL__ */ |
262 | #endif /* _LINUX_DEVICE_MAPPER_H */ | 354 | #endif /* _LINUX_DEVICE_MAPPER_H */ |