summaryrefslogtreecommitdiff
path: root/sys/kern/kern_srp.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2015-09-09 11:21:52 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2015-09-09 11:21:52 +0000
commit3c552130ca2aa2c373edf2db7e3ca05076decb63 (patch)
tree08badf74e2af36d21f45a90abc7a341cd9898c87 /sys/kern/kern_srp.c
parent5d96edddcce5fe96a47d882c1fecbc05683baad9 (diff)
implement a singly linked list built with SRPs.
this allows us to build lists of things that can be followed by multiple cpus. ok mpi@ claudio@
Diffstat (limited to 'sys/kern/kern_srp.c')
-rw-r--r--sys/kern/kern_srp.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/kern/kern_srp.c b/sys/kern/kern_srp.c
index 02e607945d3..e56d8c96e54 100644
--- a/sys/kern/kern_srp.c
+++ b/sys/kern/kern_srp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_srp.c,v 1.2 2015/09/01 03:47:58 dlg Exp $ */
+/* $OpenBSD: kern_srp.c,v 1.3 2015/09/09 11:21:51 dlg Exp $ */
/*
* Copyright (c) 2014 Jonathan Matthew <jmatthew@openbsd.org>
@@ -27,6 +27,14 @@
void srp_v_gc_start(struct srp_gc *, struct srp *, void *);
void
+srpl_rc_init(struct srpl_rc *rc, void (*ref)(void *, void *),
+ void (*unref)(void *, void *), void *cookie)
+{
+ rc->srpl_ref = ref;
+ srp_gc_init(&rc->srpl_gc, unref, cookie);
+}
+
+void
srp_gc_init(struct srp_gc *srp_gc, void (*dtor)(void *, void *), void *cookie)
{
srp_gc->srp_gc_dtor = dtor;
@@ -40,6 +48,12 @@ srp_init(struct srp *srp)
srp->ref = NULL;
}
+void srpl_refs_init(struct srpl_rc *, void (*)(void *, void *),
+ void (*)(void *, void *), void *);
+
+#define SRPL_RC_INITIALIZER(_r, _u, _c) { _r, SRP_GC_INITIALIZER(_u, _c) }
+
+
void
srp_update_locked(struct srp_gc *srp_gc, struct srp *srp, void *nv)
{