[libcamera-devel,v3,6/7] libcamera: Utilise LIBCAMERA_DISABLE_COPY
diff mbox series

Message ID 20210212133056.873230-7-kieran.bingham@ideasonboard.com
State Accepted
Commit 640f48d60399fe63f549f6cb5fa8623a6b6b2810
Headers show
Series
  • Delete Copy-Move-Assign
Related show

Commit Message

Kieran Bingham Feb. 12, 2021, 1:30 p.m. UTC
Replace existing use cases where the copy constructor and copy
assignment operator are deleted with the LIBCAMERA_DISABLE_COPY
statement

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 include/libcamera/camera.h                      | 5 ++---
 include/libcamera/camera_manager.h              | 4 ++--
 include/libcamera/framebuffer_allocator.h       | 7 ++++---
 include/libcamera/internal/byte_stream_buffer.h | 4 ++--
 include/libcamera/internal/camera_sensor.h      | 6 +++---
 include/libcamera/internal/file.h               | 6 +++---
 include/libcamera/internal/log.h                | 6 +++++-
 include/libcamera/internal/pipeline_handler.h   | 4 ++--
 include/libcamera/internal/v4l2_subdevice.h     | 5 +++--
 include/libcamera/internal/v4l2_videodevice.h   | 6 +++---
 include/libcamera/request.h                     | 5 +++--
 11 files changed, 32 insertions(+), 26 deletions(-)

Comments

