get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2225640,
    "url": "http://patchwork.ozlabs.org/api/patches/2225640/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/DHYRB7QIPFB3.3VG2UUUIXCBZP@posteo.net/",
    "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": "<DHYRB7QIPFB3.3VG2UUUIXCBZP@posteo.net>",
    "list_archive_url": null,
    "date": "2026-04-21T10:22:11",
    "name": "[v2] hw/i386: Use qemu_open for kernel/initrd",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "1c833aa87fcf3c72204362fd319076319f75fcc2",
    "submitter": {
        "id": 91035,
        "url": "http://patchwork.ozlabs.org/api/people/91035/?format=api",
        "name": "Sertonix",
        "email": "sertonix@posteo.net"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/DHYRB7QIPFB3.3VG2UUUIXCBZP@posteo.net/mbox/",
    "series": [
        {
            "id": 500775,
            "url": "http://patchwork.ozlabs.org/api/series/500775/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500775",
            "date": "2026-04-21T10:22:11",
            "name": "[v2] hw/i386: Use qemu_open for kernel/initrd",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/500775/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2225640/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2225640/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 (2048-bit key;\n secure) header.d=posteo.net header.i=@posteo.net header.a=rsa-sha256\n header.s=2017 header.b=goAAW7sG;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.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 4g0JMk0sK8z1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 20:22:55 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wF8FI-0001M6-8D; Tue, 21 Apr 2026 06:22:20 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <sertonix@posteo.net>)\n id 1wF8FG-0001Lj-Mo\n for qemu-devel@nongnu.org; Tue, 21 Apr 2026 06:22:18 -0400",
            "from mout02.posteo.de ([185.67.36.66])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <sertonix@posteo.net>)\n id 1wF8FE-0004WA-0H\n for qemu-devel@nongnu.org; Tue, 21 Apr 2026 06:22:18 -0400",
            "from submission (posteo.de [185.67.36.169])\n by mout02.posteo.de (Postfix) with ESMTPS id 593DA240101\n for <qemu-devel@nongnu.org>; Tue, 21 Apr 2026 12:22:11 +0200 (CEST)",
            "from customer (localhost [127.0.0.1])\n by submission (posteo.de) with ESMTPSA id 4g0JLq0kfFz9rxM\n for <qemu-devel@nongnu.org>; Tue, 21 Apr 2026 12:22:10 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=2017;\n t=1776766931; bh=9JGwgImOBy5qZgg5s9M+ocvXeG26ocJn4YKw3MHyvbw=;\n h=Mime-Version:Content-Transfer-Encoding:Content-Type:Date:\n Message-Id:Subject:From:To:From;\n b=goAAW7sG2yHcgel59d1mtSlYcvC3U+JF4ICbk4OjxMwBmEFOPzieLtjAKQhIkpWCF\n GwtOaqRjCpSj+66ckyooyPQkpPf6FwDq+aA8sb6qfgC0JLVnorv95rMnV6NrMWgzj2\n Jr9LybIF6iZ5G9t9hRmstLWw608oU/aVCwzMf6KAKjEXYQD5tPIAhVlAFGhtrj/gAX\n pgdSIykRArHBeGWZemLukjVhjmLGmLyG9naWuje3mHBdSq+T/mA01BFzvAWlPlGIjX\n a3ANw93Ma/X4BmphSk1BO87k1D3I3jPLEK0pE/SK5wXGEp+44sBl3eho3m6LSAA/W2\n 4BeMmLKLNqaGA==",
        "Mime-Version": "1.0",
        "Content-Transfer-Encoding": "quoted-printable",
        "Content-Type": "text/plain; charset=UTF-8",
        "Date": "Tue, 21 Apr 2026 10:22:11 +0000",
        "Message-Id": "<DHYRB7QIPFB3.3VG2UUUIXCBZP@posteo.net>",
        "Subject": "[PATCH v2] hw/i386: Use qemu_open for kernel/initrd",
        "From": "\"Sertonix\" <sertonix@posteo.net>",
        "To": "<qemu-devel@nongnu.org>",
        "Received-SPF": "pass client-ip=185.67.36.66; envelope-from=sertonix@posteo.net;\n helo=mout02.posteo.de",
        "X-Spam_score_int": "-43",
        "X-Spam_score": "-4.4",
        "X-Spam_bar": "----",
        "X-Spam_report": "(-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001,\n SPF_PASS=-0.001 autolearn=ham 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": "Allows using \"-kernel /dev/fdset/0\" and \"-initrd /dev/fdset/1\" (if the\nfile descriptors are opened read-only).\n\nFor the sake of consistency it would be best to do the same change in\nthe other hw/* subdirectories as well but I lack the means to test all\nof them.\n---\nv2: Use qemu_open instead of qemu_open_old\n\n hw/i386/x86-common.c | 27 +++++++++++++++++++++++----\n 1 file changed, 23 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c\nindex fde05fa7d7..2e4fee3e87 100644\n--- a/hw/i386/x86-common.c\n+++ b/hw/i386/x86-common.c\n@@ -650,7 +650,9 @@ void x86_load_linux(X86MachineState *x86ms,\n     uint32_t initrd_max;\n     uint8_t header[8192], *setup, *kernel;\n     hwaddr real_addr, prot_addr, cmdline_addr, initrd_addr = 0;\n+    Error *err = NULL;\n     FILE *f;\n+    int fd;\n     const char *vmode;\n     MachineState *machine = MACHINE(x86ms);\n     struct setup_data *setup_data;\n@@ -664,8 +666,13 @@ void x86_load_linux(X86MachineState *x86ms,\n     cmdline_size = (strlen(kernel_cmdline) + 16) & ~15;\n \n     /* load the kernel header */\n-    f = fopen(kernel_filename, \"rb\");\n-    if (!f) {\n+    fd = qemu_open(kernel_filename, O_RDONLY, &err);\n+    if (fd < 0) {\n+        error_report_err(err);\n+        exit(1);\n+    }\n+    f = fdopen(fd, \"rb\");\n+    if (f) {\n         fprintf(stderr, \"qemu: could not open kernel file '%s': %s\\n\",\n                 kernel_filename, strerror(errno));\n         exit(1);\n@@ -719,12 +726,18 @@ void x86_load_linux(X86MachineState *x86ms,\n \n             /* load initrd */\n             if (initrd_filename) {\n+                int mapped_file_fd;\n                 GMappedFile *mapped_file;\n                 gsize initrd_size;\n                 gchar *initrd_data;\n                 GError *gerr = NULL;\n \n-                mapped_file = g_mapped_file_new(initrd_filename, false, &gerr);\n+                mapped_file_fd = qemu_open(initrd_filename, O_RDONLY, &err);\n+                if (fd < 0) {\n+                    error_report_err(err);\n+                    exit(1);\n+                }\n+                mapped_file = g_mapped_file_new_from_fd(mapped_file_fd, false, &gerr);\n                 if (!mapped_file) {\n                     fprintf(stderr, \"qemu: error reading initrd %s: %s\\n\",\n                             initrd_filename, gerr->message);\n@@ -860,6 +873,7 @@ void x86_load_linux(X86MachineState *x86ms,\n \n     /* load initrd */\n     if (initrd_filename) {\n+        int mapped_file_fd;\n         GMappedFile *mapped_file;\n         gsize initrd_size;\n         gchar *initrd_data;\n@@ -870,7 +884,12 @@ void x86_load_linux(X86MachineState *x86ms,\n             exit(1);\n         }\n \n-        mapped_file = g_mapped_file_new(initrd_filename, false, &gerr);\n+        mapped_file_fd = qemu_open(initrd_filename, O_RDONLY, &err);\n+        if (mapped_file_fd < 0) {\n+            error_report_err(err);\n+            exit(1);\n+        }\n+        mapped_file = g_mapped_file_new_from_fd(mapped_file_fd, false, &gerr);\n         if (!mapped_file) {\n             fprintf(stderr, \"qemu: error reading initrd %s: %s\\n\",\n                     initrd_filename, gerr->message);\n",
    "prefixes": [
        "v2"
    ]
}