[libcamera-devel,v4,02/22] libcamera: Move file_descriptor.h to base/
diff mbox series

Message ID 20211130033820.18235-3-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: Introduce UniqueFD
Related show

Commit Message

Laurent Pinchart Nov. 30, 2021, 3:38 a.m. UTC
The FileDescriptor class is a generic helper that matches the criteria
for the base library. Move it there.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
---
 include/libcamera/{ => base}/file_descriptor.h     | 0
 include/libcamera/base/meson.build                 | 1 +
 include/libcamera/framebuffer.h                    | 3 +--
 include/libcamera/internal/ipc_pipe.h              | 3 +--
 include/libcamera/meson.build                      | 1 -
 src/ipa/raspberrypi/raspberrypi.cpp                | 2 +-
 src/libcamera/{ => base}/file_descriptor.cpp       | 4 ++--
 src/libcamera/base/meson.build                     | 1 +
 src/libcamera/meson.build                          | 1 -
 src/libcamera/pipeline/raspberrypi/dma_heaps.h     | 2 +-
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 ++-
 src/libcamera/v4l2_videodevice.cpp                 | 3 +--
 src/v4l2/v4l2_camera.h                             | 2 +-
 test/file-descriptor.cpp                           | 3 +--
 14 files changed, 13 insertions(+), 16 deletions(-)
 rename include/libcamera/{ => base}/file_descriptor.h (100%)
 rename src/libcamera/{ => base}/file_descriptor.cpp (99%)

Patch
diff mbox series

