Show a patch.

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

{
    "id": 1593,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/1593/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1593/",
    "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": "<20190703080007.21376-6-paul.elder@ideasonboard.com>",
    "date": "2019-07-03T08:00:05",
    "name": "[libcamera-devel,RFC,v2,5/7] libcamera: ipa_manager: use proxy",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2bc88f415e36abfa641963268b76a41e34c4fcac",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1593/mbox/",
    "series": [
        {
            "id": 392,
            "url": "https://patchwork.libcamera.org/api/1.1/series/392/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=392",
            "date": "2019-07-03T08:00:00",
            "name": "Add IPA process isolation",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/392/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1593/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1593/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<paul.elder@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 61D5661570\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Jul 2019 10:00:33 +0200 (CEST)",
            "from neptunite.flets-east.jp\n\t(p1871204-ipngn14001hodogaya.kanagawa.ocn.ne.jp [153.220.127.204])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F40C324B;\n\tWed,  3 Jul 2019 10:00:31 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562140833;\n\tbh=TIn9hsceUOYFRKPXrMZHZymDLRt+xe3k7EcVlqe55ZU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=I4pUwMg4PCSv9xu+gnW1BiMwMIeAQ56tiuybCymtEU/pm6IqLb+k4qdfSUnpkJLhn\n\tdtc5zlPBAmaDQ8KMPbT0CYI0e+JfqduRtcGMs282VZdkX2HyJVlGJ1Cfli1vXqgwCA\n\tikmDzTxkBvBJ78pIUknEnlFVRRQ2LJ+12BR9/zRw=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  3 Jul 2019 17:00:05 +0900",
        "Message-Id": "<20190703080007.21376-6-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190703080007.21376-1-paul.elder@ideasonboard.com>",
        "References": "<20190703080007.21376-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH v2 5/7] libcamera: ipa_manager: use\n\tproxy",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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": "Wed, 03 Jul 2019 08:00:33 -0000"
    },
    "content": "Make IPAManager isolate an IPA in a Proxy if the IPA's license is not\nopen source, before returning the IPA to the caller. For now, only use\nthe default Linux proxy, and only GPL and LGPL are considered open\nsource.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\nNew in v2\n- replaces adding shims\n- since Proxies are not external shared objects like the shims in v1\n  were, there is no longer a list of shims that is treated like\n  IPAModules\n- instead the matching is done by searching the list of proxy factories\n\n src/libcamera/ipa_manager.cpp | 48 +++++++++++++++++++++++++++++++++--\n 1 file changed, 46 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\nindex 532b77d..60cd84d 100644\n--- a/src/libcamera/ipa_manager.cpp\n+++ b/src/libcamera/ipa_manager.cpp\n@@ -14,6 +14,7 @@\n #include \"ipa_module.h\"\n #include \"log.h\"\n #include \"pipeline_handler.h\"\n+#include \"ipa_proxy.h\"\n #include \"utils.h\"\n \n /**\n@@ -25,6 +26,20 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(IPAManager)\n \n+namespace {\n+\n+bool isOpenSource(const char *license)\n+{\n+\tif (!strncmp(license, \"GPL\", 3))\n+\t\treturn true;\n+\tif (!strncmp(license, \"LGPL\", 4))\n+\t\treturn true;\n+\n+\treturn false;\n+}\n+\n+} /* namespace */\n+\n /**\n  * \\class IPAManager\n  * \\brief Manager for IPA modules\n@@ -129,7 +144,7 @@ int IPAManager::addDir(const char *libDir)\n  * \\param[in] maxVersion Maximum acceptable version of IPA module\n  *\n  * \\return A newly created IPA interface, or nullptr if no matching\n- * IPA module is found\n+ * IPA module is found or if the IPA interface fails to initialize\n  */\n std::unique_ptr<IPAInterface> IPAManager::createIPA(PipelineHandler *pipe,\n \t\t\t\t\t\t    uint32_t maxVersion,\n@@ -144,7 +159,36 @@ std::unique_ptr<IPAInterface> IPAManager::createIPA(PipelineHandler *pipe,\n \t\t}\n \t}\n \n-\tif (!m || !m->load())\n+\tif (!m)\n+\t\treturn nullptr;\n+\n+\tif (!isOpenSource(m->info().license)) {\n+\t\tProxyFactory *pf = nullptr;\n+\t\tstd::vector<ProxyFactory *> &factories = ProxyFactory::factories();\n+\n+\t\tfor (ProxyFactory *factory : factories) {\n+\t\t\t/* TODO: Better matching */\n+\t\t\tif (!strcmp(factory->name().c_str(), \"ProxyLinuxDefault\")) {\n+\t\t\t\tpf = factory;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (!pf) {\n+\t\t\tLOG(IPAManager, Error) << \"Failed to get proxy factory\";\n+\t\t\treturn nullptr;\n+\t\t}\n+\n+\t\tstd::unique_ptr<Proxy> proxy = pf->create(m);\n+\t\tif (!proxy->isValid()) {\n+\t\t\tLOG(IPAManager, Error) << \"Failed to load proxy\";\n+\t\t\treturn nullptr;\n+\t\t}\n+\n+\t\treturn proxy;\n+\t}\n+\n+\tif (!m->load())\n \t\treturn nullptr;\n \n \treturn m->createInstance();\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "v2",
        "5/7"
    ]
}