Laurent Pinchart Feb. 12, 2021, 2:03 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Fri, Feb 12, 2021 at 01:30:55PM +0000, Kieran Bingham wrote:
> Replace existing use cases where the copy constructor and copy
> assignment operator are deleted with the LIBCAMERA_DISABLE_COPY
> statement
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  include/libcamera/camera.h                      | 5 ++---
>  include/libcamera/camera_manager.h              | 4 ++--
>  include/libcamera/framebuffer_allocator.h       | 7 ++++---
>  include/libcamera/internal/byte_stream_buffer.h | 4 ++--
>  include/libcamera/internal/camera_sensor.h      | 6 +++---
>  include/libcamera/internal/file.h               | 6 +++---
>  include/libcamera/internal/log.h                | 6 +++++-
>  include/libcamera/internal/pipeline_handler.h   | 4 ++--
>  include/libcamera/internal/v4l2_subdevice.h     | 5 +++--
>  include/libcamera/internal/v4l2_videodevice.h   | 6 +++---
>  include/libcamera/request.h                     | 5 +++--
>  11 files changed, 32 insertions(+), 26 deletions(-)
> 
> diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h
> index cff9f46e801b..bd81fb54502e 100644
> --- a/include/libcamera/camera.h
> +++ b/include/libcamera/camera.h
> @@ -81,9 +81,6 @@ public:
>  					      const std::string &id,
>  					      const std::set<Stream *> &streams);
>  
> -	Camera(const Camera &) = delete;
> -	Camera &operator=(const Camera &) = delete;
> -
>  	const std::string &id() const;
>  
>  	Signal<Request *, FrameBuffer *> bufferCompleted;
> @@ -107,6 +104,8 @@ public:
>  	int stop();
>  
>  private:
> +	LIBCAMERA_DISABLE_COPY(Camera)
> +
>  	Camera(PipelineHandler *pipe, const std::string &id,
>  	       const std::set<Stream *> &streams);
>  	~Camera();
> diff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h
> index 7b8e533fadd6..35a59f0df4ca 100644
> --- a/include/libcamera/camera_manager.h
> +++ b/include/libcamera/camera_manager.h
> @@ -25,8 +25,6 @@ class CameraManager : public Object, public Extensible
>  	LIBCAMERA_DECLARE_PRIVATE(CameraManager)
>  public:
>  	CameraManager();
> -	CameraManager(const CameraManager &) = delete;
> -	CameraManager &operator=(const CameraManager &) = delete;
>  	~CameraManager();
>  
>  	int start();
> @@ -46,6 +44,8 @@ public:
>  	Signal<std::shared_ptr<Camera>> cameraRemoved;
>  
>  private:
> +	LIBCAMERA_DISABLE_COPY(CameraManager)
> +
>  	static const std::string version_;
>  	static CameraManager *self_;
>  };
> diff --git a/include/libcamera/framebuffer_allocator.h b/include/libcamera/framebuffer_allocator.h
> index a96aaeae58ce..0c85631a1da2 100644
> --- a/include/libcamera/framebuffer_allocator.h
> +++ b/include/libcamera/framebuffer_allocator.h
> @@ -11,6 +11,8 @@
>  #include <memory>
>  #include <vector>
>  
> +#include <libcamera/class.h>
> +
>  namespace libcamera {
>  
>  class Camera;
> @@ -21,9 +23,6 @@ class FrameBufferAllocator
>  {
>  public:
>  	FrameBufferAllocator(std::shared_ptr<Camera> camera);
> -	FrameBufferAllocator(const FrameBufferAllocator &) = delete;
> -	FrameBufferAllocator &operator=(const FrameBufferAllocator &) = delete;
> -
>  	~FrameBufferAllocator();
>  
>  	int allocate(Stream *stream);
> @@ -33,6 +32,8 @@ public:
>  	const std::vector<std::unique_ptr<FrameBuffer>> &buffers(Stream *stream) const;
>  
>  private:
> +	LIBCAMERA_DISABLE_COPY(FrameBufferAllocator)
> +
>  	std::shared_ptr<Camera> camera_;
>  	std::map<Stream *, std::vector<std::unique_ptr<FrameBuffer>>> buffers_;
>  };
> diff --git a/include/libcamera/internal/byte_stream_buffer.h b/include/libcamera/internal/byte_stream_buffer.h
> index db59577dc332..866cb9b0b2a6 100644
> --- a/include/libcamera/internal/byte_stream_buffer.h
> +++ b/include/libcamera/internal/byte_stream_buffer.h
> @@ -11,6 +11,7 @@
>  #include <stdint.h>
>  #include <type_traits>
>  
> +#include <libcamera/class.h>
>  #include <libcamera/span.h>
>  
>  namespace libcamera {
> @@ -65,8 +66,7 @@ public:
>  	}
>  
>  private:
> -	ByteStreamBuffer(const ByteStreamBuffer &other) = delete;
> -	ByteStreamBuffer &operator=(const ByteStreamBuffer &other) = delete;
> +	LIBCAMERA_DISABLE_COPY(ByteStreamBuffer)
>  
>  	void setOverflow();
>  
> diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
> index c8f81882a958..f22ffbfe9f97 100644
> --- a/include/libcamera/internal/camera_sensor.h
> +++ b/include/libcamera/internal/camera_sensor.h
> @@ -11,6 +11,7 @@
>  #include <string>
>  #include <vector>
>  
> +#include <libcamera/class.h>
>  #include <libcamera/controls.h>
>  #include <libcamera/geometry.h>
>  
> @@ -45,9 +46,6 @@ public:
>  	explicit CameraSensor(const MediaEntity *entity);
>  	~CameraSensor();
>  
> -	CameraSensor(const CameraSensor &) = delete;
> -	CameraSensor &operator=(const CameraSensor &) = delete;
> -
>  	int init();
>  
>  	const std::string &model() const { return model_; }
> @@ -74,6 +72,8 @@ protected:
>  	std::string logPrefix() const override;
>  
>  private:
> +	LIBCAMERA_DISABLE_COPY(CameraSensor)
> +
>  	int generateId();
>  	int validateSensorDriver();
>  	void initVimcDefaultProperties();
> diff --git a/include/libcamera/internal/file.h b/include/libcamera/internal/file.h
> index 9b6d011f5e9d..f0b313a5faae 100644
> --- a/include/libcamera/internal/file.h
> +++ b/include/libcamera/internal/file.h
> @@ -11,6 +11,7 @@
>  #include <string>
>  #include <sys/types.h>
>  
> +#include <libcamera/class.h>
>  #include <libcamera/span.h>
>  
>  namespace libcamera {
> @@ -34,9 +35,6 @@ public:
>  	File();
>  	~File();
>  
> -	File(const File &) = delete;
> -	File &operator=(const File &) = delete;
> -
>  	const std::string &fileName() const { return name_; }
>  	void setFileName(const std::string &name);
>  	bool exists() const;
> @@ -62,6 +60,8 @@ public:
>  	static bool exists(const std::string &name);
>  
>  private:
> +	LIBCAMERA_DISABLE_COPY(File)
> +
>  	void unmapAll();
>  
>  	std::string name_;
> diff --git a/include/libcamera/internal/log.h b/include/libcamera/internal/log.h
> index 4b10087a4718..e76ae913c857 100644
> --- a/include/libcamera/internal/log.h
> +++ b/include/libcamera/internal/log.h
> @@ -10,6 +10,8 @@
>  #include <chrono>
>  #include <sstream>
>  
> +#include <libcamera/class.h>
> +
>  #include "libcamera/internal/utils.h"
>  
>  namespace libcamera {
> @@ -57,7 +59,7 @@ public:
>  		   LogSeverity severity);
>  	LogMessage(const char *fileName, unsigned int line,
>  		   const LogCategory &category, LogSeverity severity);
> -	LogMessage(const LogMessage &) = delete;
> +

Maybe this blank line isn't needed ? Apart from that, the patch looks
good to me.

>  	LogMessage(LogMessage &&);
>  	~LogMessage();
>  
> @@ -70,6 +72,8 @@ public:
>  	const std::string msg() const { return msgStream_.str(); }
>  
>  private:
> +	LIBCAMERA_DISABLE_COPY(LogMessage)
> +
>  	void init(const char *fileName, unsigned int line);
>  
>  	std::ostringstream msgStream_;
> diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
> index 0748f8634608..d81c9b85f107 100644
> --- a/include/libcamera/internal/pipeline_handler.h
> +++ b/include/libcamera/internal/pipeline_handler.h
> @@ -15,6 +15,7 @@
>  #include <sys/types.h>
>  #include <vector>
>  
> +#include <libcamera/class.h>
>  #include <libcamera/controls.h>
>  #include <libcamera/object.h>
>  #include <libcamera/stream.h>
> @@ -49,8 +50,7 @@ public:
>  	std::unique_ptr<IPAProxy> ipa_;
>  
>  private:
> -	CameraData(const CameraData &) = delete;
> -	CameraData &operator=(const CameraData &) = delete;
> +	LIBCAMERA_DISABLE_COPY(CameraData)
>  };
>  
>  class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>,
> diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h
> index eb25fa2fd01b..d2b9ca55439e 100644
> --- a/include/libcamera/internal/v4l2_subdevice.h
> +++ b/include/libcamera/internal/v4l2_subdevice.h
> @@ -11,6 +11,7 @@
>  #include <string>
>  #include <vector>
>  
> +#include <libcamera/class.h>
>  #include <libcamera/geometry.h>
>  
>  #include "libcamera/internal/formats.h"
> @@ -41,8 +42,6 @@ public:
>  	};
>  
>  	explicit V4L2Subdevice(const MediaEntity *entity);
> -	V4L2Subdevice(const V4L2Subdevice &) = delete;
> -	V4L2Subdevice &operator=(const V4L2Subdevice &) = delete;
>  	~V4L2Subdevice();
>  
>  	int open();
> @@ -68,6 +67,8 @@ protected:
>  	std::string logPrefix() const override;
>  
>  private:
> +	LIBCAMERA_DISABLE_COPY(V4L2Subdevice)
> +
>  	std::vector<unsigned int> enumPadCodes(unsigned int pad);
>  	std::vector<SizeRange> enumPadSizes(unsigned int pad,
>  					    unsigned int code);
> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h
> index 626dfbcd6113..7938343bba8d 100644
> --- a/include/libcamera/internal/v4l2_videodevice.h
> +++ b/include/libcamera/internal/v4l2_videodevice.h
> @@ -17,6 +17,7 @@
>  #include <linux/videodev2.h>
>  
>  #include <libcamera/buffer.h>
> +#include <libcamera/class.h>
>  #include <libcamera/geometry.h>
>  #include <libcamera/pixel_format.h>
>  #include <libcamera/signal.h>
> @@ -175,11 +176,8 @@ public:
>  
>  	explicit V4L2VideoDevice(const std::string &deviceNode);
>  	explicit V4L2VideoDevice(const MediaEntity *entity);
> -	V4L2VideoDevice(const V4L2VideoDevice &) = delete;
>  	~V4L2VideoDevice();
>  
> -	V4L2VideoDevice &operator=(const V4L2VideoDevice &) = delete;
> -
>  	int open();
>  	int open(int handle, enum v4l2_buf_type type);
>  	void close();
> @@ -219,6 +217,8 @@ protected:
>  	std::string logPrefix() const override;
>  
>  private:
> +	LIBCAMERA_DISABLE_COPY(V4L2VideoDevice)
> +
>  	int getFormatMeta(V4L2DeviceFormat *format);
>  	int trySetFormatMeta(V4L2DeviceFormat *format, bool set);
>  
> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> index 655b1324bae8..6e5aad5f6b75 100644
> --- a/include/libcamera/request.h
> +++ b/include/libcamera/request.h
> @@ -12,6 +12,7 @@
>  #include <stdint.h>
>  #include <unordered_set>
>  
> +#include <libcamera/class.h>
>  #include <libcamera/controls.h>
>  #include <libcamera/signal.h>
>  
> @@ -39,8 +40,6 @@ public:
>  	using BufferMap = std::map<const Stream *, FrameBuffer *>;
>  
>  	Request(Camera *camera, uint64_t cookie = 0);
> -	Request(const Request &) = delete;
> -	Request &operator=(const Request &) = delete;
>  	~Request();
>  
>  	void reuse(ReuseFlag flags = Default);
> @@ -57,6 +56,8 @@ public:
>  	bool hasPendingBuffers() const { return !pending_.empty(); }
>  
>  private:
> +	LIBCAMERA_DISABLE_COPY(Request)
> +
>  	friend class PipelineHandler;
>  
>  	void complete();

