diff options
author | phk <phk@FreeBSD.org> | 2000-10-27 11:45:49 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2000-10-27 11:45:49 +0000 |
commit | 54ca48450cf20c453a092aa95d086cd5c5751fcf (patch) | |
tree | 479cfa046c848adf9e8ada76b004eeda743154db /sys/netinet6 | |
parent | ea5581599fd86937f5f773c8e66aedd6a3524383 (diff) | |
download | FreeBSD-src-54ca48450cf20c453a092aa95d086cd5c5751fcf.zip FreeBSD-src-54ca48450cf20c453a092aa95d086cd5c5751fcf.tar.gz |
Convert all users of fldoff() to offsetof(). fldoff() is bad
because it only takes a struct tag which makes it impossible to
use unions, typedefs etc.
Define __offsetof() in <machine/ansi.h>
Define offsetof() in terms of __offsetof() in <stddef.h> and <sys/types.h>
Remove myriad of local offsetof() definitions.
Remove includes of <stddef.h> in kernel code.
NB: Kernelcode should *never* include from /usr/include !
Make <sys/queue.h> include <machine/ansi.h> to avoid polluting the API.
Deprecate <struct.h> with a warning. The warning turns into an error on
01-12-2000 and the file gets removed entirely on 01-01-2001.
Paritials reviews by: various.
Significant brucifications by: bde
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/frag6.c | 4 | ||||
-rw-r--r-- | sys/netinet6/icmp6.c | 4 | ||||
-rw-r--r-- | sys/netinet6/in6_gif.c | 4 | ||||
-rw-r--r-- | sys/netinet6/in6_proto.c | 2 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 4 |
5 files changed, 1 insertions, 17 deletions
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index 1bf7e73..d783357 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -73,10 +73,6 @@ struct ip6q ip6q; /* ip6 reassemble queue */ /* FreeBSD tweak */ MALLOC_DEFINE(M_FTABLE, "fragment", "fragment reassembly header"); -#ifndef offsetof /* XXX */ -#define offsetof(type, member) ((size_t)(&((type *)0)->member)) -#endif - /* * Initialise reassembly queue and fragment identifier. */ diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index a5f6326..9dca71e 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1061,9 +1061,7 @@ icmp6_mtudisc_update(dst, icmp6, m) * with hostname changes by sethostname(3) */ #define hostnamelen strlen(hostname) -#ifndef offsetof /* XXX */ -#define offsetof(type, member) ((size_t)(&((type *)0)->member)) -#endif + static struct mbuf * ni6_input(m, off) struct mbuf *m; diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index e554f5a..c8c1450 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -68,10 +68,6 @@ #include <net/net_osdep.h> -#ifndef offsetof -#define offsetof(s, e) ((int)&((s *)0)->e) -#endif - int in6_gif_output(ifp, family, m, rt) struct ifnet *ifp; diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index 8af642f..87db176 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -129,8 +129,6 @@ #include <net/net_osdep.h> -#define offsetof(type, member) ((size_t)(&((type *)0)->member)) - /* * TCP/IP protocol family: IP6, ICMP6, UDP, TCP. */ diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index a846b3c..95c7d20 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -66,8 +66,6 @@ #include "opt_ipsec.h" -#include <stddef.h> - #include <sys/param.h> #include <sys/malloc.h> #include <sys/proc.h> @@ -409,8 +407,6 @@ rip6_output(m, va_alist) int off; u_int16_t *p; -#define offsetof(type, member) ((size_t)(&((type *)0)->member)) /* XXX */ - /* compute checksum */ if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) off = offsetof(struct icmp6_hdr, icmp6_cksum); |