How to use VOP_IOCTL?

Konstantin Belousov kostikbel at gmail.com
Tue Aug 7 13:34:15 UTC 2012


On Mon, Aug 06, 2012 at 09:45:03PM +0300, Oleksandr Dudinskyi wrote:
> Hi,
> I am the GSoC student I need some advice in my project.
> http://wiki.freebsd.org/SummerOfCode2012/UDFImplementation
> I want to use function VOP_IOCTL() in my project, but not very informative
> man, introduced me to the confusion. Specifically I don't know which of the
> flags use. In NetBSD after call this function, request proceeds to function
> cdioctl () in  sys/dev/scsipi/cd.c . Where the command( one of the
> VOP_IOCTL parameters) is selection. Could you tell me how to reach this
> logic in Freebsd(call cdioctl () in  sys/cam /scsi/scsi_cd.c)? Or share
> some articles on the topic.

VOP_IOCTL() is just a forwarder of the generic ioctl arguments to an
implementation of the VOP in the vnode' filesystem. You claim that you
'want to use VOP_IOCTL', but you later describes that you want to 
execute some CDROM-specific ioctl's. These things are not related.

My first question would be why do you need to execute device-specific
ioctl's in the filesystem code ? Do you plan for your UDF implementation
to be usable with e.g. md-mounted images ?

Second, if my guess is right and you want to execute device-specific ioctl
on the special device specified as your mount source, you probably need
the geom providers' geom ioctl method. You should have performed some
initial manipulations with the provider anyway at the mount time to
get access to i/o operations on it. Then provider->geom->ioctl is the
pointer to the provider ioctl implementation.

Might be, look at the g_dev_ioctl(9) for start.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20120807/b13f101a/attachment.pgp


More information about the freebsd-fs mailing list