libcamera: media_object: Rename major/minor functions

The system libraries define macro's for major/minor through
<sys/types.h> on some versions of GCC/GLibc.

To prevent namespace collisions with these macros, rename our major and
minor device node accessors.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Kieran Bingham 2019-01-07 15:51:53 +00:00
parent 5af15d1931
commit eda3cfa1e3
3 changed files with 6 additions and 6 deletions

View file

@ -208,10 +208,10 @@ int DeviceEnumerator::addDevice(const std::string &devnode)
/* Associate entities to device node paths. */ /* Associate entities to device node paths. */
for (MediaEntity *entity : media->entities()) { for (MediaEntity *entity : media->entities()) {
if (entity->major() == 0 && entity->minor() == 0) if (entity->deviceMajor() == 0 && entity->deviceMinor() == 0)
continue; continue;
std::string devnode = lookupDevnode(entity->major(), entity->minor()); std::string devnode = lookupDevnode(entity->deviceMajor(), entity->deviceMinor());
if (devnode.empty()) if (devnode.empty())
return -EINVAL; return -EINVAL;

View file

@ -80,8 +80,8 @@ class MediaEntity : public MediaObject
{ {
public: public:
const std::string &name() const { return name_; } const std::string &name() const { return name_; }
unsigned int major() const { return major_; } unsigned int deviceMajor() const { return major_; }
unsigned int minor() const { return minor_; } unsigned int deviceMinor() const { return minor_; }
const std::vector<MediaPad *> &pads() const { return pads_; } const std::vector<MediaPad *> &pads() const { return pads_; }

View file

@ -212,14 +212,14 @@ void MediaPad::addLink(MediaLink *link)
*/ */
/** /**
* \fn MediaEntity::major() * \fn MediaEntity::deviceMajor()
* \brief Retrieve the major number of the interface associated with the entity * \brief Retrieve the major number of the interface associated with the entity
* \return The interface major number, or 0 if the entity isn't associated with * \return The interface major number, or 0 if the entity isn't associated with
* an interface * an interface
*/ */
/** /**
* \fn MediaEntity::minor() * \fn MediaEntity::deviceMinor()
* \brief Retrieve the minor number of the interface associated with the entity * \brief Retrieve the minor number of the interface associated with the entity
* \return The interface minor number, or 0 if the entity isn't associated with * \return The interface minor number, or 0 if the entity isn't associated with
* an interface * an interface