Show a patch.

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

{
    "id": 13115,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/13115/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13115/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20210725171827.23643-5-laurent.pinchart@ideasonboard.com>",
    "date": "2021-07-25T17:18:26",
    "name": "[libcamera-devel,v2,4/5] libcamera: file: Use Flags<> class for open flags",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "4816741088cc32c7b489bd883ef2b2bb7cedce86",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/13115/mbox/",
    "series": [
        {
            "id": 2276,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2276/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2276",
            "date": "2021-07-25T17:18:22",
            "name": "libcamera: Add type-safe enum-based flags",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2276/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13115/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13115/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 48A71C322D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 25 Jul 2021 17:18:44 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 019C6687C6;\n\tSun, 25 Jul 2021 19:18:44 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 292676877B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 25 Jul 2021 19:18:38 +0200 (CEST)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C47044A8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 25 Jul 2021 19:18:37 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"WNRayWby\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1627233517;\n\tbh=FxQnIzmjXVgGIX1UNVwGfFOL7j8CJVND9ab+jOAYod0=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=WNRayWbyjWhqvrFfWrrI7efJXb455ySnE/+SKCMaP+QCnIVMDhkLdKK/ELP/f5wkc\n\t4qcTfjUN15Zw9Gbb+sCcYRyYXRUx4QS/tTX9lK8kW6z86vdsVEHb01T3J1xev7W7xk\n\tKMAGG+n9zHNkPe8UZxVPDH/GeS/qM4ABTKuhDO04=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sun, 25 Jul 2021 20:18:26 +0300",
        "Message-Id": "<20210725171827.23643-5-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20210725171827.23643-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20210725171827.23643-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 4/5] libcamera: file: Use Flags<> class\n\tfor open flags",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Use the newly introduced Flags<> class to store a bitfield of\nFile::OpenMode in a type-safe way. The existing File::OpenMode enum is\nrenamed to File::OpenModeFlag to free the File::OpenMode for the Flags<>\ntype alias.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v1:\n\n- Don't enable bitwise operators on File::OpenMode\n---\n include/libcamera/base/file.h | 4 +++-\n src/libcamera/base/file.cpp   | 9 +++++++--\n 2 files changed, 10 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h\nindex 452a658b409f..eebb24024025 100644\n--- a/include/libcamera/base/file.h\n+++ b/include/libcamera/base/file.h\n@@ -30,13 +30,15 @@ public:\n \n \tusing MapFlags = Flags<MapFlag>;\n \n-\tenum OpenMode {\n+\tenum OpenModeFlag {\n \t\tNotOpen = 0,\n \t\tReadOnly = (1 << 0),\n \t\tWriteOnly = (1 << 1),\n \t\tReadWrite = ReadOnly | WriteOnly,\n \t};\n \n+\tusing OpenMode = Flags<OpenModeFlag>;\n+\n \tFile(const std::string &name);\n \tFile();\n \t~File();\ndiff --git a/src/libcamera/base/file.cpp b/src/libcamera/base/file.cpp\nindex e180c5479098..0860457421a1 100644\n--- a/src/libcamera/base/file.cpp\n+++ b/src/libcamera/base/file.cpp\n@@ -58,7 +58,7 @@ LOG_DEFINE_CATEGORY(File)\n  */\n \n /**\n- * \\enum File::OpenMode\n+ * \\enum File::OpenModeFlag\n  * \\brief Mode in which a file is opened\n  * \\var File::NotOpen\n  * \\brief The file is not open\n@@ -70,6 +70,11 @@ LOG_DEFINE_CATEGORY(File)\n  * \\brief The file is open for reading and writing\n  */\n \n+/**\n+ * \\typedef File::OpenMode\n+ * \\brief An OR combination of File::OpenModeFlag values\n+ */\n+\n /**\n  * \\brief Construct a File to represent the file \\a name\n  * \\param[in] name The file name\n@@ -168,7 +173,7 @@ bool File::open(File::OpenMode mode)\n \t\treturn false;\n \t}\n \n-\tint flags = (mode & ReadWrite) - 1;\n+\tint flags = static_cast<OpenMode::Type>(mode & ReadWrite) - 1;\n \tif (mode & WriteOnly)\n \t\tflags |= O_CREAT;\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "4/5"
    ]
}