get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 815719,
    "url": "http://patchwork.ozlabs.org/api/patches/815719/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170919165226.23022-10-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": "<20170919165226.23022-10-marcandre.lureau@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-19T16:52:08",
    "name": "[v2,09/27] vhost-user-scsi: use glib allocation",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "4cdf77c85462081da667165649f080a21ac299e8",
    "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/20170919165226.23022-10-marcandre.lureau@redhat.com/mbox/",
    "series": [
        {
            "id": 3931,
            "url": "http://patchwork.ozlabs.org/api/series/3931/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3931",
            "date": "2017-09-19T16:51:59",
            "name": "vhost-user-scsi: code clean-up",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/3931/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/815719/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/815719/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-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx06.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 3xxVFR6xpjz9rvt\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 03:27:55 +1000 (AEST)",
            "from localhost ([::1]:44275 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 1duMJN-0001tC-DH\n\tfor incoming@patchwork.ozlabs.org; Tue, 19 Sep 2017 13:27:53 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:46380)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1duLlt-0005Zp-Cn\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:53:18 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1duLls-0001mL-HS\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:53:17 -0400",
            "from mx1.redhat.com ([209.132.183.28]:43330)\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 1duLls-0001la-8A\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:53:16 -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 397971F56C;\n\tTue, 19 Sep 2017 16:53:15 +0000 (UTC)",
            "from localhost (ovpn-112-56.ams2.redhat.com [10.36.112.56])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id AE24F61346;\n\tTue, 19 Sep 2017 16:53:08 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 397971F56C",
        "From": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Tue, 19 Sep 2017 18:52:08 +0200",
        "Message-Id": "<20170919165226.23022-10-marcandre.lureau@redhat.com>",
        "In-Reply-To": "<20170919165226.23022-1-marcandre.lureau@redhat.com>",
        "References": "<20170919165226.23022-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.30]);\n\tTue, 19 Sep 2017 16:53:15 +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 v2 09/27] vhost-user-scsi: use glib allocation",
        "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": "pbonzini@redhat.com, felipe@nutanix.com, changpeng.liu@intel.com,\n\t=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n\tf4bug@amsat.org",
        "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": "Use g_new/g_free instead of plain malloc. This simplify a bit memory\nhandling since glib will abort if it cannot allocate.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\nReviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n---\n contrib/vhost-user-scsi/vhost-user-scsi.c | 35 ++++++++-----------------------\n 1 file changed, 9 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c\nindex fe567452cd..cf2793ef02 100644\n--- a/contrib/vhost-user-scsi/vhost-user-scsi.c\n+++ b/contrib/vhost-user-scsi/vhost-user-scsi.c\n@@ -312,12 +312,7 @@ static struct scsi_task *scsi_task_new(int cdb_len, uint8_t *cdb, int dir,\n     assert(cdb_len > 0);\n     assert(cdb);\n \n-    task = calloc(1, sizeof(struct scsi_task));\n-    if (!task) {\n-        PERR(\"Error allocating task: %s\", strerror(errno));\n-        return NULL;\n-    }\n-\n+    task = g_new0(struct scsi_task, 1);\n     memcpy(task->cdb, cdb, cdb_len);\n     task->cdb_size = cdb_len;\n     task->xfer_dir = dir;\n@@ -393,10 +388,6 @@ static int handle_cmd_sync(struct iscsi_context *ctx,\n     }\n \n     task = scsi_task_new(cdb_len, req->cdb, dir, len);\n-    if (!task) {\n-        PERR(\"Unable to create iscsi task\");\n-        return -1;\n-    }\n \n     if (dir == SCSI_XFER_TO_DEV) {\n         task->iovector_out.iov = (struct scsi_iovec *)out;\n@@ -410,7 +401,7 @@ static int handle_cmd_sync(struct iscsi_context *ctx,\n          cdb_len, dir, task);\n     if (!iscsi_scsi_command_sync(ctx, 0, task, NULL)) {\n         PERR(\"Error serving SCSI command\");\n-        free(task);\n+        g_free(task);\n         return -1;\n     }\n \n@@ -425,7 +416,7 @@ static int handle_cmd_sync(struct iscsi_context *ctx,\n         memcpy(rsp->sense, &task->datain.data[2], rsp->sense_len);\n     }\n \n-    free(task);\n+    g_free(task);\n \n     PDBG(\"Filled in rsp: status=%hhX, resid=%u, response=%hhX, sense_len=%u\",\n          rsp->status, rsp->resid, rsp->response, rsp->sense_len);\n@@ -692,7 +683,7 @@ static vhost_scsi_dev_t *vdev_scsi_find_by_vu(VuDev *vu_dev)\n     return NULL;\n }\n \n-static void vdev_scsi_deinit(vhost_scsi_dev_t *vdev_scsi)\n+static void vdev_scsi_free(vhost_scsi_dev_t *vdev_scsi)\n {\n     if (!vdev_scsi) {\n         return;\n@@ -716,18 +707,14 @@ static void vdev_scsi_deinit(vhost_scsi_dev_t *vdev_scsi)\n         g_main_loop_unref(vdev_scsi->loop);\n         vdev_scsi->loop = NULL;\n     }\n+    g_free(vdev_scsi);\n }\n \n static vhost_scsi_dev_t *vdev_scsi_new(int server_sock)\n {\n-    vhost_scsi_dev_t *vdev_scsi = NULL;\n-\n-    vdev_scsi = calloc(1, sizeof(vhost_scsi_dev_t));\n-    if (!vdev_scsi) {\n-        PERR(\"calloc: %s\", strerror(errno));\n-        return NULL;\n-    }\n+    vhost_scsi_dev_t *vdev_scsi;\n \n+    vdev_scsi = g_new0(vhost_scsi_dev_t, 1);\n     vdev_scsi->server_sock = server_sock;\n     vdev_scsi->loop = g_main_loop_new(NULL, FALSE);\n     if (!vdev_scsi->loop) {\n@@ -744,8 +731,7 @@ static vhost_scsi_dev_t *vdev_scsi_new(int server_sock)\n     return vdev_scsi;\n \n err:\n-    vdev_scsi_deinit(vdev_scsi);\n-    free(vdev_scsi);\n+    vdev_scsi_free(vdev_scsi);\n \n     return NULL;\n }\n@@ -852,10 +838,7 @@ int main(int argc, char **argv)\n     }\n \n out:\n-    if (vdev_scsi) {\n-        vdev_scsi_deinit(vdev_scsi);\n-        free(vdev_scsi);\n-    }\n+    vdev_scsi_free(vdev_scsi);\n     g_free(unix_fn);\n     g_free(iscsi_uri);\n \n",
    "prefixes": [
        "v2",
        "09/27"
    ]
}