diff --git a/include/libcamera/file_descriptor.h b/include/libcamera/base/file_descriptor.h
similarity index 100%
rename from include/libcamera/file_descriptor.h
rename to include/libcamera/base/file_descriptor.h
diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build
index 23dd4e2023a8..f73b00917409 100644
--- a/include/libcamera/base/meson.build
+++ b/include/libcamera/base/meson.build
@@ -11,6 +11,7 @@  libcamera_base_headers = files([
     'event_dispatcher_poll.h',
     'event_notifier.h',
     'file.h',
+    'file_descriptor.h',
     'flags.h',
     'log.h',
     'message.h',
diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h
index 4e710e332370..2fbea9c5be16 100644
--- a/include/libcamera/framebuffer.h
+++ b/include/libcamera/framebuffer.h
@@ -13,10 +13,9 @@ 
 #include <vector>
 
 #include <libcamera/base/class.h>
+#include <libcamera/base/file_descriptor.h>
 #include <libcamera/base/span.h>
 
-#include <libcamera/file_descriptor.h>
-
 namespace libcamera {
 
 class Request;
diff --git a/include/libcamera/internal/ipc_pipe.h b/include/libcamera/internal/ipc_pipe.h
index bd8824f255c2..986f8d886fa6 100644
--- a/include/libcamera/internal/ipc_pipe.h
+++ b/include/libcamera/internal/ipc_pipe.h
@@ -9,10 +9,9 @@ 
 
 #include <vector>
 
+#include <libcamera/base/file_descriptor.h>
 #include <libcamera/base/signal.h>
 
-#include <libcamera/file_descriptor.h>
-
 #include "libcamera/internal/ipc_unixsocket.h"
 
 namespace libcamera {
diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
index a8cca2a88cad..5f42977c034b 100644
--- a/include/libcamera/meson.build
+++ b/include/libcamera/meson.build
@@ -6,7 +6,6 @@  libcamera_public_headers = files([
     'camera.h',
     'camera_manager.h',
     'controls.h',
-    'file_descriptor.h',
     'framebuffer.h',
     'framebuffer_allocator.h',
     'geometry.h',
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index fed82e223d38..c6aec09046f7 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -15,12 +15,12 @@ 
 
 #include <linux/bcm2835-isp.h>
 
+#include <libcamera/base/file_descriptor.h>
 #include <libcamera/base/log.h>
 #include <libcamera/base/span.h>
 
 #include <libcamera/control_ids.h>
 #include <libcamera/controls.h>
-#include <libcamera/file_descriptor.h>
 #include <libcamera/framebuffer.h>
 #include <libcamera/ipa/ipa_interface.h>
 #include <libcamera/ipa/ipa_module_info.h>
diff --git a/src/libcamera/file_descriptor.cpp b/src/libcamera/base/file_descriptor.cpp
similarity index 99%
rename from src/libcamera/file_descriptor.cpp
rename to src/libcamera/base/file_descriptor.cpp
index 0409c3e1758c..f5f87c56eee8 100644
--- a/src/libcamera/file_descriptor.cpp
+++ b/src/libcamera/base/file_descriptor.cpp
@@ -5,7 +5,7 @@ 
  * file_descriptor.cpp - File descriptor wrapper
  */
 
-#include <libcamera/file_descriptor.h>
+#include <libcamera/base/file_descriptor.h>
 
 #include <string.h>
 #include <sys/stat.h>
@@ -16,7 +16,7 @@ 
 #include <libcamera/base/log.h>
 
 /**
- * \file file_descriptor.h
+ * \file base/file_descriptor.h
  * \brief File descriptor wrapper
  */
 
diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build
index 05fed7acf561..d5254fda9cbf 100644
--- a/src/libcamera/base/meson.build
+++ b/src/libcamera/base/meson.build
@@ -8,6 +8,7 @@  libcamera_base_sources = files([
     'event_dispatcher_poll.cpp',
     'event_notifier.cpp',
     'file.cpp',
+    'file_descriptor.cpp',
     'flags.cpp',
     'log.cpp',
     'message.cpp',
diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index ddedc78c0c10..b763110e74a6 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -14,7 +14,6 @@  libcamera_sources = files([
     'delayed_controls.cpp',
     'device_enumerator.cpp',
     'device_enumerator_sysfs.cpp',
-    'file_descriptor.cpp',
     'formats.cpp',
     'framebuffer.cpp',
     'framebuffer_allocator.cpp',
diff --git a/src/libcamera/pipeline/raspberrypi/dma_heaps.h b/src/libcamera/pipeline/raspberrypi/dma_heaps.h
index 38dfc242c0b9..57beaeb2e48a 100644
--- a/src/libcamera/pipeline/raspberrypi/dma_heaps.h
+++ b/src/libcamera/pipeline/raspberrypi/dma_heaps.h
@@ -7,7 +7,7 @@ 
 
 #pragma once
 
-#include <libcamera/file_descriptor.h>
+#include <libcamera/base/file_descriptor.h>
 
 namespace libcamera {
 
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index e31fa3b23859..d82cb30f0e77 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -12,9 +12,10 @@ 
 #include <queue>
 #include <unordered_set>
 
+#include <libcamera/base/file_descriptor.h>
+
 #include <libcamera/camera.h>
 #include <libcamera/control_ids.h>
-#include <libcamera/file_descriptor.h>
 #include <libcamera/formats.h>
 #include <libcamera/ipa/raspberrypi.h>
 #include <libcamera/ipa/raspberrypi_ipa_interface.h>
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 4f04212df672..0a85bcf6b3ff 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -22,11 +22,10 @@ 
 #include <linux/version.h>
 
 #include <libcamera/base/event_notifier.h>
+#include <libcamera/base/file_descriptor.h>
 #include <libcamera/base/log.h>
 #include <libcamera/base/utils.h>
 
-#include <libcamera/file_descriptor.h>
-
 #include "libcamera/internal/formats.h"
 #include "libcamera/internal/framebuffer.h"
 #include "libcamera/internal/media_device.h"
diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h
index 94263b2f5db6..0cea111561dd 100644
--- a/src/v4l2/v4l2_camera.h
+++ b/src/v4l2/v4l2_camera.h
@@ -11,10 +11,10 @@ 
 #include <mutex>
 #include <utility>
 
+#include <libcamera/base/file_descriptor.h>
 #include <libcamera/base/semaphore.h>
 
 #include <libcamera/camera.h>
-#include <libcamera/file_descriptor.h>
 #include <libcamera/framebuffer.h>
 #include <libcamera/framebuffer_allocator.h>
 
diff --git a/test/file-descriptor.cpp b/test/file-descriptor.cpp
index 85b077a25c32..76badc4c5fad 100644
--- a/test/file-descriptor.cpp
+++ b/test/file-descriptor.cpp
@@ -11,8 +11,7 @@ 
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <libcamera/file_descriptor.h>
-
+#include <libcamera/base/file_descriptor.h>
 #include <libcamera/base/utils.h>
 
 #include "test.h"