diff options
author | Liu Yuan <namei.unix@gmail.com> | 2013-10-23 16:51:51 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-10-28 17:39:56 +0100 |
commit | 29a67f7e9204a25bc4b6221f287ad0ae38d8cbdc (patch) | |
tree | 866053e18b4101eab63be524a6c77b255daa2e61 /block/sheepdog.c | |
parent | 61ed2684539f7f31304e193d7c0e68d57ce6be88 (diff) |
sheepdog: explicitly set copies as type uint8_t
'copies' is actually uint8_t since day one, but request headers and some helper
functions parameterize it as uint32_t for unknown reasons and effectively
reserve 24 bytes for possible future use. This patch explicitly set the correct
for copies and reserve the left bytes.
This is a preparation patch that allow passing copy_policy in request header.
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Acked-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/sheepdog.c')
-rw-r--r-- | block/sheepdog.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c index 5f81c93ee3..b8a2985cd9 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -125,8 +125,8 @@ typedef struct SheepdogObjReq { uint32_t data_length; uint64_t oid; uint64_t cow_oid; - uint32_t copies; - uint32_t rsvd; + uint8_t copies; + uint8_t reserved[7]; uint64_t offset; } SheepdogObjReq; @@ -138,7 +138,8 @@ typedef struct SheepdogObjRsp { uint32_t id; uint32_t data_length; uint32_t result; - uint32_t copies; + uint8_t copies; + uint8_t reserved[3]; uint32_t pad[6]; } SheepdogObjRsp; @@ -151,7 +152,8 @@ typedef struct SheepdogVdiReq { uint32_t data_length; uint64_t vdi_size; uint32_t vdi_id; - uint32_t copies; + uint8_t copies; + uint8_t reserved[3]; uint32_t snapid; uint32_t pad[3]; } SheepdogVdiReq; @@ -1081,7 +1083,7 @@ static int coroutine_fn add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req, return 0; } -static int read_write_object(int fd, char *buf, uint64_t oid, int copies, +static int read_write_object(int fd, char *buf, uint64_t oid, uint8_t copies, unsigned int datalen, uint64_t offset, bool write, bool create, uint32_t cache_flags) { @@ -1129,7 +1131,7 @@ static int read_write_object(int fd, char *buf, uint64_t oid, int copies, } } -static int read_object(int fd, char *buf, uint64_t oid, int copies, +static int read_object(int fd, char *buf, uint64_t oid, uint8_t copies, unsigned int datalen, uint64_t offset, uint32_t cache_flags) { @@ -1137,7 +1139,7 @@ static int read_object(int fd, char *buf, uint64_t oid, int copies, false, cache_flags); } -static int write_object(int fd, char *buf, uint64_t oid, int copies, +static int write_object(int fd, char *buf, uint64_t oid, uint8_t copies, unsigned int datalen, uint64_t offset, bool create, uint32_t cache_flags) { |