Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
kernel.h File Reference
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

Go to the source code of this file.

Macros

#define DIV_ROUND_UP(n, d)   (((n) + (d) - 1) / (d))
 
#define PERF_ALIGN(x, a)   __PERF_ALIGN_MASK(x, (typeof(x))(a)-1)
 
#define __PERF_ALIGN_MASK(x, mask)   (((x)+(mask))&~(mask))
 
#define offsetof(TYPE, MEMBER)   ((size_t) &((TYPE *)0)->MEMBER)
 
#define container_of(ptr, type, member)
 
#define BUILD_BUG_ON_ZERO(e)   (sizeof(struct { int:-!!(e); }))
 
#define max(x, y)
 
#define min(x, y)
 
#define roundup(x, y)
 
#define BUG_ON(cond)   assert(!(cond))
 
#define cpu_to_le64(x)   (x)
 
#define cpu_to_le32(x)   (x)
 
#define pr_fmt(fmt)   fmt
 
#define pr_err(fmt,...)   eprintf(0, pr_fmt(fmt), ##__VA_ARGS__)
 
#define pr_warning(fmt,...)   eprintf(0, pr_fmt(fmt), ##__VA_ARGS__)
 
#define pr_info(fmt,...)   eprintf(0, pr_fmt(fmt), ##__VA_ARGS__)
 
#define pr_debug(fmt,...)   eprintf(1, pr_fmt(fmt), ##__VA_ARGS__)
 
#define pr_debugN(n, fmt,...)   eprintf(n, pr_fmt(fmt), ##__VA_ARGS__)
 
#define pr_debug2(fmt,...)   pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__)
 
#define pr_debug3(fmt,...)   pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)
 
#define pr_debug4(fmt,...)   pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
 
#define __round_mask(x, y)   ((__typeof__(x))((y)-1))
 
#define round_up(x, y)   ((((x)-1) | __round_mask(x, y))+1)
 
#define round_down(x, y)   ((x) & ~__round_mask(x, y))
 

Functions

int eprintf (int level, const char *fmt,...) __attribute__((format(printf
 

Macro Definition Documentation

#define __PERF_ALIGN_MASK (   x,
  mask 
)    (((x)+(mask))&~(mask))

Definition at line 12 of file kernel.h.

#define __round_mask (   x,
  y 
)    ((__typeof__(x))((y)-1))

Definition at line 130 of file kernel.h.

#define BUG_ON (   cond)    assert(!(cond))

Definition at line 62 of file kernel.h.

#define BUILD_BUG_ON_ZERO (   e)    (sizeof(struct { int:-!!(e); }))

Definition at line 31 of file kernel.h.

#define container_of (   ptr,
  type,
  member 
)
Value:
({ \
const typeof(((type *)0)->member) * __mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type, member)); })

container_of - cast a member of a structure out to the containing structure : the pointer to the member. : the type of the container struct this is embedded in. : the name of the member within the struct.

Definition at line 26 of file kernel.h.

#define cpu_to_le32 (   x)    (x)

Definition at line 71 of file kernel.h.

#define cpu_to_le64 (   x)    (x)

Definition at line 70 of file kernel.h.

#define DIV_ROUND_UP (   n,
  d 
)    (((n) + (d) - 1) / (d))

Definition at line 9 of file kernel.h.

#define max (   x,
  y 
)
Value:
({ \
typeof(x) _max1 = (x); \
typeof(y) _max2 = (y); \
(void) (&_max1 == &_max2); \
_max1 > _max2 ? _max1 : _max2; })

Definition at line 34 of file kernel.h.

#define min (   x,
  y 
)
Value:
({ \
typeof(x) _min1 = (x); \
typeof(y) _min2 = (y); \
(void) (&_min1 == &_min2); \
_min1 < _min2 ? _min1 : _min2; })

Definition at line 42 of file kernel.h.

#define offsetof (   TYPE,
  MEMBER 
)    ((size_t) &((TYPE *)0)->MEMBER)

Definition at line 15 of file kernel.h.

#define PERF_ALIGN (   x,
  a 
)    __PERF_ALIGN_MASK(x, (typeof(x))(a)-1)

Definition at line 11 of file kernel.h.

#define pr_debug (   fmt,
  ... 
)    eprintf(1, pr_fmt(fmt), ##__VA_ARGS__)

Definition at line 116 of file kernel.h.

#define pr_debug2 (   fmt,
  ... 
)    pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__)

Definition at line 120 of file kernel.h.

#define pr_debug3 (   fmt,
  ... 
)    pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)

Definition at line 121 of file kernel.h.

#define pr_debug4 (   fmt,
  ... 
)    pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)

Definition at line 122 of file kernel.h.

#define pr_debugN (   n,
  fmt,
  ... 
)    eprintf(n, pr_fmt(fmt), ##__VA_ARGS__)

Definition at line 118 of file kernel.h.

#define pr_err (   fmt,
  ... 
)    eprintf(0, pr_fmt(fmt), ##__VA_ARGS__)

Definition at line 110 of file kernel.h.

#define pr_fmt (   fmt)    fmt

Definition at line 107 of file kernel.h.

#define pr_info (   fmt,
  ... 
)    eprintf(0, pr_fmt(fmt), ##__VA_ARGS__)

Definition at line 114 of file kernel.h.

#define pr_warning (   fmt,
  ... 
)    eprintf(0, pr_fmt(fmt), ##__VA_ARGS__)

Definition at line 112 of file kernel.h.

#define round_down (   x,
  y 
)    ((x) & ~__round_mask(x, y))

Definition at line 132 of file kernel.h.

#define round_up (   x,
  y 
)    ((((x)-1) | __round_mask(x, y))+1)

Definition at line 131 of file kernel.h.

#define roundup (   x,
  y 
)
Value:
( \
{ \
const typeof(y) __y = y; \
(((x) + (__y - 1)) / __y) * __y; \
} \
)

Definition at line 50 of file kernel.h.

Function Documentation

int eprintf ( int  level,
const char fmt,
  ... 
)