summaryrefslogtreecommitdiffstats
path: root/usr.sbin/nsd/udb.h
diff options
context:
space:
mode:
authorbrad <brad@openbsd.org>2014-09-16 16:53:58 +0000
committerbrad <brad@openbsd.org>2014-09-16 16:53:58 +0000
commit15ed76cb77bcfb01aba628020506c73f9058172c (patch)
tree29bab7730fb1614701eb839f0157d7b624e81b9d /usr.sbin/nsd/udb.h
parentsync (diff)
downloadwireguard-openbsd-15ed76cb77bcfb01aba628020506c73f9058172c.tar.xz
wireguard-openbsd-15ed76cb77bcfb01aba628020506c73f9058172c.zip
update to NSD 4.1.0, ok sthen@
Diffstat (limited to 'usr.sbin/nsd/udb.h')
-rw-r--r--usr.sbin/nsd/udb.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/usr.sbin/nsd/udb.h b/usr.sbin/nsd/udb.h
index 691b78c817f..049760dd961 100644
--- a/usr.sbin/nsd/udb.h
+++ b/usr.sbin/nsd/udb.h
@@ -204,6 +204,11 @@ struct udb_base {
udb_walk_relptr_func* walkfunc;
/** user data for walkfunc */
void* walkarg;
+
+ /** compaction is inhibited */
+ int inhibit_compact;
+ /** compaction is useful; deletions performed. */
+ int useful_compact;
};
typedef enum udb_chunk_type udb_chunk_type;
@@ -549,6 +554,22 @@ udb_void udb_alloc_realloc(udb_alloc* alloc, udb_void r, size_t osz,
*/
int udb_alloc_grow(udb_alloc* alloc, size_t sz, size_t num);
+/**
+ * attempt to compact the data and move free space to the end
+ * can shrink the db, which calls sync on the db (for portability).
+ * @param udb: the udb base.
+ * @return 0 on failure (to remap the (possibly) changed udb base).
+ */
+int udb_compact(udb_base* udb);
+
+/**
+ * set the udb to inhibit or uninhibit compaction. Does not perform
+ * the compaction itself if enabled, for that call udb_compact.
+ * @param udb: the udb base
+ * @param inhibit: 0 or 1.
+ */
+void udb_compact_inhibited(udb_base* udb, int inhibit);
+
/**
* Set the alloc type for a newly alloced piece of data
* @param alloc: the udb space allocator.