blob: 9c61c7cda9363360595dee03ffe787b81f6c2919 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_STDDEF_H
2#define _LINUX_STDDEF_H
3
David Howells607ca462012-10-13 10:46:48 +01004#include <uapi/linux/stddef.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005
Lubos Lunak2084c242012-03-21 14:08:24 +01006#undef NULL
7#define NULL ((void *)0)
8
Richard Knutsson6e218282006-09-30 23:27:11 -07009enum {
10 false = 0,
11 true = 1
12};
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#undef offsetof
15#ifdef __compiler_offsetof
Joe Perches8c7fbe52015-06-25 15:01:16 -070016#define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#else
Joe Perches8c7fbe52015-06-25 15:01:16 -070018#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#endif
Denys Vlasenko38764882015-03-09 15:52:17 +010020
21/**
22 * offsetofend(TYPE, MEMBER)
23 *
24 * @TYPE: The type of the structure
25 * @MEMBER: The member within the structure to get the end offset of
26 */
27#define offsetofend(TYPE, MEMBER) \
28 (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
Joe Perches8c7fbe52015-06-25 15:01:16 -070029
30#endif