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

Go to the source code of this file.

Data Structures

struct  atomic64_t
 

Macros

#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()
 
#define ATOMIC_INIT(i)   { (i) }
 
#define atomic_read(v)   (*(volatile int *)&(v)->counter)
 
#define atomic_set(v, i)   (((v)->counter) = (i))
 
#define atomic_dec_return(v)   atomic_sub_return(1, (v))
 
#define atomic_inc_return(v)   atomic_add_return(1, (v))
 
#define atomic_sub_and_test(i, v)   (atomic_sub_return((i), (v)) == 0)
 
#define atomic_dec_and_test(v)   (atomic_sub_return(1, (v)) == 0)
 
#define atomic_inc_and_test(v)   (atomic_add_return(1, (v)) == 0)
 
#define ATOMIC64_INIT(i)   { (i) }
 
#define atomic64_sub_and_test(i, v)   (atomic64_sub_return((i), (v)) == 0)
 
#define atomic64_dec_and_test(v)   (atomic64_dec_return((v)) == 0)
 
#define atomic64_inc_and_test(v)   (atomic64_inc_return((v)) == 0)
 
#define atomic_cmpxchg(v, old, new)   (cmpxchg(&(v)->counter, old, new))
 
#define atomic_xchg(v, new)   (xchg(&(v)->counter, new))
 
#define atomic64_cmpxchg(v, old, new)   (__cmpxchg_64(old, new, &(v)->counter))
 
#define atomic64_xchg(v, new)   (__xchg_64(new, &(v)->counter))
 

Functions

long long atomic64_inc_return (atomic64_t *v)
 
long long atomic64_dec_return (atomic64_t *v)
 
long long atomic64_add_return (long long i, atomic64_t *v)
 
long long atomic64_sub_return (long long i, atomic64_t *v)
 

Macro Definition Documentation

#define atomic64_cmpxchg (   v,
  old,
  new 
)    (__cmpxchg_64(old, new, &(v)->counter))

Definition at line 186 of file atomic.h.

#define atomic64_dec_and_test (   v)    (atomic64_dec_return((v)) == 0)

Definition at line 181 of file atomic.h.

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

Definition at line 182 of file atomic.h.

#define ATOMIC64_INIT (   i)    { (i) }

Definition at line 131 of file atomic.h.

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

Definition at line 180 of file atomic.h.

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

Definition at line 187 of file atomic.h.

#define atomic_cmpxchg (   v,
  old,
  new 
)    (cmpxchg(&(v)->counter, old, new))

Definition at line 184 of file atomic.h.

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

Definition at line 121 of file atomic.h.

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

Definition at line 117 of file atomic.h.

#define atomic_inc_and_test (   v)    (atomic_add_return(1, (v)) == 0)

Definition at line 122 of file atomic.h.

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

Definition at line 118 of file atomic.h.

#define ATOMIC_INIT (   i)    { (i) }

Definition at line 38 of file atomic.h.

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

Definition at line 39 of file atomic.h.

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

Definition at line 40 of file atomic.h.

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

Definition at line 120 of file atomic.h.

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

Definition at line 185 of file atomic.h.

#define smp_mb__after_atomic_dec ( )    barrier()

Definition at line 34 of file atomic.h.

#define smp_mb__after_atomic_inc ( )    barrier()

Definition at line 36 of file atomic.h.

#define smp_mb__before_atomic_dec ( )    barrier()

Definition at line 33 of file atomic.h.

#define smp_mb__before_atomic_inc ( )    barrier()

Definition at line 35 of file atomic.h.

Function Documentation

long long atomic64_add_return ( long long  i,
atomic64_t v 
)

Definition at line 80 of file atomic64.c.

long long atomic64_dec_return ( atomic64_t v)
long long atomic64_inc_return ( atomic64_t v)
long long atomic64_sub_return ( long long  i,
atomic64_t v 
)

Definition at line 104 of file atomic64.c.