From patchwork Tue Oct 29 16:31:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 286906 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 667AB2C036A for ; Wed, 30 Oct 2013 03:50:15 +1100 (EST) Received: from localhost ([::1]:48303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbCJC-0005oW-Uk for incoming@patchwork.ozlabs.org; Tue, 29 Oct 2013 12:38:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbCCh-0006QV-Ad for qemu-devel@nongnu.org; Tue, 29 Oct 2013 12:31:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbCCc-0001rv-AZ for qemu-devel@nongnu.org; Tue, 29 Oct 2013 12:31:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbCCc-0001rn-1z for qemu-devel@nongnu.org; Tue, 29 Oct 2013 12:31:34 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9TGVW3M000876 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 29 Oct 2013 12:31:32 -0400 Received: from dhcp-200-207.str.redhat.com (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9TGVEB8007722; Tue, 29 Oct 2013 12:31:31 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Tue, 29 Oct 2013 17:31:04 +0100 Message-Id: <1383064269-27720-13-git-send-email-kwolf@redhat.com> In-Reply-To: <1383064269-27720-1-git-send-email-kwolf@redhat.com> References: <1383064269-27720-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 12/17] sheepdog: explicitly set copies as type uint8_t X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Liu Yuan '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 Acked-by: MORITA Kazutaka Signed-off-by: Kevin Wolf --- 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) {