Patch
diff mbox series

diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h
index cff9f46e801b..bd81fb54502e 100644
--- a/include/libcamera/camera.h
+++ b/include/libcamera/camera.h
@@ -81,9 +81,6 @@  public:
 					      const std::string &id,
 					      const std::set<Stream *> &streams);
 
-	Camera(const Camera &) = delete;
-	Camera &operator=(const Camera &) = delete;
-
 	const std::string &id() const;
 
 	Signal<Request *, FrameBuffer *> bufferCompleted;
@@ -107,6 +104,8 @@  public:
 	int stop();
 
 private:
+	LIBCAMERA_DISABLE_COPY(Camera)
+
 	Camera(PipelineHandler *pipe, const std::string &id,
 	       const std::set<Stream *> &streams);
 	~Camera();
diff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h
index 7b8e533fadd6..35a59f0df4ca 100644
--- a/include/libcamera/camera_manager.h
+++ b/include/libcamera/camera_manager.h
@@ -25,8 +25,6 @@  class CameraManager : public Object, public Extensible
 	LIBCAMERA_DECLARE_PRIVATE(CameraManager)
 public:
 	CameraManager();
-	CameraManager(const CameraManager &) = delete;
-	CameraManager &operator=(const CameraManager &) = delete;
 	~CameraManager();
 
 	int start();
