diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-10-12 12:12:36 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-11-18 13:27:59 -0500 |
commit | 97e36834f5a106459ab1b290e663a4eb6264639e (patch) | |
tree | 39e4843998cb7f75b94d80f27e4b11ffb3662f28 /include/xen/interface/io/blkif.h | |
parent | cfcfc9eca2bcbd26a8e206baeb005b055dbf8e37 (diff) |
xen/blk[front|back]: Squash blkif_request_rw and blkif_request_discard together
In a union type structure to deal with the overlapping
attributes in a easier manner.
Suggested-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'include/xen/interface/io/blkif.h')
-rw-r--r-- | include/xen/interface/io/blkif.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h index 9324488f23f0..f88e28b6a27c 100644 --- a/include/xen/interface/io/blkif.h +++ b/include/xen/interface/io/blkif.h | |||
@@ -95,6 +95,12 @@ typedef uint64_t blkif_sector_t; | |||
95 | #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 | 95 | #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 |
96 | 96 | ||
97 | struct blkif_request_rw { | 97 | struct blkif_request_rw { |
98 | uint8_t nr_segments; /* number of segments */ | ||
99 | blkif_vdev_t handle; /* only for read/write requests */ | ||
100 | #ifdef CONFIG_X86_64 | ||
101 | uint32_t _pad1; /* offsetof(blkif_request,u.rw.id) == 8 */ | ||
102 | #endif | ||
103 | uint64_t id; /* private guest value, echoed in resp */ | ||
98 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | 104 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ |
99 | struct blkif_request_segment { | 105 | struct blkif_request_segment { |
100 | grant_ref_t gref; /* reference to I/O buffer frame */ | 106 | grant_ref_t gref; /* reference to I/O buffer frame */ |
@@ -102,23 +108,27 @@ struct blkif_request_rw { | |||
102 | /* @last_sect: last sector in frame to transfer (inclusive). */ | 108 | /* @last_sect: last sector in frame to transfer (inclusive). */ |
103 | uint8_t first_sect, last_sect; | 109 | uint8_t first_sect, last_sect; |
104 | } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 110 | } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
105 | }; | 111 | } __attribute__((__packed__)); |
106 | 112 | ||
107 | struct blkif_request_discard { | 113 | struct blkif_request_discard { |
114 | uint8_t nr_segments; /* number of segments */ | ||
115 | blkif_vdev_t _pad1; /* only for read/write requests */ | ||
116 | #ifdef CONFIG_X86_64 | ||
117 | uint32_t _pad2; /* offsetof(blkif_req..,u.discard.id)==8*/ | ||
118 | #endif | ||
119 | uint64_t id; /* private guest value, echoed in resp */ | ||
108 | blkif_sector_t sector_number; | 120 | blkif_sector_t sector_number; |
109 | uint64_t nr_sectors; | 121 | uint64_t nr_sectors; |
110 | }; | 122 | uint8_t _pad3; |
123 | } __attribute__((__packed__)); | ||
111 | 124 | ||
112 | struct blkif_request { | 125 | struct blkif_request { |
113 | uint8_t operation; /* BLKIF_OP_??? */ | 126 | uint8_t operation; /* BLKIF_OP_??? */ |
114 | uint8_t nr_segments; /* number of segments */ | ||
115 | blkif_vdev_t handle; /* only for read/write requests */ | ||
116 | uint64_t id; /* private guest value, echoed in resp */ | ||
117 | union { | 127 | union { |
118 | struct blkif_request_rw rw; | 128 | struct blkif_request_rw rw; |
119 | struct blkif_request_discard discard; | 129 | struct blkif_request_discard discard; |
120 | } u; | 130 | } u; |
121 | }; | 131 | } __attribute__((__packed__)); |
122 | 132 | ||
123 | struct blkif_response { | 133 | struct blkif_response { |
124 | uint64_t id; /* copied from request */ | 134 | uint64_t id; /* copied from request */ |