get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 806608,
    "url": "http://patchwork.ozlabs.org/api/patches/806608/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170828144112.1256-1-marcandre.lureau@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": "<20170828144112.1256-1-marcandre.lureau@redhat.com>",
    "list_archive_url": null,
    "date": "2017-08-28T14:41:12",
    "name": "tpm: lookup cancel path under tpm device class",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "3f37c332a19c3afce9adc0ff1fbcd39247fbc6b5",
    "submitter": {
        "id": 66774,
        "url": "http://patchwork.ozlabs.org/api/people/66774/?format=api",
        "name": "Marc-André Lureau",
        "email": "marcandre.lureau@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170828144112.1256-1-marcandre.lureau@redhat.com/mbox/",
    "series": [
        {
            "id": 184,
            "url": "http://patchwork.ozlabs.org/api/series/184/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=184",
            "date": "2017-08-28T14:41:12",
            "name": "tpm: lookup cancel path under tpm device class",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/184/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/806608/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/806608/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=marcandre.lureau@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 3xgvcQ2gRPz9s7p\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Aug 2017 00:42:14 +1000 (AEST)",
            "from localhost ([::1]:40126 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 1dmLEy-0000jX-5n\n\tfor incoming@patchwork.ozlabs.org; Mon, 28 Aug 2017 10:42:12 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:44980)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1dmLEO-0000hr-1i\n\tfor qemu-devel@nongnu.org; Mon, 28 Aug 2017 10:41:37 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1dmLEK-0001qw-4C\n\tfor qemu-devel@nongnu.org; Mon, 28 Aug 2017 10:41:36 -0400",
            "from mx1.redhat.com ([209.132.183.28]:42372)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <marcandre.lureau@redhat.com>)\n\tid 1dmLEJ-0001q6-Qw\n\tfor qemu-devel@nongnu.org; Mon, 28 Aug 2017 10:41:32 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\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 B4C6FC04B303;\n\tMon, 28 Aug 2017 14:41:29 +0000 (UTC)",
            "from localhost (unknown [10.36.112.13])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id C3FDA7F483;\n\tMon, 28 Aug 2017 14:41:26 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com B4C6FC04B303",
        "From": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Mon, 28 Aug 2017 16:41:12 +0200",
        "Message-Id": "<20170828144112.1256-1-marcandre.lureau@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.11",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tMon, 28 Aug 2017 14:41:29 +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] [PATCH] tpm: lookup cancel path under tpm device class",
        "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": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n\tstefanb@us.ibm.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": "Since Linux 4.0 (commit 313d21eeab9282e), tpm devices have their own\ndevice class \"tpm\" and the cancel path must be looked up under\n/sys/class/tpm/ instead of /sys/class/misc/.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n---\n hw/tpm/tpm_passthrough.c | 36 ++++++++++++++++++++++--------------\n 1 file changed, 22 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c\nindex 9234eb3459..e3e9368057 100644\n--- a/hw/tpm/tpm_passthrough.c\n+++ b/hw/tpm/tpm_passthrough.c\n@@ -367,7 +367,8 @@ static TPMVersion tpm_passthrough_get_tpm_version(TPMBackend *tb)\n  * Unless path or file descriptor set has been provided by user,\n  * determine the sysfs cancel file following kernel documentation\n  * in Documentation/ABI/stable/sysfs-class-tpm.\n- * From /dev/tpm0 create /sys/class/misc/tpm0/device/cancel\n+ * From /dev/tpm0 create /sys/class/tpm/tpm0/device/cancel\n+ * before 4.0: /sys/class/misc/tpm0/device/cancel\n  */\n static int tpm_passthrough_open_sysfs_cancel(TPMBackend *tb)\n {\n@@ -379,28 +380,35 @@ static int tpm_passthrough_open_sysfs_cancel(TPMBackend *tb)\n     if (tb->cancel_path) {\n         fd = qemu_open(tb->cancel_path, O_WRONLY);\n         if (fd < 0) {\n-            error_report(\"Could not open TPM cancel path : %s\",\n+            error_report(\"Could not open TPM cancel path: %s\",\n                          strerror(errno));\n         }\n         return fd;\n     }\n \n     dev = strrchr(tpm_pt->tpm_dev, '/');\n-    if (dev) {\n-        dev++;\n-        if (snprintf(path, sizeof(path), \"/sys/class/misc/%s/device/cancel\",\n-                     dev) < sizeof(path)) {\n-            fd = qemu_open(path, O_WRONLY);\n-            if (fd >= 0) {\n-                tb->cancel_path = g_strdup(path);\n-            } else {\n-                error_report(\"tpm_passthrough: Could not open TPM cancel \"\n-                             \"path %s : %s\", path, strerror(errno));\n+    if (!dev) {\n+        error_report(\"tpm_passthrough: Bad TPM device path %s\",\n+                     tpm_pt->tpm_dev);\n+        return -1;\n+    }\n+\n+    dev++;\n+    if (snprintf(path, sizeof(path), \"/sys/class/tpm/%s/device/cancel\",\n+                 dev) < sizeof(path)) {\n+        fd = qemu_open(path, O_WRONLY);\n+        if (fd < 0) {\n+            if (snprintf(path, sizeof(path), \"/sys/class/misc/%s/device/cancel\",\n+                         dev) < sizeof(path)) {\n+                fd = qemu_open(path, O_WRONLY);\n             }\n         }\n+    }\n+\n+    if (fd < 0) {\n+        error_report(\"tpm_passthrough: Could not guess TPM cancel path\");\n     } else {\n-       error_report(\"tpm_passthrough: Bad TPM device path %s\",\n-                    tpm_pt->tpm_dev);\n+        tb->cancel_path = g_strdup(path);\n     }\n \n     return fd;\n",
    "prefixes": []
}