get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2218754,
    "url": "http://patchwork.ozlabs.org/api/patches/2218754/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260401202844.673494-4-peterx@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": "<20260401202844.673494-4-peterx@redhat.com>",
    "list_archive_url": null,
    "date": "2026-04-01T20:28:36",
    "name": "[03/11] vmstate: Do not set size for VMS_ARRAY_OF_POINTER",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "bbb59265a06afbfe2a33fe1216006a977dcf2daa",
    "submitter": {
        "id": 67717,
        "url": "http://patchwork.ozlabs.org/api/people/67717/?format=api",
        "name": "Peter Xu",
        "email": "peterx@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260401202844.673494-4-peterx@redhat.com/mbox/",
    "series": [
        {
            "id": 498385,
            "url": "http://patchwork.ozlabs.org/api/series/498385/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=498385",
            "date": "2026-04-01T20:28:34",
            "name": "vmstate: Implement VMS_ARRAY_OF_POINTER_AUTO_ALLOC",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/498385/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2218754/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2218754/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@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Y1Y+1bKX;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=B+j5p3pN;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmGp61WNBz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 02 Apr 2026 07:30:38 +1100 (AEDT)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w82BT-0004MC-80; Wed, 01 Apr 2026 16:29:03 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <peterx@redhat.com>) id 1w82BM-0004Il-T2\n for qemu-devel@nongnu.org; Wed, 01 Apr 2026 16:28:57 -0400",
            "from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <peterx@redhat.com>) id 1w82BK-000385-IY\n for qemu-devel@nongnu.org; Wed, 01 Apr 2026 16:28:56 -0400",
            "from mail-qk1-f197.google.com (mail-qk1-f197.google.com\n [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-299-ID8bNQYnP5KlbrnI47Ssqg-1; Wed, 01 Apr 2026 16:28:52 -0400",
            "by mail-qk1-f197.google.com with SMTP id\n af79cd13be357-8cdae902bccso50843385a.0\n for <qemu-devel@nongnu.org>; Wed, 01 Apr 2026 13:28:52 -0700 (PDT)",
            "from x1.com ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8d2a548a4efsm68194085a.8.2026.04.01.13.28.49\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 01 Apr 2026 13:28:50 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1775075333;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=hPQP5b/pynpHzfsBPX6i6Pduta9C+EPL3oVh5IQ70nQ=;\n b=Y1Y+1bKXw8yj01VYKp/gseaS3KwkQ5PHbXEberGM8zzDah8WgrWM+R1fxVpD5OSQesKuDl\n gISac504pbLWUDr1uotwRUdI2Iss61BTBy+v4vfk88JgPLTSIMutQLQ84ZxQKqf/iAyyJ1\n ZSibjjjLYiuE9a4j1zzoDCgSgzMZvfk=",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1775075332; x=1775680132; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=hPQP5b/pynpHzfsBPX6i6Pduta9C+EPL3oVh5IQ70nQ=;\n b=B+j5p3pN8IDNDH+7fSjCzNZzSOB7qAvj/D4P1mXvLsZq8OU+s27SWN0T1nIIVUMzHL\n vw7KOMHoG2qyVtko7bJAwpixcJz54fWoqA7H4HZRW1F5njXYZX17JbM5VrGX697eWmHv\n e6OV+W30Ao4+WyF6FTz4k5ipEQeOT7kZsCmCTtVwerQ2ZCqEjS07rx8WuFzoRxp19BZ4\n MgmGNjChT76mlt/m3AYcXiiumwUdec86HxL7tFXX2JVZkWC0uIGFUx580oQeaIZv5WYY\n kEpTLJH/M1kpbYG3C28pyzMq2RRkle77Xg0hTBbCKOp57IECmb0QtrDmaxPLv87tFk1V\n MKvg=="
        ],
        "X-MC-Unique": "ID8bNQYnP5KlbrnI47Ssqg-1",
        "X-Mimecast-MFC-AGG-ID": "ID8bNQYnP5KlbrnI47Ssqg_1775075332",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775075332; x=1775680132;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=hPQP5b/pynpHzfsBPX6i6Pduta9C+EPL3oVh5IQ70nQ=;\n b=WrJ7JTn25DOOGraXukB+TkyRtuKyTq1P5NTCM4dnyqkC/0wbvaN7RJkI+KE80KCGFr\n th5aFA9n5nGf5w18t3q0UiPb6LogfmAExqpos5EMJA2sLvjntMpR9xwwJpYNWzyrHI2I\n lCZyf0QZuKqPQJKumdcASJMm3FOlB3dfzbHHbPqzV1OgnSDCgY1zdgvpbMMmWQEbmcsh\n vUsJ4K1sKGzGFaj5qUB7ktz62on5VYoq7b1Bgvw7bsp/9IE7KTcRj9kWTx5HJRzkDjiL\n dp0bBlaKmU6yJ4HjxkBxqBKLXhgI9TMhraRPKlT1Ki1ASOyk3bXwbu99Trzq7ToAiMHV\n j4cQ==",
        "X-Gm-Message-State": "AOJu0YzfM5EgukJV4oxRPMM/V2fBkkoSkjWyPMcBzNPB2OxURDtYEKmJ\n bPhB6iUoqsCI/uJrciXgq9GeUYiL6Dq0MMReEaHtp4qbQVjjh+ECjYGVxeJw9L2e3TNvM4jtiTN\n a93mN7peTuVPKJl7NAykYNeFU7PCZZuYp06o5dr42KrELE0yyVUiPGV/Fh1TJsYBvfusgbMIewl\n jmWa0cmACAdbyko3ge2l0gt2vLOiWRhIYQdUHszQ==",
        "X-Gm-Gg": "ATEYQzyDtpBy2t9SLQaWuhR4/tUvqin+7F5SSXF07RCn4mqtSZvyeygzmnN7ZzF7JCK\n mNp0tKT1j/a7HvcwwqeuwiWtHbXfm8DTv9ffqwJjp1U/ZEs5SBTo9ARbpQui8vl72sCniRZxyim\n t339/Zn99j4sg8UT2oLJNI6o20/GKMEcHJpBeitRzQylSw2GTws9ByfE8jJnqBRJ3sm6tSbHPZ5\n 1BXf2C37cb5MrSFXGAN1Dho1PtBR76XUO/V6K7bSgfjBsXNIbWJmsV4LOywX5Rv2xPSd6GHtqHw\n HyJi1t7Dp+cd+hR6BuiO6ubeYkjQn+BO3AJMBx85KgnkF3FqM8tXZaRzXzMx8PugU3fymarzNTt\n gRU2RGfEY1uefkZ5qb5/ZVan0E8htlODcg83y6IE8XIA=",
        "X-Received": [
            "by 2002:a05:620a:7001:b0:8cd:9599:b7c7 with SMTP id\n af79cd13be357-8d2aba26606mr169963785a.23.1775075331636;\n Wed, 01 Apr 2026 13:28:51 -0700 (PDT)",
            "by 2002:a05:620a:7001:b0:8cd:9599:b7c7 with SMTP id\n af79cd13be357-8d2aba26606mr169956985a.23.1775075330673;\n Wed, 01 Apr 2026 13:28:50 -0700 (PDT)"
        ],
        "From": "Peter Xu <peterx@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Juraj Marcin <jmarcin@redhat.com>,\n Alexander Mikhalitsyn <alexander@mihalicyn.com>,\n Fabiano Rosas <farosas@suse.de>, Peter Xu <peterx@redhat.com>,\n Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>, =?utf-8?q?Phi?=\n\t=?utf-8?q?lippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>",
        "Subject": "[PATCH 03/11] vmstate: Do not set size for VMS_ARRAY_OF_POINTER",
        "Date": "Wed,  1 Apr 2026 16:28:36 -0400",
        "Message-ID": "<20260401202844.673494-4-peterx@redhat.com>",
        "X-Mailer": "git-send-email 2.50.1",
        "In-Reply-To": "<20260401202844.673494-1-peterx@redhat.com>",
        "References": "<20260401202844.673494-1-peterx@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com",
        "X-Spam_score_int": "-6",
        "X-Spam_score": "-0.7",
        "X-Spam_bar": "/",
        "X-Spam_report": "(-0.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "qemu development <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://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 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "When VMS_ARRAY_OF_POINTER is specified, it means the vmstate field is an\narray of pointers.\n\nThe size of the element is not relevant to whatever it is stored inside: it\nis always the host pointer size.\n\nLet's reserve the \"size\" field in this case for future use, update\nvmstate_size() so as to make it still work for array of pointers properly.\n\nWhen at this, provide rich documentation on how size / size_offset works in\nvmstate.\n\nReviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>\nReviewed-by: Fabiano Rosas <farosas@suse.de>\nReviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n include/migration/vmstate.h | 20 ++++++++++++++++----\n migration/savevm.c          |  3 +++\n migration/vmstate.c         | 10 +++++++++-\n 3 files changed, 28 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h\nindex 32bb8e8ebc..350e62a55a 100644\n--- a/include/migration/vmstate.h\n+++ b/include/migration/vmstate.h\n@@ -183,11 +183,26 @@ typedef enum {\n struct VMStateField {\n     const char *name;\n     size_t offset;\n+\n+    /*\n+     * @size or @size_offset specifies the size of the element embeded in\n+     * the field.  Only one of them should be present never both.  When\n+     * @size_offset is used together with VMS_VBUFFER, it means the size is\n+     * dynamic calculated instead of a constant.\n+     *\n+     * When the field is an array of any type, this stores the size of one\n+     * element of the array.\n+     *\n+     * NOTE: even if VMS_POINTER or VMS_ARRAY_OF_POINTER may be specified,\n+     * this parameter always reflects the real size of the objects that a\n+     * pointer point to.\n+     */\n     size_t size;\n+    size_t size_offset;\n+\n     size_t start;\n     int num;\n     size_t num_offset;\n-    size_t size_offset;\n     const VMStateInfo *info;\n     enum VMStateFlags flags;\n     const VMStateDescription *vmsd;\n@@ -547,7 +562,6 @@ extern const VMStateInfo vmstate_info_qlist;\n     .version_id = (_version),                                        \\\n     .num        = (_num),                                            \\\n     .info       = &(_info),                                          \\\n-    .size       = sizeof(_type *),                                   \\\n     .flags      = VMS_ARRAY|VMS_ARRAY_OF_POINTER,                    \\\n     .offset     = vmstate_offset_array(_state, _field, _type *, _num), \\\n }\n@@ -557,7 +571,6 @@ extern const VMStateInfo vmstate_info_qlist;\n     .version_id = (_v),                                              \\\n     .num        = (_n),                                              \\\n     .vmsd       = &(_vmsd),                                          \\\n-    .size       = sizeof(_type *),                                    \\\n     .flags      = VMS_ARRAY|VMS_STRUCT|VMS_ARRAY_OF_POINTER,         \\\n     .offset     = vmstate_offset_array(_s, _f, _type*, _n),          \\\n }\n@@ -567,7 +580,6 @@ extern const VMStateInfo vmstate_info_qlist;\n     .version_id = (_version),                                             \\\n     .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),     \\\n     .info       = &(_info),                                               \\\n-    .size       = sizeof(_type *),                                          \\\n     .flags      = VMS_VARRAY_UINT32 | VMS_ARRAY_OF_POINTER | VMS_POINTER, \\\n     .offset     = vmstate_offset_pointer(_state, _field, _type *),          \\\n }\ndiff --git a/migration/savevm.c b/migration/savevm.c\nindex 8115203b51..f5a6fd0c66 100644\n--- a/migration/savevm.c\n+++ b/migration/savevm.c\n@@ -868,6 +868,9 @@ static void vmstate_check(const VMStateDescription *vmsd)\n \n     if (field) {\n         while (field->name) {\n+            if (field->flags & VMS_ARRAY_OF_POINTER) {\n+                assert(field->size == 0);\n+            }\n             if (field->flags & (VMS_STRUCT | VMS_VSTRUCT)) {\n                 /* Recurse to sub structures */\n                 vmstate_check(field->vmsd);\ndiff --git a/migration/vmstate.c b/migration/vmstate.c\nindex e98b5f5346..e29a8c3f49 100644\n--- a/migration/vmstate.c\n+++ b/migration/vmstate.c\n@@ -110,13 +110,21 @@ static int vmstate_n_elems(void *opaque, const VMStateField *field)\n \n static int vmstate_size(void *opaque, const VMStateField *field)\n {\n-    int size = field->size;\n+    int size;\n \n     if (field->flags & VMS_VBUFFER) {\n         size = *(int32_t *)(opaque + field->size_offset);\n         if (field->flags & VMS_MULTIPLY) {\n             size *= field->size;\n         }\n+    } else if (field->flags & VMS_ARRAY_OF_POINTER) {\n+        /*\n+         * For an array of pointer, the each element is always size of a\n+         * host pointer.\n+         */\n+        size = sizeof(void *);\n+    } else {\n+        size = field->size;\n     }\n \n     return size;\n",
    "prefixes": [
        "03/11"
    ]
}