diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 08:06:13 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 08:06:13 +0930 |
commit | b50b48f575d8ad2a709c89dab0a64e19e45d7b08 (patch) | |
tree | f5cddc9072fa37e6c9692fa30fe0c7d45547af65 /lib/tdb2/open.c | |
parent | 13238912facb04ab3aafeb020de6226659d83e6b (diff) | |
download | samba-b50b48f575d8ad2a709c89dab0a64e19e45d7b08.tar.gz samba-b50b48f575d8ad2a709c89dab0a64e19e45d7b08.tar.bz2 samba-b50b48f575d8ad2a709c89dab0a64e19e45d7b08.zip |
tdb2: add tdb_attribute_tdb1_max_dead
This allows us to simulate the old "volatile" flag for tdb1. It's not
necessary for tdb2.
As this is the last function in tdb1.h, we remove that file.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit b8e64e9346793164651a36eccb3c205077e5c91b)
Diffstat (limited to 'lib/tdb2/open.c')
-rw-r--r-- | lib/tdb2/open.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/tdb2/open.c b/lib/tdb2/open.c index 0a4ca5d17e..46e22a324c 100644 --- a/lib/tdb2/open.c +++ b/lib/tdb2/open.c @@ -388,6 +388,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags, struct tdb_header hdr; struct tdb_attribute_seed *seed = NULL; struct tdb_attribute_tdb1_hashsize *hsize_attr = NULL; + struct tdb_attribute_tdb1_max_dead *maxsize_attr = NULL; tdb_bool_err berr; enum TDB_ERROR ecode; int openlock; @@ -433,6 +434,9 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags, case TDB_ATTRIBUTE_TDB1_HASHSIZE: hsize_attr = &attr->tdb1_hashsize; break; + case TDB_ATTRIBUTE_TDB1_MAX_DEAD: + maxsize_attr = &attr->tdb1_max_dead; + break; default: /* These are set as normal. */ ecode = tdb_set_attribute(tdb, attr); @@ -511,7 +515,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags, } tdb->file->fd = -1; if (tdb->flags & TDB_VERSION1) - ecode = tdb1_new_database(tdb, hsize_attr); + ecode = tdb1_new_database(tdb, hsize_attr, maxsize_attr); else { ecode = tdb_new_database(tdb, seed, &hdr); if (ecode == TDB_SUCCESS) { @@ -591,7 +595,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags, rlen = pread(tdb->file->fd, &hdr, sizeof(hdr), 0); if (rlen == 0 && (open_flags & O_CREAT)) { if (tdb->flags & TDB_VERSION1) { - ecode = tdb1_new_database(tdb, hsize_attr); + ecode = tdb1_new_database(tdb, hsize_attr, maxsize_attr); if (ecode != TDB_SUCCESS) goto fail; goto finished; @@ -608,7 +612,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags, } else if (rlen < sizeof(hdr) || strcmp(hdr.magic_food, TDB_MAGIC_FOOD) != 0) { if (is_tdb1(&tdb->tdb1.header, &hdr, rlen)) { - ecode = tdb1_open(tdb); + ecode = tdb1_open(tdb, maxsize_attr); if (!ecode) goto finished; goto fail; @@ -623,7 +627,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags, tdb->flags |= TDB_CONVERT; else { if (is_tdb1(&tdb->tdb1.header, &hdr, rlen)) { - ecode = tdb1_open(tdb); + ecode = tdb1_open(tdb, maxsize_attr); if (!ecode) goto finished; goto fail; |