From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYuAp-0002d8-Hf for qemu-devel@nongnu.org; Wed, 23 Oct 2013 04:52:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VYuAg-0005lB-V5 for qemu-devel@nongnu.org; Wed, 23 Oct 2013 04:52:15 -0400 Received: from mail-pb0-x229.google.com ([2607:f8b0:400e:c01::229]:44287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYuAg-0005l1-NM for qemu-devel@nongnu.org; Wed, 23 Oct 2013 04:52:06 -0400 Received: by mail-pb0-f41.google.com with SMTP id rp16so625783pbb.28 for ; Wed, 23 Oct 2013 01:52:05 -0700 (PDT) From: Liu Yuan Date: Wed, 23 Oct 2013 16:51:51 +0800 Message-Id: <1382518312-16578-2-git-send-email-namei.unix@gmail.com> In-Reply-To: <1382518312-16578-1-git-send-email-namei.unix@gmail.com> References: <1382518312-16578-1-git-send-email-namei.unix@gmail.com> Subject: [Qemu-devel] [PATCH v2 1/2] sheepdog: explicitly set copies as type uint8_t List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , sheepdog@lists.wpkg.org, Stefan Hajnoczi '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 Cc: Stefan Hajnoczi Signed-off-by: Liu Yuan --- block/sheepdog.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index 5f81c93..b8a2985 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) { -- 1.7.9.5