get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/808736/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 808736,
    "url": "http://patchwork.ozlabs.org/api/patches/808736/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901153758.8628-44-armbru@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/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": "<20170901153758.8628-44-armbru@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-01T15:37:54",
    "name": "[PULL,v2,43/47] qapi: Generate FOO_str() macro for QAPI enum FOO",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "896a6cdd0a42a871bb8ad7697dafda0d30237745",
    "submitter": {
        "id": 2645,
        "url": "http://patchwork.ozlabs.org/api/people/2645/?format=api",
        "name": "Markus Armbruster",
        "email": "armbru@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901153758.8628-44-armbru@redhat.com/mbox/",
    "series": [
        {
            "id": 1049,
            "url": "http://patchwork.ozlabs.org/api/series/1049/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1049",
            "date": "2017-09-01T15:37:14",
            "name": "[PULL,v2,01/47] qapi: Fix error handling code on alternate conflict",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/1049/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/808736/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/808736/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-mx08.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=armbru@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 3xkNpr3t5gz9t2d\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 01:44:52 +1000 (AEST)",
            "from localhost ([::1]:46509 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 1dno7m-00053w-JF\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 11:44:50 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:51718)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1dno1T-0006ju-Uu\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:38:24 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1dno1N-0001kR-5o\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:38:19 -0400",
            "from mx1.redhat.com ([209.132.183.28]:51140)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <armbru@redhat.com>) id 1dno1M-0001j8-RQ\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:38:13 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\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 E3549C05679E\n\tfor <qemu-devel@nongnu.org>; Fri,  1 Sep 2017 15:38:11 +0000 (UTC)",
            "from blackfin.pond.sub.org (ovpn-116-75.ams2.redhat.com\n\t[10.36.116.75])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 84DDF808E1\n\tfor <qemu-devel@nongnu.org>; Fri,  1 Sep 2017 15:38:11 +0000 (UTC)",
            "by blackfin.pond.sub.org (Postfix, from userid 1000)\n\tid C10AA1132F4C; Fri,  1 Sep 2017 17:37:58 +0200 (CEST)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com E3549C05679E",
        "From": "Markus Armbruster <armbru@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Fri,  1 Sep 2017 17:37:54 +0200",
        "Message-Id": "<20170901153758.8628-44-armbru@redhat.com>",
        "In-Reply-To": "<20170901153758.8628-1-armbru@redhat.com>",
        "References": "<20170901153758.8628-1-armbru@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.13",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.32]);\n\tFri, 01 Sep 2017 15:38:12 +0000 (UTC)",
        "Content-Transfer-Encoding": "quoted-printable",
        "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] [PULL v2 43/47] qapi: Generate FOO_str() macro for\n\tQAPI enum FOO",
        "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>",
        "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": "The next commit will put it to use.  May look pointless now, but we're\ngoing to change the FOO_lookup's type, and then it'll help.\n\nSigned-off-by: Markus Armbruster <armbru@redhat.com>\nMessage-Id: <1503564371-26090-13-git-send-email-armbru@redhat.com>\nReviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n---\n block.c                      | 1 -\n block/blkdebug.c             | 1 -\n block/file-posix.c           | 1 -\n block/file-win32.c           | 1 -\n block/gluster.c              | 1 -\n block/parallels.c            | 1 -\n block/qcow2.c                | 1 -\n block/quorum.c               | 1 -\n blockdev.c                   | 1 -\n crypto/block-luks.c          | 1 -\n docs/devel/qapi-code-gen.txt | 3 +++\n hmp.c                        | 1 -\n include/qapi/util.h          | 1 +\n migration/global_state.c     | 1 -\n migration/migration.c        | 1 -\n qapi/qapi-util.c             | 8 +++++++-\n qapi/qapi-visit-core.c       | 1 -\n qemu-img.c                   | 1 -\n qemu-nbd.c                   | 1 -\n scripts/qapi-event.py        | 1 +\n scripts/qapi-types.py        | 4 ++++\n scripts/qapi.py              | 3 +++\n tests/test-qapi-util.c       | 1 -\n tpm.c                        | 1 -\n util/keyval.c                | 1 -\n 25 files changed, 19 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/block.c b/block.c\nindex af48b0d26b..845eff8177 100644\n--- a/block.c\n+++ b/block.c\n@@ -42,7 +42,6 @@\n #include \"qapi-event.h\"\n #include \"qemu/cutils.h\"\n #include \"qemu/id.h\"\n-#include \"qapi/util.h\"\n \n #ifdef CONFIG_BSD\n #include <sys/ioctl.h>\ndiff --git a/block/blkdebug.c b/block/blkdebug.c\nindex f1bbee9497..b370fcedfb 100644\n--- a/block/blkdebug.c\n+++ b/block/blkdebug.c\n@@ -32,7 +32,6 @@\n #include \"qapi/qmp/qbool.h\"\n #include \"qapi/qmp/qdict.h\"\n #include \"qapi/qmp/qstring.h\"\n-#include \"qapi/util.h\"\n #include \"sysemu/qtest.h\"\n \n typedef struct BDRVBlkdebugState {\ndiff --git a/block/file-posix.c b/block/file-posix.c\nindex 97e8a92e23..d81eccc191 100644\n--- a/block/file-posix.c\n+++ b/block/file-posix.c\n@@ -31,7 +31,6 @@\n #include \"block/thread-pool.h\"\n #include \"qemu/iov.h\"\n #include \"block/raw-aio.h\"\n-#include \"qapi/util.h\"\n #include \"qapi/qmp/qstring.h\"\n \n #if defined(__APPLE__) && (__MACH__)\ndiff --git a/block/file-win32.c b/block/file-win32.c\nindex 978d8058fe..192ea819d9 100644\n--- a/block/file-win32.c\n+++ b/block/file-win32.c\n@@ -31,7 +31,6 @@\n #include \"block/thread-pool.h\"\n #include \"qemu/iov.h\"\n #include \"qapi/qmp/qstring.h\"\n-#include \"qapi/util.h\"\n #include <windows.h>\n #include <winioctl.h>\n \ndiff --git a/block/gluster.c b/block/gluster.c\nindex 8367e806d0..0614e0c8aa 100644\n--- a/block/gluster.c\n+++ b/block/gluster.c\n@@ -12,7 +12,6 @@\n #include \"block/block_int.h\"\n #include \"qapi/error.h\"\n #include \"qapi/qmp/qerror.h\"\n-#include \"qapi/util.h\"\n #include \"qemu/uri.h\"\n #include \"qemu/error-report.h\"\n #include \"qemu/cutils.h\"\ndiff --git a/block/parallels.c b/block/parallels.c\nindex eb92366e51..d812210b4f 100644\n--- a/block/parallels.c\n+++ b/block/parallels.c\n@@ -35,7 +35,6 @@\n #include \"qemu/module.h\"\n #include \"qemu/bswap.h\"\n #include \"qemu/bitmap.h\"\n-#include \"qapi/util.h\"\n \n /**************************************************************/\n \ndiff --git a/block/qcow2.c b/block/qcow2.c\nindex 470a0dedaa..3a93983e3f 100644\n--- a/block/qcow2.c\n+++ b/block/qcow2.c\n@@ -30,7 +30,6 @@\n #include \"qemu/error-report.h\"\n #include \"qapi/qmp/qerror.h\"\n #include \"qapi/qmp/qbool.h\"\n-#include \"qapi/util.h\"\n #include \"qapi/qmp/types.h\"\n #include \"qapi-event.h\"\n #include \"trace.h\"\ndiff --git a/block/quorum.c b/block/quorum.c\nindex cb6617703c..8d1c9f6306 100644\n--- a/block/quorum.c\n+++ b/block/quorum.c\n@@ -22,7 +22,6 @@\n #include \"qapi/qmp/qjson.h\"\n #include \"qapi/qmp/qlist.h\"\n #include \"qapi/qmp/qstring.h\"\n-#include \"qapi/util.h\"\n #include \"qapi-event.h\"\n #include \"crypto/hash.h\"\n \ndiff --git a/blockdev.c b/blockdev.c\nindex 722a61e3fb..f90bc9399a 100644\n--- a/blockdev.c\n+++ b/blockdev.c\n@@ -44,7 +44,6 @@\n #include \"qapi-visit.h\"\n #include \"qapi/qmp/qerror.h\"\n #include \"qapi/qobject-output-visitor.h\"\n-#include \"qapi/util.h\"\n #include \"sysemu/sysemu.h\"\n #include \"block/block_int.h\"\n #include \"qmp-commands.h\"\ndiff --git a/crypto/block-luks.c b/crypto/block-luks.c\nindex c3cacdb1ed..84d189a426 100644\n--- a/crypto/block-luks.c\n+++ b/crypto/block-luks.c\n@@ -20,7 +20,6 @@\n \n #include \"qemu/osdep.h\"\n #include \"qapi/error.h\"\n-#include \"qapi/util.h\"\n #include \"qemu/bswap.h\"\n \n #include \"crypto/block-luks.h\"\ndiff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt\nindex ae05327869..f04c63fe82 100644\n--- a/docs/devel/qapi-code-gen.txt\n+++ b/docs/devel/qapi-code-gen.txt\n@@ -1275,6 +1275,9 @@ Example:\n         EXAMPLE_QAPI_EVENT__MAX = 1,\n     } example_QAPIEvent;\n \n+    #define example_QAPIEvent_str(val) \\\n+        qapi_enum_lookup(example_QAPIEvent_lookup, (val))\n+\n     extern const char *const example_QAPIEvent_lookup[];\n \n     #endif\ndiff --git a/hmp.c b/hmp.c\nindex 2b6e919501..5d980acb1e 100644\n--- a/hmp.c\n+++ b/hmp.c\n@@ -31,7 +31,6 @@\n #include \"qapi/qmp/qerror.h\"\n #include \"qapi/string-input-visitor.h\"\n #include \"qapi/string-output-visitor.h\"\n-#include \"qapi/util.h\"\n #include \"qapi-visit.h\"\n #include \"qom/object_interfaces.h\"\n #include \"ui/console.h\"\ndiff --git a/include/qapi/util.h b/include/qapi/util.h\nindex 4eb8a3fe2f..5e50d0c1ce 100644\n--- a/include/qapi/util.h\n+++ b/include/qapi/util.h\n@@ -11,6 +11,7 @@\n #ifndef QAPI_UTIL_H\n #define QAPI_UTIL_H\n \n+const char *qapi_enum_lookup(const char *const lookup[], int val);\n int qapi_enum_parse(const char * const lookup[], const char *buf,\n                     int def, Error **errp);\n \ndiff --git a/migration/global_state.c b/migration/global_state.c\nindex 88c55f8cdb..76cd3a13d4 100644\n--- a/migration/global_state.c\n+++ b/migration/global_state.c\n@@ -14,7 +14,6 @@\n #include \"qemu/cutils.h\"\n #include \"qemu/error-report.h\"\n #include \"qapi/error.h\"\n-#include \"qapi/util.h\"\n #include \"migration.h\"\n #include \"migration/global_state.h\"\n #include \"migration/vmstate.h\"\ndiff --git a/migration/migration.c b/migration/migration.c\nindex c3fe0ed9ca..1a2b3ebd1a 100644\n--- a/migration/migration.c\n+++ b/migration/migration.c\n@@ -31,7 +31,6 @@\n #include \"migration/vmstate.h\"\n #include \"block/block.h\"\n #include \"qapi/qmp/qerror.h\"\n-#include \"qapi/util.h\"\n #include \"qemu/rcu.h\"\n #include \"block.h\"\n #include \"postcopy-ram.h\"\ndiff --git a/qapi/qapi-util.c b/qapi/qapi-util.c\nindex ee7594ff19..7af2f04d36 100644\n--- a/qapi/qapi-util.c\n+++ b/qapi/qapi-util.c\n@@ -13,7 +13,13 @@\n #include \"qemu/osdep.h\"\n #include \"qapi/error.h\"\n #include \"qemu-common.h\"\n-#include \"qapi/util.h\"\n+\n+const char *qapi_enum_lookup(const char *const lookup[], int val)\n+{\n+    assert(val >= 0);\n+\n+    return lookup[val];\n+}\n \n int qapi_enum_parse(const char * const lookup[], const char *buf,\n                     int def, Error **errp)\ndiff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c\nindex ec83ff68f9..f285879d72 100644\n--- a/qapi/qapi-visit-core.c\n+++ b/qapi/qapi-visit-core.c\n@@ -14,7 +14,6 @@\n \n #include \"qemu/osdep.h\"\n #include \"qapi/error.h\"\n-#include \"qapi/util.h\"\n #include \"qemu-common.h\"\n #include \"qapi/qmp/qobject.h\"\n #include \"qapi/qmp/qerror.h\"\ndiff --git a/qemu-img.c b/qemu-img.c\nindex 611ab7ddf3..a72a2e3133 100644\n--- a/qemu-img.c\n+++ b/qemu-img.c\n@@ -26,7 +26,6 @@\n \n #include \"qemu-version.h\"\n #include \"qapi/error.h\"\n-#include \"qapi/util.h\"\n #include \"qapi-visit.h\"\n #include \"qapi/qobject-output-visitor.h\"\n #include \"qapi/qmp/qerror.h\"\ndiff --git a/qemu-nbd.c b/qemu-nbd.c\nindex 96e10d62dc..a97f3f4540 100644\n--- a/qemu-nbd.c\n+++ b/qemu-nbd.c\n@@ -34,7 +34,6 @@\n #include \"qemu/log.h\"\n #include \"qemu/systemd.h\"\n #include \"block/snapshot.h\"\n-#include \"qapi/util.h\"\n #include \"qapi/qmp/qstring.h\"\n #include \"qom/object_interfaces.h\"\n #include \"io/channel-socket.h\"\ndiff --git a/scripts/qapi-event.py b/scripts/qapi-event.py\nindex bcbef1035f..07b4b70199 100644\n--- a/scripts/qapi-event.py\n+++ b/scripts/qapi-event.py\n@@ -217,6 +217,7 @@ fdef.write(mcgen('''\n \n fdecl.write(mcgen('''\n #include \"qapi/error.h\"\n+#include \"qapi/util.h\"\n #include \"qapi/qmp/qdict.h\"\n #include \"%(prefix)sqapi-types.h\"\n \ndiff --git a/scripts/qapi-types.py b/scripts/qapi-types.py\nindex b45e7b5634..7e3051dbb9 100644\n--- a/scripts/qapi-types.py\n+++ b/scripts/qapi-types.py\n@@ -292,6 +292,10 @@ fdef.write(mcgen('''\n ''',\n                  prefix=prefix))\n \n+fdecl.write(mcgen('''\n+#include \"qapi/util.h\"\n+'''))\n+\n schema = QAPISchema(input_file)\n gen = QAPISchemaGenTypeVisitor()\n schema.visit(gen)\ndiff --git a/scripts/qapi.py b/scripts/qapi.py\nindex 3693b520da..8736b9c786 100644\n--- a/scripts/qapi.py\n+++ b/scripts/qapi.py\n@@ -1894,6 +1894,9 @@ typedef enum %(c_name)s {\n \n     ret += mcgen('''\n \n+#define %(c_name)s_str(val) \\\\\n+    qapi_enum_lookup(%(c_name)s_lookup, (val))\n+\n extern const char *const %(c_name)s_lookup[];\n ''',\n                  c_name=c_name(name))\ndiff --git a/tests/test-qapi-util.c b/tests/test-qapi-util.c\nindex d72ee8c4e7..7e1be1d851 100644\n--- a/tests/test-qapi-util.c\n+++ b/tests/test-qapi-util.c\n@@ -12,7 +12,6 @@\n \n #include \"qemu/osdep.h\"\n #include \"qapi/error.h\"\n-#include \"qapi/util.h\"\n #include \"test-qapi-types.h\"\n \n static void test_qapi_enum_parse(void)\ndiff --git a/tpm.c b/tpm.c\nindex 7635fc779b..38f3eb827f 100644\n--- a/tpm.c\n+++ b/tpm.c\n@@ -14,7 +14,6 @@\n #include \"qemu/osdep.h\"\n \n #include \"qapi/qmp/qerror.h\"\n-#include \"qapi/util.h\"\n #include \"sysemu/tpm_backend.h\"\n #include \"sysemu/tpm.h\"\n #include \"qemu/config-file.h\"\ndiff --git a/util/keyval.c b/util/keyval.c\nindex 7dbda62305..7dfc75cf01 100644\n--- a/util/keyval.c\n+++ b/util/keyval.c\n@@ -82,7 +82,6 @@\n #include \"qemu/osdep.h\"\n #include \"qapi/error.h\"\n #include \"qapi/qmp/qstring.h\"\n-#include \"qapi/util.h\"\n #include \"qemu/cutils.h\"\n #include \"qemu/option.h\"\n \n",
    "prefixes": [
        "PULL",
        "v2",
        "43/47"
    ]
}