get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 812443,
    "url": "http://patchwork.ozlabs.org/api/patches/812443/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170911165929.2791-2-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": "<20170911165929.2791-2-marcandre.lureau@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-11T16:59:23",
    "name": "[v6,1/7] fw_cfg: add write callback",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "6c0683bcca81a8f09b9d40aeb9b1bb8e92ff9801",
    "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/20170911165929.2791-2-marcandre.lureau@redhat.com/mbox/",
    "series": [
        {
            "id": 2525,
            "url": "http://patchwork.ozlabs.org/api/series/2525/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2525",
            "date": "2017-09-11T16:59:22",
            "name": "KASLR kernel dump support",
            "version": 6,
            "mbox": "http://patchwork.ozlabs.org/series/2525/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/812443/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/812443/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=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 3xrZ1Q4dmKz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 03:00:26 +1000 (AEST)",
            "from localhost ([::1]:59149 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 1drS4O-0005uW-Mp\n\tfor incoming@patchwork.ozlabs.org; Mon, 11 Sep 2017 13:00:24 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:57589)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1drS3k-0005sl-U6\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 12:59:46 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1drS3j-00075e-H5\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 12:59:45 -0400",
            "from mx1.redhat.com ([209.132.183.28]:49794)\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 1drS3j-00074B-9I\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 12:59:43 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\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 2A18A745C4;\n\tMon, 11 Sep 2017 16:59:42 +0000 (UTC)",
            "from localhost (ovpn-112-51.ams2.redhat.com [10.36.112.51])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 157F85D9CA;\n\tMon, 11 Sep 2017 16:59:37 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 2A18A745C4",
        "From": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Mon, 11 Sep 2017 18:59:23 +0200",
        "Message-Id": "<20170911165929.2791-2-marcandre.lureau@redhat.com>",
        "In-Reply-To": "<20170911165929.2791-1-marcandre.lureau@redhat.com>",
        "References": "<20170911165929.2791-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.14",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.27]);\n\tMon, 11 Sep 2017 16:59:42 +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 v6 1/7] fw_cfg: add write callback",
        "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": "ehabkost@redhat.com, Ben Warren <ben@skyportsystems.com>, mst@redhat.com,\n\tPaolo Bonzini <pbonzini@redhat.com>, anderson@redhat.com, =?utf-8?q?M?=\n\t=?utf-8?q?arc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n\timammedo@redhat.com, lersek@redhat.com,\n\tRichard Henderson <rth@twiddle.net>",
        "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": "Reintroduce the write callback that was removed when write support was\nremoved in commit 023e3148567ac898c7258138f8e86c3c2bb40d07.\n\nContrary to the previous callback implementation, the write_cb\ncallback is called whenever a write happened, so handlers must be\nready to handle partial write as necessary.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n---\n include/hw/nvram/fw_cfg.h |  3 +++\n hw/acpi/vmgenid.c         |  2 +-\n hw/core/loader.c          |  2 +-\n hw/i386/acpi-build.c      |  2 +-\n hw/isa/lpc_ich9.c         |  4 ++--\n hw/nvram/fw_cfg.c         | 14 ++++++++++----\n 6 files changed, 18 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h\nindex f50d068563..7ccbae5fba 100644\n--- a/include/hw/nvram/fw_cfg.h\n+++ b/include/hw/nvram/fw_cfg.h\n@@ -45,6 +45,7 @@ typedef struct FWCfgDmaAccess {\n } QEMU_PACKED FWCfgDmaAccess;\n \n typedef void (*FWCfgCallback)(void *opaque);\n+typedef void (*FWCfgWriteCallback)(void *opaque, off_t start, size_t len);\n \n struct FWCfgState {\n     /*< private >*/\n@@ -183,6 +184,7 @@ void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data,\n  * @s: fw_cfg device being modified\n  * @filename: name of new fw_cfg file item\n  * @select_cb: callback function when selecting\n+ * @write_cb: callback function after a write\n  * @callback_opaque: argument to be passed into callback function\n  * @data: pointer to start of item data\n  * @len: size of item data\n@@ -202,6 +204,7 @@ void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data,\n  */\n void fw_cfg_add_file_callback(FWCfgState *s, const char *filename,\n                               FWCfgCallback select_cb,\n+                              FWCfgWriteCallback write_cb,\n                               void *callback_opaque,\n                               void *data, size_t len, bool read_only);\n \ndiff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c\nindex 2876d8a639..105044f666 100644\n--- a/hw/acpi/vmgenid.c\n+++ b/hw/acpi/vmgenid.c\n@@ -124,7 +124,7 @@ void vmgenid_add_fw_cfg(VmGenIdState *vms, FWCfgState *s, GArray *guid)\n     fw_cfg_add_file(s, VMGENID_GUID_FW_CFG_FILE, guid->data,\n                     VMGENID_FW_CFG_SIZE);\n     /* Create a read-write fw_cfg file for Address */\n-    fw_cfg_add_file_callback(s, VMGENID_ADDR_FW_CFG_FILE, NULL, NULL,\n+    fw_cfg_add_file_callback(s, VMGENID_ADDR_FW_CFG_FILE, NULL, NULL, NULL,\n                              vms->vmgenid_addr_le,\n                              ARRAY_SIZE(vms->vmgenid_addr_le), false);\n }\ndiff --git a/hw/core/loader.c b/hw/core/loader.c\nindex 4593061445..91669d65aa 100644\n--- a/hw/core/loader.c\n+++ b/hw/core/loader.c\n@@ -1023,7 +1023,7 @@ MemoryRegion *rom_add_blob(const char *name, const void *blob, size_t len,\n         }\n \n         fw_cfg_add_file_callback(fw_cfg, fw_file_name,\n-                                 fw_callback, callback_opaque,\n+                                 fw_callback, NULL, callback_opaque,\n                                  data, rom->datasize, read_only);\n     }\n     return mr;\ndiff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c\nindex 4d19d91e1b..702a214369 100644\n--- a/hw/i386/acpi-build.c\n+++ b/hw/i386/acpi-build.c\n@@ -2890,7 +2890,7 @@ void acpi_setup(void)\n \n         build_state->rsdp = g_memdup(tables.rsdp->data, rsdp_size);\n         fw_cfg_add_file_callback(pcms->fw_cfg, ACPI_BUILD_RSDP_FILE,\n-                                 acpi_build_update, build_state,\n+                                 acpi_build_update, NULL, build_state,\n                                  build_state->rsdp, rsdp_size, true);\n         build_state->rsdp_mr = NULL;\n     } else {\ndiff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c\nindex ac8416d42b..de8fbb7260 100644\n--- a/hw/isa/lpc_ich9.c\n+++ b/hw/isa/lpc_ich9.c\n@@ -402,12 +402,12 @@ void ich9_lpc_pm_init(PCIDevice *lpc_pci, bool smm_enabled)\n          * just link them into fw_cfg here.\n          */\n         fw_cfg_add_file_callback(fw_cfg, \"etc/smi/requested-features\",\n-                                 NULL, NULL,\n+                                 NULL, NULL, NULL,\n                                  lpc->smi_guest_features_le,\n                                  sizeof lpc->smi_guest_features_le,\n                                  false);\n         fw_cfg_add_file_callback(fw_cfg, \"etc/smi/features-ok\",\n-                                 smi_features_ok_callback, lpc,\n+                                 smi_features_ok_callback, NULL, lpc,\n                                  &lpc->smi_features_ok,\n                                  sizeof lpc->smi_features_ok,\n                                  true);\ndiff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c\nindex e3bd626b8c..753ac0e4ea 100644\n--- a/hw/nvram/fw_cfg.c\n+++ b/hw/nvram/fw_cfg.c\n@@ -56,6 +56,7 @@ struct FWCfgEntry {\n     uint8_t *data;\n     void *callback_opaque;\n     FWCfgCallback select_cb;\n+    FWCfgWriteCallback write_cb;\n };\n \n #define JPG_FILE 0\n@@ -370,6 +371,8 @@ static void fw_cfg_dma_transfer(FWCfgState *s)\n                     dma_memory_read(s->dma_as, dma.address,\n                                     &e->data[s->cur_offset], len)) {\n                     dma.control |= FW_CFG_DMA_CTL_ERROR;\n+                } else if (e->write_cb) {\n+                    e->write_cb(e->callback_opaque, s->cur_offset, len);\n                 }\n             }\n \n@@ -570,6 +573,7 @@ static const VMStateDescription vmstate_fw_cfg = {\n \n static void fw_cfg_add_bytes_callback(FWCfgState *s, uint16_t key,\n                                       FWCfgCallback select_cb,\n+                                      FWCfgWriteCallback write_cb,\n                                       void *callback_opaque,\n                                       void *data, size_t len,\n                                       bool read_only)\n@@ -584,6 +588,7 @@ static void fw_cfg_add_bytes_callback(FWCfgState *s, uint16_t key,\n     s->entries[arch][key].data = data;\n     s->entries[arch][key].len = (uint32_t)len;\n     s->entries[arch][key].select_cb = select_cb;\n+    s->entries[arch][key].write_cb = write_cb;\n     s->entries[arch][key].callback_opaque = callback_opaque;\n     s->entries[arch][key].allow_write = !read_only;\n }\n@@ -610,7 +615,7 @@ static void *fw_cfg_modify_bytes_read(FWCfgState *s, uint16_t key,\n \n void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, void *data, size_t len)\n {\n-    fw_cfg_add_bytes_callback(s, key, NULL, NULL, data, len, true);\n+    fw_cfg_add_bytes_callback(s, key, NULL, NULL, NULL, data, len, true);\n }\n \n void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value)\n@@ -737,6 +742,7 @@ static int get_fw_cfg_order(FWCfgState *s, const char *name)\n \n void fw_cfg_add_file_callback(FWCfgState *s,  const char *filename,\n                               FWCfgCallback select_cb,\n+                              FWCfgWriteCallback write_cb,\n                               void *callback_opaque,\n                               void *data, size_t len, bool read_only)\n {\n@@ -800,7 +806,7 @@ void fw_cfg_add_file_callback(FWCfgState *s,  const char *filename,\n     }\n \n     fw_cfg_add_bytes_callback(s, FW_CFG_FILE_FIRST + index,\n-                              select_cb,\n+                              select_cb, write_cb,\n                               callback_opaque, data, len,\n                               read_only);\n \n@@ -815,7 +821,7 @@ void fw_cfg_add_file_callback(FWCfgState *s,  const char *filename,\n void fw_cfg_add_file(FWCfgState *s,  const char *filename,\n                      void *data, size_t len)\n {\n-    fw_cfg_add_file_callback(s, filename, NULL, NULL, data, len, true);\n+    fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true);\n }\n \n void *fw_cfg_modify_file(FWCfgState *s, const char *filename,\n@@ -838,7 +844,7 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename,\n         }\n     }\n     /* add new one */\n-    fw_cfg_add_file_callback(s, filename, NULL, NULL, data, len, true);\n+    fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true);\n     return NULL;\n }\n \n",
    "prefixes": [
        "v6",
        "1/7"
    ]
}