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/dev/aac | |
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/dev/aac')
-rw-r--r-- | sys/dev/aac/aac.c | 8 | ||||
-rw-r--r-- | sys/dev/aac/aacvar.h | 7 |
2 files changed, 4 insertions, 11 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 938db51..87cc9ae 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -1124,12 +1124,12 @@ aac_init(struct aac_softc *sc) ip = &sc->aac_common->ac_init; ip->InitStructRevision = AAC_INIT_STRUCT_REVISION; - ip->AdapterFibsPhysicalAddress = sc->aac_common_busaddr + fldoff(aac_common, ac_fibs); + ip->AdapterFibsPhysicalAddress = sc->aac_common_busaddr + offsetof(struct aac_common, ac_fibs); ip->AdapterFibsVirtualAddress = &sc->aac_common->ac_fibs[0]; ip->AdapterFibsSize = AAC_ADAPTER_FIBS * sizeof(struct aac_fib); ip->AdapterFibAlign = sizeof(struct aac_fib); - ip->PrintfBufferAddress = sc->aac_common_busaddr + fldoff(aac_common, ac_printf); + ip->PrintfBufferAddress = sc->aac_common_busaddr + offsetof(struct aac_common, ac_printf); ip->PrintfBufferSize = AAC_PRINTF_BUFSIZE; ip->HostPhysMemPages = 0; /* not used? */ @@ -1191,7 +1191,7 @@ aac_init(struct aac_softc *sc) * Give the init structure to the controller. */ if (aac_sync_command(sc, AAC_MONKER_INITSTRUCT, - sc->aac_common_busaddr + fldoff(aac_common, ac_init), + sc->aac_common_busaddr + offsetof(struct aac_common, ac_init), 0, 0, 0, NULL)) { device_printf(sc->aac_dev, "error establishing init structure\n"); return(EIO); @@ -1266,7 +1266,7 @@ aac_sync_fib(struct aac_softc *sc, u_int32_t command, u_int32_t xferstate, fib->Header.Size = sizeof(struct aac_fib) + datasize; fib->Header.SenderSize = sizeof(struct aac_fib); fib->Header.SenderFibAddress = (u_int32_t)fib; - fib->Header.ReceiverFibAddress = sc->aac_common_busaddr + fldoff(aac_common, ac_sync_fib); + fib->Header.ReceiverFibAddress = sc->aac_common_busaddr + offsetof(struct aac_common, ac_sync_fib); /* * Copy in data. diff --git a/sys/dev/aac/aacvar.h b/sys/dev/aac/aacvar.h index e65dd66..f70cb64 100644 --- a/sys/dev/aac/aacvar.h +++ b/sys/dev/aac/aacvar.h @@ -336,13 +336,6 @@ struct aac_code_lookup { u_int32_t code; }; -/* - * Borrowed from <struct.h> - */ -/* Offset of the field in the structure. */ -#define fldoff(name, field) \ - ((int)&(((struct name *)0)->field)) - /******************************************************************************** * Queue primitives * |