Patch Detail
Show a patch.
GET /api/1.1/patches/25749/?format=api
{ "id": 25749, "url": "https://patchwork.libcamera.org/api/1.1/patches/25749/?format=api", "web_url": "https://patchwork.libcamera.org/patch/25749/", "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": "<20260113000808.15395-30-laurent.pinchart@ideasonboard.com>", "date": "2026-01-13T00:08:01", "name": "[29/36] libcamera: value_node: Support adding nested children in one operation", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c62601106d9bef98380ca29326f2bdaa136e8a5d", "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/25749/mbox/", "series": [ { "id": 5703, "url": "https://patchwork.libcamera.org/api/1.1/series/5703/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5703", "date": "2026-01-13T00:07:32", "name": "libcamera: Global configuration file improvements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5703/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/25749/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/25749/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 22310BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Jan 2026 00:09:19 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C021E61FFE;\n\tTue, 13 Jan 2026 01:09:18 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2EAF361FFF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Jan 2026 01:09:17 +0100 (CET)", "from pendragon.ideasonboard.com (81-175-209-152.bb.dnainternet.fi\n\t[81.175.209.152])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 88A9FBCA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Jan 2026 01:08:51 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"UfmjG6Is\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1768262931;\n\tbh=Q4PkQX2DZj9WDuWPR7gu+NRUWPoKvmBZtKuMRMRT0t8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=UfmjG6IsxRLXq81G2OIOs01e7XHMTzInC9eDRS2yUkLb7RuS5JtHXyMUAYYYHTHG9\n\tdTxMvXD6QxRIEolPAR5CerNv+KJhho5/EgziCbm/F6ums26jTtRIXjOQumdKUZDK5W\n\thOI+kQEXBcKM62G1x5vui2yUwKy53tUPox4HCB+o=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH 29/36] libcamera: value_node: Support adding nested children\n\tin one operation", "Date": "Tue, 13 Jan 2026 02:08:01 +0200", "Message-ID": "<20260113000808.15395-30-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.51.2", "In-Reply-To": "<20260113000808.15395-1-laurent.pinchart@ideasonboard.com>", "References": "<20260113000808.15395-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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": "The GlobalConfiguration class will need to add nested children to a\nValueNode. Add a new overload to the add() function for this purpose.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/value_node.h | 3 ++\n src/libcamera/value_node.cpp | 56 +++++++++++++++++++++++++\n 2 files changed, 59 insertions(+)", "diff": "diff --git a/include/libcamera/internal/value_node.h b/include/libcamera/internal/value_node.h\nindex c285be4957ed..abb0991fd87e 100644\n--- a/include/libcamera/internal/value_node.h\n+++ b/include/libcamera/internal/value_node.h\n@@ -8,6 +8,7 @@\n \n #pragma once\n \n+#include <initializer_list>\n #include <iterator>\n #include <map>\n #include <memory>\n@@ -237,6 +238,8 @@ public:\n \n \tValueNode *add(std::unique_ptr<ValueNode> child);\n \tValueNode *add(std::string key, std::unique_ptr<ValueNode> child);\n+\tValueNode *add(std::initializer_list<std::string_view> path,\n+\t\t std::unique_ptr<ValueNode> child);\n \n private:\n \tLIBCAMERA_DISABLE_COPY_AND_MOVE(ValueNode)\ndiff --git a/src/libcamera/value_node.cpp b/src/libcamera/value_node.cpp\nindex 50b23284f930..1256adf8361d 100644\n--- a/src/libcamera/value_node.cpp\n+++ b/src/libcamera/value_node.cpp\n@@ -13,6 +13,8 @@\n #include <string>\n #include <vector>\n \n+#include <libcamera/base/log.h>\n+#include <libcamera/base/span.h>\n #include <libcamera/base/utils.h>\n \n /**\n@@ -22,6 +24,8 @@\n \n namespace libcamera {\n \n+LOG_DEFINE_CATEGORY(ValueNode)\n+\n namespace {\n \n /* Empty static ValueNode as a safe result for invalid operations */\n@@ -539,4 +543,56 @@ ValueNode *ValueNode::add(std::string key, std::unique_ptr<ValueNode> child)\n \treturn elem.value.get();\n }\n \n+/**\n+ * \\brief Add a child node at the given path\n+ * \\param[in] path The path\n+ * \\param[in] child The child node\n+ *\n+ * Add the \\a child node at the given \\a path starting at this node. Missing\n+ * nodes are created along the path. Nodes along the path must be empty, in\n+ * which case they are converted to the Type::Dictionary type, be a dictionary,\n+ * or be missing. Otherwise, the \\a child is discarded and the function returns\n+ * a nullptr.\n+ *\n+ * Path elements are unique in the context of a parent node. If a child with the\n+ * same \\a key already exist at the end of the path, the \\a child is discarded\n+ * and the function returns a nullptr.\n+ *\n+ * \\return A pointer to the \\a child node if successfully added, nullptr\n+ * otherwise\n+ */\n+ValueNode *ValueNode::add(std::initializer_list<std::string_view> path,\n+\t\t\t std::unique_ptr<ValueNode> child)\n+{\n+\tif (!path.size())\n+\t\treturn NULL;\n+\n+\tValueNode *node = this;\n+\n+\tfor (const auto [i, name] : utils::enumerate(path)) {\n+\t\tauto iter = node->dictionary_.find(name);\n+\t\tif (iter == node->dictionary_.end()) {\n+\t\t\tstd::unique_ptr<ValueNode> obj;\n+\n+\t\t\tif (i < path.size() - 1)\n+\t\t\t\tobj = std::make_unique<ValueNode>();\n+\t\t\telse\n+\t\t\t\tobj = std::move(child);\n+\n+\t\t\tnode = node->add(std::string{ name }, std::move(obj));\n+\t\t\tif (!node) {\n+\t\t\t\tSpan<const std::string_view> pathName{ std::data(path), i + 1 };\n+\t\t\t\tLOG(ValueNode, Error)\n+\t\t\t\t\t<< \"Failed to populate '\"\n+\t\t\t\t\t<< utils::join(pathName, \"/\") << \"'\";\n+\t\t\t\treturn nullptr;\n+\t\t\t}\n+\t\t} else {\n+\t\t\tnode = iter->second;\n+\t\t}\n+\t}\n+\n+\treturn node;\n+}\n+\n } /* namespace libcamera */\n", "prefixes": [ "29/36" ] }