Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 #ifndef PERF_LINUX_KERNEL_H_
  2 #define PERF_LINUX_KERNEL_H_
  3 
  4 #ifndef offsetof
  5 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  6 #endif
  7 
  8 #ifndef container_of
  9 /**
 10  * container_of - cast a member of a structure out to the containing structure
 11  * @ptr:        the pointer to the member.
 12  * @type:       the type of the container struct this is embedded in.
 13  * @member:     the name of the member within the struct.
 14  *
 15  */
 16 #define container_of(ptr, type, member) ({                      \
 17         const typeof(((type *)0)->member) * __mptr = (ptr);     \
 18         (type *)((char *)__mptr - offsetof(type, member)); })
 19 #endif
 20 
 21 #ifndef max
 22 #define max(x, y) ({                            \
 23         typeof(x) _max1 = (x);                  \
 24         typeof(y) _max2 = (y);                  \
 25         (void) (&_max1 == &_max2);              \
 26         _max1 > _max2 ? _max1 : _max2; })
 27 #endif
 28 
 29 #endif
 30 
  This page was automatically generated by the LXR engine.