[{"id":4070,"web_url":"https://patchwork.libcamera.org/comment/4070/","msgid":"<20200318122805.GF4733@pendragon.ideasonboard.com>","date":"2020-03-18T12:28:05","subject":"Re: [libcamera-devel] [PATCH LIBCAMERA v3 5/6] libcamera:\n\tipa_manager: replace by utils functions","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kaaira,\n\nThank you for the patch.\n\nOn Wed, Mar 18, 2020 at 05:28:45PM +0530, Kaaira Gupta wrote:\n> Now that functions isLibcameraInstalled() and libcameraPath() are\n> defined in utils, they don't need to be defined here again. Hence remove\n> them and replace them with utils' functions.\n\nI would squash this with the patch that adds the functions to utils, and\nname it\n\nlibcamera: utils: Move libcamera build path lookup to utils\n\nThe IPA proxy manager will need to find the libcamera build path exactly\nthe same way as the IPA module mnager. Move the isLibcameraInstalled()\nand libcameraPath() functions to utils to make them reusable.\n\n> Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>\n> ---\n>  src/libcamera/ipa_manager.cpp | 36 ++---------------------------------\n>  1 file changed, 2 insertions(+), 34 deletions(-)\n> \n> diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n> index 238433d..0bd280c 100644\n> --- a/src/libcamera/ipa_manager.cpp\n> +++ b/src/libcamera/ipa_manager.cpp\n> @@ -9,9 +9,6 @@\n>  \n>  #include <algorithm>\n>  #include <dirent.h>\n> -#include <dlfcn.h>\n> -#include <elf.h>\n> -#include <link.h>\n>  #include <string.h>\n>  #include <sys/types.h>\n>  \n> @@ -27,35 +24,6 @@\n>   * \\brief Image Processing Algorithm module manager\n>   */\n>  \n> -static bool isLibcameraInstalled()\n> -{\n> -\t/* musl doesn't declare _DYNAMIC in link.h, declare it manually. */\n> -\textern ElfW(Dyn) _DYNAMIC[];\n> -\n> -\t/*\n> -\t * DT_RUNPATH (DT_RPATH when the linker uses old dtags) is removed on\n> -\t * install.\n> -\t */\n> -\tfor (const ElfW(Dyn) *dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn) {\n> -\t\tif (dyn->d_tag == DT_RUNPATH || dyn->d_tag == DT_RPATH)\n> -\t\t\treturn false;\n> -\t}\n> -\n> -\treturn true;\n> -}\n> -\n> -static std::string libcameraPath()\n> -{\n> -\tDl_info info;\n> -\n> -\t/* Look up our own symbol. */\n> -\tint ret = dladdr(reinterpret_cast<void *>(libcameraPath), &info);\n> -\tif (ret == 0)\n> -\t\treturn nullptr;\n> -\n> -\treturn info.dli_fname;\n> -}\n> -\n>  namespace libcamera {\n>  \n>  LOG_DEFINE_CATEGORY(IPAManager)\n> @@ -151,8 +119,8 @@ IPAManager::IPAManager()\n>  \t * path for the IPA from that point. We need to recurse one level of\n>  \t * sub-directories to match the build tree.\n>  \t */\n> -\tif (!isLibcameraInstalled()) {\n> -\t\tstd::string ipaBuildPath = utils::dirname(libcameraPath()) + \"/../ipa\";\n> +\tif (!utils::isLibcameraInstalled()) {\n> +\t\tstd::string ipaBuildPath = utils::dirname(utils::libcameraPath()) + \"/../ipa\";\n>  \t\tconstexpr int maxDepth = 1;\n>  \n>  \t\tLOG(IPAManager, Info)\n> -- \n> 2.17.1\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 6A3FA60418\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Mar 2020 13:28:11 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D49A1F9;\n\tWed, 18 Mar 2020 13:28:10 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584534491;\n\tbh=RQ3swN2fwrGkx2Q4XAy1mRfPdkKzxvIEkCvKMraQjFU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=jw9a17QVejPfZ/Aus9kIBA0tGVSAS3BV9S9FOM3C+CqVMzdUrZI6ZiGQe15ee8Jel\n\t+WdJzWAC9vah95TMywO8X2J0n4alfrWLHVHFm2mK91Uljba6Ag432cJ5Pl7vbuYSsY\n\tUxRka7wEtB4T4ozQdYcYpgrxb50TR+pYR6WOWMcU=","Date":"Wed, 18 Mar 2020 14:28:05 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kaaira Gupta <kgupta@es.iitr.ac.in>","Cc":"Helen Koike <helen.koike@collabora.com>,\n\tVaishali Thakkar <vthakkar@vaishalithakkar.in>,\n\tkieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org","Message-ID":"<20200318122805.GF4733@pendragon.ideasonboard.com>","References":"<20200318115846.7975-1-kgupta@es.iitr.ac.in>\n\t<20200318115846.7975-6-kgupta@es.iitr.ac.in>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200318115846.7975-6-kgupta@es.iitr.ac.in>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH LIBCAMERA v3 5/6] libcamera:\n\tipa_manager: replace by utils functions","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":"Wed, 18 Mar 2020 12:28:11 -0000"}}]