@@ -46,6 +44,8 @@  public:
 	Signal<std::shared_ptr<Camera>> cameraRemoved;
 
 private:
+	LIBCAMERA_DISABLE_COPY(CameraManager)
+
 	static const std::string version_;
 	static CameraManager *self_;
 };
diff --git a/include/libcamera/framebuffer_allocator.h b/include/libcamera/framebuffer_allocator.h
index a96aaeae58ce..0c85631a1da2 100644
--- a/include/libcamera/framebuffer_allocator.h
+++ b/include/libcamera/framebuffer_allocator.h
@@ -11,6 +11,8 @@ 
 #include <memory>
 #include <vector>
 
+#include <libcamera/class.h>
+
 namespace libcamera {
 
 class Camera;
@@ -21,9 +23,6 @@  class FrameBufferAllocator
 {
 public:
 	FrameBufferAllocator(std::shared_ptr<Camera> camera);
-	FrameBufferAllocator(const FrameBufferAllocator &) = delete;
-	FrameBufferAllocator &operator=(const FrameBufferAllocator &) = delete;
-
 	~FrameBufferAllocator();
 
 	int allocate(Stream *stream);
@@ -33,6 +32,8 @@  public:
 	const std::vector<std::unique_ptr<FrameBuffer>> &buffers(Stream *stream) const;
 
 private:
+	LIBCAMERA_DISABLE_COPY(FrameBufferAllocator)
+
 	std::shared_ptr<Camera> camera_;
 	std::map<Stream *, std::vector<std::unique_ptr<FrameBuffer>>> buffers_;
 };
diff --git a/include/libcamera/internal/byte_stream_buffer.h b/include/libcamera/internal/byte_stream_buffer.h
index db59577dc332..866cb9b0b2a6 100644
--- a/include/libcamera/internal/byte_stream_buffer.h
+++ b/include/libcamera/internal/byte_stream_buffer.h
@@ -11,6 +11,7 @@ 
 #include <stdint.h>
 #include <type_traits>
 
+#include <libcamera/class.h>
 #include <libcamera/span.h>
 
 namespace libcamera {
@@ -65,8 +66,7 @@  public:
 	}
 
 private:
-	ByteStreamBuffer(const ByteStreamBuffer &other) = delete;
-	ByteStreamBuffer &operator=(const ByteStreamBuffer &other) = delete;
+	LIBCAMERA_DISABLE_COPY(ByteStreamBuffer)
 
 	void setOverflow();
 
diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
index c8f81882a958..f22ffbfe9f97 100644
--- a/include/libcamera/internal/camera_sensor.h
+++ b/include/libcamera/internal/camera_sensor.h
@@ -11,6 +11,7 @@ 
 #include <string>
 #include <vector>
 
+#include <libcamera/class.h>
 #include <libcamera/controls.h>
 #include <libcamera/geometry.h>
 
@@ -45,9 +46,6 @@  public:
 	explicit CameraSensor(const MediaEntity *entity);
 	~CameraSensor();
 
-	CameraSensor(const CameraSensor &) = delete;
-	CameraSensor &operator=(const CameraSensor &) = delete;
-
 	int init();
 
 	const std::string &model() const { return model_; }
@@ -74,6 +72,8 @@  protected:
 	std::string logPrefix() const override;
 
 private:
+	LIBCAMERA_DISABLE_COPY(CameraSensor)
+
 	int generateId();
 	int validateSensorDriver();
 	void initVimcDefaultProperties();
diff --git a/include/libcamera/internal/file.h b/include/libcamera/internal/file.h
index 9b6d011f5e9d..f0b313a5faae 100644
--- a/include/libcamera/internal/file.h
+++ b/include/libcamera/internal/file.h
@@ -11,6 +11,7 @@ 
 #include <string>
 #include <sys/types.h>
 
+#include <libcamera/class.h>
 #include <libcamera/span.h>
 
 namespace libcamera {
@@ -34,9 +35,6 @@  public:
 	File();
 	~File();
 
-	File(const File &) = delete;
-	File &operator=(const File &) = delete;
-
 	const std::string &fileName() const { return name_; }
 	void setFileName(const std::string &name);
 	bool exists() const;
@@ -62,6 +60,8 @@  public:
 	static bool exists(const std::string &name);
 
 private:
+	LIBCAMERA_DISABLE_COPY(File)
+
 	void unmapAll();
 
 	std::string name_;
diff --git a/include/libcamera/internal/log.h b/include/libcamera/internal/log.h
index 4b10087a4718..e76ae913c857 100644
--- a/include/libcamera/internal/log.h
+++ b/include/libcamera/internal/log.h
@@ -10,6 +10,8 @@ 
 #include <chrono>
 #include <sstream>
 
+#include <libcamera/class.h>
+
 #include "libcamera/internal/utils.h"
 
 namespace libcamera {
@@ -57,7 +59,7 @@  public:
 		   LogSeverity severity);
 	LogMessage(const char *fileName, unsigned int line,
 		   const LogCategory &category, LogSeverity severity);
-	LogMessage(const LogMessage &) = delete;
+
 	LogMessage(LogMessage &&);
 	~LogMessage();
 
@@ -70,6 +72,8 @@  public:
 	const std::string msg() const { return msgStream_.str(); }
 
 private:
+	LIBCAMERA_DISABLE_COPY(LogMessage)
+
 	void init(const char *fileName, unsigned int line);
 
 	std::ostringstream msgStream_;
diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
index 0748f8634608..d81c9b85f107 100644
--- a/include/libcamera/internal/pipeline_handler.h
+++ b/include/libcamera/internal/pipeline_handler.h
@@ -15,6 +15,7 @@ 
 #include <sys/types.h>
 #include <vector>
 
+#include <libcamera/class.h>
 #include <libcamera/controls.h>
 #include <libcamera/object.h>
 #include <libcamera/stream.h>
@@ -49,8 +50,7 @@  public:
 	std::unique_ptr<IPAProxy> ipa_;
 
 private:
-	CameraData(const CameraData &) = delete;
-	CameraData &operator=(const CameraData &) = delete;
+	LIBCAMERA_DISABLE_COPY(CameraData)
 };
 
 class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>,
diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h
index eb25fa2fd01b..d2b9ca55439e 100644
--- a/include/libcamera/internal/v4l2_subdevice.h
+++ b/include/libcamera/internal/v4l2_subdevice.h
@@ -11,6 +11,7 @@ 
 #include <string>
 #include <vector>
 
+#include <libcamera/class.h>
 #include <libcamera/geometry.h>
 
 #include "libcamera/internal/formats.h"
@@ -41,8 +42,6 @@  public:
 	};
 
 	explicit V4L2Subdevice(const MediaEntity *entity);
