Linux: changed CDev to VDev for virtual device implementation

To avoid confusion when a real device and a virtual device is
being used, changed CDev to VDev for Linux.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-04-20 11:34:12 -07:00
parent 8c8f57b5b4
commit ccd18929fc
11 changed files with 95 additions and 113 deletions
+9 -9
View File
@@ -84,7 +84,7 @@ inline bool valid_fd(int fd)
int px4_open(const char *path, int flags)
{
CDev *dev = CDev::getDev(path);
VDev *dev = VDev::getDev(path);
int ret = 0;
int i;
@@ -117,7 +117,7 @@ int px4_close(int fd)
{
int ret;
if (valid_fd(fd)) {
CDev *dev = (CDev *)(filemap[fd]->cdev);
VDev *dev = (VDev *)(filemap[fd]->cdev);
PX4_DEBUG("px4_close fd = %d\n", fd);
ret = dev->close(filemap[fd]);
filemap[fd] = NULL;
@@ -135,7 +135,7 @@ ssize_t px4_read(int fd, void *buffer, size_t buflen)
{
int ret;
if (valid_fd(fd)) {
CDev *dev = (CDev *)(filemap[fd]->cdev);
VDev *dev = (VDev *)(filemap[fd]->cdev);
PX4_DEBUG("px4_read fd = %d\n", fd);
ret = dev->read(filemap[fd], (char *)buffer, buflen);
}
@@ -152,7 +152,7 @@ ssize_t px4_write(int fd, const void *buffer, size_t buflen)
{
int ret = PX4_ERROR;
if (valid_fd(fd)) {
CDev *dev = (CDev *)(filemap[fd]->cdev);
VDev *dev = (VDev *)(filemap[fd]->cdev);
PX4_DEBUG("px4_write fd = %d\n", fd);
ret = dev->write(filemap[fd], (const char *)buffer, buflen);
}
@@ -169,7 +169,7 @@ int px4_ioctl(int fd, int cmd, unsigned long arg)
{
int ret = PX4_ERROR;
if (valid_fd(fd)) {
CDev *dev = (CDev *)(filemap[fd]->cdev);
VDev *dev = (VDev *)(filemap[fd]->cdev);
PX4_DEBUG("px4_ioctl fd = %d\n", fd);
ret = dev->ioctl(filemap[fd], cmd, arg);
}
@@ -206,8 +206,8 @@ int px4_poll(px4_pollfd_struct_t *fds, nfds_t nfds, int timeout)
// If fd is valid
if (valid_fd(fds[i].fd))
{
CDev *dev = (CDev *)(filemap[fds[i].fd]->cdev);;
PX4_DEBUG("px4_poll: CDev->poll(setup) %d\n", fds[i].fd);
VDev *dev = (VDev *)(filemap[fds[i].fd]->cdev);;
PX4_DEBUG("px4_poll: VDev->poll(setup) %d\n", fds[i].fd);
ret = dev->poll(filemap[fds[i].fd], &fds[i], true);
if (ret < 0)
@@ -250,8 +250,8 @@ int px4_poll(px4_pollfd_struct_t *fds, nfds_t nfds, int timeout)
// If fd is valid
if (valid_fd(fds[i].fd))
{
CDev *dev = (CDev *)(filemap[fds[i].fd]->cdev);;
PX4_DEBUG("px4_poll: CDev->poll(teardown) %d\n", fds[i].fd);
VDev *dev = (VDev *)(filemap[fds[i].fd]->cdev);;
PX4_DEBUG("px4_poll: VDev->poll(teardown) %d\n", fds[i].fd);
ret = dev->poll(filemap[fds[i].fd], &fds[i], false);
if (ret < 0)