Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2224590/?format=api
{ "id": 2224590, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2224590/?format=api", "web_url": "http://patchwork.ozlabs.org/project/swupdate/patch/20260417161524.2806435-5-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-5-hyyoxhk@163.com>", "list_archive_url": null, "date": "2026-04-17T16:15:24", "name": "[v1,4/4] compress: add lz4 decompression support", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "e01777625249d98e27033da5b91d32215c8e0b08", "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-5-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/2224590/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2224590/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<swupdate+bncBAABB4OGRHHQMGQEILHTFNY@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=ERvW8Aff;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com\n (client-ip=2607:f8b0:4864:20::f3a; helo=mail-qv1-xf3a.google.com;\n envelope-from=swupdate+bncbaabb4ogrhhqmgqeilhtfny@googlegroups.com;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from mail-qv1-xf3a.google.com (mail-qv1-xf3a.google.com\n [IPv6:2607:f8b0:4864:20::f3a])\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 4fy1214cp9z2125\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 02:44:41 +1000 (AEST)", "by mail-qv1-xf3a.google.com with SMTP id\n 6a1803df08f44-8aca14d1faasf36689006d6.3\n for <incoming@patchwork.ozlabs.org>;\n Fri, 17 Apr 2026 09:44:41 -0700 (PDT)", "by 2002:a05:6214:2027:b0:89a:99a:dcce with SMTP id\n 6a1803df08f44-8ae820d92d1ls53658416d6.2.-pod-prod-04-us; Fri, 17 Apr 2026\n 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:35 -0700 (PDT)", "from m16.mail.163.com (m16.mail.163.com. [220.197.31.2])\n by gmr-mx.google.com with ESMTPS id\n 98e67ed59e1d1-3613fb2d478si60391a91.2.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:34 -0700 (PDT)", "from nh50.. (unknown [])\n\tby gzsmtp2 (Coremail) with SMTP id PSgvCgDnEgycXOJpPjUTAg--.9473S6;\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=f6wWUtEcNF2oDo2m0KhWFExDmm4LYzrg+Five58+0h3FhfVOXoTTfcNLKMslSEhHg/\n HxK4QPIHqGt6w+P1t8hDDzfBnPLxWslS39Kki176ich0UKOwt60ZAIL6rhD784QOynwc\n kXYuYtFKmzf1aGaqtJGTGNprPSC5/NdrH8ipDfuTyCmfirNmteQWnnil/JWKB7bvdta5\n qzSC0bymiZnodo+2SNxDZ33cGF1QbNgjRtD4v18wJSK2PRzGBlikaTAcwpI7wANhfqlZ\n 0jlYRJ7H+Nu6folbQCnlIiqm+dvKOAIYx40p9UugINOhiaWa9mjj5/ip63NVrVve8hKZ\n mKog==", "i=1; a=rsa-sha256; t=1776442534; cv=none;\n d=google.com; s=arc-20240605;\n b=RJcl5do7V8qZrlGmXs05WO+Uwyp6tIIzd8X2et8WRJoQKhrxqh/QqQqW3Wcxf4T9wh\n 2nwS7RPfJUjc+9qY6K48u4tGFVp96rCrOSKJH7hT28C6kbAtKz3+bWellYD1pcpgc3vC\n 8ZswOj9w+rXPKkRS/YGpG2zbqX6o61BbweNLhUb/S4Dz5EQo3rxPJvR/8tN/HZikSS8l\n g9Q38wfcgrLOXSCLh1L/0VcVpHJdM8GadIDe4E7sWv/GJ+A1oIjXYpQ/20dZeVzitpca\n nnuHFMv5m7i8GeVpdODggSCBm41oVpoO9i2zH8btwqXCEnroKNLsLNlwqYoDvtHCagTY\n Z2xg==" ], "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=J92PCRBMRORR2o9nLez90RXttr9dd/6hMAItdJ9sjvI=;\n fh=rPjbyyeffWkiI3+WvxQD6x3V1ryOBywS0UBKVS28dLc=;\n b=bmPAG4hbk3EZnbUiZsT2VfW+QiNPfm/XowpIliBlJLYb199cAWYjVYwP++Ub7je6fV\n dSQOEW3SUh3sRgnowQmmv8UIs0FqGnMZjyKNdKrO823QoA+eSOmd4OZYthLzebXEpWNA\n zONnMwt7sTJTlH2979u92oOzaTKojQJXMBrJvSNXx9TFpr7DwNtCKXXiBFfQzqqjBWvH\n opw6PF2+DaLECkAny4YK8/Obhez+Sw3P9BPEliBSRsDRnPa+0g/n4qSzCTzrwP6o6LY7\n /uPOvcUHG1rR1i/D1xHIWEV7yGpxxw9t/9ptfdrqsEEKBiOnLtxprl0b3wHXN95OxTEx\n j24g==;\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=q+UwFbGX32ahPaS56iEKIMnTXm+6ACRlZdggd/mW/kw=;\n fh=nvZsCFpxgpf+fsVXzjnWA8g1K3V/kNbRAKogjNDW4HY=;\n b=ewAi1LGoOGHI6zZ8IdtcPtpCHyto9+FDXLCbBBjyAbawGmipB5GRZtLJ4/SJke2sBF\n 1/tYPN1pwJWeI69xAEcFghXRGbFl6yLh8xasgHml+BYQGvR9kunqnpR9sWnhS3YSLcDJ\n 36kN9hmVZWql+Ikvg4fTSuGx8WrM+PqLVXRIwwQqzjYcNsiSD4wSUkCHDa3JtjtScc5E\n lKvTBY/HmaoVYgrl5hIlpvgM1RtzfmqU2Ed+LruhFrs80bRfFDxtV4o/A1DVnCskPFxF\n //TW6UcjYXxZN5GBbUwNWf/JLfAKtqXj4qU7kQbaQcDH3nqVxe1oqTRDOAett433h7Nn\n wLWA==;\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=FZ5o0wkQ;\n spf=pass (google.com: domain of hyyoxhk@163.com designates 220.197.31.2\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=FZ5o0wkQ;\n spf=pass (google.com: domain of hyyoxhk@163.com designates 220.197.31.2\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=J92PCRBMRORR2o9nLez90RXttr9dd/6hMAItdJ9sjvI=;\n b=ERvW8AffNzemT50ztfcRJ1NRKq5v3zhLe1gn+Wg+qE+aGzpQA4YmZmcq0dBrE1hBVz\n 5moEfdwzXZpvZZ/2fn2L9I9IHIhFSuBKegZw8MAjYA/II1eOzEm4H9upGE8PPLN7Z133\n +fCaiEwE1e9BZl0+jVdo7VL53sMKxf+e++8Jz9Gr+TflXw1A0pHoVqBiN17+3ChQbuFA\n 8gFIpS5adv8TkDT6sIZ4cbe3LxAezkHnk2/kEhpGWlKExY4V70SDLKucJ9my91sNJ+Kt\n qJHe6EXl/FJEBTTMYRl7nRUNMOk1MYRyH1sNyqW4n3dLby2NhV5S4YVYvxTMcFpWSOZj\n X30Q==", "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=J92PCRBMRORR2o9nLez90RXttr9dd/6hMAItdJ9sjvI=;\n b=rE+rE/YbMgY3WMFm7EXopiXbFOL6x7H94NjF7BtNYqfOWb2bhR5UGhorkU7UVojBmx\n St0nFQM2xUoLHzeRVhLC2CN87gtcmUr1BvsCDWxi5X7Rve/KowS260oRj58oR3hf/yGV\n lS2wCRCJoOo0vfdqN4vDv67mI1nIqVr49HWqdTU88UNbfYkjDX3F4CUZe0NTy3anmeDr\n qyjp8PXpdLGw86Mr3NUTOro6fvpynKljDjxcuTe9vdRAt5QhOiboZIYt9xRdB0h2u9iK\n LqdM4HlvmrMr6+VfevPnDC5KSy1QGaDhjjcPbCGXqpl8CcxKlCytwsyiU2aWOz/XK4FL\n sqUQ==", "Sender": "swupdate@googlegroups.com", "X-Forwarded-Encrypted": "i=2;\n AFNElJ+DyIMZu1AgEHgyR1tEiRF4rPjOOwS0JMLnb/9rdc1/k/KqzdaDaVvvi2tw5CRU16aJ3dxqLXnJdQ==@patchwork.ozlabs.org", "X-Gm-Message-State": "AOJu0YzRA8F9IOz2nRmpRleyF+IhmAGUBACmPgCZ6mWMxTo3avLr7k4o\n\tJQBZomkw3WgI9PjjjhScEj7gVk7JMbOI+DFxqLPSo6dYUQi3+25dTjJV", "X-Received": [ "by 2002:a05:6214:4783:b0:8ac:b2e1:37a4 with SMTP id\n 6a1803df08f44-8b02812e432mr49479156d6.25.1776444274452;\n Fri, 17 Apr 2026 09:44:34 -0700 (PDT)", "by 2002:a05:620a:4591:b0:8d3:e8d1:e2b9 with SMTP id\n af79cd13be357-8e792466e29mr484355485a.57.1776444272837;\n Fri, 17 Apr 2026 09:44:32 -0700 (PDT)", "by 2002:a17:90a:e7d0:b0:35c:1695:24a3 with SMTP id\n 98e67ed59e1d1-361404945e0mr3830792a91.23.1776442534956;\n Fri, 17 Apr 2026 09:15:34 -0700 (PDT)" ], "X-BeenThere": "swupdate@googlegroups.com;\n h=\"AYAyTiLnhhCqQeFSsCm8nvH8BlMQUnjIVLh4X0nwwhcqmm/b8A==\"", "Received-SPF": "pass (google.com: domain of hyyoxhk@163.com designates\n 220.197.31.2 as permitted sender) client-ip=220.197.31.2;", "From": "He Yong <hyyoxhk@163.com>", "To": "swupdate@googlegroups.com", "Subject": "[swupdate] [PATCH v1 4/4] compress: add lz4 decompression support", "Date": "Sat, 18 Apr 2026 00:15:24 +0800", "Message-ID": "<20260417161524.2806435-5-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--.9473S6", "X-Coremail-Antispam": "1Uf129KBjvJXoWxtF4xZFW8AF17Gw4xGw17ZFb_yoWfWF18pF\n\ts3C3yfKryIgr1xZ3yxJF109rW3Kr18Cry5GryxJF1FyF15AwsYqr1ktrWrJFWUtrZ0va90\n\t93Wqgr9rAw4YyaUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UU-B_UUUUU=", "X-Originating-IP": "[2408:8266:bb01:57f4:788f:a08d:bbc4:eabb]", "X-CM-SenderInfo": "pk1105lkn6il2tof0z/xtbC8R1RJGniXJ1PrQAA3x", "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=FZ5o0wkQ; spf=pass\n (google.com: domain of hyyoxhk@163.com designates 220.197.31.2 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": "Enable lz4 artifacts end-to-end by wiring parser mappings, runtime\ndecompression pipeline, build flags, and docs so compressed=\"lz4\"\nworks like existing codecs.\n\nSigned-off-by: He Yong <hyyoxhk@163.com>\n---\n Kconfig | 8 +++\n Makefile.deps | 4 ++\n Makefile.flags | 4 ++\n ci/setup.sh | 1 +\n core/cpio_utils.c | 101 +++++++++++++++++++++++++++++++++-\n core/util.c | 1 +\n doc/source/sw-description.rst | 2 +-\n doc/source/swupdate.rst | 2 +-\n handlers/swupdate.lua | 2 +-\n include/util.h | 1 +\n 10 files changed, 120 insertions(+), 6 deletions(-)", "diff": "diff --git a/Kconfig b/Kconfig\nindex 2cf68eb8..8b6139de 100644\n--- a/Kconfig\n+++ b/Kconfig\n@@ -85,6 +85,10 @@ config HAVE_ZSTD\n \tbool\n \toption env=\"HAVE_ZSTD\"\n \n+config HAVE_LZ4\n+\tbool\n+\toption env=\"HAVE_LZ4\"\n+\n config HAVE_LIBSSL\n \tbool\n \toption env=\"HAVE_LIBSSL\"\n@@ -421,6 +425,10 @@ config ZSTD\n \tbool \"Zstd compression support\"\n \tdepends on HAVE_ZSTD\n \n+config LZ4\n+\tbool \"LZ4 compression support\"\n+\tdepends on HAVE_LZ4\n+\n comment \"Parsers\"\n source \"parser/Kconfig\"\n \ndiff --git a/Makefile.deps b/Makefile.deps\nindex c759f687..35f1bd6b 100644\n--- a/Makefile.deps\n+++ b/Makefile.deps\n@@ -66,6 +66,10 @@ ifeq ($(HAVE_ZSTD),)\n export HAVE_ZSTD = y\n endif\n \n+ifeq ($(HAVE_LZ4),)\n+export HAVE_LZ4 = y\n+endif\n+\n ifeq ($(HAVE_LIBEXT2FS),)\n export HAVE_LIBEXT2FS = y\n endif\ndiff --git a/Makefile.flags b/Makefile.flags\nindex 40dd3b66..267d74ab 100644\n--- a/Makefile.flags\n+++ b/Makefile.flags\n@@ -197,6 +197,10 @@ ifeq ($(CONFIG_ZSTD),y)\n LDLIBS += zstd\n endif\n \n+ifeq ($(CONFIG_LZ4),y)\n+LDLIBS += lz4\n+endif\n+\n ifeq ($(CONFIG_DISKPART),y)\n LDLIBS += fdisk\n endif\ndiff --git a/ci/setup.sh b/ci/setup.sh\nindex 863b1c42..82aca63a 100755\n--- a/ci/setup.sh\n+++ b/ci/setup.sh\n@@ -51,6 +51,7 @@ $_SUDO apt-get -qq update && apt-get install --yes --no-install-recommends \\\n liburiparser-dev \\\n libwebsockets-dev \\\n \tliblzma-dev \\\n+ liblz4-dev \\\n libwolfssl-dev \\\n libzstd-dev \\\n make \\\ndiff --git a/core/cpio_utils.c b/core/cpio_utils.c\nindex cb291d3b..4a8b2964 100644\n--- a/core/cpio_utils.c\n+++ b/core/cpio_utils.c\n@@ -22,6 +22,9 @@\n #ifdef CONFIG_ZSTD\n #include <zstd.h>\n #endif\n+#ifdef CONFIG_LZ4\n+#include <lz4frame.h>\n+#endif\n \n #include \"generated/autoconf.h\"\n #include \"cpiohdr.h\"\n@@ -341,7 +344,7 @@ static int decrypt_step(void *state, void *buffer, size_t size)\n \treturn 0;\n }\n \n-#if defined(CONFIG_GUNZIP) || defined(CONFIG_ZSTD) || defined(CONFIG_XZ)\n+#if defined(CONFIG_GUNZIP) || defined(CONFIG_ZSTD) || defined(CONFIG_XZ) || defined(CONFIG_LZ4)\n typedef int (*DecompressStep)(void *state, void *buffer, size_t size);\n \n struct DecompressState {\n@@ -494,6 +497,70 @@ static int zstd_step(void* state, void* buffer, size_t size)\n \n #endif\n \n+#ifdef CONFIG_LZ4\n+\n+struct Lz4State {\n+\tLZ4F_decompressionContext_t dctx;\n+\tconst uint8_t *input_src;\n+\tsize_t input_size;\n+\tsize_t input_pos;\n+};\n+\n+static int lz4_step(void *state, void *buffer, size_t size)\n+{\n+\tstruct DecompressState *ds = (struct DecompressState *)state;\n+\tstruct Lz4State *s = (struct Lz4State *)ds->impl_state;\n+\tsize_t decompress_ret = 0;\n+\tsize_t produced = 0;\n+\tint ret;\n+\n+\tdo {\n+\t\tif (s->input_pos == s->input_size) {\n+\t\t\tret = ds->upstream_step(ds->upstream_state, ds->input, sizeof ds->input);\n+\t\t\tif (ret < 0) {\n+\t\t\t\treturn ret;\n+\t\t\t} else if (ret == 0) {\n+\t\t\t\tds->eof = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\ts->input_src = ds->input;\n+\t\t\ts->input_size = ret;\n+\t\t\ts->input_pos = 0;\n+\t\t}\n+\n+\t\tsize_t out_len = size - produced;\n+\t\tsize_t in_len = s->input_size - s->input_pos;\n+\t\tsize_t old_produced = produced;\n+\t\tsize_t old_in_pos = s->input_pos;\n+\n+\t\tdecompress_ret = LZ4F_decompress(s->dctx,\n+\t\t\t\t\t\t (uint8_t *)buffer + produced, &out_len,\n+\t\t\t\t\t\t s->input_src + s->input_pos, &in_len,\n+\t\t\t\t\t\t NULL);\n+\t\tif (LZ4F_isError(decompress_ret)) {\n+\t\t\tERROR(\"LZ4F_decompress failed: %s\", LZ4F_getErrorName(decompress_ret));\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\tproduced += out_len;\n+\t\ts->input_pos += in_len;\n+\n+\t\tif (old_produced == produced && old_in_pos == s->input_pos) {\n+\t\t\tERROR(\"LZ4F_decompress made no progress\");\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\tif (decompress_ret == 0) {\n+\t\t\tds->eof = true;\n+\t\t\tbreak;\n+\t\t}\n+\t} while (produced == 0 && !ds->eof);\n+\n+\treturn produced;\n+}\n+\n+#endif\n+\n static int hash_compare(void *dgst, unsigned char *hash)\n {\n \t/*\n@@ -554,7 +621,7 @@ int copyfile(struct swupdate_copy *args)\n \t\t.outlen = 0, .eof = false\n \t};\n \n-#if defined(CONFIG_GUNZIP) || defined(CONFIG_ZSTD) || defined(CONFIG_XZ)\n+#if defined(CONFIG_GUNZIP) || defined(CONFIG_ZSTD) || defined(CONFIG_XZ) || defined(CONFIG_LZ4)\n \tstruct DecompressState decompress_state = {\n \t\t.upstream_step = NULL, .upstream_state = NULL,\n \t\t.impl_state = NULL\n@@ -583,6 +650,14 @@ int copyfile(struct swupdate_copy *args)\n \t\t.input_view = { NULL, 0, 0 },\n \t};\n #endif\n+#ifdef CONFIG_LZ4\n+\tstruct Lz4State lz4_state = {\n+\t\t.dctx = NULL,\n+\t\t.input_src = NULL,\n+\t\t.input_size = 0,\n+\t\t.input_pos = 0,\n+\t};\n+#endif\n #endif\n \n \t/*\n@@ -690,6 +765,21 @@ int copyfile(struct swupdate_copy *args)\n \t\t\tdecompress_step = &zstd_step;\n \t\t\tdecompress_state.impl_state = &zstd_state;\n \t\t} else\n+#endif\n+#ifdef CONFIG_LZ4\n+\t\tif (args->compressed == COMPRESSED_LZ4) {\n+\t\t\tsize_t create_ret;\n+\n+\t\t\tcreate_ret = LZ4F_createDecompressionContext(&lz4_state.dctx, LZ4F_VERSION);\n+\t\t\tif (LZ4F_isError(create_ret)) {\n+\t\t\t\tERROR(\"LZ4F_createDecompressionContext failed: %s\",\n+\t\t\t\t LZ4F_getErrorName(create_ret));\n+\t\t\t\tret = -EFAULT;\n+\t\t\t\tgoto copyfile_exit;\n+\t\t\t}\n+\t\t\tdecompress_step = &lz4_step;\n+\t\t\tdecompress_state.impl_state = &lz4_state;\n+\t\t} else\n #endif\n \t\t{\n \t\t\tTRACE(\"Requested decompression method (%d) is not configured!\", args->compressed);\n@@ -724,7 +814,7 @@ int copyfile(struct swupdate_copy *args)\n \t\tstate = &decrypt_state;\n \t}\n \n-#if defined(CONFIG_GUNZIP) || defined(CONFIG_ZSTD) || defined(CONFIG_XZ)\n+#if defined(CONFIG_GUNZIP) || defined(CONFIG_ZSTD) || defined(CONFIG_XZ) || defined(CONFIG_LZ4)\n \tif (args->compressed) {\n \t\tdecompress_state.upstream_step = step;\n \t\tdecompress_state.upstream_state = state;\n@@ -806,6 +896,11 @@ copyfile_exit:\n \t\tZSTD_freeDStream(zstd_state.dctx);\n \t}\n #endif\n+#ifdef CONFIG_LZ4\n+\tif (lz4_state.dctx != NULL) {\n+\t\tLZ4F_freeDecompressionContext(lz4_state.dctx);\n+\t}\n+#endif\n \n \treturn ret;\n }\ndiff --git a/core/util.c b/core/util.c\nindex 89046f3c..efc41f84 100644\n--- a/core/util.c\n+++ b/core/util.c\n@@ -83,6 +83,7 @@ static const struct {\n \t{ \"zlib\", COMPRESSED_ZLIB },\n \t{ \"xz\", COMPRESSED_XZ },\n \t{ \"zstd\", COMPRESSED_ZSTD },\n+\t{ \"lz4\", COMPRESSED_LZ4 },\n };\n \n int compressed_string_to_type(const char *s, int *out_type)\ndiff --git a/doc/source/sw-description.rst b/doc/source/sw-description.rst\nindex b09333fc..2c1e0017 100644\n--- a/doc/source/sw-description.rst\n+++ b/doc/source/sw-description.rst\n@@ -1491,7 +1491,7 @@ There are 4 main sections inside sw-description:\n | | | | before being installed. the value |\n | | | | denotes the compression type. |\n | | | | currently supported values are \"xz\", |\n- | | | | \"zlib\" and \"zstd\". |\n+ | | | | \"zlib\", \"zstd\" and \"lz4\". |\n +-------------+----------+------------+---------------------------------------+\n | compressed | bool (dep| images | Deprecated. Use the string form. true |\n | | recated) | files | is equal to 'compressed = \"zlib\"'. |\ndiff --git a/doc/source/swupdate.rst b/doc/source/swupdate.rst\nindex 84a8f21b..62681c2a 100644\n--- a/doc/source/swupdate.rst\n+++ b/doc/source/swupdate.rst\n@@ -57,7 +57,7 @@ General Overview\n SWUpdate can recreate UBI volumes, resizing them and\n copying the new software.\n \n-- support for compressed images, using the xz, zlib and zstd library.\n+- support for compressed images, using the xz, zlib, zstd and lz4 library.\n tarball (tgz file) are supported.\n \n - support for partitioned USB-pen or unpartitioned (mainly\ndiff --git a/handlers/swupdate.lua b/handlers/swupdate.lua\nindex aaba4774..e4bda3fa 100644\n--- a/handlers/swupdate.lua\n+++ b/handlers/swupdate.lua\n@@ -273,7 +273,7 @@ swupdate.register_handler = function(name, funcptr, mask) end\n --- @field size number Artifact size\n --- @field checksum number Computed checksum\n --- @field skip number `skip_t` enum number as in `include/swupdate.h`\n---- @field compressed string `zlib` or `zstd` (boolean value is deprecated)\n+--- @field compressed string `zlib`, `xz`, `zstd` or `lz4` (boolean value is deprecated)\n --- @field properties table Properties Table equivalent as specified in `sw-description`\n --- @field sha256 string sha256 hash of the image, file, or script\n local img_type = {\ndiff --git a/include/util.h b/include/util.h\nindex dcd0604c..5c7e1363 100644\n--- a/include/util.h\n+++ b/include/util.h\n@@ -64,6 +64,7 @@ enum compression_type {\n COMPRESSED_ZLIB,\n COMPRESSED_XZ,\n COMPRESSED_ZSTD,\n+ COMPRESSED_LZ4,\n };\n \n typedef int (*writeimage) (void *out, const void *buf, size_t len);\n", "prefixes": [ "v1", "4/4" ] }