{"id":831204,"url":"http://patchwork.ozlabs.org/api/1.2/patches/831204/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20171027104037.8319-12-eblake@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.2/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20171027104037.8319-12-eblake@redhat.com>","list_archive_url":null,"date":"2017-10-27T10:40:36","name":"[v6,11/12] nbd: Move nbd_read() to common header","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"75d510d0cfe105915988b3121e8d5f29aee65c79","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/1.2/people/6591/?format=json","name":"Eric Blake","email":"eblake@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20171027104037.8319-12-eblake@redhat.com/mbox/","series":[{"id":10552,"url":"http://patchwork.ozlabs.org/api/1.2/series/10552/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=10552","date":"2017-10-27T10:40:27","name":"nbd minimal structured read","version":6,"mbox":"http://patchwork.ozlabs.org/series/10552/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/831204/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/831204/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNggb1Pr9z9t2x\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 27 Oct 2017 21:52:25 +1100 (AEDT)","from localhost ([::1]:56593 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1e82FR-0000yR-DZ\n\tfor incoming@patchwork.ozlabs.org; Fri, 27 Oct 2017 06:52:21 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:57541)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1e824h-0001Wv-4h\n\tfor qemu-devel@nongnu.org; Fri, 27 Oct 2017 06:41:16 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1e824g-0005qV-BH\n\tfor qemu-devel@nongnu.org; Fri, 27 Oct 2017 06:41:15 -0400","from mx1.redhat.com ([209.132.183.28]:43048)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>)\n\tid 1e824b-0005n4-S8; Fri, 27 Oct 2017 06:41:09 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 5FAE4C04AC43;\n\tFri, 27 Oct 2017 10:41:08 +0000 (UTC)","from red.redhat.com (ovpn-120-166.rdu2.redhat.com [10.10.120.166])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id A3EA65C549;\n\tFri, 27 Oct 2017 10:41:04 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 5FAE4C04AC43","From":"Eric Blake <eblake@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Fri, 27 Oct 2017 12:40:36 +0200","Message-Id":"<20171027104037.8319-12-eblake@redhat.com>","In-Reply-To":"<20171027104037.8319-1-eblake@redhat.com>","References":"<20171027104037.8319-1-eblake@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tFri, 27 Oct 2017 10:41:08 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"[Qemu-devel] [PATCH v6 11/12] nbd: Move nbd_read() to common header","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Kevin Wolf <kwolf@redhat.com>, pbonzini@redhat.com,\n\tvsementsov@virtuozzo.com, qemu-block@nongnu.org,\n\tMax Reitz <mreitz@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"An upcoming change to block/nbd-client.c will want to read the\ntail of a structured reply chunk directly from the wire.  Move\nthis function to make it easier.\n\nBased on a patch from Vladimir Sementsov-Ogievskiy.\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\nReviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>\n---\n include/block/nbd.h | 10 ++++++++++\n nbd/nbd-internal.h  |  9 ---------\n 2 files changed, 10 insertions(+), 9 deletions(-)","diff":"diff --git a/include/block/nbd.h b/include/block/nbd.h\nindex 2ee1578420..da6e305dd5 100644\n--- a/include/block/nbd.h\n+++ b/include/block/nbd.h\n@@ -264,6 +264,16 @@ void nbd_client_put(NBDClient *client);\n void nbd_server_start(SocketAddress *addr, const char *tls_creds,\n                       Error **errp);\n\n+\n+/* nbd_read\n+ * Reads @size bytes from @ioc. Returns 0 on success.\n+ */\n+static inline int nbd_read(QIOChannel *ioc, void *buffer, size_t size,\n+                           Error **errp)\n+{\n+    return qio_channel_read_all(ioc, buffer, size, errp) < 0 ? -EIO : 0;\n+}\n+\n static inline bool nbd_reply_is_simple(NBDReply *reply)\n {\n     return reply->magic == NBD_SIMPLE_REPLY_MAGIC;\ndiff --git a/nbd/nbd-internal.h b/nbd/nbd-internal.h\nindex 4f24d6e57d..b64eb1cc9b 100644\n--- a/nbd/nbd-internal.h\n+++ b/nbd/nbd-internal.h\n@@ -82,15 +82,6 @@ static inline int nbd_read_eof(QIOChannel *ioc, void *buffer, size_t size,\n     return ret;\n }\n\n-/* nbd_read\n- * Reads @size bytes from @ioc. Returns 0 on success.\n- */\n-static inline int nbd_read(QIOChannel *ioc, void *buffer, size_t size,\n-                           Error **errp)\n-{\n-    return qio_channel_read_all(ioc, buffer, size, errp) < 0 ? -EIO : 0;\n-}\n-\n /* nbd_write\n  * Writes @size bytes to @ioc. Returns 0 on success.\n  */\n","prefixes":["v6","11/12"]}