Blame view

include/linux/stddef.h 581 Bytes
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
  #ifndef _LINUX_STDDEF_H
  #define _LINUX_STDDEF_H
607ca46e9   David Howells   UAPI: (Scripted) ...
3
  #include <uapi/linux/stddef.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
5
  
  #undef NULL
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
  #define NULL ((void *)0)
6e2182874   Richard Knutsson   [PATCH] Generic b...
7
8
9
10
11
  
  enum {
  	false	= 0,
  	true	= 1
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
12
13
  #undef offsetof
  #ifdef __compiler_offsetof
8c7fbe579   Joe Perches   stddef.h: move of...
14
  #define offsetof(TYPE, MEMBER)	__compiler_offsetof(TYPE, MEMBER)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
  #else
8c7fbe579   Joe Perches   stddef.h: move of...
16
  #define offsetof(TYPE, MEMBER)	((size_t)&((TYPE *)0)->MEMBER)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
  #endif
387648844   Denys Vlasenko   include/stddef.h:...
18
19
20
21
22
23
24
25
26
  
  /**
   * offsetofend(TYPE, MEMBER)
   *
   * @TYPE: The type of the structure
   * @MEMBER: The member within the structure to get the end offset of
   */
  #define offsetofend(TYPE, MEMBER) \
  	(offsetof(TYPE, MEMBER)	+ sizeof(((TYPE *)0)->MEMBER))
8c7fbe579   Joe Perches   stddef.h: move of...
27
28
  
  #endif