loader: allow fs modules to use ioctl()

Currently only directly opened disk device is allowed to access
ioctl() - that is, when file has F_RAW flag set.

The problem is, file systems might need to determine the device parameters,
and we could use already opened device descriptor to communicate this
information.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D49077
This commit is contained in:
Toomas Soome
2025-03-03 23:52:55 +02:00
parent 498b0abe55
commit ccf7b62bd8
+7 -7
View File
@@ -70,12 +70,12 @@ ioctl(int fd, u_long cmd, void *arg)
errno = EBADF;
return (-1);
}
if (f->f_flags & F_RAW) {
if (f->f_dev == NULL)
errno = EIO;
else
errno = (f->f_dev->dv_ioctl)(f, cmd, arg);
if (errno)
return (-1);
return (0);
}
errno = EIO;
return (-1);
if (errno != 0)
return (-1);
return (0);
}