Replace callse to ioctl() in the OS to file_ioctl()

This commit is contained in:
Gregory Nutt
2018-09-15 11:47:24 -06:00
parent 5a0c6547d9
commit a83b6d990b
6 changed files with 71 additions and 73 deletions
+8 -7
View File
@@ -73,7 +73,7 @@
int bchdev_unregister(FAR const char *chardev)
{
FAR struct bchlib_s *bch;
int fd;
FAR struct file *filestruct;
int ret;
/* Sanity check */
@@ -87,19 +87,20 @@ int bchdev_unregister(FAR const char *chardev)
/* Open the character driver associated with chardev */
fd = nx_open(chardev, O_RDONLY);
if (fd < 0)
ret = file_open(&filestruct, chardev, O_RDONLY);
if (ret < 0)
{
_err("ERROR: Failed to open %s: %d\n", chardev, fd);
return fd;
_err("ERROR: Failed to open %s: %d\n", chardev, ret);
return ret;
}
/* Get a reference to the internal data structure. On success, we
* will hold a reference count on the state structure.
*/
ret = ioctl(fd, DIOC_GETPRIV, (unsigned long)((uintptr_t)&bch));
(void)close(fd);
ret = file_ioctl(&filestruct, DIOC_GETPRIV,
(unsigned long)((uintptr_t)&bch));
(void)file_close_detached(&filestruct);
if (ret < 0)
{