[libcamera-devel] [PATCH 6/6] libcamera: Global s/devnode/deviceNode rename
Niklas Söderlund
niklas.soderlund at ragnatech.se
Tue Jan 22 12:43:09 CET 2019
Hi Jacopo,
Thanks for your work.
On 2019-01-21 18:27:05 +0100, Jacopo Mondi wrote:
> Do not use the abreviated version for members, variables and getter
> methods.
>
> Library-wise rename, no intended functional changes.
>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
I think this patch should be merged soon as to not create new
inconsistencies :-)
> ---
> src/libcamera/include/media_device.h | 6 +++---
> src/libcamera/include/media_object.h | 6 +++---
> src/libcamera/include/v4l2_device.h | 4 ++--
> src/libcamera/media_device.cpp | 14 +++++++-------
> src/libcamera/media_object.cpp | 14 +++++++-------
> src/libcamera/v4l2_device.cpp | 14 +++++++-------
> test/media_device/media_device_link_test.cpp | 2 +-
> test/media_device/media_device_print_test.cpp | 12 ++++++------
> test/pipeline/ipu3/ipu3_pipeline_test.cpp | 6 +++---
> 9 files changed, 39 insertions(+), 39 deletions(-)
>
> diff --git a/src/libcamera/include/media_device.h b/src/libcamera/include/media_device.h
> index a8dec0d..ba3046d 100644
> --- a/src/libcamera/include/media_device.h
> +++ b/src/libcamera/include/media_device.h
> @@ -21,7 +21,7 @@ namespace libcamera {
> class MediaDevice
> {
> public:
> - MediaDevice(const std::string &devnode);
> + MediaDevice(const std::string &deviceNode);
> ~MediaDevice();
>
> bool acquire();
> @@ -35,7 +35,7 @@ public:
> bool valid() const { return valid_; }
>
> const std::string driver() const { return driver_; }
> - const std::string devnode() const { return devnode_; }
> + const std::string deviceNode() const { return deviceNode_; }
>
> const std::vector<MediaEntity *> &entities() const { return entities_; }
> MediaEntity *getEntityByName(const std::string &name) const;
> @@ -49,7 +49,7 @@ public:
>
> private:
> std::string driver_;
> - std::string devnode_;
> + std::string deviceNode_;
> int fd_;
> bool valid_;
> bool acquired_;
> diff --git a/src/libcamera/include/media_object.h b/src/libcamera/include/media_object.h
> index fad55a0..64095be 100644
> --- a/src/libcamera/include/media_object.h
> +++ b/src/libcamera/include/media_object.h
> @@ -85,7 +85,7 @@ class MediaEntity : public MediaObject
> public:
> const std::string &name() const { return name_; }
> unsigned int function() const { return function_; }
> - const std::string &devnode() const { return devnode_; }
> + const std::string &deviceNode() const { return deviceNode_; }
> unsigned int deviceMajor() const { return major_; }
> unsigned int deviceMinor() const { return minor_; }
>
> @@ -94,7 +94,7 @@ public:
> const MediaPad *getPadByIndex(unsigned int index) const;
> const MediaPad *getPadById(unsigned int id) const;
>
> - int setDeviceNode(const std::string &devnode);
> + int setDeviceNode(const std::string &deviceNode);
>
> private:
> friend class MediaDevice;
> @@ -106,7 +106,7 @@ private:
>
> std::string name_;
> unsigned int function_;
> - std::string devnode_;
> + std::string deviceNode_;
> unsigned int major_;
> unsigned int minor_;
>
> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h
> index 81992dc..ca4583c 100644
> --- a/src/libcamera/include/v4l2_device.h
> +++ b/src/libcamera/include/v4l2_device.h
> @@ -39,7 +39,7 @@ class MediaEntity;
> class V4L2Device
> {
> public:
> - explicit V4L2Device(const std::string &devnode);
> + explicit V4L2Device(const std::string &deviceNode);
> explicit V4L2Device(const MediaEntity &entity);
> V4L2Device(const V4L2Device &) = delete;
> ~V4L2Device();
> @@ -89,7 +89,7 @@ private:
> int getFormat();
> };
>
> - std::string devnode_;
> + std::string deviceNode_;
> int fd_;
> V4L2Capability caps_;
> std::unique_ptr<V4L2Format> format_;
> diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp
> index 0ee5506..7cf4ce6 100644
> --- a/src/libcamera/media_device.cpp
> +++ b/src/libcamera/media_device.cpp
> @@ -61,13 +61,13 @@ namespace libcamera {
>
> /**
> * \brief Construct a MediaDevice
> - * \param devnode The media device node path
> + * \param deviceNode The media device node path
> *
> * Once constructed the media device is invalid, and must be opened and
> * populated with open() and populate() before the media graph can be queried.
> */
> -MediaDevice::MediaDevice(const std::string &devnode)
> - : devnode_(devnode), fd_(-1), valid_(false), acquired_(false)
> +MediaDevice::MediaDevice(const std::string &deviceNode)
> + : deviceNode_(deviceNode), fd_(-1), valid_(false), acquired_(false)
> {
> }
>
> @@ -143,10 +143,10 @@ int MediaDevice::open()
> return -EBUSY;
> }
>
> - int ret = ::open(devnode_.c_str(), O_RDWR);
> + int ret = ::open(deviceNode_.c_str(), O_RDWR);
> if (ret < 0) {
> ret = -errno;
> - LOG(Error) << "Failed to open media device at " << devnode_
> + LOG(Error) << "Failed to open media device at " << deviceNode_
> << ": " << strerror(-ret);
> return ret;
> }
> @@ -280,9 +280,9 @@ int MediaDevice::populate()
> */
>
> /**
> - * \fn MediaDevice::devnode()
> + * \fn MediaDevice::deviceNode()
> * \brief Retrieve the media device device node path
> - * \return The MediaDevice devnode path
> + * \return The MediaDevice deviceNode path
> */
>
> /**
> diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp
> index 7d07538..bda1e6c 100644
> --- a/src/libcamera/media_object.cpp
> +++ b/src/libcamera/media_object.cpp
> @@ -244,7 +244,7 @@ void MediaPad::addLink(MediaLink *link)
> *
> * In addition to their graph id, media graph entities are identified by a
> * name() unique in the media device context. They implement a function() and
> - * may expose a devnode().
> + * may expose a deviceNode().
> */
>
> /**
> @@ -264,7 +264,7 @@ void MediaPad::addLink(MediaLink *link)
> */
>
> /**
> - * \fn MediaEntity::devnode()
> + * \fn MediaEntity::deviceNode()
> * \brief Retrieve the entity's device node path, if any
> *
> * \sa int setDeviceNode()
> @@ -324,22 +324,22 @@ const MediaPad *MediaEntity::getPadById(unsigned int id) const
>
> /**
> * \brief Set the path to the device node for the associated interface
> - * \param devnode The interface device node path associated with this entity
> + * \param deviceNode The interface device node path associated with this entity
> * \return 0 on success, or a negative error code if the device node can't be
> * accessed
> */
> -int MediaEntity::setDeviceNode(const std::string &devnode)
> +int MediaEntity::setDeviceNode(const std::string &deviceNode)
> {
> /* Make sure the device node can be accessed. */
> - int ret = ::access(devnode.c_str(), R_OK | W_OK);
> + int ret = ::access(deviceNode.c_str(), R_OK | W_OK);
> if (ret < 0) {
> ret = -errno;
> - LOG(Error) << "Device node " << devnode << " can't be accessed: "
> + LOG(Error) << "Device node " << deviceNode << " can't be accessed: "
> << strerror(-ret);
> return ret;
> }
>
> - devnode_ = devnode;
> + deviceNode_ = deviceNode;
>
> return 0;
> }
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index 126f6f2..0e15f86 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -118,10 +118,10 @@ bool V4L2Capability::isOutput() const
>
> /**
> * \brief Construct a V4L2Device
> - * \param devnode The file-system path to the video device node
> + * \param deviceNode The file-system path to the video device node
> */
> -V4L2Device::V4L2Device(const std::string &devnode)
> - : devnode_(devnode), fd_(-1)
> +V4L2Device::V4L2Device(const std::string &deviceNode)
> + : deviceNode_(deviceNode), fd_(-1)
> {
> }
>
> @@ -132,7 +132,7 @@ V4L2Device::V4L2Device(const std::string &devnode)
> * Construct a V4L2Device from a MediaEntity's device node path.
> */
> V4L2Device::V4L2Device(const MediaEntity &entity)
> - : V4L2Device(entity.devnode())
> + : V4L2Device(entity.deviceNode())
> {
> }
>
> @@ -154,10 +154,10 @@ int V4L2Device::open()
> return -EBUSY;
> }
>
> - ret = ::open(devnode_.c_str(), O_RDWR);
> + ret = ::open(deviceNode_.c_str(), O_RDWR);
> if (ret < 0) {
> ret = -errno;
> - LOG(Error) << "Failed to open V4L2 device '" << devnode_
> + LOG(Error) << "Failed to open V4L2 device '" << deviceNode_
> << "': " << strerror(-ret);
> return ret;
> }
> @@ -171,7 +171,7 @@ int V4L2Device::open()
> return ret;
> }
>
> - LOG(Debug) << "Opened '" << devnode_ << "' "
> + LOG(Debug) << "Opened '" << deviceNode_ << "' "
> << caps_.bus_info() << ": " << caps_.driver()
> << ": " << caps_.card();
>
> diff --git a/test/media_device/media_device_link_test.cpp b/test/media_device/media_device_link_test.cpp
> index 2297e33..ac5b632 100644
> --- a/test/media_device/media_device_link_test.cpp
> +++ b/test/media_device/media_device_link_test.cpp
> @@ -55,7 +55,7 @@ class MediaDeviceLinkTest : public Test
>
> if (dev_->open()) {
> cerr << "Failed to open media device at "
> - << dev_->devnode() << endl;
> + << dev_->deviceNode() << endl;
> return TestFail;
> }
>
> diff --git a/test/media_device/media_device_print_test.cpp b/test/media_device/media_device_print_test.cpp
> index 13af722..3eef973 100644
> --- a/test/media_device/media_device_print_test.cpp
> +++ b/test/media_device/media_device_print_test.cpp
> @@ -35,7 +35,7 @@ protected:
> void cleanup() { }
>
> private:
> - int testMediaDevice(string devnode);
> + int testMediaDevice(string deviceNode);
>
> void printMediaGraph(const MediaDevice &media, ostream &os);
> void printLinkFlags(const MediaLink *link, ostream &os);
> @@ -68,7 +68,7 @@ void MediaDevicePrintTest::printLinkFlags(const MediaLink *link, ostream &os)
> */
> void MediaDevicePrintTest::printMediaGraph(const MediaDevice &media, ostream &os)
> {
> - os << "\n" << media.driver() << " - " << media.devnode() << "\n\n";
> + os << "\n" << media.driver() << " - " << media.deviceNode() << "\n\n";
>
> for (auto const &entity : media.entities()) {
> os << "\"" << entity->name() << "\"\n";
> @@ -108,9 +108,9 @@ void MediaDevicePrintTest::printMediaGraph(const MediaDevice &media, ostream &os
> }
>
> /* Test a single media device. */
> -int MediaDevicePrintTest::testMediaDevice(const string devnode)
> +int MediaDevicePrintTest::testMediaDevice(const string deviceNode)
> {
> - MediaDevice dev(devnode);
> + MediaDevice dev(deviceNode);
> int ret;
>
> /* Fuzzy open/close sequence. */
> @@ -144,7 +144,7 @@ int MediaDevicePrintTest::testMediaDevice(const string devnode)
> #define MAX_MEDIA_DEV 256
> int MediaDevicePrintTest::run()
> {
> - const string devnode("/dev/media");
> + const string deviceNode("/dev/media");
> unsigned int i;
> int ret = 77; /* skip test exit code */
>
> @@ -153,7 +153,7 @@ int MediaDevicePrintTest::run()
> * system, if any.
> */
> for (i = 0; i < MAX_MEDIA_DEV; i++) {
> - string mediadev = devnode + to_string(i);
> + string mediadev = deviceNode + to_string(i);
> struct stat pstat = { };
>
> if (stat(mediadev.c_str(), &pstat))
> diff --git a/test/pipeline/ipu3/ipu3_pipeline_test.cpp b/test/pipeline/ipu3/ipu3_pipeline_test.cpp
> index deaee40..efe9eaf 100644
> --- a/test/pipeline/ipu3/ipu3_pipeline_test.cpp
> +++ b/test/pipeline/ipu3/ipu3_pipeline_test.cpp
> @@ -45,7 +45,7 @@ private:
>
> int IPU3PipelineTest::init()
> {
> - const string devnode("/dev/media");
> + const string deviceNode("/dev/media");
> bool cio2 = false;
> bool imgu = false;
> unsigned int i;
> @@ -59,7 +59,7 @@ int IPU3PipelineTest::init()
> * as soon as we hit a non accessible media device.
> */
> for (i = 0; i < 256; i++) {
> - string mediadev = devnode + to_string(i);
> + string mediadev = deviceNode + to_string(i);
> struct stat pstat = { };
>
> if (stat(mediadev.c_str(), &pstat))
> @@ -82,7 +82,7 @@ int IPU3PipelineTest::init()
> */
> ret = dev.populate();
> if (ret) {
> - cerr << "Failed to populate media device " << dev.devnode() << endl;
> + cerr << "Failed to populate media device " << dev.deviceNode() << endl;
> return TestFail;
> }
>
> --
> 2.20.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list