From 1af83ca6df779fc3c7f8f4fc48f3ca82d824987d Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Mon, 21 Jan 2019 17:53:28 +0100 Subject: libcamera: Global s/devnode/deviceNode rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not use the abreviated version for members, variables and getter methods. Library-wise rename, no intended functional changes. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/libcamera/device_enumerator.cpp | 28 ++++++++++++++-------------- src/libcamera/include/device_enumerator.h | 6 +++--- 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 +++++++------- 8 files changed, 46 insertions(+), 46 deletions(-) (limited to 'src/libcamera') diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp index 22d4edee..fcf71af6 100644 --- a/src/libcamera/device_enumerator.cpp +++ b/src/libcamera/device_enumerator.cpp @@ -189,18 +189,18 @@ DeviceEnumerator::~DeviceEnumerator() /** * \brief Add a media device to the enumerator - * \param[in] devnode path to the media device to add + * \param[in] deviceNode path to the media device to add * - * Create a media device for the \a devnode, open it, populate its media graph, + * Create a media device for the \a deviceNode, open it, populate its media graph, * and look up device nodes associated with all entities. Store the media device * in the internal list for later matching with pipeline handlers. * * \return 0 on success, or a negative error code if the media device can't be * created or populated */ -int DeviceEnumerator::addDevice(const std::string &devnode) +int DeviceEnumerator::addDevice(const std::string &deviceNode) { - MediaDevice *media = new MediaDevice(devnode); + MediaDevice *media = new MediaDevice(deviceNode); int ret = media->open(); if (ret < 0) @@ -209,25 +209,25 @@ int DeviceEnumerator::addDevice(const std::string &devnode) ret = media->populate(); if (ret < 0) { LOG(DeviceEnumerator, Info) - << "Unable to populate media device " << devnode + << "Unable to populate media device " << deviceNode << " (" << strerror(-ret) << "), skipping"; return ret; } LOG(DeviceEnumerator, Debug) << "New media device \"" << media->driver() - << "\" created from " << devnode; + << "\" created from " << deviceNode; /* Associate entities to device node paths. */ for (MediaEntity *entity : media->entities()) { if (entity->deviceMajor() == 0 && entity->deviceMinor() == 0) continue; - std::string devnode = lookupDevnode(entity->deviceMajor(), entity->deviceMinor()); - if (devnode.empty()) + std::string deviceNode = lookupDeviceNode(entity->deviceMajor(), entity->deviceMinor()); + if (deviceNode.empty()) return -EINVAL; - ret = entity->setDeviceNode(devnode); + ret = entity->setDeviceNode(deviceNode); if (ret) return ret; } @@ -267,7 +267,7 @@ MediaDevice *DeviceEnumerator::search(const DeviceMatch &dm) } /** - * \fn DeviceEnumerator::lookupDevnode(int major, int minor) + * \fn DeviceEnumerator::lookupDeviceNode(int major, int minor) * \brief Lookup device node path from device number * \param major The device major number * \param minor The device minor number @@ -358,12 +358,12 @@ done: return ret >= 0 ? 0 : ret; } -std::string DeviceEnumeratorUdev::lookupDevnode(int major, int minor) +std::string DeviceEnumeratorUdev::lookupDeviceNode(int major, int minor) { struct udev_device *device; const char *name; dev_t devnum; - std::string devnode = std::string(); + std::string deviceNode = std::string(); devnum = makedev(major, minor); device = udev_device_new_from_devnum(udev_, 'c', devnum); @@ -372,11 +372,11 @@ std::string DeviceEnumeratorUdev::lookupDevnode(int major, int minor) name = udev_device_get_devnode(device); if (name) - devnode = name; + deviceNode = name; udev_device_unref(device); - return devnode; + return deviceNode; } } /* namespace libcamera */ diff --git a/src/libcamera/include/device_enumerator.h b/src/libcamera/include/device_enumerator.h index c5541c5f..40c7750b 100644 --- a/src/libcamera/include/device_enumerator.h +++ b/src/libcamera/include/device_enumerator.h @@ -45,12 +45,12 @@ public: MediaDevice *search(const DeviceMatch &dm); protected: - int addDevice(const std::string &devnode); + int addDevice(const std::string &deviceNode); private: std::vector devices_; - virtual std::string lookupDevnode(int major, int minor) = 0; + virtual std::string lookupDeviceNode(int major, int minor) = 0; }; class DeviceEnumeratorUdev: public DeviceEnumerator @@ -65,7 +65,7 @@ public: private: struct udev *udev_; - std::string lookupDevnode(int major, int minor) final; + std::string lookupDeviceNode(int major, int minor) final; }; } /* namespace libcamera */ diff --git a/src/libcamera/include/media_device.h b/src/libcamera/include/media_device.h index a8dec0d3..ba3046dd 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 &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 fad55a06..64095bec 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 c6f3d9a0..b92e1f1c 100644 --- a/src/libcamera/include/v4l2_device.h +++ b/src/libcamera/include/v4l2_device.h @@ -36,7 +36,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(); @@ -52,7 +52,7 @@ public: const char *busName() const { return caps_.bus_info(); } private: - std::string devnode_; + std::string deviceNode_; int fd_; V4L2Capability caps_; }; diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp index eb2e68bb..81c6a773 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -63,13 +63,13 @@ LOG_DEFINE_CATEGORY(MediaDevice) /** * \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) { } @@ -145,12 +145,12 @@ 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(MediaDevice, Error) << "Failed to open media device at " - << devnode_ << ": " << strerror(-ret); + << deviceNode_ << ": " << strerror(-ret); return ret; } fd_ = ret; @@ -285,9 +285,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 a8d92e5f..baf9aeaa 100644 --- a/src/libcamera/media_object.cpp +++ b/src/libcamera/media_object.cpp @@ -246,7 +246,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(). */ /** @@ -266,7 +266,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() @@ -326,23 +326,23 @@ 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(MediaDevice, Error) - << "Device node " << devnode << " can't be accessed: " + << "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 5809fc62..2b17fa1e 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -88,10 +88,10 @@ LOG_DEFINE_CATEGORY(V4L2) /** * \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) { } @@ -102,7 +102,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()) { } @@ -124,11 +124,11 @@ 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(V4L2, Error) - << "Failed to open V4L2 device '" << devnode_ + << "Failed to open V4L2 device '" << deviceNode_ << "': " << strerror(-ret); return ret; } @@ -144,7 +144,7 @@ int V4L2Device::open() } LOG(V4L2, Debug) - << "Opened '" << devnode_ << "' " + << "Opened '" << deviceNode_ << "' " << caps_.bus_info() << ": " << caps_.driver() << ": " << caps_.card(); -- cgit v1.2.1