Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
atomic_64.h File Reference
#include <linux/types.h>
#include <asm/cmpxchg.h>

Go to the source code of this file.

Macros

#define ATOMIC_INIT(i)   { (i) }
 
#define ATOMIC64_INIT(i)   { (i) }
 
#define atomic_read(v)   (*(volatile int *)&(v)->counter)
 
#define atomic64_read(v)   (*(volatile long *)&(v)->counter)
 
#define atomic_set(v, i)   (((v)->counter) = i)
 
#define atomic64_set(v, i)   (((v)->counter) = i)
 
#define atomic_dec_return(v)   atomic_sub_ret(1, v)
 
#define atomic64_dec_return(v)   atomic64_sub_ret(1, v)
 
#define atomic_inc_return(v)   atomic_add_ret(1, v)
 
#define atomic64_inc_return(v)   atomic64_add_ret(1, v)
 
#define atomic_sub_return(i, v)   atomic_sub_ret(i, v)
 
#define atomic64_sub_return(i, v)   atomic64_sub_ret(i, v)
 
#define atomic_add_return(i, v)   atomic_add_ret(i, v)
 
#define atomic64_add_return(i, v)   atomic64_add_ret(i, v)
 
#define atomic_inc_and_test(v)   (atomic_inc_return(v) == 0)
 
#define atomic64_inc_and_test(v)   (atomic64_inc_return(v) == 0)
 
#define atomic_sub_and_test(i, v)   (atomic_sub_ret(i, v) == 0)
 
#define atomic64_sub_and_test(i, v)   (atomic64_sub_ret(i, v) == 0)
 
#define atomic_dec_and_test(v)   (atomic_sub_ret(1, v) == 0)
 
#define atomic64_dec_and_test(v)   (atomic64_sub_ret(1, v) == 0)
 
#define atomic_inc(v)   atomic_add(1, v)
 
#define atomic64_inc(v)   atomic64_add(1, v)
 
#define atomic_dec(v)   atomic_sub(1, v)
 
#define atomic64_dec(v)   atomic64_sub(1, v)
 
#define atomic_add_negative(i, v)   (atomic_add_ret(i, v) < 0)
 
#define atomic64_add_negative(i, v)   (atomic64_add_ret(i, v) < 0)
 
#define atomic_cmpxchg(v, o, n)   (cmpxchg(&((v)->counter), (o), (n)))
 
#define atomic_xchg(v, new)   (xchg(&((v)->counter), new))
 
#define atomic64_cmpxchg(v, o, n)   ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
 
#define atomic64_xchg(v, new)   (xchg(&((v)->counter), new))
 
#define atomic64_inc_not_zero(v)   atomic64_add_unless((v), 1, 0)
 
#define smp_mb__before_atomic_dec()   barrier()
 
#define smp_mb__after_atomic_dec()   barrier()
 
#define smp_mb__before_atomic_inc()   barrier()
 
#define smp_mb__after_atomic_inc()   barrier()
 

Functions

void atomic_add (int, atomic_t *)
 
void atomic64_add (long, atomic64_t *)
 
void atomic_sub (int, atomic_t *)
 
void atomic64_sub (long, atomic64_t *)
 
int atomic_add_ret (int, atomic_t *)
 
long atomic64_add_ret (long, atomic64_t *)
 
int atomic_sub_ret (int, atomic_t *)
 
long atomic64_sub_ret (long, atomic64_t *)
 
long atomic64_dec_if_positive (atomic64_t *v)
 

Macro Definition Documentation

#define atomic64_add_negative (   i,
  v 
)    (atomic64_add_ret(i, v) < 0)

Definition at line 68 of file atomic_64.h.

#define atomic64_add_return (   i,
  v 
)    atomic64_add_ret(i, v)

Definition at line 42 of file atomic_64.h.

#define atomic64_cmpxchg (   v,
  o,
  n 
)    ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))

Definition at line 88 of file atomic_64.h.

#define atomic64_dec (   v)    atomic64_sub(1, v)

Definition at line 65 of file atomic_64.h.

#define atomic64_dec_and_test (   v)    (atomic64_sub_ret(1, v) == 0)

Definition at line 59 of file atomic_64.h.

#define atomic64_dec_return (   v)    atomic64_sub_ret(1, v)

Definition at line 33 of file atomic_64.h.

#define atomic64_inc (   v)    atomic64_add(1, v)