-	V4L2Subdevice(const V4L2Subdevice &) = delete;
-	V4L2Subdevice &operator=(const V4L2Subdevice &) = delete;
 	~V4L2Subdevice();
 
 	int open();
@@ -68,6 +67,8 @@  protected:
 	std::string logPrefix() const override;
 
 private:
+	LIBCAMERA_DISABLE_COPY(V4L2Subdevice)
+
 	std::vector<unsigned int> enumPadCodes(unsigned int pad);
 	std::vector<SizeRange> enumPadSizes(unsigned int pad,
 					    unsigned int code);
diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h
index 626dfbcd6113..7938343bba8d 100644
--- a/include/libcamera/internal/v4l2_videodevice.h
+++ b/include/libcamera/internal/v4l2_videodevice.h
@@ -17,6 +17,7 @@ 
 #include <linux/videodev2.h>
 
 #include <libcamera/buffer.h>
+#include <libcamera/class.h>
 #include <libcamera/geometry.h>
 #include <libcamera/pixel_format.h>
 #include <libcamera/signal.h>
@@ -175,11 +176,8 @@  public:
 
 	explicit V4L2VideoDevice(const std::string &deviceNode);
 	explicit V4L2VideoDevice(const MediaEntity *entity);
-	V4L2VideoDevice(const V4L2VideoDevice &) = delete;
 	~V4L2VideoDevice();
 
