FreeBSD ZFS
The Zettabyte File System
Data Structures | Defines | Typedefs

sys/refcount.h File Reference

#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/list.h>
#include <sys/zfs_context.h>
Include dependency graph for refcount.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  refcount

Defines

#define FTAG   ((char *)__func__)
 If the reference is held only by the calling function and not any particular object, use FTAG (which is a string) for the holder_tag.
#define refcount_create(rc)   ((rc)->rc_count = 0)
#define refcount_destroy(rc)   ((rc)->rc_count = 0)
#define refcount_destroy_many(rc, number)   ((rc)->rc_count = 0)
#define refcount_is_zero(rc)   ((rc)->rc_count == 0)
#define refcount_count(rc)   ((rc)->rc_count)
#define refcount_add(rc, holder)   atomic_add_64_nv(&(rc)->rc_count, 1)
#define refcount_remove(rc, holder)   atomic_add_64_nv(&(rc)->rc_count, -1)
#define refcount_add_many(rc, number, holder)   atomic_add_64_nv(&(rc)->rc_count, number)
#define refcount_remove_many(rc, number, holder)   atomic_add_64_nv(&(rc)->rc_count, -number)
#define refcount_transfer(dst, src)
#define refcount_sysinit()
#define refcount_fini()

Typedefs

typedef struct refcount refcount_t

Define Documentation

#define FTAG   ((char *)__func__)

If the reference is held only by the calling function and not any particular object, use FTAG (which is a string) for the holder_tag.

Otherwise, use the object that holds the reference.

Definition at line 43 of file refcount.h.

#define refcount_add (   rc,
  holder 
)    atomic_add_64_nv(&(rc)->rc_count, 1)

Definition at line 86 of file refcount.h.

#define refcount_add_many (   rc,
  number,
  holder 
)    atomic_add_64_nv(&(rc)->rc_count, number)

Definition at line 88 of file refcount.h.

#define refcount_count (   rc)    ((rc)->rc_count)

Definition at line 85 of file refcount.h.

#define refcount_create (   rc)    ((rc)->rc_count = 0)

Definition at line 81 of file refcount.h.

#define refcount_destroy (   rc)    ((rc)->rc_count = 0)

Definition at line 82 of file refcount.h.

#define refcount_destroy_many (   rc,
  number 
)    ((rc)->rc_count = 0)

Definition at line 83 of file refcount.h.

#define refcount_fini ( )

Definition at line 99 of file refcount.h.

#define refcount_is_zero (   rc)    ((rc)->rc_count == 0)

Definition at line 84 of file refcount.h.

#define refcount_remove (   rc,
  holder 
)    atomic_add_64_nv(&(rc)->rc_count, -1)

Definition at line 87 of file refcount.h.

#define refcount_remove_many (   rc,
  number,
  holder 
)    atomic_add_64_nv(&(rc)->rc_count, -number)

Definition at line 90 of file refcount.h.

#define refcount_sysinit ( )

Definition at line 98 of file refcount.h.

#define refcount_transfer (   dst,
  src 
)
Value:
{ \
        uint64_t __tmp = (src)->rc_count; \
        atomic_add_64(&(src)->rc_count, -__tmp); \
        atomic_add_64(&(dst)->rc_count, __tmp); \
}

Definition at line 92 of file refcount.h.


Typedef Documentation

typedef struct refcount refcount_t
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines