get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1072856,
    "url": "http://patchwork.ozlabs.org/api/patches/1072856/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20190401140903.19186-6-eblake@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": "<20190401140903.19186-6-eblake@redhat.com>",
    "list_archive_url": null,
    "date": "2019-04-01T14:08:54",
    "name": "[PULL,05/14] qemu-img: Gracefully shutdown when map can't finish",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "2a03360fe7cb66a4c826e5942e1bbe822edc6dab",
    "submitter": {
        "id": 6591,
        "url": "http://patchwork.ozlabs.org/api/people/6591/?format=api",
        "name": "Eric Blake",
        "email": "eblake@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20190401140903.19186-6-eblake@redhat.com/mbox/",
    "series": [
        {
            "id": 100345,
            "url": "http://patchwork.ozlabs.org/api/series/100345/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=100345",
            "date": "2019-04-01T14:08:49",
            "name": "[PULL,01/14] qemu-img: Report bdrv_block_status failures",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/100345/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1072856/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1072856/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=209.51.188.17; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=redhat.com"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 44Xvh32Pltz9sPB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  2 Apr 2019 01:22:59 +1100 (AEDT)",
            "from localhost ([127.0.0.1]:36629 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 1hAxpx-0007s8-9j\n\tfor incoming@patchwork.ozlabs.org; Mon, 01 Apr 2019 10:22:57 -0400",
            "from eggs.gnu.org ([209.51.188.92]:45851)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1hAxcj-0001zG-12\n\tfor qemu-devel@nongnu.org; Mon, 01 Apr 2019 10:09:18 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1hAxci-0004mD-1J\n\tfor qemu-devel@nongnu.org; Mon, 01 Apr 2019 10:09:16 -0400",
            "from mx1.redhat.com ([209.132.183.28]:18738)\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 1hAxcf-0004jl-DH; Mon, 01 Apr 2019 10:09:13 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23])\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 B1AC23688E;\n\tMon,  1 Apr 2019 14:09:12 +0000 (UTC)",
            "from blue.redhat.com (ovpn-116-75.phx2.redhat.com [10.3.116.75])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 5987119C70;\n\tMon,  1 Apr 2019 14:09:09 +0000 (UTC)"
        ],
        "From": "Eric Blake <eblake@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Mon,  1 Apr 2019 09:08:54 -0500",
        "Message-Id": "<20190401140903.19186-6-eblake@redhat.com>",
        "In-Reply-To": "<20190401140903.19186-1-eblake@redhat.com>",
        "References": "<20190401140903.19186-1-eblake@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.84 on 10.5.11.23",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.30]);\n\tMon, 01 Apr 2019 14:09:12 +0000 (UTC)",
        "Content-Transfer-Encoding": "quoted-printable",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]",
        "X-Received-From": "209.132.183.28",
        "Subject": "[Qemu-devel] [PULL 05/14] qemu-img: Gracefully shutdown when map\n\tcan't finish",
        "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>, John Snow <jsnow@redhat.com>,\n\t\"open list:Block layer core\" <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": "Trying 'qemu-img map -f raw nbd://localhost:10809' causes the\nNBD server to output a scary message:\n\nqemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read\n\nThis is because the NBD client, being remote, has no way to expose a\nhuman-readable map (the --output=json data is fine, however). But\nbecause we exit(1) right after the message, causing the client to\nbypass all block cleanup, the server sees the abrupt exit and warns,\nwhereas it would be silent had the client had a chance to send\nNBD_CMD_DISC. Other protocols may have similar cleanup issues, where\nfailure to blk_unref() could cause unintended effects.\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\nMessage-Id: <20190326184043.7544-1-eblake@redhat.com>\nReviewed-by: John Snow <jsnow@redhat.com>\nReviewed-by: Kevin Wolf <kwolf@redhat.com>\n---\n qemu-img.c | 14 +++++++++-----\n 1 file changed, 9 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/qemu-img.c b/qemu-img.c\nindex 03a9a10dec1..76a961df824 100644\n--- a/qemu-img.c\n+++ b/qemu-img.c\n@@ -2736,14 +2736,14 @@ static int img_info(int argc, char **argv)\n     return 0;\n }\n\n-static void dump_map_entry(OutputFormat output_format, MapEntry *e,\n-                           MapEntry *next)\n+static int dump_map_entry(OutputFormat output_format, MapEntry *e,\n+                          MapEntry *next)\n {\n     switch (output_format) {\n     case OFORMAT_HUMAN:\n         if (e->data && !e->has_offset) {\n             error_report(\"File contains external, encrypted or compressed clusters.\");\n-            exit(1);\n+            return -1;\n         }\n         if (e->data && !e->zero) {\n             printf(\"%#-16\"PRIx64\"%#-16\"PRIx64\"%#-16\"PRIx64\"%s\\n\",\n@@ -2776,6 +2776,7 @@ static void dump_map_entry(OutputFormat output_format, MapEntry *e,\n         }\n         break;\n     }\n+    return 0;\n }\n\n static int get_block_status(BlockDriverState *bs, int64_t offset,\n@@ -2968,12 +2969,15 @@ static int img_map(int argc, char **argv)\n         }\n\n         if (curr.length > 0) {\n-            dump_map_entry(output_format, &curr, &next);\n+            ret = dump_map_entry(output_format, &curr, &next);\n+            if (ret < 0) {\n+                goto out;\n+            }\n         }\n         curr = next;\n     }\n\n-    dump_map_entry(output_format, &curr, NULL);\n+    ret = dump_map_entry(output_format, &curr, NULL);\n\n out:\n     blk_unref(blk);\n",
    "prefixes": [
        "PULL",
        "05/14"
    ]
}