From edacd07c5e9a5080628e7cc4d057674f7f742ead Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Mon, 22 Jun 2020 18:42:07 +0900 Subject: v4l2: V4L2CameraProxy: Take V4L2CameraFile as argument for intercepted calls Prepare for using the V4L2CameraFile as a container for file-specific information in the V4L2 compatibility layer by making it a required argument for all V4L2CameraProxy calls that are directed from V4L2CompatManager, which are intercepted via LD_PRELOAD. Change V4L2CameraFile accordingly. Also change V4L2CompatManager accordingly. Instead of keeping a map of file descriptors to V4L2CameraProxy instances, we keep a map of V4L2CameraFile instances to V4L2CameraProxy instances. When the proxy methods are called, feed the file as a parameter. The dup function is also modified, in that it is removed from V4L2CameraProxy, and is handled completely in V4L2CompatManager, as a map from file descriptors to V4L2CameraFile instances. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- src/v4l2/v4l2_compat_manager.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/v4l2/v4l2_compat_manager.h') diff --git a/src/v4l2/v4l2_compat_manager.h b/src/v4l2/v4l2_compat_manager.h index 3d4e512e..bc548ab2 100644 --- a/src/v4l2/v4l2_compat_manager.h +++ b/src/v4l2/v4l2_compat_manager.h @@ -44,7 +44,6 @@ public: static V4L2CompatManager *instance(); - V4L2CameraProxy *getProxy(int fd); const FileOperations &fops() const { return fops_; } int openat(int dirfd, const char *path, int oflag, mode_t mode); @@ -62,13 +61,14 @@ private: int start(); int getCameraIndex(int fd); + std::shared_ptr cameraFile(int fd); FileOperations fops_; CameraManager *cm_; std::vector> proxies_; - std::map devices_; + std::map> files_; std::map mmaps_; }; -- cgit v1.2.1