Now that we have non-geom_disk based drivers, we need to cover for those,

in case they return EOPNOTSUPP on an ioctl.

Found by:	jhb
This commit is contained in:
phk 2003-01-14 21:31:00 +00:00
parent e0f2b06d78
commit aaa8136387

View File

@ -260,6 +260,7 @@ g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
error = 0;
DROP_GIANT();
gio = NULL;
i = IOCPARM_LEN(cmd);
switch (cmd) {
case DIOCGSECTORSIZE:
@ -322,10 +323,8 @@ g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
KASSERT(gio->func != NULL, ("NULL function but EDIRIOCTL"));
error = (gio->func)(gio->dev, cmd, data, fflag, td);
}
if (gio != NULL)
g_free(gio);
g_waitidle();
if (error == ENOIOCTL) {
if (gio != NULL && (error == EOPNOTSUPP || error == ENOIOCTL)) {
if (g_debugflags & G_T_TOPOLOGY) {
i = IOCGROUP(cmd);
printf("IOCTL(0x%lx) \"%s\"", cmd, gp->name);
@ -342,6 +341,8 @@ g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
}
error = ENOTTY;
}
if (gio != NULL)
g_free(gio);
return (error);
}