Show a patch.

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

{
    "id": 3553,
    "url": "https://patchwork.libcamera.org/api/patches/3553/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3553/",
    "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": "<20200427031713.14013-2-laurent.pinchart@ideasonboard.com>",
    "date": "2020-04-27T03:17:03",
    "name": "[libcamera-devel,01/11] ipa: Name IPA modules after their source directory",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6a102aea60d7f9e3a7c89fa35ec039a96acb84fa",
    "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/3553/mbox/",
    "series": [
        {
            "id": 831,
            "url": "https://patchwork.libcamera.org/api/series/831/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=831",
            "date": "2020-04-27T03:17:02",
            "name": "libcamera: Add support for IPA configuration",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/831/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3553/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3553/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "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 5B23960AF0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Apr 2020 05:17:33 +0200 (CEST)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DCF7C97D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Apr 2020 05:17:32 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Gp2XEtbO\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1587957453;\n\tbh=4K3q3LxITDScf4fk6mopnuQ3dB5mLsL2heWudNvKlRk=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Gp2XEtbOZ3f3RjnupkZYXS3RAm6gp3X4I1cVzIDT+XG62f5lSvhqSP3tLgDPLN5kp\n\tQ1sluq2tS22iO/6zhpvgTvxWfSxb9bwRSWvkk/nAYF4OH3T/BGMDb6WTBNib4n5Zxz\n\t0vFH3Xc7KCUMZ8H3ovU04oPdEUkZlEuo0jBBDjWQ=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 27 Apr 2020 06:17:03 +0300",
        "Message-Id": "<20200427031713.14013-2-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.25.3",
        "In-Reply-To": "<20200427031713.14013-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200427031713.14013-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 01/11] ipa: Name IPA modules after their\n\tsource directory",
        "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>",
        "X-List-Received-Date": "Mon, 27 Apr 2020 03:17:33 -0000"
    },
    "content": "The IPAModuleInfo::name field is currently a free-formed string that has\nlittle use. Tighten its usage rules to make it suitable for building\nfile system paths to IPA-specific resources by matching the directory\nname of the IPA module.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/rkisp1/rkisp1.cpp    |  2 +-\n src/ipa/vimc/vimc.cpp        |  2 +-\n src/libcamera/ipa_module.cpp | 20 ++++++++++++++++++++\n test/ipa/ipa_module_test.cpp |  2 +-\n 4 files changed, 23 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex acbbe58c7a2e..7f0ffb0a791f 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -274,7 +274,7 @@ const struct IPAModuleInfo ipaModuleInfo = {\n \tIPA_MODULE_API_VERSION,\n \t1,\n \t\"PipelineHandlerRkISP1\",\n-\t\"RkISP1 IPA\",\n+\t\"rkisp1\",\n };\n \n struct ipa_context *ipaCreate()\ndiff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp\nindex d2267e11737f..cfdbd6f99155 100644\n--- a/src/ipa/vimc/vimc.cpp\n+++ b/src/ipa/vimc/vimc.cpp\n@@ -126,7 +126,7 @@ const struct IPAModuleInfo ipaModuleInfo = {\n \tIPA_MODULE_API_VERSION,\n \t0,\n \t\"PipelineHandlerVimc\",\n-\t\"Dummy IPA for Vimc\",\n+\t\"vimc\",\n };\n \n struct ipa_context *ipaCreate()\ndiff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp\nindex 958ede74688e..52823e88a508 100644\n--- a/src/libcamera/ipa_module.cpp\n+++ b/src/libcamera/ipa_module.cpp\n@@ -9,6 +9,7 @@\n \n #include <algorithm>\n #include <array>\n+#include <ctype.h>\n #include <dlfcn.h>\n #include <elf.h>\n #include <errno.h>\n@@ -216,6 +217,11 @@ Span<uint8_t> elfLoadSymbol(Span<uint8_t> elf, const char *symbol)\n  * \\var IPAModuleInfo::name\n  * \\brief The name of the IPA module\n  *\n+ * The name may be used to build file system paths to IPA-specific resources.\n+ * It shall only contain printable characters, and may not contain '/', '*',\n+ * '?' or '\\'. For IPA modules included in libcamera, it shall match the\n+ * directory of the IPA module in the source tree.\n+ *\n  * \\todo Allow user to choose to isolate open source IPAs\n  */\n \n@@ -287,6 +293,20 @@ int IPAModule::loadIPAModuleInfo()\n \t\treturn -EINVAL;\n \t}\n \n+\t/* Validate the IPA module name. */\n+\tstd::string ipaName = info_.name;\n+\tauto iter = std::find_if_not(ipaName.begin(), ipaName.end(),\n+\t\t\t\t     [](unsigned char c) -> bool {\n+\t\t\t\t\t     return isprint(c) && c != '/' &&\n+\t\t\t\t\t\t    c != '?' && c != '*' &&\n+\t\t\t\t\t\t    c != '\\\\';\n+\t\t\t\t     });\n+\tif (iter != ipaName.end()) {\n+\t\tLOG(IPAModule, Error)\n+\t\t\t<< \"Invalid IPA module name '\" << ipaName << \"'\";\n+\t\treturn -EINVAL;\n+\t}\n+\n \t/* Load the signature. Failures are not fatal. */\n \tFile sign{ libPath_ + \".sign\" };\n \tif (!sign.open(File::ReadOnly)) {\ndiff --git a/test/ipa/ipa_module_test.cpp b/test/ipa/ipa_module_test.cpp\nindex d22c302fa726..e3aee190b410 100644\n--- a/test/ipa/ipa_module_test.cpp\n+++ b/test/ipa/ipa_module_test.cpp\n@@ -58,7 +58,7 @@ protected:\n \t\t\tIPA_MODULE_API_VERSION,\n \t\t\t0,\n \t\t\t\"PipelineHandlerVimc\",\n-\t\t\t\"Dummy IPA for Vimc\",\n+\t\t\t\"vimc\",\n \t\t};\n \n \t\tcount += runTest(\"src/ipa/vimc/ipa_vimc.so\", testInfo);\n",
    "prefixes": [
        "libcamera-devel",
        "01/11"
    ]
}