summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/netgraph.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netgraph/netgraph.h')
-rw-r--r--sys/netgraph/netgraph.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h
index 8dbf0b5..7b67c94e 100644
--- a/sys/netgraph/netgraph.h
+++ b/sys/netgraph/netgraph.h
@@ -53,6 +53,7 @@
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
+#include <sys/refcount.h>
#ifdef HAVE_KERNEL_OPTION_HEADERS
#include "opt_netgraph.h"
@@ -137,7 +138,7 @@ struct ng_hook {
* If you can't do it with these you probably shouldn;t be doing it.
*/
void ng_unref_hook(hook_p hook); /* don't move this */
-#define _NG_HOOK_REF(hook) atomic_add_int(&(hook)->hk_refs, 1)
+#define _NG_HOOK_REF(hook) refcount_acquire(&(hook)->hk_refs)
#define _NG_HOOK_NAME(hook) ((hook)->hk_name)
#define _NG_HOOK_UNREF(hook) ng_unref_hook(hook)
#define _NG_HOOK_SET_PRIVATE(hook, val) do {(hook)->hk_private = val;} while (0)
@@ -396,11 +397,11 @@ struct ng_node {
* Public methods for nodes.
* If you can't do it with these you probably shouldn't be doing it.
*/
-int ng_unref_node(node_p node); /* don't move this */
+void ng_unref_node(node_p node); /* don't move this */
#define _NG_NODE_NAME(node) ((node)->nd_name + 0)
#define _NG_NODE_HAS_NAME(node) ((node)->nd_name[0] + 0)
#define _NG_NODE_ID(node) ((node)->nd_ID + 0)
-#define _NG_NODE_REF(node) atomic_add_int(&(node)->nd_refs, 1)
+#define _NG_NODE_REF(node) refcount_acquire(&(node)->nd_refs)
#define _NG_NODE_UNREF(node) ng_unref_node(node)
#define _NG_NODE_SET_PRIVATE(node, val) do {(node)->nd_private = val;} while (0)
#define _NG_NODE_PRIVATE(node) ((node)->nd_private)
@@ -441,7 +442,7 @@ static __inline char * _ng_node_name(node_p node, char *file, int line);
static __inline int _ng_node_has_name(node_p node, char *file, int line);
static __inline ng_ID_t _ng_node_id(node_p node, char *file, int line);
static __inline void _ng_node_ref(node_p node, char *file, int line);
-static __inline int _ng_node_unref(node_p node, char *file, int line);
+static __inline void _ng_node_unref(node_p node, char *file, int line);
static __inline void _ng_node_set_private(node_p node, void * val,
char *file, int line);
static __inline void * _ng_node_private(node_p node, char *file, int line);
@@ -492,11 +493,11 @@ _ng_node_ref(node_p node, char *file, int line)
_NG_NODE_REF(node);
}
-static __inline int
+static __inline void
_ng_node_unref(node_p node, char *file, int line)
{
_chknode(node, file, line);
- return (_NG_NODE_UNREF(node));
+ _NG_NODE_UNREF(node);
}
static __inline void
OpenPOWER on IntegriCloud