Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
cmpxchg.h File Reference

Go to the source code of this file.

Macros

#define xchg(ptr, x)
 
#define cmpxchg(ptr, o, n)
 
#define tas(ptr)   (xchg((ptr), 1))
 

Functions

unsigned long __xchg_called_with_bad_pointer (void)
 
unsigned long __cmpxchg_called_with_bad_pointer (void)
 

Macro Definition Documentation

#define cmpxchg (   ptr,
  o,
  n 
)
Value:
({ \
typeof(*(ptr)) __x; \
switch (sizeof(*(ptr))) { \
case 4: \
__x = (typeof(__x))(typeof(__x-__x))atomic_cmpxchg( \
(atomic_t *)(ptr), \
(u32)(typeof((o)-(o)))(o), \
(u32)(typeof((n)-(n)))(n)); \
break; \
case 8: \
__x = (typeof(__x))(typeof(__x-__x))atomic64_cmpxchg( \
(atomic64_t *)(ptr), \
(u64)(typeof((o)-(o)))(o), \
(u64)(typeof((n)-(n)))(n)); \
break; \
default: \
__cmpxchg_called_with_bad_pointer(); \
} \
__x; \
})

Definition at line 47 of file cmpxchg.h.

#define tas (   ptr)    (xchg((ptr), 1))

Definition at line 69 of file cmpxchg.h.

#define xchg (   ptr,
  x 
)
Value:
({ \
typeof(*(ptr)) __x; \
switch (sizeof(*(ptr))) { \
case 4: \
__x = (typeof(__x))(typeof(__x-__x))atomic_xchg( \
(atomic_t *)(ptr), \
(u32)(typeof((x)-(x)))(x)); \
break; \
case 8: \
__x = (typeof(__x))(typeof(__x-__x))atomic64_xchg( \
(atomic64_t *)(ptr), \
(u64)(typeof((x)-(x)))(x)); \
break; \
default: \
__xchg_called_with_bad_pointer(); \
} \
__x; \
})

Definition at line 27 of file cmpxchg.h.

Function Documentation

unsigned long __cmpxchg_called_with_bad_pointer ( void  )
unsigned long __xchg_called_with_bad_pointer ( void  )