Patch Detail
Show a patch.
GET /api/patches/13114/?format=api
{ "id": 13114, "url": "https://patchwork.libcamera.org/api/patches/13114/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13114/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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-4-laurent.pinchart@ideasonboard.com>", "date": "2021-07-25T17:18:25", "name": "[libcamera-devel,v2,3/5] libcamera: file: Use Flags<> class for map flags", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "5a6f8df4a2a3db8133921bdbc2b9087ff0bbab5e", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13114/mbox/", "series": [ { "id": 2276, "url": "https://patchwork.libcamera.org/api/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/13114/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13114/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 CC33EC322C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 25 Jul 2021 17:18:43 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 80F0F687BC;\n\tSun, 25 Jul 2021 19:18:43 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CC24160273\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 25 Jul 2021 19:18:37 +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 73B73DD\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=\"GuvzE8zs\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1627233517;\n\tbh=/PLHvP2Ge39FRPLwtEmA86ZEQGBBBoqCeq6llsOHW/k=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=GuvzE8zs5SOmM2ZL60SD3JpTMmTQel+XXfEtPtUd9+sDkcv4DD/9dfd1xy5e9tBLS\n\t5YJAA+OFHylO2+pEjRjHMZA8AVHknjmOAAi5ec+fJvFFmHZlFd91JxgT9YpNS/Qz2G\n\tleyj1Ap+LSbdVUxZZIpKkwZrDgUa6sSvbmE+uWck=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 25 Jul 2021 20:18:25 +0300", "Message-Id": "<20210725171827.23643-4-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-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 3/5] libcamera: file: Use Flags<> class\n\tfor map 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::MapFlag in a type-safe way.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\nChanges since v1:\n\n- Use an unscoped enum\n---\n include/libcamera/base/file.h | 5 ++++-\n src/libcamera/base/file.cpp | 7 ++++++-\n 2 files changed, 10 insertions(+), 2 deletions(-)", "diff": "diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h\nindex 7dd1559d2285..452a658b409f 100644\n--- a/include/libcamera/base/file.h\n+++ b/include/libcamera/base/file.h\n@@ -15,6 +15,7 @@\n #include <libcamera/base/private.h>\n \n #include <libcamera/base/class.h>\n+#include <libcamera/base/flags.h>\n #include <libcamera/base/span.h>\n \n namespace libcamera {\n@@ -27,6 +28,8 @@ public:\n \t\tMapPrivate = (1 << 0),\n \t};\n \n+\tusing MapFlags = Flags<MapFlag>;\n+\n \tenum OpenMode {\n \t\tNotOpen = 0,\n \t\tReadOnly = (1 << 0),\n@@ -57,7 +60,7 @@ public:\n \tssize_t write(const Span<const uint8_t> &data);\n \n \tSpan<uint8_t> map(off_t offset = 0, ssize_t size = -1,\n-\t\t\t MapFlag flags = MapNoOption);\n+\t\t\t MapFlags flags = MapNoOption);\n \tbool unmap(uint8_t *addr);\n \n \tstatic bool exists(const std::string &name);\ndiff --git a/src/libcamera/base/file.cpp b/src/libcamera/base/file.cpp\nindex 073666fa6f66..e180c5479098 100644\n--- a/src/libcamera/base/file.cpp\n+++ b/src/libcamera/base/file.cpp\n@@ -52,6 +52,11 @@ LOG_DEFINE_CATEGORY(File)\n * the file constents\n */\n \n+/**\n+ * \\typedef File::MapFlags\n+ * \\brief An OR combination of File::MapFlag values\n+ */\n+\n /**\n * \\enum File::OpenMode\n * \\brief Mode in which a file is opened\n@@ -371,7 +376,7 @@ ssize_t File::write(const Span<const uint8_t> &data)\n *\n * \\return The mapped memory on success, or an empty span otherwise\n */\n-Span<uint8_t> File::map(off_t offset, ssize_t size, enum File::MapFlag flags)\n+Span<uint8_t> File::map(off_t offset, ssize_t size, File::MapFlags flags)\n {\n \tif (!isOpen()) {\n \t\terror_ = -EBADF;\n", "prefixes": [ "libcamera-devel", "v2", "3/5" ] }