diff options
Diffstat (limited to 'sys/sys/queue.h')
-rw-r--r-- | sys/sys/queue.h | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/sys/sys/queue.h b/sys/sys/queue.h index ee66759..ab232b8 100644 --- a/sys/sys/queue.h +++ b/sys/sys/queue.h @@ -37,6 +37,8 @@ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ +#include <machine/ansi.h> /* for __offsetof */ + /* * This file defines five types of data structures: singly-linked lists, * singly-linked tail queues, lists, tail queues, and circular queues. @@ -109,18 +111,6 @@ */ /* - * XXX: temporary, we need to find the real home of these. - */ - -/* Offset of the field in the structure. */ -#define __qfldoff(name, field) \ - ((int)&(((struct name *)0)->field)) - -/* Address of the structure from a field. */ -#define __qstrbase(name, addr, field) \ - ((struct name *)((char *)(addr) - __qfldoff(name, field))) - -/* * Singly-linked List declarations. */ #define SLIST_HEAD(name, type) \ @@ -236,7 +226,8 @@ struct { \ #define STAILQ_LAST(head, type, field) \ (STAILQ_EMPTY(head) ? \ NULL : \ - __qstrbase(type, (head)->stqh_last, field)) + ((struct type *) \ + ((char *)((head)->stqh_last) - __offsetof(struct type, field)))) #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) |