direct-io.hg

view linux-2.6-xen-sparse/include/xen/blkif.h @ 13973:c4ed5b740a8d

linux: remove {lock,unlock}_vm_area(). Instead use vmalloc_sync_all()
in alloc_vm_area().
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Feb 16 11:24:10 2007 +0000 (2007-02-16)
parents c9ac0bace498
children
line source
1 #ifndef __XEN_BLKIF_H__
2 #define __XEN_BLKIF_H__
4 #include <xen/interface/io/ring.h>
5 #include <xen/interface/io/blkif.h>
6 #include <xen/interface/io/protocols.h>
8 /* Not a real protocol. Used to generate ring structs which contain
9 * the elements common to all protocols only. This way we get a
10 * compiler-checkable way to use common struct elements, so we can
11 * avoid using switch(protocol) in a number of places. */
12 struct blkif_common_request {
13 char dummy;
14 };
15 struct blkif_common_response {
16 char dummy;
17 };
19 /* i386 protocol version */
20 #pragma pack(push, 4)
21 struct blkif_x86_32_request {
22 uint8_t operation; /* BLKIF_OP_??? */
23 uint8_t nr_segments; /* number of segments */
24 blkif_vdev_t handle; /* only for read/write requests */
25 uint64_t id; /* private guest value, echoed in resp */
26 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
27 struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
28 };
29 struct blkif_x86_32_response {
30 uint64_t id; /* copied from request */
31 uint8_t operation; /* copied from request */
32 int16_t status; /* BLKIF_RSP_??? */
33 };
34 typedef struct blkif_x86_32_request blkif_x86_32_request_t;
35 typedef struct blkif_x86_32_response blkif_x86_32_response_t;
36 #pragma pack(pop)
38 /* x86_64 protocol version */
39 struct blkif_x86_64_request {
40 uint8_t operation; /* BLKIF_OP_??? */
41 uint8_t nr_segments; /* number of segments */
42 blkif_vdev_t handle; /* only for read/write requests */
43 uint64_t __attribute__((__aligned__(8))) id;
44 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
45 struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
46 };
47 struct blkif_x86_64_response {
48 uint64_t __attribute__((__aligned__(8))) id;
49 uint8_t operation; /* copied from request */
50 int16_t status; /* BLKIF_RSP_??? */
51 };
52 typedef struct blkif_x86_64_request blkif_x86_64_request_t;
53 typedef struct blkif_x86_64_response blkif_x86_64_response_t;
55 DEFINE_RING_TYPES(blkif_common, struct blkif_common_request, struct blkif_common_response);
56 DEFINE_RING_TYPES(blkif_x86_32, struct blkif_x86_32_request, struct blkif_x86_32_response);
57 DEFINE_RING_TYPES(blkif_x86_64, struct blkif_x86_64_request, struct blkif_x86_64_response);
59 union blkif_back_rings {
60 blkif_back_ring_t native;
61 blkif_common_back_ring_t common;
62 blkif_x86_32_back_ring_t x86_32;
63 blkif_x86_64_back_ring_t x86_64;
64 };
65 typedef union blkif_back_rings blkif_back_rings_t;
67 enum blkif_protocol {
68 BLKIF_PROTOCOL_NATIVE = 1,
69 BLKIF_PROTOCOL_X86_32 = 2,
70 BLKIF_PROTOCOL_X86_64 = 3,
71 };
73 static void inline blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_request_t *src)
74 {
75 int i;
76 dst->operation = src->operation;
77 dst->nr_segments = src->nr_segments;
78 dst->handle = src->handle;
79 dst->id = src->id;
80 dst->sector_number = src->sector_number;
81 for (i = 0; i < src->nr_segments; i++)
82 dst->seg[i] = src->seg[i];
83 }
85 static void inline blkif_get_x86_64_req(blkif_request_t *dst, blkif_x86_64_request_t *src)
86 {
87 int i;
88 dst->operation = src->operation;
89 dst->nr_segments = src->nr_segments;
90 dst->handle = src->handle;
91 dst->id = src->id;
92 dst->sector_number = src->sector_number;
93 for (i = 0; i < src->nr_segments; i++)
94 dst->seg[i] = src->seg[i];
95 }
97 #endif /* __XEN_BLKIF_H__ */