Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Nov 2009 16:33:39 +0100
From:      Ed Schouten <ed@80386.nl>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r198706 - head/sys/sys
Message-ID:  <20091101153339.GH1293@hoeg.nl>
In-Reply-To: <alpine.BSF.2.00.0911011506130.2930@fledge.watson.org>
References:  <200910311035.n9VAZfIb082932@svn.freebsd.org> <alpine.BSF.2.00.0911011506130.2930@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Bina0ufSB9dLMnVr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Robert,

* Robert Watson <rwatson@FreeBSD.org> wrote:
> The underlying change seems fine, especially in -CURRENT, but I'm
> confused by the paragraph here on alignment and safety.  What do you
> mean by safe, and does it matter?

With safe I mean that all useful members still begin at the same offset
within the structure. I'm not sure whether it matters at all, because I
can imagine d_devs could be moved around without having any effect, but
I'm not going to make any predictions on that.

> From a casual glance (perhaps mistaken), it looks like this changes
> the KBI, so all modules declaring struct cdevsw will need to be
> rebuilt.

It shouldn't, right?

-	uid_t			d_uid;
-	gid_t			d_gid;
-	mode_t			d_mode;
-	const char		*d_kind;
+
+	int32_t			d_spare0[3];
+	void			*d_spare1[3];

	/* These fields should not be messed with by drivers */
-	LIST_ENTRY(cdevsw)	d_list;

d_uid, d_gid and d_mode is equal to:

	int32_t		d_uid;
	int32_t		d_gid;
	int16_t		d_mode;

Because d_kind is a pointer, there will be a hole in the structure of at
least 2 bytes (maybe even 6), which means we can safely extend d_mode to
32 bits as well. I could have decided to leave it at uint16_t, but that
would only obfuscate it even more when we would try to reclaim some
space there.

d_list is just two pointers, so I merged it with d_kind into an array of
three pointers.

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkrtqlMACgkQ52SDGA2eCwUPBgCfXSx7mkhM4zu3hSCN+jcucGxC
M38An0vDiD4tkSSbYUHnG4MEDC4FOyOT
=K5yx
-----END PGP SIGNATURE-----

--Bina0ufSB9dLMnVr--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091101153339.GH1293>