summaryrefslogtreecommitdiffstats
path: root/sys/uvm/uvm_object.c
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2010-04-30 21:56:39 +0000
committeroga <oga@openbsd.org>2010-04-30 21:56:39 +0000
commitca0f98fe9754cf4fac9870df0f9d237a2ef52760 (patch)
treec26e7a686050c272451f2d6dc432e252486aae20 /sys/uvm/uvm_object.c
parentPrevent a possible case of lock recursion in swapoff. (diff)
downloadwireguard-openbsd-ca0f98fe9754cf4fac9870df0f9d237a2ef52760.tar.xz
wireguard-openbsd-ca0f98fe9754cf4fac9870df0f9d237a2ef52760.zip
Right now, if anything internal changes with a uvm object, diverse
places in the tree need to be touched to update the object initialisation with respect to that. So, make a function (uvm_initobj) that takes the refcount, object and pager ops and does this initialisation for us. This should save on maintainance in the future. looked good to fgs@. Tedu complained about the British spelling but OKed it anyway.
Diffstat (limited to 'sys/uvm/uvm_object.c')
-rw-r--r--sys/uvm/uvm_object.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/uvm/uvm_object.c b/sys/uvm/uvm_object.c
index fdd931f0afe..cc7871b8a5f 100644
--- a/sys/uvm/uvm_object.c
+++ b/sys/uvm/uvm_object.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_object.c,v 1.4 2010/04/21 03:04:49 deraadt Exp $ */
+/* $OpenBSD: uvm_object.c,v 1.5 2010/04/30 21:56:39 oga Exp $ */
/*
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -43,6 +43,18 @@
#define FETCH_PAGECOUNT 16
/*
+ * uvm_objinit: initialise a uvm object.
+ */
+void
+uvm_objinit(struct uvm_object *uobj, struct uvm_pagerops *pgops, int refs)
+{
+ uobj->pgops = pgops;
+ RB_INIT(&uobj->memt);
+ uobj->uo_npages = 0;
+ uobj->uo_refs = refs;
+}
+
+/*
* uvm_objwire: wire the pages of entire uobj
*
* => caller must pass page-aligned start and end values