mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-26 14:50:34 +08:00
make vdev file flags and priv consistent with nuttx
This commit is contained in:
@@ -33,14 +33,6 @@
|
||||
|
||||
#include "uORBDeviceNode.hpp"
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#define FILE_FLAGS(filp) filp->f_oflags
|
||||
#define FILE_PRIV(filp) filp->f_priv
|
||||
#else
|
||||
#define FILE_FLAGS(filp) filp->flags
|
||||
#define FILE_PRIV(filp) filp->priv
|
||||
#endif
|
||||
|
||||
#include "uORBDeviceNode.hpp"
|
||||
#include "uORBUtils.hpp"
|
||||
#include "uORBManager.hpp"
|
||||
@@ -58,7 +50,7 @@ uORB::DeviceNode::SubscriberData *uORB::DeviceNode::filp_to_sd(cdev::file_t *fil
|
||||
}
|
||||
|
||||
#endif
|
||||
return (SubscriberData *)(FILE_PRIV(filp));
|
||||
return (SubscriberData *)(filp->f_priv);
|
||||
}
|
||||
|
||||
uORB::DeviceNode::DeviceNode(const struct orb_metadata *meta, const char *path, int priority, unsigned int queue_size) :
|
||||
@@ -82,7 +74,7 @@ uORB::DeviceNode::open(cdev::file_t *filp)
|
||||
int ret;
|
||||
|
||||
/* is this a publisher? */
|
||||
if (FILE_FLAGS(filp) == PX4_F_WRONLY) {
|
||||
if (filp->f_oflags == PX4_F_WRONLY) {
|
||||
|
||||
/* become the publisher if we can */
|
||||
lock();
|
||||
@@ -111,7 +103,7 @@ uORB::DeviceNode::open(cdev::file_t *filp)
|
||||
}
|
||||
|
||||
/* is this a new subscriber? */
|
||||
if (FILE_FLAGS(filp) == PX4_F_RDONLY) {
|
||||
if (filp->f_oflags == PX4_F_RDONLY) {
|
||||
|
||||
/* allocate subscriber data */
|
||||
SubscriberData *sd = new SubscriberData{};
|
||||
@@ -123,7 +115,7 @@ uORB::DeviceNode::open(cdev::file_t *filp)
|
||||
/* If there were any previous publications, allow the subscriber to read them */
|
||||
sd->generation = _generation - (_queue_size < _generation ? _queue_size : _generation);
|
||||
|
||||
FILE_PRIV(filp) = (void *)sd;
|
||||
filp->f_priv = (void *)sd;
|
||||
|
||||
ret = CDev::open(filp);
|
||||
|
||||
@@ -137,7 +129,7 @@ uORB::DeviceNode::open(cdev::file_t *filp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (FILE_FLAGS(filp) == 0) {
|
||||
if (filp->f_oflags == 0) {
|
||||
return CDev::open(filp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user