-	V4L2VideoDevice &operator=(const V4L2VideoDevice &) = delete;
-
 	int open();
 	int open(int handle, enum v4l2_buf_type type);
 	void close();
@@ -219,6 +217,8 @@  protected:
 	std::string logPrefix() const override;
 
 private:
+	LIBCAMERA_DISABLE_COPY(V4L2VideoDevice)
+
 	int getFormatMeta(V4L2DeviceFormat *format);
 	int trySetFormatMeta(V4L2DeviceFormat *format, bool set);
 
diff --git a/include/libcamera/request.h b/include/libcamera/request.h
index 655b1324bae8..6e5aad5f6b75 100644
--- a/include/libcamera/request.h
+++ b/include/libcamera/request.h
@@ -12,6 +12,7 @@ 
 #include <stdint.h>
 #include <unordered_set>
 
+#include <libcamera/class.h>
 #include <libcamera/controls.h>
 #include <libcamera/signal.h>
 
@@ -39,8 +40,6 @@  public:
 	using BufferMap = std::map<const Stream *, FrameBuffer *>;
 
 	Request(Camera *camera, uint64_t cookie = 0);
-	Request(const Request &) = delete;
-	Request &operator=(const Request &) = delete;
 	~Request();
 
 	void reuse(ReuseFlag flags = Default);
@@ -57,6 +56,8 @@  public:
 	bool hasPendingBuffers() const { return !pending_.empty(); }
 
 private:
+	LIBCAMERA_DISABLE_COPY(Request)
+
 	friend class PipelineHandler;
 
 	void complete();