Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/831185/?format=api
{ "id": 831185, "url": "http://patchwork.ozlabs.org/api/1.2/patches/831185/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20171027104037.8319-3-eblake@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api", "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-3-eblake@redhat.com>", "list_archive_url": null, "date": "2017-10-27T10:40:27", "name": "[v6,02/12] nbd: Move nbd_errno_to_system_errno() to public header", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "a8f4e11c3b854078002e43eb68523d2e73e77623", "submitter": { "id": 6591, "url": "http://patchwork.ozlabs.org/api/1.2/people/6591/?format=api", "name": "Eric Blake", "email": "eblake@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20171027104037.8319-3-eblake@redhat.com/mbox/", "series": [ { "id": 10552, "url": "http://patchwork.ozlabs.org/api/1.2/series/10552/?format=api", "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/831185/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/831185/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-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx09.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 3yNgRT0SGvz9t30\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 27 Oct 2017 21:41:56 +1100 (AEDT)", "from localhost ([::1]:56542 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 1e825I-0001N2-3X\n\tfor incoming@patchwork.ozlabs.org; Fri, 27 Oct 2017 06:41:52 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:57165)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1e824J-00019H-7w\n\tfor qemu-devel@nongnu.org; Fri, 27 Oct 2017 06:40:54 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1e824I-0005WU-1d\n\tfor qemu-devel@nongnu.org; Fri, 27 Oct 2017 06:40:51 -0400", "from mx1.redhat.com ([209.132.183.28]:49794)\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 1e824F-0005Tg-4l; Fri, 27 Oct 2017 06:40:47 -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 28045B0AA6;\n\tFri, 27 Oct 2017 10:40:46 +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 47B335C549;\n\tFri, 27 Oct 2017 10:40:44 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 28045B0AA6", "From": "Eric Blake <eblake@redhat.com>", "To": "qemu-devel@nongnu.org", "Date": "Fri, 27 Oct 2017 12:40:27 +0200", "Message-Id": "<20171027104037.8319-3-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.38]);\n\tFri, 27 Oct 2017 10:40:46 +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 02/12] nbd: Move nbd_errno_to_system_errno()\n\tto public 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": "This is needed in preparation for structured reply handling,\nas we will be performing the translation from NBD error to\nsystem errno value higher in the stack at block/nbd-client.c.\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\nReviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>\n---\n include/block/nbd.h | 13 +++++++++++++\n nbd/nbd-internal.h | 12 ------------\n nbd/client.c | 32 --------------------------------\n nbd/common.c | 34 ++++++++++++++++++++++++++++++++++\n nbd/trace-events | 4 +++-\n 5 files changed, 50 insertions(+), 45 deletions(-)", "diff": "diff --git a/include/block/nbd.h b/include/block/nbd.h\nindex a6df5ce8b5..dc62b5cd19 100644\n--- a/include/block/nbd.h\n+++ b/include/block/nbd.h\n@@ -149,6 +149,18 @@ enum {\n * aren't overflowing some other buffer. */\n #define NBD_MAX_NAME_SIZE 256\n\n+/* NBD errors are based on errno numbers, so there is a 1:1 mapping,\n+ * but only a limited set of errno values is specified in the protocol.\n+ * Everything else is squashed to EINVAL.\n+ */\n+#define NBD_SUCCESS 0\n+#define NBD_EPERM 1\n+#define NBD_EIO 5\n+#define NBD_ENOMEM 12\n+#define NBD_EINVAL 22\n+#define NBD_ENOSPC 28\n+#define NBD_ESHUTDOWN 108\n+\n /* Details collected by NBD_OPT_EXPORT_NAME and NBD_OPT_GO */\n struct NBDExportInfo {\n /* Set by client before nbd_receive_negotiate() */\n@@ -172,6 +184,7 @@ int nbd_send_request(QIOChannel *ioc, NBDRequest *request);\n int nbd_receive_reply(QIOChannel *ioc, NBDReply *reply, Error **errp);\n int nbd_client(int fd);\n int nbd_disconnect(int fd);\n+int nbd_errno_to_system_errno(int err);\n\n typedef struct NBDExport NBDExport;\n typedef struct NBDClient NBDClient;\ndiff --git a/nbd/nbd-internal.h b/nbd/nbd-internal.h\nindex 4bfe5be884..df6c8b2f24 100644\n--- a/nbd/nbd-internal.h\n+++ b/nbd/nbd-internal.h\n@@ -64,18 +64,6 @@\n #define NBD_SET_TIMEOUT _IO(0xab, 9)\n #define NBD_SET_FLAGS _IO(0xab, 10)\n\n-/* NBD errors are based on errno numbers, so there is a 1:1 mapping,\n- * but only a limited set of errno values is specified in the protocol.\n- * Everything else is squashed to EINVAL.\n- */\n-#define NBD_SUCCESS 0\n-#define NBD_EPERM 1\n-#define NBD_EIO 5\n-#define NBD_ENOMEM 12\n-#define NBD_EINVAL 22\n-#define NBD_ENOSPC 28\n-#define NBD_ESHUTDOWN 108\n-\n /* nbd_read_eof\n * Tries to read @size bytes from @ioc.\n * Returns 1 on success\ndiff --git a/nbd/client.c b/nbd/client.c\nindex 59d7c9d49f..50f36b511e 100644\n--- a/nbd/client.c\n+++ b/nbd/client.c\n@@ -22,38 +22,6 @@\n #include \"trace.h\"\n #include \"nbd-internal.h\"\n\n-static int nbd_errno_to_system_errno(int err)\n-{\n- int ret;\n- switch (err) {\n- case NBD_SUCCESS:\n- ret = 0;\n- break;\n- case NBD_EPERM:\n- ret = EPERM;\n- break;\n- case NBD_EIO:\n- ret = EIO;\n- break;\n- case NBD_ENOMEM:\n- ret = ENOMEM;\n- break;\n- case NBD_ENOSPC:\n- ret = ENOSPC;\n- break;\n- case NBD_ESHUTDOWN:\n- ret = ESHUTDOWN;\n- break;\n- default:\n- trace_nbd_unknown_error(err);\n- /* fallthrough */\n- case NBD_EINVAL:\n- ret = EINVAL;\n- break;\n- }\n- return ret;\n-}\n-\n /* Definitions for opaque data types */\n\n static QTAILQ_HEAD(, NBDExport) exports = QTAILQ_HEAD_INITIALIZER(exports);\ndiff --git a/nbd/common.c b/nbd/common.c\nindex 7456021f7e..593904f148 100644\n--- a/nbd/common.c\n+++ b/nbd/common.c\n@@ -18,6 +18,7 @@\n\n #include \"qemu/osdep.h\"\n #include \"qapi/error.h\"\n+#include \"trace.h\"\n #include \"nbd-internal.h\"\n\n /* Discard length bytes from channel. Return -errno on failure and 0 on\n@@ -171,3 +172,36 @@ const char *nbd_err_lookup(int err)\n return \"<unknown>\";\n }\n }\n+\n+\n+int nbd_errno_to_system_errno(int err)\n+{\n+ int ret;\n+ switch (err) {\n+ case NBD_SUCCESS:\n+ ret = 0;\n+ break;\n+ case NBD_EPERM:\n+ ret = EPERM;\n+ break;\n+ case NBD_EIO:\n+ ret = EIO;\n+ break;\n+ case NBD_ENOMEM:\n+ ret = ENOMEM;\n+ break;\n+ case NBD_ENOSPC:\n+ ret = ENOSPC;\n+ break;\n+ case NBD_ESHUTDOWN:\n+ ret = ESHUTDOWN;\n+ break;\n+ default:\n+ trace_nbd_unknown_error(err);\n+ /* fallthrough */\n+ case NBD_EINVAL:\n+ ret = EINVAL;\n+ break;\n+ }\n+ return ret;\n+}\ndiff --git a/nbd/trace-events b/nbd/trace-events\nindex 920c8a0e5e..ab3d7dad4f 100644\n--- a/nbd/trace-events\n+++ b/nbd/trace-events\n@@ -1,5 +1,4 @@\n # nbd/client.c\n-nbd_unknown_error(int err) \"Squashing unexpected error %d to EINVAL\"\n nbd_send_option_request(uint32_t opt, const char *name, uint32_t len) \"Sending option request %\" PRIu32\" (%s), len %\" PRIu32\n nbd_receive_option_reply(uint32_t option, const char *optname, uint32_t type, const char *typename, uint32_t length) \"Received option reply 0x%\" PRIx32\" (%s), type 0x%\" PRIx32\" (%s), len %\" PRIu32\n nbd_reply_err_unsup(uint32_t option, const char *name) \"server doesn't understand request 0x%\" PRIx32 \" (%s), attempting fallback\"\n@@ -31,6 +30,9 @@ nbd_client_clear_socket(void) \"Clearing NBD socket\"\n nbd_send_request(uint64_t from, uint32_t len, uint64_t handle, uint16_t flags, uint16_t type, const char *name) \"Sending request to server: { .from = %\" PRIu64\", .len = %\" PRIu32 \", .handle = %\" PRIu64 \", .flags = 0x%\" PRIx16 \", .type = %\" PRIu16 \" (%s) }\"\n nbd_receive_reply(uint32_t magic, int32_t error, const char *errname, uint64_t handle) \"Got reply: { magic = 0x%\" PRIx32 \", .error = %\" PRId32 \" (%s), handle = %\" PRIu64\" }\"\n\n+# nbd/common.c\n+nbd_unknown_error(int err) \"Squashing unexpected error %d to EINVAL\"\n+\n # nbd/server.c\n nbd_negotiate_send_rep_len(uint32_t opt, const char *optname, uint32_t type, const char *typename, uint32_t len) \"Reply opt=0x%\" PRIx32 \" (%s), type=0x%\" PRIx32 \" (%s), len=%\" PRIu32\n nbd_negotiate_send_rep_err(const char *msg) \"sending error message \\\"%s\\\"\"\n", "prefixes": [ "v6", "02/12" ] }