Date: Thu, 17 Oct 2002 01:03:20 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Poul-Henning Kamp <phk@critter.freebsd.dk> Cc: Jeffrey Hsu <hsu@FreeBSD.ORG>, <net@FreeBSD.ORG>, <arch@FreeBSD.ORG> Subject: Re: RFC: eliminating the _IP_VHL hack. Message-ID: <20021017004627.O5865-100000@gamplex.bde.org> In-Reply-To: <69413.1034756200@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 16 Oct 2002, Poul-Henning Kamp wrote: > In message <20021016172019.W4358-100000@gamplex.bde.org>, Bruce Evans writes: > >On Tue, 15 Oct 2002, Jeffrey Hsu wrote: > > > >> > The side effect of having some source-files using the _IP_VHL hack and > >> > some not is that sizeof(struct ip) varies from file to file, which at > >> > best is confusing an at worst the source of some really evil bugs. > > > >There is no such effect, or ip would not work. > > s/,/ with our current compilers and architectures,/ It is the non-_IP_VHL case that will break. The _IP_VHL case requires little more than the existence of uint8_t, which is now required by POSIX. > >> > I would therefore propose to eliminate the _IP_VHL hack from the kernel > >> > to end this state of (potential) confusion > > > >This would remove the least unportable version. > > Could be, but there is no point in us having two different versions, > neither of which is guaranteed to be portable, in particular when > one of the two is private to FreeBSD and not even consistently used > there. I agree that source oce portability is a problem and wasn't helped by not completing this change. > For reference: > > NetBSD hasn't got the _IP_VHL but has a __packed__ on the > structure. As you may know, I don't like gccisms like __packed__. NetBSD actually uses __attribute__(__packed__) like we used to in other places. Our __packed doesn't exactly help portability, since it is a syntax error on systems that don't #define it. > OpenBSD hasn't got the _IP_VHL either, but hasn't adopted > the __packed__ from NetBSD. > > Linux also uses bitfields and endianess #ifdefs. There are also an amazing number of unportable bit-fields in <sys/ata.h> <sys/cdio.h>, <sys/cdrio.h> and <sys/dvdio.h>. The declarations of these don't even use endianness #ifdefs or __packed in most cases. Some unportabilities are avoided using the gcc extension of small bit-field types. > I'll ammend my proposal to include a __packed__ and a CTASSERT on > the size of struct ip == 20. I prefer just the CTASSERT until __packed is found to be necessary. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021017004627.O5865-100000>