Subject: Re: Upgrade of `struct vnd_ioctl'
To: Christos Zoulas <christos@astron.com>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 02/12/2007 21:06:22
--HQqNQMH5OMGB2qNu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Feb 12, 2007 at 07:49:33PM +0000, Christos Zoulas wrote:
> In article <20070212054652.GA24959@baal.public.ulaval.ca>,
> Arnaud Lacombe  <arnaud.lacombe.1@ulaval.ca> wrote:
> >-=3D-=3D-=3D-=3D-=3D-
> >
> >On Sun, Feb 11, 2007 at 11:46:39PM +0100, Quentin Garnier wrote:
> >> On Sun, Feb 11, 2007 at 02:27:22PM -0500, Arnaud Lacombe wrote:
> >> > I'd like to change the size of the `vnd_size' member of struct vnd_i=
octl
> >> > from `int' to `u_quad_t' (or any other unsigned 64bits type, but
> >> > u_quad_t is used by `struct vattr->va_size').
> >>=20
> >> uint64_t should be preferred for new code.
> >ok, done
> >
> >> > Does the change needs any compatibility layer to be added ?=20
> >>=20
> >> The process is quite simple:  keep a copy of the current structure with
> >> a different name (e.g., oldvnd_ioctl), and create new ioctl commands
> >> referencing that structure with the name OXXX.
> >>=20
> >> E.g.:
> >>=20
> >> #define OVNDIOCSET       _IOWR('F', 0, struct oldvnd_ioctl)
> >>=20
> >> Then you add an entry in ioctl handler for those commands that do what
> >> they're supposed to do (i.e., in that case convert the value), and put
> >> those specific parts under COMPAT_40.
> >>=20
> >does the attached patch looks good ?
> >
> > - Arnaud
>=20
> Sure...

Huh, no.

First, you should decide if you want VNDIOOxxx or OVNDIOxxx and make it
consistent all through the patch.

Then, with that patch, VNDIOOCSET will not have the intended result...
And will write 4 extra bytes in memory or fault, depending on some
factors.

What you need to do in the OVNDIOxxx cases is actually *convert* data
(which points to a struct oldvnd_ioctl) into a struct vnd_ioctl.

Then it will be fine.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"You could have made it, spitting out benchmarks
Owe it to yourself not to fail"
Amplifico, Spitting Out Benchmarks, Hometakes Vol. 2, 2005.

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

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

iQEVAwUBRdDIvdgoQloHrPnoAQIdwwgAuA+7qE7CvFFXTwHZRn324IY8ftELOyKg
p/dR4Nqi/+0SFZjlno22LzL93NhbUPv/Vj6dV6bPTg2cKdhGIhMDYqtz+aGa/XEw
cAozf+ixfZRSBnPaxQxm+XxGCEXzwgMsRSPIPghM6oIsfZubP6korKNxbQRV5tAQ
niWAfwGtT6+lxUDYPWzt9/izknYZKqsQTY3fDjpb5Mu7xKRBl6dJNyLuFG33HgYV
6dCDgL/u+cwGJLLRyQ5tVudBi/fmEdWWSH4GmRDiieIs9Un0/OI3T3RzqG+hJNix
GmS3sX2snHYVhNt/qC82vNfbSAB/9XnM8S0nOfzW12E0tMy2BvwN1Q==
=zNYs
-----END PGP SIGNATURE-----

--HQqNQMH5OMGB2qNu--