diff options
author | behlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c> | 2008-03-05 00:58:54 +0000 |
---|---|---|
committer | behlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c> | 2008-03-05 00:58:54 +0000 |
commit | a713518f5d9e4f7b1c361035f1f3ef79869a960f (patch) | |
tree | eb5eb8b5457adb7418689c4750fa32d832793967 /include/sys/kstat.h | |
parent | 23f28c4f75b6a7583ac706db331211baa055ca5d (diff) |
Checkpoint for the night,
added a few more stub headers,
fleshed out a few stub headers,
added a FIXME file,
added various compatibility macros
git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@25 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
Diffstat (limited to 'include/sys/kstat.h')
-rw-r--r-- | include/sys/kstat.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/sys/kstat.h b/include/sys/kstat.h index 0b79a41c0..dea7987f5 100644 --- a/include/sys/kstat.h +++ b/include/sys/kstat.h @@ -130,6 +130,35 @@ kstat_delete(kstat_t *ksp) return; } +/* FIXME - NONE OF THIS IS ATOMIC, IT SHOULD BE. For the moment this is + * OK since it is only used for the noncritical kstat counters */ +static __inline__ uint64_t +atomic_add_64(volatile uint64_t *target, uint64_t delta) +{ + uint64_t rc = *target; + *target += delta; + return rc; +} + +static __inline__ uint64_t +atomic_add_64_nv(volatile uint64_t *target, uint64_t delta) +{ + *target += delta; + return *target; +} + +static __inline__ uint64_t +atomic_cas_64(volatile uint64_t *target, uint64_t cmp, + uint64_t newval) +{ + uint64_t rc = *target; + + if (*target == cmp) + *target = newval; + + return rc; +} + #ifdef __cplusplus } #endif |