{"id":12703,"url":"https://patchwork.libcamera.org/api/patches/12703/?format=json","web_url":"https://patchwork.libcamera.org/patch/12703/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210625013539.625803-11-kieran.bingham@ideasonboard.com>","date":"2021-06-25T01:35:33","name":"[libcamera-devel,10/16] libcamera/base: Move File to base library","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"02cc3bcc9ae99ea58127418482641e465fdb97b3","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12703/mbox/","series":[{"id":2173,"url":"https://patchwork.libcamera.org/api/series/2173/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2173","date":"2021-06-25T01:35:23","name":"libcamera-base: A new split on libcamera","version":1,"mbox":"https://patchwork.libcamera.org/series/2173/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12703/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12703/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 0CEE4C321D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 25 Jun 2021 01:35:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A963E684F2;\n\tFri, 25 Jun 2021 03:35:54 +0200 (CEST)","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 A8BC0684DF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jun 2021 03:35:47 +0200 (CEST)","from Monstersaurus.local\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 436738B6;\n\tFri, 25 Jun 2021 03:35:47 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"VlqZnF3j\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1624584947;\n\tbh=okcxq3JgyqOPsSSfCz2poZh9TuQcyV1v9pxK7BsgKfU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=VlqZnF3jrc2r4owMQ38KyHTJzmipkYx+DtRlcIFyvqngY3OHREM7CCJHkvkoXMFAc\n\tkfPfFfBbDU18QKWjhuBV5r9HWiOBI/9QWSBXvytdbx4Vx4VvzhNlSJNYYGMh75naad\n\t9B98WpgVULLuK6pNoKxSWJN+reHU2GsJHsSCn1HA=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Fri, 25 Jun 2021 02:35:33 +0100","Message-Id":"<20210625013539.625803-11-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.30.2","In-Reply-To":"<20210625013539.625803-1-kieran.bingham@ideasonboard.com>","References":"<20210625013539.625803-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 10/16] libcamera/base: Move File to base\n\tlibrary","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 File abstraction is a base helper and not part of the libcamera\nAPI.  Move it to the base library to allow usage when reading and\nwriting to files.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/{internal => base}/file.h |  6 +++---\n include/libcamera/base/meson.build          |  1 +\n include/libcamera/internal/meson.build      |  1 -\n src/ipa/vimc/vimc.cpp                       | 11 ++++-------\n src/libcamera/{ => base}/file.cpp           |  4 ++--\n src/libcamera/base/meson.build              |  1 +\n src/libcamera/ipa_manager.cpp               |  2 +-\n src/libcamera/ipa_module.cpp                |  2 +-\n src/libcamera/meson.build                   |  1 -\n src/libcamera/sysfs.cpp                     |  3 +--\n test/file.cpp                               |  2 +-\n test/hotplug-cameras.cpp                    |  3 +--\n 12 files changed, 16 insertions(+), 21 deletions(-)\n rename include/libcamera/{internal => base}/file.h (91%)\n rename src/libcamera/{ => base}/file.cpp (99%)","diff":"diff --git a/include/libcamera/internal/file.h b/include/libcamera/base/file.h\nsimilarity index 91%\nrename from include/libcamera/internal/file.h\nrename to include/libcamera/base/file.h\nindex 44621ceb4c19..e8e4b76e1a4e 100644\n--- a/include/libcamera/internal/file.h\n+++ b/include/libcamera/base/file.h\n@@ -4,8 +4,8 @@\n  *\n  * file.h - File I/O operations\n  */\n-#ifndef __LIBCAMERA_INTERNAL_FILE_H__\n-#define __LIBCAMERA_INTERNAL_FILE_H__\n+#ifndef __LIBCAMERA_BASE_FILE_H__\n+#define __LIBCAMERA_BASE_FILE_H__\n \n #include <map>\n #include <string>\n@@ -75,4 +75,4 @@ private:\n \n } /* namespace libcamera */\n \n-#endif /* __LIBCAMERA_INTERNAL_FILE_H__ */\n+#endif /* __LIBCAMERA_BASE_FILE_H__ */\ndiff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build\nindex 7a858dcb6f1a..6fc6c138a5fd 100644\n--- a/include/libcamera/base/meson.build\n+++ b/include/libcamera/base/meson.build\n@@ -7,6 +7,7 @@ libcamera_base_headers = files([\n     'class.h',\n     'event_dispatcher.h',\n     'event_dispatcher_poll.h',\n+    'file.h',\n     'log.h',\n     'message.h',\n     'object.h',\ndiff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\nindex 64f50373a7fb..b10285edac27 100644\n--- a/include/libcamera/internal/meson.build\n+++ b/include/libcamera/internal/meson.build\n@@ -23,7 +23,6 @@ libcamera_internal_headers = files([\n     'device_enumerator_sysfs.h',\n     'device_enumerator_udev.h',\n     'event_notifier.h',\n-    'file.h',\n     'formats.h',\n     'ipa_manager.h',\n     'ipa_module.h',\ndiff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp\nindex 9ffd07f493a1..cb9414e7b97a 100644\n--- a/src/ipa/vimc/vimc.cpp\n+++ b/src/ipa/vimc/vimc.cpp\n@@ -5,21 +5,18 @@\n  * ipa_vimc.cpp - Vimc Image Processing Algorithm module\n  */\n \n-#include <libcamera/ipa/vimc_ipa_interface.h>\n-\n #include <fcntl.h>\n+#include <iostream>\n #include <string.h>\n #include <sys/stat.h>\n #include <unistd.h>\n \n-#include <iostream>\n+#include <libcamera/base/file.h>\n+#include <libcamera/base/log.h>\n \n #include <libcamera/ipa/ipa_interface.h>\n #include <libcamera/ipa/ipa_module_info.h>\n-\n-#include <libcamera/base/log.h>\n-\n-#include \"libcamera/internal/file.h\"\n+#include <libcamera/ipa/vimc_ipa_interface.h>\n \n namespace libcamera {\n \ndiff --git a/src/libcamera/file.cpp b/src/libcamera/base/file.cpp\nsimilarity index 99%\nrename from src/libcamera/file.cpp\nrename to src/libcamera/base/file.cpp\nindex def0f60d044b..073666fa6f66 100644\n--- a/src/libcamera/file.cpp\n+++ b/src/libcamera/base/file.cpp\n@@ -5,7 +5,7 @@\n  * file.cpp - File I/O operations\n  */\n \n-#include \"libcamera/internal/file.h\"\n+#include <libcamera/base/file.h>\n \n #include <errno.h>\n #include <fcntl.h>\n@@ -17,7 +17,7 @@\n #include <libcamera/base/log.h>\n \n /**\n- * \\file file.h\n+ * \\file base/file.h\n  * \\brief File I/O operations\n  */\n \ndiff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build\nindex 7a19c67c51b8..fb8ed79acd8e 100644\n--- a/src/libcamera/base/meson.build\n+++ b/src/libcamera/base/meson.build\n@@ -5,6 +5,7 @@ libcamera_base_sources = files([\n     'bound_method.cpp',\n     'event_dispatcher.cpp',\n     'event_dispatcher_poll.cpp',\n+    'file.cpp',\n     'log.cpp',\n     'message.cpp',\n     'object.cpp',\ndiff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\nindex 35c7259801fa..b4606c6159e5 100644\n--- a/src/libcamera/ipa_manager.cpp\n+++ b/src/libcamera/ipa_manager.cpp\n@@ -12,10 +12,10 @@\n #include <string.h>\n #include <sys/types.h>\n \n+#include <libcamera/base/file.h>\n #include <libcamera/base/log.h>\n #include <libcamera/base/utils.h>\n \n-#include \"libcamera/internal/file.h\"\n #include \"libcamera/internal/ipa_module.h\"\n #include \"libcamera/internal/ipa_proxy.h\"\n #include \"libcamera/internal/pipeline_handler.h\"\ndiff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp\nindex 7ab5557916e7..984c1fed9bdb 100644\n--- a/src/libcamera/ipa_module.cpp\n+++ b/src/libcamera/ipa_module.cpp\n@@ -23,10 +23,10 @@\n \n #include <libcamera/span.h>\n \n+#include <libcamera/base/file.h>\n #include <libcamera/base/log.h>\n #include <libcamera/base/utils.h>\n \n-#include \"libcamera/internal/file.h\"\n #include \"libcamera/internal/pipeline_handler.h\"\n \n /**\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 86212cec0281..58eee14aed97 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -16,7 +16,6 @@ libcamera_sources = files([\n     'device_enumerator.cpp',\n     'device_enumerator_sysfs.cpp',\n     'event_notifier.cpp',\n-    'file.cpp',\n     'file_descriptor.cpp',\n     'formats.cpp',\n     'framebuffer_allocator.cpp',\ndiff --git a/src/libcamera/sysfs.cpp b/src/libcamera/sysfs.cpp\nindex 4372b1348178..44c3331b4e1c 100644\n--- a/src/libcamera/sysfs.cpp\n+++ b/src/libcamera/sysfs.cpp\n@@ -12,10 +12,9 @@\n #include <sys/stat.h>\n #include <sys/sysmacros.h>\n \n+#include <libcamera/base/file.h>\n #include <libcamera/base/log.h>\n \n-#include \"libcamera/internal/file.h\"\n-\n /**\n  * \\file sysfs.h\n  * \\brief Miscellaneous utility functions to access sysfs\ndiff --git a/test/file.cpp b/test/file.cpp\nindex b80667ae5b2f..d768e3235b8c 100644\n--- a/test/file.cpp\n+++ b/test/file.cpp\n@@ -13,7 +13,7 @@\n #include <sys/types.h>\n #include <unistd.h>\n \n-#include \"libcamera/internal/file.h\"\n+#include <libcamera/base/file.h>\n \n #include \"test.h\"\n \ndiff --git a/test/hotplug-cameras.cpp b/test/hotplug-cameras.cpp\nindex bb160537c5d5..df56040350c5 100644\n--- a/test/hotplug-cameras.cpp\n+++ b/test/hotplug-cameras.cpp\n@@ -15,11 +15,10 @@\n #include <libcamera/camera_manager.h>\n \n #include <libcamera/base/event_dispatcher.h>\n+#include <libcamera/base/file.h>\n #include <libcamera/base/thread.h>\n #include <libcamera/base/timer.h>\n \n-#include \"libcamera/internal/file.h\"\n-\n #include \"test.h\"\n \n using namespace libcamera;\n","prefixes":["libcamera-devel","10/16"]}