summaryrefslogtreecommitdiffstats
path: root/lib/list
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-10-21 11:03:17 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-11-13 17:20:28 +0800
commitdd8fe077022138d1f6aca7e6d6cceec61f56ce95 (patch)
tree1ceb699411ddbdcde2a96cdbea85d275f454b736 /lib/list
parent59dbd08e2a8354e71578c0d7ca2283951a384801 (diff)
downloadtalos-petitboot-dd8fe077022138d1f6aca7e6d6cceec61f56ce95.tar.gz
talos-petitboot-dd8fe077022138d1f6aca7e6d6cceec61f56ce95.zip
lib: consolidate util macros in util/util.h
This change groups the offsetof, container_of and ARRAY_SIZE macros in a single header file util/util.h. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib/list')
-rw-r--r--lib/list/list.h12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/list/list.h b/lib/list/list.h
index 0174b90..ad562e4 100644
--- a/lib/list/list.h
+++ b/lib/list/list.h
@@ -1,6 +1,8 @@
#ifndef _LIST_H
#define _LIST_H
+#include <util/util.h>
+
struct list_item {
struct list_item *prev, *next;
};
@@ -9,16 +11,6 @@ struct list {
struct list_item head;
};
-#ifndef container_of
-#define container_of(_ptr, _type, _member) ({ \
- const typeof( ((_type *)0)->_member ) *__mptr = (_ptr); \
- (_type *)( (char *)__mptr - offsetof(_type,_member) );})
-#endif
-
-#ifndef offsetof
-#define offsetof(_type, _member) ((size_t) &((_type *)0)->_member)
-#endif
-
#define list_for_each(_list, _pos) \
for (_pos = (_list)->head.next; _pos != ((_list)->head); _pos = _pos->next)
OpenPOWER on IntegriCloud