xen: fix style of hw/block/xen_blkif.h

Fix hw/block/xen_blkif.h to match qemu coding style.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Juergen Gross 2016-06-20 09:55:42 +02:00 committed by Stefano Stabellini
parent 6f1d2d1c5a
commit 0d8e58942a
1 changed files with 81 additions and 70 deletions

View File

@ -5,10 +5,12 @@
#include <xen/io/blkif.h>
#include <xen/io/protocols.h>
/* Not a real protocol. Used to generate ring structs which contain
/*
* Not a real protocol. Used to generate ring structs which contain
* the elements common to all protocols only. This way we get a
* compiler-checkable way to use common struct elements, so we can
* avoid using switch(protocol) in a number of places. */
* avoid using switch(protocol) in a number of places.
*/
struct blkif_common_request {
char dummy;
};
@ -23,7 +25,7 @@ struct blkif_x86_32_request {
uint8_t nr_segments; /* number of segments */
blkif_vdev_t handle; /* only for read/write requests */
uint64_t id; /* private guest value, echoed in resp */
blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
blkif_sector_t sector_number; /* start sector idx on disk (r/w only) */
struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
};
struct blkif_x86_32_response {
@ -41,7 +43,7 @@ struct blkif_x86_64_request {
uint8_t nr_segments; /* number of segments */
blkif_vdev_t handle; /* only for read/write requests */
uint64_t __attribute__((__aligned__(8))) id;
blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
blkif_sector_t sector_number; /* start sector idx on disk (r/w only) */
struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
};
struct blkif_x86_64_response {
@ -52,9 +54,12 @@ struct blkif_x86_64_response {
typedef struct blkif_x86_64_request blkif_x86_64_request_t;
typedef struct blkif_x86_64_response blkif_x86_64_response_t;
DEFINE_RING_TYPES(blkif_common, struct blkif_common_request, struct blkif_common_response);
DEFINE_RING_TYPES(blkif_x86_32, struct blkif_x86_32_request, struct blkif_x86_32_response);
DEFINE_RING_TYPES(blkif_x86_64, struct blkif_x86_64_request, struct blkif_x86_64_response);
DEFINE_RING_TYPES(blkif_common, struct blkif_common_request,
struct blkif_common_response);
DEFINE_RING_TYPES(blkif_x86_32, struct blkif_x86_32_request,
struct blkif_x86_32_response);
DEFINE_RING_TYPES(blkif_x86_64, struct blkif_x86_64_request,
struct blkif_x86_64_response);
union blkif_back_rings {
blkif_back_ring_t native;
@ -70,7 +75,8 @@ enum blkif_protocol {
BLKIF_PROTOCOL_X86_64 = 3,
};
static inline void blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_request_t *src)
static inline void blkif_get_x86_32_req(blkif_request_t *dst,
blkif_x86_32_request_t *src)
{
int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST;
@ -87,13 +93,16 @@ static inline void blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_reque
d->nr_sectors = s->nr_sectors;
return;
}
if (n > dst->nr_segments)
if (n > dst->nr_segments) {
n = dst->nr_segments;
for (i = 0; i < n; i++)
}
for (i = 0; i < n; i++) {
dst->seg[i] = src->seg[i];
}
}
static inline void blkif_get_x86_64_req(blkif_request_t *dst, blkif_x86_64_request_t *src)
static inline void blkif_get_x86_64_req(blkif_request_t *dst,
blkif_x86_64_request_t *src)
{
int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST;
@ -110,10 +119,12 @@ static inline void blkif_get_x86_64_req(blkif_request_t *dst, blkif_x86_64_reque
d->nr_sectors = s->nr_sectors;
return;
}
if (n > dst->nr_segments)
if (n > dst->nr_segments) {
n = dst->nr_segments;
for (i = 0; i < n; i++)
}
for (i = 0; i < n; i++) {
dst->seg[i] = src->seg[i];
}
}
#endif /* __XEN_BLKIF_H__ */