Definition at line 62 of file atomic_64.h.

#define atomic64_inc_and_test (   v)    (atomic64_inc_return(v) == 0)

Definition at line 53 of file atomic_64.h.

#define atomic64_inc_not_zero (   v)    atomic64_add_unless((v), 1, 0)

Definition at line 107 of file atomic_64.h.

#define atomic64_inc_return (   v)    atomic64_add_ret(1, v)

Definition at line 36 of file atomic_64.h.

#define ATOMIC64_INIT (   i)    { (i) }

Definition at line 14 of file atomic_64.h.

#define atomic64_read (   v)    (*(volatile long *)&(v)->counter)

Definition at line 17 of file atomic_64.h.

#define atomic64_set (   v,
  i 
)    (((v)->counter) = i)

Definition at line 20 of file atomic_64.h.

#define atomic64_sub_and_test (   i,
  v 
)    (atomic64_sub_ret(i, v) == 0)

Definition at line 56 of file atomic_64.h.

#define atomic64_sub_return (   i,
  v 
)    atomic64_sub_ret(i, v)

Definition at line 39 of file atomic_64.h.

#define atomic64_xchg (   v,
  new 
)    (xchg(&((v)->counter), new))

Definition at line 90 of file atomic_64.h.

#define atomic_add_negative (   i,
  v 
)    (atomic_add_ret(i, v) < 0)

Definition at line 67 of file atomic_64.h.

#define atomic_add_return (   i,
  v 
)    atomic_add_ret(i, v)

Definition at line 41 of file atomic_64.h.

#define atomic_cmpxchg (   v,
  o,
  n 
)    (cmpxchg(&((v)->counter), (o), (n)))

Definition at line 70 of file atomic_64.h.

#define atomic_dec (   v)    atomic_sub(1, v)

Definition at line 64 of file atomic_64.h.

#define atomic_dec_and_test (   v)    (atomic_sub_ret(1, v) == 0)

Definition at line 58 of file atomic_64.h.

#define atomic_dec_return (   v)    atomic_sub_ret(1, v)

Definition at line 32 of file atomic_64.h.

#define atomic_inc (   v)    atomic_add(1, v)

Definition at line 61 of file atomic_64.h.

#define atomic_inc_and_test (   v)    (atomic_inc_return(v) == 0)

Definition at line 52 of file atomic_64.h.

#define atomic_inc_return (   v)    atomic_add_ret(1, v)

Definition at line 35 of file atomic_64.h.

#define ATOMIC_INIT (   i)    { (i) }

Definition at line 13 of file atomic_64.h.

#define atomic_read (   v)    (*(volatile int *)&(v)->counter)

Definition at line 16 of file atomic_64.h.

#define atomic_set (   v,
  i 
)    (((v)->counter) = i)

Definition at line 19 of file atomic_64.h.

#define atomic_sub_and_test (   i,
  v 
)    (atomic_sub_ret(i, v) == 0)

Definition at line 55 of file atomic_64.h.

#define atomic_sub_return (   i,
  v 
)    atomic_sub_ret(i, v)

Definition at line 38 of file atomic_64.h.

#define atomic_xchg (   v,
  new 
)    (xchg(&((v)->counter), new))

Definition at line 71 of file atomic_64.h.

#define smp_mb__after_atomic_dec ( )    barrier()

Definition at line 113 of file atomic_64.h.

#define smp_mb__after_atomic_inc ( )    barrier()

Definition at line 115 of file atomic_64.h.

#define smp_mb__before_atomic_dec ( )    barrier()

Definition at line 112 of file atomic_64.h.

#define smp_mb__before_atomic_inc ( )    barrier()

Definition at line 114 of file atomic_64.h.

Function Documentation

void atomic64_add ( long  ,
atomic64_t  
)
long atomic64_add_ret ( long  ,
atomic64_t  
)
long atomic64_dec_if_positive ( atomic64_t v)

Definition at line 117 of file atomic64.c.

void atomic64_sub ( long  ,
atomic64_t  
)
long atomic64_sub_ret ( long  ,
atomic64_t  
)
void atomic_add ( int  ,
atomic_t  
)
int atomic_add_ret ( int  ,
atomic_t  
)
void atomic_sub ( int  ,
atomic_t  
)
int atomic_sub_ret ( int  ,
atomic_t  
)