get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 139994,
    "url": "https://patches.dpdk.org/api/patches/139994/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20240508095214.2541115-1-david.marchand@redhat.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20240508095214.2541115-1-david.marchand@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240508095214.2541115-1-david.marchand@redhat.com",
    "date": "2024-05-08T09:52:14",
    "name": "eal/unix: support ZSTD compression for firmwares",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "e2124296ede44c56f58bf94fe0771e20d5bb9f38",
    "submitter": {
        "id": 1173,
        "url": "https://patches.dpdk.org/api/people/1173/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@redhat.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20240508095214.2541115-1-david.marchand@redhat.com/mbox/",
    "series": [
        {
            "id": 31893,
            "url": "https://patches.dpdk.org/api/series/31893/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=31893",
            "date": "2024-05-08T09:52:14",
            "name": "eal/unix: support ZSTD compression for firmwares",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/31893/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/139994/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/139994/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8B07743FDC;\n\tWed,  8 May 2024 11:52:21 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 53A8340A6E;\n\tWed,  8 May 2024 11:52:21 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id C1C2E402AF\n for <dev@dpdk.org>; Wed,  8 May 2024 11:52:19 +0200 (CEST)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-599-dnbyhh3YOPmNxVBJZCSiLQ-1; Wed, 08 May 2024 05:52:17 -0400",
            "from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com\n [10.11.54.5])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C43C8015D7;\n Wed,  8 May 2024 09:52:17 +0000 (UTC)",
            "from dmarchan.redhat.com (unknown [10.45.224.116])\n by smtp.corp.redhat.com (Postfix) with ESMTP id BBAA828E2;\n Wed,  8 May 2024 09:52:16 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1715161939;\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 bh=W7GfasfR9qvQg3LdWOX4EnVLULGSXsrlft/TH1knyI4=;\n b=iAME6t58ldIv4MXKDjk4ku/6zC+Lq7j7DinX2WhXRh1leE/Le7180jK/dLiolBv5vYv4lN\n KHvTsPMgQPtpTp7LeaG5415TT9ogenUdTsiOu5jWwt9q/jmw2Pgit3wMkB9r4EqwNmTzKq\n ZWGCtfA5Wqk9aLkEWamcMIuLa6+UHs0=",
        "X-MC-Unique": "dnbyhh3YOPmNxVBJZCSiLQ-1",
        "From": "David Marchand <david.marchand@redhat.com>",
        "To": "dev@dpdk.org",
        "Cc": "Yu Jiang <yux.jiang@intel.com>,\n Bruce Richardson <bruce.richardson@intel.com>",
        "Subject": "[PATCH] eal/unix: support ZSTD compression for firmwares",
        "Date": "Wed,  8 May 2024 11:52:14 +0200",
        "Message-ID": "<20240508095214.2541115-1-david.marchand@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.5",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Ubuntu 24.04 started to compress firmwares with ZSTD compression.\n\nBugzilla ID: 1437\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\n lib/eal/unix/eal_firmware.c | 42 +++++++++++++++++++++++++++++--------\n 1 file changed, 33 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/lib/eal/unix/eal_firmware.c b/lib/eal/unix/eal_firmware.c\nindex 1d47e879c8..065e251f9d 100644\n--- a/lib/eal/unix/eal_firmware.c\n+++ b/lib/eal/unix/eal_firmware.c\n@@ -16,6 +16,21 @@\n #include \"eal_firmware.h\"\n #include \"eal_private.h\"\n \n+#ifndef RTE_HAS_LIBARCHIVE\n+/* Fake definitions for the compression_algorithms array below. */\n+struct archive;\n+extern int archive_read_support_filter_xz(struct archive *a);\n+extern int archive_read_support_filter_zstd(struct archive *a);\n+#endif\n+\n+static struct {\n+\tconst char *suffix;\n+\tint (*support_callback)(struct archive *a);\n+} compression_algorithms[] = {\n+\t{ \"xz\", archive_read_support_filter_xz, },\n+\t{ \"zst\", archive_read_support_filter_zstd, },\n+};\n+\n #ifdef RTE_HAS_LIBARCHIVE\n \n struct firmware_read_ctx {\n@@ -26,7 +41,7 @@ static int\n firmware_open(struct firmware_read_ctx *ctx, const char *name, size_t blocksize)\n {\n \tstruct archive_entry *e;\n-\tint err;\n+\tunsigned int i;\n \n \tctx->a = archive_read_new();\n \tif (ctx->a == NULL)\n@@ -35,9 +50,12 @@ firmware_open(struct firmware_read_ctx *ctx, const char *name, size_t blocksize)\n \tif (archive_read_support_format_raw(ctx->a) != ARCHIVE_OK)\n \t\tgoto error;\n \n-\terr = archive_read_support_filter_xz(ctx->a);\n-\tif (err != ARCHIVE_OK && err != ARCHIVE_WARN)\n-\t\tgoto error;\n+\tfor (i = 0; i < RTE_DIM(compression_algorithms); i++) {\n+\t\tint err = compression_algorithms[i].support_callback(ctx->a);\n+\t\tif (err != ARCHIVE_OK && err != ARCHIVE_WARN)\n+\t\t\tEAL_LOG(WARNING, \"could not initialise libarchive for %s compression\",\n+\t\t\t\tcompression_algorithms[i].suffix);\n+\t}\n \n \tif (archive_read_open_filename(ctx->a, name, blocksize) != ARCHIVE_OK)\n \t\tgoto error;\n@@ -148,16 +166,22 @@ rte_firmware_read(const char *name, void **buf, size_t *bufsz)\n \n \tret = firmware_read(name, buf, bufsz);\n \tif (ret < 0) {\n-\t\tsnprintf(path, sizeof(path), \"%s.xz\", name);\n-\t\tpath[PATH_MAX - 1] = '\\0';\n+\t\tunsigned int i;\n+\n+\t\tfor (i = 0; i < RTE_DIM(compression_algorithms); i++) {\n+\t\t\tsnprintf(path, sizeof(path), \"%s.%s\", name,\n+\t\t\t\tcompression_algorithms[i].suffix);\n+\t\t\tpath[PATH_MAX - 1] = '\\0';\n+\t\t\tif (access(path, F_OK) != 0)\n+\t\t\t\tcontinue;\n #ifndef RTE_HAS_LIBARCHIVE\n-\t\tif (access(path, F_OK) == 0) {\n \t\t\tEAL_LOG(WARNING, \"libarchive not linked, %s cannot be decompressed\",\n \t\t\t\tpath);\n-\t\t}\n #else\n-\t\tret = firmware_read(path, buf, bufsz);\n+\t\t\tret = firmware_read(path, buf, bufsz);\n #endif\n+\t\t\tbreak;\n+\t\t}\n \t}\n \treturn ret;\n }\n",
    "prefixes": []
}