ioctl: tidy up a bit more
authorAlan Cox <alan@linux.intel.com>
Mon, 12 Jan 2015 11:13:19 +0000 (11:13 +0000)
committerAlan Cox <alan@linux.intel.com>
Mon, 12 Jan 2015 11:13:19 +0000 (11:13 +0000)
Unknown ioctls return ENOTTY not EINVAL (Unix history...) so we need to do
the right thing. In addition we automatically set the errno so blkdev doesn't
have to care about it

Kernel/dev/blkdev.c
Kernel/devio.c

index 99ae15b..514bf64 100644 (file)
@@ -125,10 +125,8 @@ int blkdev_ioctl(uint8_t minor, uint16_t request, char *data)
     blkdev_t *blk;
     data; /* unused */
 
-    if (request != BLKFLSBUF) {
-       udata.u_error = ENXIO;
+    if (request != BLKFLSBUF)
        return -1;
-    }
 
     /* we trust that blkdev_open() has already verified that this minor number is valid */
     blk = &blkdev_table[minor >> 4];
index 27e5996..f17285a 100644 (file)
@@ -277,7 +277,7 @@ int d_ioctl(uint16_t dev, uint16_t request, char *data)
 
        if ((*dev_tab[major(dev)].dev_ioctl) (minor(dev), request, data)) {
                if (!udata.u_error)     // maybe the ioctl routine might set this?
-                       udata.u_error = EINVAL;
+                       udata.u_error = ENOTTY;
                return -1;
        }