Subject: Re: COPYIN/COPYOUT macro problems Re: IOCTL implementation and kernel/userland addresses
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Reinoud Zandijk <reinoud@netbsd.org>
List: tech-kern
Date: 08/26/2005 17:14:08
--WhfpMioaduB5tiZL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Aug 26, 2005 at 12:28:20PM +0900, YAMAMOTO Takashi wrote:
> > but then you loose the advantage of just calling
> > 	kucopyin(flags & KFIOCTL, from, to, len);
> > 	kucopyin(uio.uio_segflg == UIO_SYSSPACE, from, to, len);
> > 	kucopyin(ISSET(flags, ...), from, to, len);
> 
> what is an advantage?

that it doesn't care about `magic' values like UIO_SYSSPACE or FKIOCTL and 
the likes.

> > or go for `aliases' that check specific values in
> > 	ioctl_copyin(flag, ...)
> > 	uio_copyin(flag, ...)
> > functions.
> 
> do you mean that these "aliases" convert the flag to
> UIO_* and call kucopyin?  i personally prefer it.
> (i don't understand what's uio_copyin, tho)

With uio_copyin() i just meant that it uses the uio flag semantic... not 
very usefull in normal operation i guess.

Maybe its better to keep it to ioctl_copyin() and ioctl_copyout() for that 
are the places that its going to be usefull most. If other places have 
similar issues we could create the stubs for them too.

regards,

Reinoud

--WhfpMioaduB5tiZL
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQw8xuYKcNwBDyKpoAQLsigf+OMQPzjQgrf1fhRHVWzZsKW+IKDTmi3W3
DPV7xxzVPOFxxgy7bVVhYW5JBUFGiLGvNvANCbG4sgvB1HHnRN28m8be706oYnre
EcRkAX5xD58rJb3Jsqr+amY7VEXtE5uZMz3ahn6KIxsnA1pFQWgrtEMTiVruRgjv
xXLmcXVanSgr462Nr6wdHoicsW90/bFQ9M9xikUT5Wx8mdK0gKxWAh0aFQkTJwQ9
R2SafcoWb2eRLqqJ1yDm8iMfnQ84U0IGAU6vnxAPmxgKxW7QElOvNzv2/cwGJIMO
nieEi823AsdD75dXcCD7/OB05OOZlZ2fOTVxY5uE/5ZGLTsevyIyzw==
=2Cil
-----END PGP SIGNATURE-----

--WhfpMioaduB5tiZL--