mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-05 19:47:48 +00:00
dm: types: add container_of macro
Add standard container_of macro to access the parent struct pointer. Tracked-On: #1536 Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
parent
4e057c32d2
commit
6a96878e0b
@ -18,6 +18,11 @@ typedef uint64_t cap_ioctl_t;
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
const typeof(((type *)0)->member) * __mptr = (ptr); \
|
||||
(type *)((char *)__mptr - (offsetof(type, member))); \
|
||||
})
|
||||
|
||||
#define __aligned(x) __attribute__((aligned(x)))
|
||||
#define __section(x) __attribute__((__section__(x)))
|
||||
#define __MAKE_SET(set, sym) \
|
||||
|
Loading…
Reference in New Issue
Block a user