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/mly | |
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/mly')
-rw-r--r-- | sys/dev/mly/mly.c | 9 |
1 files changed, 3 insertions, 6 deletions
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; |