On Tue, 11 Mar 2014, Patrick Welche wrote:
The attached trivial patch allows vnd(4) to support generic disk ioctls. The only one in kern/subr_disk.c at the moment is DIOCGDISKINFO. Before:$ ./vndtest /dev/vnd0a vndtest: DIOCGDISKINFO: Inappropriate ioctl for deviceAfter: $ ./vndtest /dev/vnd0a size of /dev/vnd0a: 524288 bytes
That's good, but ...
default: - return ENOTTY; + error = disk_ioctl(&vnd->sc_dkdev, cmd, data, flag, l); + if (error == EPASSTHROUGH) + return ENOTTY; + else + return error;
I think there's no need to translate EPASSTHROUGH to ENOTTY here; that translation will be done by sys_ioctl() before returning to userland. Also, several other disk drivers have their ioctl handlers call disk_ioctl early (see fdioctl, wdioctl, sdioctl, dkioctl, raidioctl, among others), and it's not clear why vndioctl doesn't do that.
--apb (Alan Barrett)