aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-06-27 17:33:22 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-06-27 17:33:22 +0300
commit505faa939a83495603b2fd4a5c77d2ca8d5b08df (patch)
tree3e5550d33744abd9c566d994b6cd3f8cbfac7dd5 /src
parent3bf70df01fc591e10b204b69074e1ff4074f143b (diff)
downloadgdbm-505faa939a83495603b2fd4a5c77d2ca8d5b08df.tar.gz
gdbm-505faa939a83495603b2fd4a5c77d2ca8d5b08df.tar.bz2
New gdbmtool variables: coalesce and centfree
The two boolean variables control the use of free block coalescing and central free block modes in newly opened databases.
Diffstat (limited to 'src')
-rw-r--r--src/gdbmtool.c15
-rw-r--r--src/var.c2
2 files changed, 16 insertions, 1 deletions
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index e99547d..5ae668c 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -89,3 +89,3 @@ opendb (char *dbname)
flags |= GDBM_SYNC;
-
+
if (open_mode == GDBM_NEWDB)
@@ -116,2 +116,15 @@ opendb (char *dbname)
+ if (variable_is_true ("coalesce"))
+ {
+ int t = 1;
+ if (gdbm_setopt (db, GDBM_SETCOALESCEBLKS, &t, sizeof (t)) == -1)
+ terror (_("gdbm_setopt failed: %s"), gdbm_strerror (gdbm_errno));
+ }
+ if (variable_is_true ("centfree"))
+ {
+ int t = 1;
+ if (gdbm_setopt (db, GDBM_SETCENTFREE, &t, sizeof (t)) == -1)
+ terror (_("gdbm_setopt failed: %s"), gdbm_strerror (gdbm_errno));
+ }
+
if (gdbm_file)
diff --git a/src/var.c b/src/var.c
index be274c6..4765bc9 100644
--- a/src/var.c
+++ b/src/var.c
@@ -61,2 +61,4 @@ static struct variable vartab[] = {
{ "sync", VART_BOOL, VARF_INIT, { .bool = 0 } },
+ { "coalesce", VART_BOOL, VARF_INIT, { .bool = 0 } },
+ { "centfree", VART_BOOL, VARF_INIT, { .bool = 0 } },
{ "filemode", VART_INT, VARF_INIT|VARF_OCTAL|VARF_PROT, { .num = 0644 } },

Return to:

Send suggestions and report system problems to the System administrator.