Subject: Re: IOCTL implementation and kernel/userland addresses
To: Frank van der Linden <fvdl@netbsd.org>
From: Reinoud Zandijk <reinoud@netbsd.org>
List: tech-kern
Date: 02/04/2005 23:00:31
--vkogqOf2sHV7VnPd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hiya Frank,
On Fri, Feb 04, 2005 at 09:44:17PM +0100, Frank van der Linden wrote:
> On Fri, Feb 04, 2005 at 06:36:08PM +0100, Reinoud Zandijk wrote:
> I see where your confusion comes from.. ioctl is wrapped in a piece of
> code which copies in/out data depending on _IOR/_IOW/_IOWR. So, the
> ioctl backend implementations (devices) don't deal with the copyin/copyout.
thats what i thought! but there are situations like in the
CDIOREADTOCENTRIES where variable length data is transported... shouldn't
these at least be callable both ways?
> However, ioctl is and always has been a userspace interface.
ok. If so, then how to call operations on a device from say a filingsystem
other than the standard read/write?
> If you want something usable from kernel space, implement a seperate
> function which can be called by both the ioctl code and your code.
but how would i call the code? i.e. i get a generic block device vnode and
then have to request the parameters using in-kernel scsipi calls but only
when its a device handled by scsipi offcource! Thats when i call an ioctl.
I could offcource add an ioctl for in-kernel use only but that would be
ugly IMHO.
> Btw, copyout_proc is only to be used when data is to be copied to
> an address space that is not the current process.
Ah! i thought it was a more generic copyout that could determine if its the
current process or not and/or kernel space...
Cheers,
Reinoud
--vkogqOf2sHV7VnPd
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)
iQEVAwUBQgPwdoKcNwBDyKpoAQJEmgf/ReheoIViA7HLs68Aso9ABZXKZFK9HyDo
MWhR8AuQS2sRfmG5zc9bzaHIu+s9GCFW9a13iLH5bmcgO5d6MwOjSF59vtZqV29q
/l9UVuhzF6D19nUbpoFyQMgfTTslqqyNXzpkdeswUV5H+VofERDyuWvCYfc4hjnj
X2f/smlNzEVn7UQt9kn2L/4pgRYwd9xDi7SCIw1mUT2ltmXNNRpNSiCjUnOx/Dpc
rgPiZh6/OEH1+rKMYRl9dS6PRGhJjubMEbTan4dIkFSyVG5Wwc0wPe25DqcyJSs1
7ZNw3IZIT0EXhQwThCReaSlFxUYQlRsEc4gF9CpHvxQOb/HUdVCV2g==
=KSah
-----END PGP SIGNATURE-----
--vkogqOf2sHV7VnPd--