libcamera: file: Manage fd by UniqueFD
Manages the file descriptor owned by File by UniqueFD. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
committed by
Laurent Pinchart
parent
a59c471e5a
commit
edd70612e5
@@ -17,6 +17,7 @@
|
||||
#include <libcamera/base/class.h>
|
||||
#include <libcamera/base/flags.h>
|
||||
#include <libcamera/base/span.h>
|
||||
#include <libcamera/base/unique_fd.h>
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
@@ -48,7 +49,7 @@ public:
|
||||
bool exists() const;
|
||||
|
||||
bool open(OpenMode mode);
|
||||
bool isOpen() const { return fd_ != -1; }
|
||||
bool isOpen() const { return fd_.isValid(); }
|
||||
OpenMode openMode() const { return mode_; }
|
||||
void close();
|
||||
|
||||
@@ -73,7 +74,7 @@ private:
|
||||
void unmapAll();
|
||||
|
||||
std::string name_;
|
||||
int fd_;
|
||||
UniqueFD fd_;
|
||||
OpenMode mode_;
|
||||
|
||||
int error_;
|
||||
|
||||
Reference in New Issue
Block a user