On Wed, 16 Oct 2002, Poul-Henning Kamp wrote: > In message <[EMAIL PROTECTED]>, 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 [EMAIL PROTECTED] with "unsubscribe freebsd-net" in the body of the message