[libcamera-devel] [PATCH 5/6] libcamera-platform: Move File to platform library
Kieran Bingham
kieran.bingham at ideasonboard.com
Wed Jun 16 17:11:51 CEST 2021
The File abstraction is a platform helper and not part of the libcamera
API. Move it to the platform library to allow usage when reading and
writing to files.
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
include/libcamera/internal/meson.build | 1 -
include/libcamera/{internal => platform}/file.h | 6 +++---
include/libcamera/platform/meson.build | 1 +
src/ipa/vimc/vimc.cpp | 3 +--
src/{libcamera => libcamera-platform}/file.cpp | 4 ++--
src/libcamera-platform/meson.build | 1 +
src/libcamera/ipa_manager.cpp | 2 +-
src/libcamera/ipa_module.cpp | 2 +-
src/libcamera/meson.build | 1 -
src/libcamera/sysfs.cpp | 3 +--
test/file.cpp | 2 +-
test/hotplug-cameras.cpp | 3 +--
12 files changed, 13 insertions(+), 16 deletions(-)
rename include/libcamera/{internal => platform}/file.h (91%)
rename src/{libcamera => libcamera-platform}/file.cpp (99%)
diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build
index 1ff16f54a68b..1187cc1f63e4 100644
--- a/include/libcamera/internal/meson.build
+++ b/include/libcamera/internal/meson.build
@@ -23,7 +23,6 @@ libcamera_internal_headers = files([
'device_enumerator_sysfs.h',
'device_enumerator_udev.h',
'event_notifier.h',
- 'file.h',
'formats.h',
'ipa_manager.h',
'ipa_module.h',
diff --git a/include/libcamera/internal/file.h b/include/libcamera/platform/file.h
similarity index 91%
rename from include/libcamera/internal/file.h
rename to include/libcamera/platform/file.h
index f0b313a5faae..68108ff6039d 100644
--- a/include/libcamera/internal/file.h
+++ b/include/libcamera/platform/file.h
@@ -4,8 +4,8 @@
*
* file.h - File I/O operations
*/
-#ifndef __LIBCAMERA_INTERNAL_FILE_H__
-#define __LIBCAMERA_INTERNAL_FILE_H__
+#ifndef __LIBCAMERA_PLATFORM_FILE_H__
+#define __LIBCAMERA_PLATFORM_FILE_H__
#include <map>
#include <string>
@@ -74,4 +74,4 @@ private:
} /* namespace libcamera */
-#endif /* __LIBCAMERA_INTERNAL_FILE_H__ */
+#endif /* __LIBCAMERA_PLATFORM_FILE_H__ */
diff --git a/include/libcamera/platform/meson.build b/include/libcamera/platform/meson.build
index a0f89523f2b2..a5da16554f6e 100644
--- a/include/libcamera/platform/meson.build
+++ b/include/libcamera/platform/meson.build
@@ -6,6 +6,7 @@ libcamera_platform_headers = files([
'bound_method.h',
'event_dispatcher.h',
'event_dispatcher_poll.h',
+ 'file.h',
'log.h',
'message.h',
'object.h',
diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp
index 64ed51097065..1c7632bdb53b 100644
--- a/src/ipa/vimc/vimc.cpp
+++ b/src/ipa/vimc/vimc.cpp
@@ -17,10 +17,9 @@
#include <libcamera/ipa/ipa_interface.h>
#include <libcamera/ipa/ipa_module_info.h>
+#include <libcamera/platform/file.h>
#include <libcamera/platform/log.h>
-#include "libcamera/internal/file.h"
-
namespace libcamera {
LOG_DEFINE_CATEGORY(IPAVimc)
diff --git a/src/libcamera/file.cpp b/src/libcamera-platform/file.cpp
similarity index 99%
rename from src/libcamera/file.cpp
rename to src/libcamera-platform/file.cpp
index c554074c2e51..6ac33659a7ae 100644
--- a/src/libcamera/file.cpp
+++ b/src/libcamera-platform/file.cpp
@@ -5,7 +5,7 @@
* file.cpp - File I/O operations
*/
-#include "libcamera/internal/file.h"
+#include <libcamera/platform/file.h>
#include <errno.h>
#include <fcntl.h>
@@ -17,7 +17,7 @@
#include <libcamera/platform/log.h>
/**
- * \file file.h
+ * \file platform/file.h
* \brief File I/O operations
*/
diff --git a/src/libcamera-platform/meson.build b/src/libcamera-platform/meson.build
index afdc4465da28..78d7d894a63f 100644
--- a/src/libcamera-platform/meson.build
+++ b/src/libcamera-platform/meson.build
@@ -4,6 +4,7 @@ libcamera_platform_sources = files([
'bound_method.cpp',
'event_dispatcher.cpp',
'event_dispatcher_poll.cpp',
+ 'file.cpp',
'log.cpp',
'message.cpp',
'object.cpp',
diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp
index 122811e2bcae..f3fcc20806fa 100644
--- a/src/libcamera/ipa_manager.cpp
+++ b/src/libcamera/ipa_manager.cpp
@@ -12,10 +12,10 @@
#include <string.h>
#include <sys/types.h>
+#include <libcamera/platform/file.h>
#include <libcamera/platform/log.h>
#include <libcamera/platform/utils.h>
-#include "libcamera/internal/file.h"
#include "libcamera/internal/ipa_module.h"
#include "libcamera/internal/ipa_proxy.h"
#include "libcamera/internal/pipeline_handler.h"
diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
index a615ca91257e..093046c7ab17 100644
--- a/src/libcamera/ipa_module.cpp
+++ b/src/libcamera/ipa_module.cpp
@@ -23,10 +23,10 @@
#include <libcamera/span.h>
+#include <libcamera/platform/file.h>
#include <libcamera/platform/log.h>
#include <libcamera/platform/utils.h>
-#include "libcamera/internal/file.h"
#include "libcamera/internal/pipeline_handler.h"
/**
diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index f83ca4b1f6aa..9e2d1fd634aa 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -17,7 +17,6 @@ libcamera_sources = files([
'device_enumerator.cpp',
'device_enumerator_sysfs.cpp',
'event_notifier.cpp',
- 'file.cpp',
'file_descriptor.cpp',
'formats.cpp',
'framebuffer_allocator.cpp',
diff --git a/src/libcamera/sysfs.cpp b/src/libcamera/sysfs.cpp
index dea00b072519..939abefdf775 100644
--- a/src/libcamera/sysfs.cpp
+++ b/src/libcamera/sysfs.cpp
@@ -12,10 +12,9 @@
#include <sys/stat.h>
#include <sys/sysmacros.h>
+#include <libcamera/platform/file.h>
#include <libcamera/platform/log.h>
-#include "libcamera/internal/file.h"
-
/**
* \file sysfs.h
* \brief Miscellaneous utility functions to access sysfs
diff --git a/test/file.cpp b/test/file.cpp
index b80667ae5b2f..cdbfd9fa6d0b 100644
--- a/test/file.cpp
+++ b/test/file.cpp
@@ -13,7 +13,7 @@
#include <sys/types.h>
#include <unistd.h>
-#include "libcamera/internal/file.h"
+#include <libcamera/platform/file.h>
#include "test.h"
diff --git a/test/hotplug-cameras.cpp b/test/hotplug-cameras.cpp
index 514718214317..96aad8351cf9 100644
--- a/test/hotplug-cameras.cpp
+++ b/test/hotplug-cameras.cpp
@@ -15,11 +15,10 @@
#include <libcamera/camera_manager.h>
#include <libcamera/platform/event_dispatcher.h>
+#include <libcamera/platform/file.h>
#include <libcamera/platform/thread.h>
#include <libcamera/platform/timer.h>
-#include "libcamera/internal/file.h"
-
#include "test.h"
using namespace libcamera;
--
2.30.2
More information about the libcamera-devel
mailing list