mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-05-14 10:33:45 +00:00
Adds kernel headers so that <linux/list.h> (and others) could be included directly. Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
27 lines
741 B
C
27 lines
741 B
C
#ifndef KVM__LINUX_KERNEL_H_
|
|
#define KVM__LINUX_KERNEL_H_
|
|
|
|
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
|
|
|
|
#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
|
|
#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
|
|
|
|
#ifndef offsetof
|
|
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
|
#endif
|
|
|
|
#ifndef container_of
|
|
/**
|
|
* container_of - cast a member of a structure out to the containing structure
|
|
* @ptr: the pointer to the member.
|
|
* @type: the type of the container struct this is embedded in.
|
|
* @member: the name of the member within the struct.
|
|
*
|
|
*/
|
|
#define container_of(ptr, type, member) ({ \
|
|
const typeof(((type *)0)->member) * __mptr = (ptr); \
|
|
(type *)((char *)__mptr - offsetof(type, member)); })
|
|
#endif
|
|
|
|
#endif
|