get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 818305,
    "url": "http://patchwork.ozlabs.org/api/patches/818305/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170925160517.681-2-dgilbert@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": "<20170925160517.681-2-dgilbert@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-25T16:05:17",
    "name": "[1/1] virtio/pci/migration: Convert to VMState",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "4391d10ca68b41dd1e9e5cba1ee7e85ca56ac208",
    "submitter": {
        "id": 48102,
        "url": "http://patchwork.ozlabs.org/api/people/48102/?format=api",
        "name": "Dr. David Alan Gilbert",
        "email": "dgilbert@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170925160517.681-2-dgilbert@redhat.com/mbox/",
    "series": [
        {
            "id": 4985,
            "url": "http://patchwork.ozlabs.org/api/series/4985/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=4985",
            "date": "2017-09-25T16:05:16",
            "name": "VMState conversion for virtio-pci 'modern state'",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/4985/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/818305/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/818305/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-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=dgilbert@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 3y188Q19fRz9t3t\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 26 Sep 2017 02:06:13 +1000 (AEST)",
            "from localhost ([::1]:43305 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 1dwVta-0005YA-Oc\n\tfor incoming@patchwork.ozlabs.org; Mon, 25 Sep 2017 12:06:10 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:48321)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <dgilbert@redhat.com>) id 1dwVsu-0005Wp-TC\n\tfor qemu-devel@nongnu.org; Mon, 25 Sep 2017 12:05:29 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <dgilbert@redhat.com>) id 1dwVss-0000XM-Vz\n\tfor qemu-devel@nongnu.org; Mon, 25 Sep 2017 12:05:28 -0400",
            "from mx1.redhat.com ([209.132.183.28]:42866)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <dgilbert@redhat.com>) id 1dwVss-0000Wu-NR\n\tfor qemu-devel@nongnu.org; Mon, 25 Sep 2017 12:05:26 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\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 A0D567E429\n\tfor <qemu-devel@nongnu.org>; Mon, 25 Sep 2017 16:05:25 +0000 (UTC)",
            "from dgilbert-t530.redhat.com (ovpn-116-100.ams2.redhat.com\n\t[10.36.116.100])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 2655870BD7;\n\tMon, 25 Sep 2017 16:05:23 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com A0D567E429",
        "From": "\"Dr. David Alan Gilbert (git)\" <dgilbert@redhat.com>",
        "To": "qemu-devel@nongnu.org,\n\tjasowang@redhat.com,\n\tmst@redhat.com",
        "Date": "Mon, 25 Sep 2017 17:05:17 +0100",
        "Message-Id": "<20170925160517.681-2-dgilbert@redhat.com>",
        "In-Reply-To": "<20170925160517.681-1-dgilbert@redhat.com>",
        "References": "<20170925160517.681-1-dgilbert@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.27]);\n\tMon, 25 Sep 2017 16:05:25 +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 1/1] virtio/pci/migration: Convert to VMState",
        "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": "quintela@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": "From: \"Dr. David Alan Gilbert\" <dgilbert@redhat.com>\n\nConvert the 'modern_state' part of virtio-pci to modern migration\nmacros.\n\nSigned-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>\n---\n hw/virtio/virtio-pci.c | 108 +++++++++++++------------------------------------\n 1 file changed, 27 insertions(+), 81 deletions(-)",
    "diff": "diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c\nindex 8b0d6b69cd..f825a68a84 100644\n--- a/hw/virtio/virtio-pci.c\n+++ b/hw/virtio/virtio-pci.c\n@@ -88,77 +88,19 @@ static void virtio_pci_save_config(DeviceState *d, QEMUFile *f)\n         qemu_put_be16(f, vdev->config_vector);\n }\n \n-static void virtio_pci_load_modern_queue_state(VirtIOPCIQueue *vq,\n-                                               QEMUFile *f)\n-{\n-    vq->num = qemu_get_be16(f);\n-    vq->enabled = qemu_get_be16(f);\n-    vq->desc[0] = qemu_get_be32(f);\n-    vq->desc[1] = qemu_get_be32(f);\n-    vq->avail[0] = qemu_get_be32(f);\n-    vq->avail[1] = qemu_get_be32(f);\n-    vq->used[0] = qemu_get_be32(f);\n-    vq->used[1] = qemu_get_be32(f);\n-}\n-\n-static bool virtio_pci_has_extra_state(DeviceState *d)\n-{\n-    VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);\n-\n-    return proxy->flags & VIRTIO_PCI_FLAG_MIGRATE_EXTRA;\n-}\n-\n-static int get_virtio_pci_modern_state(QEMUFile *f, void *pv, size_t size,\n-                                       VMStateField *field)\n-{\n-    VirtIOPCIProxy *proxy = pv;\n-    int i;\n-\n-    proxy->dfselect = qemu_get_be32(f);\n-    proxy->gfselect = qemu_get_be32(f);\n-    proxy->guest_features[0] = qemu_get_be32(f);\n-    proxy->guest_features[1] = qemu_get_be32(f);\n-    for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {\n-        virtio_pci_load_modern_queue_state(&proxy->vqs[i], f);\n-    }\n-\n-    return 0;\n-}\n-\n-static void virtio_pci_save_modern_queue_state(VirtIOPCIQueue *vq,\n-                                               QEMUFile *f)\n-{\n-    qemu_put_be16(f, vq->num);\n-    qemu_put_be16(f, vq->enabled);\n-    qemu_put_be32(f, vq->desc[0]);\n-    qemu_put_be32(f, vq->desc[1]);\n-    qemu_put_be32(f, vq->avail[0]);\n-    qemu_put_be32(f, vq->avail[1]);\n-    qemu_put_be32(f, vq->used[0]);\n-    qemu_put_be32(f, vq->used[1]);\n-}\n-\n-static int put_virtio_pci_modern_state(QEMUFile *f, void *pv, size_t size,\n-                                       VMStateField *field, QJSON *vmdesc)\n-{\n-    VirtIOPCIProxy *proxy = pv;\n-    int i;\n-\n-    qemu_put_be32(f, proxy->dfselect);\n-    qemu_put_be32(f, proxy->gfselect);\n-    qemu_put_be32(f, proxy->guest_features[0]);\n-    qemu_put_be32(f, proxy->guest_features[1]);\n-    for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {\n-        virtio_pci_save_modern_queue_state(&proxy->vqs[i], f);\n+static const VMStateDescription vmstate_virtio_pci_modern_queue_state = {\n+    .name = \"virtio_pci/modern_queue_state\",\n+    .version_id = 1,\n+    .minimum_version_id = 1,\n+    .fields = (VMStateField[]) {\n+        VMSTATE_UINT16(num, VirtIOPCIQueue),\n+        VMSTATE_UNUSED(1), /* enabled was stored as be16 */\n+        VMSTATE_BOOL(enabled, VirtIOPCIQueue),\n+        VMSTATE_UINT32_ARRAY(desc, VirtIOPCIQueue, 2),\n+        VMSTATE_UINT32_ARRAY(avail, VirtIOPCIQueue, 2),\n+        VMSTATE_UINT32_ARRAY(used, VirtIOPCIQueue, 2),\n+        VMSTATE_END_OF_LIST()\n     }\n-\n-    return 0;\n-}\n-\n-static const VMStateInfo vmstate_info_virtio_pci_modern_state = {\n-    .name = \"virtqueue_state\",\n-    .get = get_virtio_pci_modern_state,\n-    .put = put_virtio_pci_modern_state,\n };\n \n static bool virtio_pci_modern_state_needed(void *opaque)\n@@ -168,21 +110,18 @@ static bool virtio_pci_modern_state_needed(void *opaque)\n     return virtio_pci_modern(proxy);\n }\n \n-static const VMStateDescription vmstate_virtio_pci_modern_state = {\n+static const VMStateDescription vmstate_virtio_pci_modern_state_sub = {\n     .name = \"virtio_pci/modern_state\",\n     .version_id = 1,\n     .minimum_version_id = 1,\n     .needed = &virtio_pci_modern_state_needed,\n     .fields = (VMStateField[]) {\n-        {\n-            .name         = \"modern_state\",\n-            .version_id   = 0,\n-            .field_exists = NULL,\n-            .size         = 0,\n-            .info         = &vmstate_info_virtio_pci_modern_state,\n-            .flags        = VMS_SINGLE,\n-            .offset       = 0,\n-        },\n+        VMSTATE_UINT32(dfselect, VirtIOPCIProxy),\n+        VMSTATE_UINT32(gfselect, VirtIOPCIProxy),\n+        VMSTATE_UINT32_ARRAY(guest_features, VirtIOPCIProxy, 2),\n+        VMSTATE_STRUCT_ARRAY(vqs, VirtIOPCIProxy, VIRTIO_QUEUE_MAX, 0,\n+                             vmstate_virtio_pci_modern_queue_state,\n+                             VirtIOPCIQueue),\n         VMSTATE_END_OF_LIST()\n     }\n };\n@@ -196,11 +135,18 @@ static const VMStateDescription vmstate_virtio_pci = {\n         VMSTATE_END_OF_LIST()\n     },\n     .subsections = (const VMStateDescription*[]) {\n-        &vmstate_virtio_pci_modern_state,\n+        &vmstate_virtio_pci_modern_state_sub,\n         NULL\n     }\n };\n \n+static bool virtio_pci_has_extra_state(DeviceState *d)\n+{\n+    VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);\n+\n+    return proxy->flags & VIRTIO_PCI_FLAG_MIGRATE_EXTRA;\n+}\n+\n static void virtio_pci_save_extra_state(DeviceState *d, QEMUFile *f)\n {\n     VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);\n",
    "prefixes": [
        "1/1"
    ]
}