diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/aac/aac.c | 8 | ||||
-rw-r--r-- | sys/dev/aac/aacvar.h | 7 | ||||
-rw-r--r-- | sys/dev/advansys/adwcam.c | 1 | ||||
-rw-r--r-- | sys/dev/ahb/ahb.c | 2 | ||||
-rw-r--r-- | sys/dev/dpt/dpt_scsi.c | 2 | ||||
-rw-r--r-- | sys/dev/mly/mly.c | 9 | ||||
-rw-r--r-- | sys/dev/sound/midi/midisynth.c | 1 | ||||
-rw-r--r-- | sys/dev/sym/sym_hipd.c | 4 | ||||
-rw-r--r-- | sys/dev/wds/wd7000.c | 4 |
9 files changed, 7 insertions, 31 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 * diff --git a/sys/dev/advansys/adwcam.c b/sys/dev/advansys/adwcam.c index 95777a6..77c1718 100644 --- a/sys/dev/advansys/adwcam.c +++ b/sys/dev/advansys/adwcam.c @@ -44,7 +44,6 @@ * code retain the above copyright notice and this comment without * modification. */ -#include <stddef.h> /* For offsetof */ #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/dev/ahb/ahb.c b/sys/dev/ahb/ahb.c index 0388b3e..9fc15a4 100644 --- a/sys/dev/ahb/ahb.c +++ b/sys/dev/ahb/ahb.c @@ -28,8 +28,6 @@ * $FreeBSD$ */ -#include <stddef.h> /* For offsetof() */ - #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> diff --git a/sys/dev/dpt/dpt_scsi.c b/sys/dev/dpt/dpt_scsi.c index 7b5fd94..9fa12e5 100644 --- a/sys/dev/dpt/dpt_scsi.c +++ b/sys/dev/dpt/dpt_scsi.c @@ -54,8 +54,6 @@ #include <sys/malloc.h> #include <sys/kernel.h> -#include <stddef.h> /* For offsetof */ - #include <sys/bus.h> #include <machine/bus_memio.h> diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c index 15073f4..91cec9c 100644 --- a/sys/dev/mly/mly.c +++ b/sys/dev/mly/mly.c @@ -42,9 +42,6 @@ #include <cam/scsi/scsi_all.h> -/* XXX: This is not where we should get fldoff() from. */ -#include <struct.h> - #include <dev/mly/mlyreg.h> #include <dev/mly/mlyvar.h> #define MLY_DEFINE_TABLES @@ -442,9 +439,9 @@ mly_enable_mmbox(struct mly_softc *sc) bzero(&mci, sizeof(mci)); mci.sub_ioctl = MDACIOCTL_SETMEMORYMAILBOX; /* set buffer addresses */ - mci.param.setmemorymailbox.command_mailbox_physaddr = sc->mly_mmbox_busaddr + fldoff(mly_mmbox, mmm_command); - mci.param.setmemorymailbox.status_mailbox_physaddr = sc->mly_mmbox_busaddr + fldoff(mly_mmbox, mmm_status); - mci.param.setmemorymailbox.health_buffer_physaddr = sc->mly_mmbox_busaddr + fldoff(mly_mmbox, mmm_health); + mci.param.setmemorymailbox.command_mailbox_physaddr = sc->mly_mmbox_busaddr + offsetof(struct mly_mmbox, mmm_command); + mci.param.setmemorymailbox.status_mailbox_physaddr = sc->mly_mmbox_busaddr + offsetof(struct mly_mmbox, mmm_status); + mci.param.setmemorymailbox.health_buffer_physaddr = sc->mly_mmbox_busaddr + offsetof(struct mly_mmbox, mmm_health); /* set buffer sizes - abuse of data_size field is revolting */ sp = (u_int8_t *)&mci.data_size; diff --git a/sys/dev/sound/midi/midisynth.c b/sys/dev/sound/midi/midisynth.c index 42a2a7e..0c6dd8a 100644 --- a/sys/dev/sound/midi/midisynth.c +++ b/sys/dev/sound/midi/midisynth.c @@ -34,7 +34,6 @@ * midi messages, and vice versa. */ -#include <stddef.h> #include <dev/sound/midi/midi.h> #define TYPEDRANGE(type, x, lower, upper) \ diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index fa6fcc2..45f148a 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -62,7 +62,6 @@ /* #define SYM_DEBUG_GENERIC_SUPPORT */ #include <pci.h> -#include <stddef.h> /* For offsetof */ #include <sys/param.h> /* @@ -393,9 +392,6 @@ static __inline struct sym_quehead *sym_remque_tail(struct sym_quehead *head) /* * These ones should have been already defined. */ -#ifndef offsetof -#define offsetof(t, m) ((size_t) (&((t *)0)->m)) -#endif #ifndef MIN #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif diff --git a/sys/dev/wds/wd7000.c b/sys/dev/wds/wd7000.c index abba71d3..c09532a 100644 --- a/sys/dev/wds/wd7000.c +++ b/sys/dev/wds/wd7000.c @@ -159,10 +159,6 @@ #include <isa/isavar.h> #include <isa/pnpvar.h> -/* somehow offsetof() was lost in FreeBSD 5.0, so declare it */ -#undef offsetof -#define offsetof(type, field) ( (int)( &((type *)0)->field ) ) - #define WDSTOPHYS(wp, a) ( ((u_long)a) - ((u_long)wp->dx) + ((u_long)wp->dx_p) ) #define WDSTOVIRT(wp, a) ( ((char *)a) - ((char*)wp->dx_p) + ((char *)wp->dx) ) |