summaryrefslogtreecommitdiff
path: root/src/libcamera
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-11-29 20:38:10 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-12-04 23:05:07 +0200
commit560f5cf998646ddc54a20dc1c7326012834d3204 (patch)
treeb0b4da6084cdf2c10b359b986ad27e33baa6bdfb /src/libcamera
parent5c85e7024027c90b1b054782e510691b8b9c7419 (diff)
libcamera: base: shared_fd: Rename fd() to get()
For consistency with UniqueFD, rename the fd() function to get(). Renaming UniqueFD::get() to fd() would have been another option, but was rejected to keep as close as possible to the std::shared_ptr<> and std::unique_ptr<> APIs. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Diffstat (limited to 'src/libcamera')
-rw-r--r--src/libcamera/base/shared_fd.cpp4
-rw-r--r--src/libcamera/framebuffer.cpp2
-rw-r--r--src/libcamera/ipc_pipe.cpp2
-rw-r--r--src/libcamera/mapped_framebuffer.cpp4
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp2
-rw-r--r--src/libcamera/v4l2_videodevice.cpp6
6 files changed, 10 insertions, 10 deletions
diff --git a/src/libcamera/base/shared_fd.cpp b/src/libcamera/base/shared_fd.cpp
index 346b4a85..bb35b448 100644
--- a/src/libcamera/base/shared_fd.cpp
+++ b/src/libcamera/base/shared_fd.cpp
@@ -208,7 +208,7 @@ SharedFD &SharedFD::operator=(SharedFD &&other)
*/
/**
- * \fn SharedFD::fd()
+ * \fn SharedFD::get()
* \brief Retrieve the numerical file descriptor
* \return The numerical file descriptor, which may be -1 if the SharedFD
* instance is invalid
@@ -227,7 +227,7 @@ SharedFD &SharedFD::operator=(SharedFD &&other)
*/
UniqueFD SharedFD::dup() const
{
- UniqueFD dupFd(::dup(fd()));
+ UniqueFD dupFd(::dup(get()));
if (!dupFd.isValid()) {
int ret = -errno;
LOG(SharedFD, Error)
diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp
index fbf8f1c2..ee93ba4d 100644
--- a/src/libcamera/framebuffer.cpp
+++ b/src/libcamera/framebuffer.cpp
@@ -218,7 +218,7 @@ ino_t fileDescriptorInode(const SharedFD &fd)
return 0;
struct stat st;
- int ret = fstat(fd.fd(), &st);
+ int ret = fstat(fd.get(), &st);
if (ret < 0) {
ret = -errno;
LOG(Buffer, Fatal)
diff --git a/src/libcamera/ipc_pipe.cpp b/src/libcamera/ipc_pipe.cpp
index 3b47032d..31a0ca09 100644
--- a/src/libcamera/ipc_pipe.cpp
+++ b/src/libcamera/ipc_pipe.cpp
@@ -113,7 +113,7 @@ IPCUnixSocket::Payload IPCMessage::payload() const
}
for (const SharedFD &fd : fds_)
- payload.fds.push_back(fd.fd());
+ payload.fds.push_back(fd.get());
return payload;
}
diff --git a/src/libcamera/mapped_framebuffer.cpp b/src/libcamera/mapped_framebuffer.cpp
index 464d35fe..6860069b 100644
--- a/src/libcamera/mapped_framebuffer.cpp
+++ b/src/libcamera/mapped_framebuffer.cpp
@@ -198,7 +198,7 @@ MappedFrameBuffer::MappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags)
std::map<int, MappedBufferInfo> mappedBuffers;
for (const FrameBuffer::Plane &plane : buffer->planes()) {
- const int fd = plane.fd.fd();
+ const int fd = plane.fd.get();
if (mappedBuffers.find(fd) == mappedBuffers.end()) {
const size_t length = lseek(fd, 0, SEEK_END);
mappedBuffers[fd] = MappedBufferInfo{ nullptr, 0, length };
@@ -220,7 +220,7 @@ MappedFrameBuffer::MappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags)
}
for (const FrameBuffer::Plane &plane : buffer->planes()) {
- const int fd = plane.fd.fd();
+ const int fd = plane.fd.get();
auto &info = mappedBuffers[fd];
if (!info.address) {
void *address = mmap(nullptr, info.mapLength, mmapFlags,
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 4885a939..321b72ad 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1479,7 +1479,7 @@ void RPiCameraData::setIspControls(const ControlList &controls)
Span<uint8_t> s = value.data();
bcm2835_isp_lens_shading *ls =
reinterpret_cast<bcm2835_isp_lens_shading *>(s.data());
- ls->dmabuf = lsTable_.fd();
+ ls->dmabuf = lsTable_.get();
}
isp_[Isp::Input].dev()->setControls(&ctrls);
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 0d214d9e..b4b89e27 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -282,7 +282,7 @@ bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer) const
return false;
for (unsigned int i = 0; i < planes.size(); i++)
- if (planes_[i].fd != planes[i].fd.fd() ||
+ if (planes_[i].fd != planes[i].fd.get() ||
planes_[i].length != planes[i].length)
return false;
return true;
@@ -1517,9 +1517,9 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)
if (buf.memory == V4L2_MEMORY_DMABUF) {
if (multiPlanar) {
for (unsigned int p = 0; p < numV4l2Planes; ++p)
- v4l2Planes[p].m.fd = planes[p].fd.fd();
+ v4l2Planes[p].m.fd = planes[p].fd.get();
} else {
- buf.m.fd = planes[0].fd.fd();
+ buf.m.fd = planes[0].fd.get();
}
}