summaryrefslogtreecommitdiff
path: root/include/kernel/container_of.h
blob: 1b5b4445d895558acdb2ab835e0b6556329cf6c2 (plain)
1
2
3
4
5
6
7
8
9
10
#ifndef KERNEL_CONTAINER_OF_H
#define KERNEL_CONTAINER_OF_H

#ifndef container_of
#define container_of(ptr, type, member) ({                              \
                const typeof(((type*)0)->member)*__mptr = (ptr);        \
                (type*)((char*)__mptr - offsetof(type, member)); })
#endif

#endif