#define offsetof(TYPE,MEMBER)
__compiler_offsetof(TYPE,MEMBER)
#else
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE
*)0)->MEMBER)
#endif
#define container_of(ptr, type, member) ({
\
const typeof( ((type *)0)->member ) *__mptr =
(ptr);
\
(type *)((char *)__mptr – offsetof(type,member)
);})
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
#define define_list(name, type) \
struct name##_head { \
struct list_head _private; \
};
static inline type *name##_head_first(struct
name##_head *head) { \
return
list_entry(head->_private.next,
type,
name); \
}
static inline type *name##_next(const type *node)
Do'stlaringiz bilan baham: |