Date: Wed, 18 Jun 2003 16:43:44 -0400 From: "cd_freebsd" <cd_freebsd@gatorzone.com> To: <freebsd-hackers@freebsd.org> Subject: Performing Ioctls to Devices in Kernel Message-ID: <200306181643.AA112656480@gatorzone.com>
next in thread | raw e-mail | index | archive | help
I want to be able to send IOCTL commands to standard devices (fdd,cdrom,kbd) from my kernel driver. Whereas I can do reads and writes using the vn_rdwr commands, how do I do IOCTLS? VOP_IOCTL keeps giving me EINVAL when I try to send the DIOCGDINFO IOCTL. My code is basically NDINIT(&_VdFloppyND, LOOKUP, FOLLOW, UIO_SYSSPACE, "/dev/fd0", p); vn_open(&_VdFloppyND, FREAD, 0); osError = VOP_IOCTL(_VdFloppyND.ni_vp, DIOCGDINFO, (caddr_t)&dl, 0, // fflags ??? p->p_ucred, p); Questions: 1) Is there something I am doing wrong? 2) Should I use something else other than vn_open/vn_rdwr/VOP_*? The error occurs regardless whether the floppy is mounted or not.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306181643.AA112656480>