diff options
Diffstat (limited to 'kern/sref.h')
-rw-r--r-- | kern/sref.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/kern/sref.h b/kern/sref.h index 768f1ee..fb62d83 100644 --- a/kern/sref.h +++ b/kern/sref.h @@ -31,6 +31,8 @@ #ifndef _KERN_SREF_H #define _KERN_SREF_H +#include <kern/init.h> + /* * Scalable reference counter. */ @@ -77,17 +79,20 @@ void sref_report_periodic_event(void); /* * Initialize a scalable reference counter. * - * The counter is set to 1. The no-reference function is called (from thread - * context) when it is certain that the true number of references is 0. + * The no-reference function is called (from thread context) when it is + * certain that the true number of references is 0. */ void sref_counter_init(struct sref_counter *counter, + unsigned long init_value, struct sref_weakref *weakref, sref_noref_fn_t noref_fn); /* * Counter operations. * - * These functions may safely be called with preemption disabled. + * These functions may safely be called in interrupt context. + * + * These functions imply a compiler barrier. */ void sref_counter_inc(struct sref_counter *counter); void sref_counter_dec(struct sref_counter *counter); @@ -98,8 +103,14 @@ void sref_counter_dec(struct sref_counter *counter); * If successful, increment the reference counter before returning it. * Otherwise return NULL. * - * This function may safely be called with preemption disabled. + * This function may safely be called in interrupt context. */ struct sref_counter * sref_weakref_get(struct sref_weakref *weakref); +/* + * This init operation provides : + * - sref counter and weakref initialization and usage + */ +INIT_OP_DECLARE(sref_bootstrap); + #endif /* _KERN_SREF_H */ |