get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2224588,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2224588/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/swupdate/patch/20260417161524.2806435-2-hyyoxhk@163.com/",
    "project": {
        "id": 58,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/58/?format=api",
        "name": "swupdate development",
        "link_name": "swupdate",
        "list_id": "swupdate.googlegroups.com",
        "list_email": "swupdate@googlegroups.com",
        "web_url": "https://github.com/sbabic/swupdate",
        "scm_url": "git://github.com/sbabic/swupdate",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260417161524.2806435-2-hyyoxhk@163.com>",
    "list_archive_url": null,
    "date": "2026-04-17T16:15:21",
    "name": "[v1,1/4] util: add compressed-string parser and img setter macros",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "12be7628e8a75baac4d1af0832f8cd6430480060",
    "submitter": {
        "id": 79707,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/79707/?format=api",
        "name": "He Yong",
        "email": "hyyoxhk@163.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/swupdate/patch/20260417161524.2806435-2-hyyoxhk@163.com/mbox/",
    "series": [
        {
            "id": 500375,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/500375/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/swupdate/list/?series=500375",
            "date": "2026-04-17T16:15:21",
            "name": "Refactor image parsing and add LZ4 support",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/500375/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2224588/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2224588/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<swupdate+bncBAABB4GGRHHQMGQEZC6RSYQ@googlegroups.com>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=googlegroups.com header.i=@googlegroups.com\n header.a=rsa-sha256 header.s=20251104 header.b=YYv9Edcn;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com\n (client-ip=2607:f8b0:4864:20::f3c; helo=mail-qv1-xf3c.google.com;\n envelope-from=swupdate+bncbaabb4ggrhhqmgqezc6rsyq@googlegroups.com;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from mail-qv1-xf3c.google.com (mail-qv1-xf3c.google.com\n [IPv6:2607:f8b0:4864:20::f3c])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fy1214Xb2z2124\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 02:44:41 +1000 (AEST)",
            "by mail-qv1-xf3c.google.com with SMTP id\n 6a1803df08f44-8aca6f796d5sf27745366d6.0\n        for <incoming@patchwork.ozlabs.org>;\n Fri, 17 Apr 2026 09:44:41 -0700 (PDT)",
            "by 2002:ac8:5e08:0:b0:509:553b:c6da with SMTP id\n d75a77b69052e-50e25889150ls46073871cf.1.-pod-prod-04-us;\n Fri, 17 Apr 2026 09:44:32 -0700 (PDT)",
            "by 2002:a05:6808:1d1e:b0:479:8e15:9311 with SMTP id\n 5614622812f47-4799c9889b1msb6e;\n        Fri, 17 Apr 2026 09:15:38 -0700 (PDT)",
            "from m16.mail.163.com (m16.mail.163.com. [220.197.31.3])\n        by gmr-mx.google.com with ESMTPS id\n 5a478bee46e88-2e53d4bf8a8si76321eec.3.2026.04.17.09.15.32\n        for <swupdate@googlegroups.com>\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Fri, 17 Apr 2026 09:15:37 -0700 (PDT)",
            "from nh50.. (unknown [])\n\tby gzsmtp2 (Coremail) with SMTP id PSgvCgDnEgycXOJpPjUTAg--.9473S3;\n\tSat, 18 Apr 2026 00:15:25 +0800 (CST)"
        ],
        "ARC-Seal": [
            "i=2; a=rsa-sha256; t=1776444274; cv=pass;\n        d=google.com; s=arc-20240605;\n        b=LCiSl7GuZOocamz7rzX92ZHeLeaCUsGqrtcNewKLp+Np6n0YPEFIF8Or5ZpcH1C3Zs\n         EI/iSDdWKQVMrkkfXLv9pm3PWl4aZlcgxFy7Dx0Q7HzzcHNvIMrlilclhxohezqb5Y/w\n         3TfWadH19eU926GFfUsrxLnYmLlkNZf9Y88V4YRJnCxvr28PrdTv5rK2XlPNes8XmrbO\n         5djLV5QTFe62vL3dXvCnbcMRVggZCRe7wVmCS6O2U/MLl/bf6y55Ub51HTNjEGumGKgD\n         5RH8KZzFXbjSSIngYFDKadcNreM796m7sRASoV8l7aDh8NxvFQILZelU4eh1Pl7oqJSq\n         sNXA==",
            "i=1; a=rsa-sha256; t=1776442537; cv=none;\n        d=google.com; s=arc-20240605;\n        b=BmGGD38U8zDkLIVDYoQoe19sCaH0HSf99AgKkW4PxazhJU6n27BXAEvMhrU+PpxVG2\n         0ZyYHP5LdkvAO+1hO2/ZU0prDpVAVY+Rbd/ZGjd3e8Zwmmak/CRzO1iUIkacmhP/caPU\n         zOI5PJMzGW81tQWF0Qv3NngYcyhANN1vi0ZVrUjIlQyHM41hoIXIqUATnTUmEd6b+Iim\n         w25M6ooYe8QkEkNtwHh3+adzIdsP718NO+QRnhnNMsnmfb9kzEq/2oeIYCytEHkY8/iE\n         uHVKnfNBTp7JIxdxAXFbobh3cW9UcilO1IjMQqImPWXiQpVWj193lgWyLfdjKtkTNa83\n         kMKg=="
        ],
        "ARC-Message-Signature": [
            "i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:mime-version:references:in-reply-to\n         :message-id:date:subject:to:from:sender:dkim-signature;\n        bh=tGmdq0ThrwxcuJ9KP+gd1F8iFINvyD1aT3k0cefwE58=;\n        fh=yVEV0eS9VB0ZlZAaSz22ZwBEfd/MI8HdPbtLwBvGfP4=;\n        b=ah0/o2Xbkd82WX8L0CaLiFwtBQBcxEmRtZQrUa9p7XzTJ36Sxvb66sYp79nYqd0K64\n         dBJXXf1LBYZV9yO9Zh9bsT9v9OQoZFoteKneJg0w3wUvIA+3PwwKQSEpHl5G1P2OSdc7\n         jyGIF53Kqq6OcVNDv7mszNjhhUKuScgPibA1xL+UrTsF4iosDT9pP/aIpw0fFu6paz3I\n         o+8vIlOhfMlQoe99p9dHAs2OcuCuznvqFq4Q4+5LABicioPjx7VDronmVZmyN15v1nrX\n         +7YA6etraObX16cG6i1quTN17zuqOx7Yrw+BmviZL21hZl8uT3AL24WV8rsvWtpGteu8\n         BsPw==;\n        darn=patchwork.ozlabs.org",
            "i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:to:from:dkim-signature;\n        bh=qqBdEjsvJIICpGLP5zSJqqgffDLMT635Je+ON0qxisQ=;\n        fh=nvZsCFpxgpf+fsVXzjnWA8g1K3V/kNbRAKogjNDW4HY=;\n        b=X0NvVSBhfhXCEpwYY4yWy7PFAtzyV4I3FnF7QFqmdq6voIlSqFpDPnUOAbwuoaa2yA\n         Lm6h6KpWvqu4wAD4LjzEbsWERTWuAf0zXweRiULmnfuet58rbpioWDH9BI6omI+qwZqi\n         9HFPMg+vu/KV/RuV1ea4PEF1DyNS4ZxTGoWFoEaHy+bUaRUp5ql9mxmduhHQHfOAQtyB\n         zLb0KeiwWjZ4hEG8VwSNhlUrRj6g2W7DmzfqbUoXbKQAd1x0KgsZB7uCXd1KA0qIsCr4\n         Cs+CQOw7Q/x4/yF+oyNCLfMamEUMztNTJ71Wf8Tl85U6aNtCilvO6XR/F8+u7ZPYN9Mc\n         1llw==;\n        dara=google.com"
        ],
        "ARC-Authentication-Results": [
            "i=2; gmr-mx.google.com;\n       dkim=pass header.i=@163.com header.s=s110527 header.b=NNOFSnvy;\n       spf=pass (google.com: domain of hyyoxhk@163.com designates 220.197.31.3\n as permitted sender) smtp.mailfrom=hyyoxhk@163.com;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com",
            "i=1; gmr-mx.google.com;\n       dkim=pass header.i=@163.com header.s=s110527 header.b=NNOFSnvy;\n       spf=pass (google.com: domain of hyyoxhk@163.com designates 220.197.31.3\n as permitted sender) smtp.mailfrom=hyyoxhk@163.com;\n       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=googlegroups.com; s=20251104; t=1776444274; x=1777049074;\n darn=patchwork.ozlabs.org;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:x-original-authentication-results\n         :x-original-sender:mime-version:references:in-reply-to:message-id\n         :date:subject:to:from:sender:from:to:cc:subject:date:message-id\n         :reply-to;\n        bh=tGmdq0ThrwxcuJ9KP+gd1F8iFINvyD1aT3k0cefwE58=;\n        b=YYv9Edcn8Ni0PXhZ4Z10KZuuMWGrukotWOyjSA2b4PF5ONu66d2wboNFly3opBjuBW\n         aIisJdcxdDin+m5rdXiMqS5ha4MzQeoO1hFY/QhTRJpT5Yscyv1uw/JUvk228Fre+iQM\n         XWFEb+SpKXstF5Akfk6yWsQKGBaypf/4sFIl9pS7JMYbRucDiHmy4UJWmqsbGPqZa9q9\n         37seVwkZxmvgDM28N4SrgoAD1NIfe2LCZe16nBBuojJ0h33PbhVVfK5M/YYO+FNk7/SZ\n         wdoGgC+HTRIswv0t7MlimSkRr8xkNWdFw/ZRXE2RziieKrzDObKUHV/pl02IbVejWJLR\n         k3kA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1776444274; x=1777049074;\n        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n         :list-id:mailing-list:precedence:x-original-authentication-results\n         :x-original-sender:mime-version:references:in-reply-to:message-id\n         :date:subject:to:from:x-beenthere:x-gm-message-state:sender:from:to\n         :cc:subject:date:message-id:reply-to;\n        bh=tGmdq0ThrwxcuJ9KP+gd1F8iFINvyD1aT3k0cefwE58=;\n        b=D7/mT6/Qp0VMT02TYoKyVNiJNdvcBdUgeKWUbpDmrpFTgVzaswzO+3gMsrfrhTHG4v\n         5fJS0Z7APu2XjM2IDS25zc+hD1hsOM1JHLsbCFUh1YAmIZr39sRGCm+Fy7zp4fK34r2g\n         hI/4EgfYeQMOktyC+jHuOwgTJcWVf/JU7SvxTyjQjcg1yQoPpj8gGJfxs+h1lXjUL/Oy\n         qhEhJKxbR1owxLx31nukpnPGZjsCVKlY/ym/Im4FDRGL8aVvcXAX2F+8DytEDBUD4/jy\n         P3562YOGbsAhmPv4vHlLEBLAXoclmmaKCO7vBA/YU/g9XFBre7RudEq2Xu9s9xn/aJR6\n         Fc9g==",
        "Sender": "swupdate@googlegroups.com",
        "X-Forwarded-Encrypted": "i=2;\n AFNElJ+NJpD0RMLyoVgWLS9+3z+A63bHi0YEW4WY6k99gTqPfRq5LnDwwIB23KNji0t7IG4EAsLOcIatCA==@patchwork.ozlabs.org",
        "X-Gm-Message-State": "AOJu0Yz+cMP3nAhbbny8cvlDn/G3MBODikAymlINorl5HWnDfnhy3/1A\n\tGVGJPJZd4yRP2xoBetscgE1/ntUhY+I8PVKxtnNrLjLuM3Ex5kOta3KO",
        "X-Received": [
            "by 2002:ad4:5c86:0:b0:8a6:f065:3ef9 with SMTP id\n 6a1803df08f44-8b028087d60mr59745676d6.15.1776444274497;\n        Fri, 17 Apr 2026 09:44:34 -0700 (PDT)",
            "by 2002:a05:620a:31a5:b0:8d6:874c:a763 with SMTP id\n af79cd13be357-8e791d87409mr473629585a.49.1776444272835;\n        Fri, 17 Apr 2026 09:44:32 -0700 (PDT)",
            "by 2002:a05:693c:2b04:b0:2de:cc07:e8b with SMTP id\n 5a478bee46e88-2e466044dddmr1889737eec.1.1776442537276;\n        Fri, 17 Apr 2026 09:15:37 -0700 (PDT)"
        ],
        "X-BeenThere": "swupdate@googlegroups.com;\n h=\"AYAyTiKDq7ZEOh71AOoD4s7Vw/8oa9pPH9kGEqdeBlS5liTsNw==\"",
        "Received-SPF": "pass (google.com: domain of hyyoxhk@163.com designates\n 220.197.31.3 as permitted sender) client-ip=220.197.31.3;",
        "From": "He Yong <hyyoxhk@163.com>",
        "To": "swupdate@googlegroups.com",
        "Subject": "[swupdate] [PATCH v1 1/4] util: add compressed-string parser and img\n setter macros",
        "Date": "Sat, 18 Apr 2026 00:15:21 +0800",
        "Message-ID": "<20260417161524.2806435-2-hyyoxhk@163.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260417161524.2806435-1-hyyoxhk@163.com>",
        "References": "<20260417161524.2806435-1-hyyoxhk@163.com>",
        "MIME-Version": "1.0",
        "X-CM-TRANSID": "PSgvCgDnEgycXOJpPjUTAg--.9473S3",
        "X-Coremail-Antispam": "1Uf129KBjvJXoW7CrW3Ar43uF43tr13Gw1fCrg_yoW8tF4Upa\n\t1kXry5CF1fXFnruFW3tFnIga13Xr48Gry2k39rXr1qyF90q34vqrWxKF4YvFy5GrWvg39x\n\tZFsIg345Cw18tw7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07U24EiUUUUU=",
        "X-Originating-IP": "[2408:8266:bb01:57f4:788f:a08d:bbc4:eabb]",
        "X-CM-SenderInfo": "pk1105lkn6il2tof0z/xtbC0B1RJGniXJ2ynwAA3f",
        "X-Original-Sender": "hyyoxhk@163.com",
        "X-Original-Authentication-Results": "gmr-mx.google.com;       dkim=pass\n header.i=@163.com header.s=s110527 header.b=NNOFSnvy;       spf=pass\n (google.com: domain of hyyoxhk@163.com designates 220.197.31.3 as permitted\n sender) smtp.mailfrom=hyyoxhk@163.com;       dmarc=pass (p=NONE sp=NONE\n dis=NONE) header.from=163.com",
        "Content-Type": "text/plain; charset=\"UTF-8\"",
        "Precedence": "list",
        "Mailing-list": "list swupdate@googlegroups.com;\n contact swupdate+owners@googlegroups.com",
        "List-ID": "<swupdate.googlegroups.com>",
        "X-Google-Group-Id": "605343134186",
        "List-Post": "<https://groups.google.com/group/swupdate/post>,\n <mailto:swupdate@googlegroups.com>",
        "List-Help": "<https://groups.google.com/support/>,\n <mailto:swupdate+help@googlegroups.com>",
        "List-Archive": "<https://groups.google.com/group/swupdate",
        "List-Subscribe": "<https://groups.google.com/group/swupdate/subscribe>,\n <mailto:swupdate+subscribe@googlegroups.com>",
        "List-Unsubscribe": "\n <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>,\n <https://groups.google.com/group/swupdate/subscribe>"
    },
    "content": "Add a shared helper to convert compressed strings to internal type values,\nand introduce reusable image setter macros used by parser and Lua mapping code.\n\nSigned-off-by: He Yong <hyyoxhk@163.com>\n---\n core/util.c    | 22 ++++++++++++++++++++++\n include/util.h | 18 ++++++++++++++++++\n 2 files changed, 40 insertions(+)",
    "diff": "diff --git a/core/util.c b/core/util.c\nindex 3f62e070..89046f3c 100644\n--- a/core/util.c\n+++ b/core/util.c\n@@ -76,6 +76,28 @@ int ascii_to_bin(unsigned char *dest, size_t dstlen, const char *src)\n \treturn 0;\n }\n \n+static const struct {\n+\tconst char *name;\n+\tint type;\n+} compressed_by_name[] = {\n+\t{ \"zlib\", COMPRESSED_ZLIB },\n+\t{ \"xz\", COMPRESSED_XZ },\n+\t{ \"zstd\", COMPRESSED_ZSTD },\n+};\n+\n+int compressed_string_to_type(const char *s, int *out_type)\n+{\n+\tsize_t i;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(compressed_by_name); i++) {\n+\t\tif (!strcmp(s, compressed_by_name[i].name)) {\n+\t\t\t*out_type = compressed_by_name[i].type;\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\treturn -1;\n+}\n+\n static int countargc(char *args, char **argv)\n {\n \tint count = 0;\ndiff --git a/include/util.h b/include/util.h\nindex d4874f64..dcd0604c 100644\n--- a/include/util.h\n+++ b/include/util.h\n@@ -184,6 +184,23 @@ void notifier_set_color(int level, char *col);\n \tp = strdup(v); \\\n } while (0)\n \n+#define DEFINE_IMG_STRLCPY_SETTER(_name, _field) \\\n+static void _name(struct img_type *img, const char *value) \\\n+{ \\\n+\tstrlcpy(img->_field, value, sizeof(img->_field)); \\\n+}\n+\n+#define DEFINE_IMG_BOOL_SETTER(_name, _field) \\\n+static void _name(struct img_type *img, bool val) \\\n+{ \\\n+\timg->_field = (bool)val; \\\n+}\n+\n+#define DEFINE_IMG_NUMBER_SETTER(_name, _field, _type) \\\n+static void _name(struct img_type *img, double val) \\\n+{ \\\n+\timg->_field = (_type)val; \\\n+}\n \n #define IS_STR_EQUAL(s,s1) (s && s1 && !strcmp(s,s1))\n #define UNUSED __attribute__((__unused__))\n@@ -197,6 +214,7 @@ int ascii_to_bin(unsigned char *dest, size_t dstlen, const char *src);\n void hash_to_ascii(const unsigned char *hash, char *s);\n int IsValidHash(const unsigned char *hash);\n bool is_hex_str(const char *ascii);\n+int compressed_string_to_type(const char *s, int *out_type);\n \n #ifndef typeof\n #define typeof __typeof__\n",
    "prefixes": [
        "v1",
        "1/4"
    ]
}