Go to the documentation of this file.
27 #ifndef __XEN_BLKIF__BACKEND__COMMON_H__
28 #define __XEN_BLKIF__BACKEND__COMMON_H__
30 #include <linux/module.h>
32 #include <linux/slab.h>
35 #include <linux/wait.h>
37 #include <asm/setup.h>
38 #include <asm/pgalloc.h>
39 #include <asm/hypervisor.h>
46 #define DRV_PFX "xen-blkback:"
47 #define DPRINTK(fmt, args...) \
48 pr_debug(DRV_PFX "(%s:%d) " fmt ".\n", \
49 __func__, __LINE__, ##args)
207 #define vbd_sz(_v) ((_v)->bdev->bd_part ? \
208 (_v)->bdev->bd_part->nr_sects : \
209 get_capacity((_v)->bdev->bd_disk))
211 #define xen_blkif_get(_b) (atomic_inc(&(_b)->refcnt))
212 #define xen_blkif_put(_b) \
214 if (atomic_dec_and_test(&(_b)->refcnt)) \
215 wake_up(&(_b)->waiting_to_free);\
248 dst->
u.
rw.nr_segments = src->
u.
rw.nr_segments;
249 dst->
u.
rw.handle = src->
u.
rw.handle;
250 dst->
u.
rw.id = src->
u.
rw.id;
251 dst->
u.
rw.sector_number = src->
u.
rw.sector_number;
253 if (n > dst->
u.
rw.nr_segments)
254 n = dst->
u.
rw.nr_segments;
255 for (i = 0; i <
n; i++)
256 dst->
u.
rw.seg[i] = src->
u.
rw.seg[i];
269 static inline void blkif_get_x86_64_req(
struct blkif_request *dst,
279 dst->
u.
rw.nr_segments = src->
u.
rw.nr_segments;
280 dst->
u.
rw.handle = src->
u.
rw.handle;
281 dst->
u.
rw.id = src->
u.
rw.id;
282 dst->
u.
rw.sector_number = src->
u.
rw.sector_number;
284 if (n > dst->
u.
rw.nr_segments)
285 n = dst->
u.
rw.nr_segments;
286 for (i = 0; i <
n; i++)
287 dst->
u.
rw.seg[i] = src->
u.
rw.seg[i];