[{"id":3620,"web_url":"https://patchwork.libcamera.org/comment/3620/","msgid":"<20200206192304.GB7611@pendragon.ideasonboard.com>","date":"2020-02-06T19:23:04","subject":"Re: [libcamera-devel] [PATCH 2/5] libcamera: ipa_manager: Split\n\tpath handling","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the path.\n\nOn Wed, Feb 05, 2020 at 01:04:17PM +0000, Kieran Bingham wrote:\n> Move the iteration of a colon separated path to it's own function.\n\ns/colon separated/colon-separated/\ns/it's/its/\n\n> This prepares for parsing extra path variables.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/libcamera/include/ipa_manager.h |  1 +\n>  src/libcamera/ipa_manager.cpp       | 52 +++++++++++++++++++----------\n>  2 files changed, 36 insertions(+), 17 deletions(-)\n> \n> diff --git a/src/libcamera/include/ipa_manager.h b/src/libcamera/include/ipa_manager.h\n> index 126f8babbc8f..94d35d9062e4 100644\n> --- a/src/libcamera/include/ipa_manager.h\n> +++ b/src/libcamera/include/ipa_manager.h\n> @@ -33,6 +33,7 @@ private:\n>  \t~IPAManager();\n>  \n>  \tint addDir(const char *libDir);\n> +\tint addPath(const char *path);\n\nThere's a mismatch between the parameter name here and below.\n\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n> index 92adc6c45015..048465c37772 100644\n> --- a/src/libcamera/ipa_manager.cpp\n> +++ b/src/libcamera/ipa_manager.cpp\n> @@ -110,23 +110,7 @@ IPAManager::IPAManager()\n>  \t\treturn;\n>  \t}\n>  \n> -\tconst char *paths = modulePaths;\n> -\twhile (1) {\n> -\t\tconst char *delim = strchrnul(paths, ':');\n> -\t\tsize_t count = delim - paths;\n> -\n> -\t\tif (count) {\n> -\t\t\tstd::string path(paths, count);\n> -\t\t\tret = addDir(path.c_str());\n> -\t\t\tif (ret > 0)\n> -\t\t\t\tipaCount += ret;\n> -\t\t}\n> -\n> -\t\tif (*delim == '\\0')\n> -\t\t\tbreak;\n> -\n> -\t\tpaths += count + 1;\n> -\t}\n> +\tipaCount += addPath(modulePaths);\n>  \n>  \tif (!ipaCount)\n>  \t\tLOG(IPAManager, Warning)\n> @@ -206,6 +190,40 @@ int IPAManager::addDir(const char *libDir)\n>  \treturn count;\n>  }\n>  \n> +/**\n> + * \\brief Load IPA modules from a colon separated PATH variable\n\ns/colon separated/colon-separated/ ?\n\n> + * \\param[in] path string to split to search for IPA modules\n\ns/string/String/\n\nTo be consistent with the way PATH is documented, we could replace the\nbrief with\n\n * \\brief Load IPA modules from a search path\n\nand document this parameter as\n\n * \\param[in] path The colon-separated list of directories to load IPA modules from\n\n\n> + *\n> + * This method tries to create an IPAModule instance for every shared object\n> + * found in the directories described by \\a paths.\n\ns/described by/listed in/ ?\n\n> + *\n> + * \\return Number of modules loaded by this call, or a negative error code\n> + * otherwise\n> + */\n> +int IPAManager::addPath(const char *paths)\n\nLet's be consistent. addPath and path, or addPaths and paths ? I'd go\nfor the former, and rename the local path variable to dir below. The\n\\param[in] should also match.\n\n> +{\n> +\tint ipaCount = 0;\n> +\n> +\twhile (1) {\n> +\t\tconst char *delim = strchrnul(paths, ':');\n> +\t\tsize_t count = delim - paths;\n> +\n> +\t\tif (count) {\n> +\t\t\tstd::string path(paths, count);\n> +\t\t\tint ret = addDir(path.c_str());\n> +\t\t\tif (ret > 0)\n> +\t\t\t\tipaCount += ret;\n> +\t\t}\n> +\n> +\t\tif (*delim == '\\0')\n> +\t\t\tbreak;\n> +\n> +\t\tpaths += count + 1;\n> +\t}\n> +\n> +\treturn ipaCount;\n> +}\n> +\n>  /**\n>   * \\brief Create an IPA interface that matches a given pipeline handler\n>   * \\param[in] pipe The pipeline handler that wants a matching IPA interface","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1EC5660864\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Feb 2020 20:23:21 +0100 (CET)","from pendragon.ideasonboard.com\n\t(117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3A4A19F0;\n\tThu,  6 Feb 2020 20:23:19 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1581017000;\n\tbh=X6vW4apG1DRBYj9aBKD2FDkG/thsUaYQbkAaJiFQnAw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=cHGF5Uk/F8HzrreHcmCLR0OQDCsMYNabB9f/x/mXECVLoxbOwpBOmrywdxX0/0ToJ\n\tq99h4boW3LIg7RKPM2cymR9H6p9p5q1nUHwCQsd32BLxLfZfmV7amGEYAqrO3SQDJV\n\tQ2U47fybtG7cXdgpsuRpTPZ/Wo2gBFS/iLNONsq0=","Date":"Thu, 6 Feb 2020 21:23:04 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Message-ID":"<20200206192304.GB7611@pendragon.ideasonboard.com>","References":"<20200205130420.8736-1-kieran.bingham@ideasonboard.com>\n\t<20200205130420.8736-3-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200205130420.8736-3-kieran.bingham@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 2/5] libcamera: ipa_manager: Split\n\tpath handling","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":"Thu, 06 Feb 2020 19:23:21 -0000"}}]