diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:37:13 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:37:13 +0930 |
commit | c5b7c4aea8a1d2be1d61c3b909177cb5ef07fd62 (patch) | |
tree | db52ef46f4f127ffba98916a42b73eff780450af /lib/tdb2/tdb1_tdb.c | |
parent | 5a3f207318bee2fc2236ac1e19eda8ac2ae80829 (diff) | |
download | samba-c5b7c4aea8a1d2be1d61c3b909177cb5ef07fd62.tar.gz samba-c5b7c4aea8a1d2be1d61c3b909177cb5ef07fd62.tar.bz2 samba-c5b7c4aea8a1d2be1d61c3b909177cb5ef07fd62.zip |
tdb2: Make tdb1 use the tdb_file structure.
Because tdb2 allows multiple opens of the same TDB, we separate out
the file information from the struct tdb_context. Do the same for
tdb1.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 60210a73ec08a7b34ba637ad19e6749cf6dc1952)
Diffstat (limited to 'lib/tdb2/tdb1_tdb.c')
-rw-r--r-- | lib/tdb2/tdb1_tdb.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/tdb2/tdb1_tdb.c b/lib/tdb2/tdb1_tdb.c index a1a0643835..c69c61d0c0 100644 --- a/lib/tdb2/tdb1_tdb.c +++ b/lib/tdb2/tdb1_tdb.c @@ -698,7 +698,7 @@ static int tdb1_free_region(struct tdb1_context *tdb, tdb1_off_t offset, ssize_t /* the region is not worth adding */ return 0; } - if (length + offset > tdb->map_size) { + if (length + offset > tdb->file->map_size) { tdb->last_error = tdb_logerr(tdb, TDB_ERR_CORRUPT, TDB_LOG_ERROR, "tdb1_free_region: adding region beyond" " end of file"); @@ -774,7 +774,7 @@ int tdb1_wipe_all(struct tdb1_context *tdb) for the recovery area */ if (recovery_size == 0) { /* the simple case - the whole file can be used as a freelist */ - data_len = (tdb->map_size - TDB1_DATA_START(tdb->header.hash_size)); + data_len = (tdb->file->map_size - TDB1_DATA_START(tdb->header.hash_size)); if (tdb1_free_region(tdb, TDB1_DATA_START(tdb->header.hash_size), data_len) != 0) { goto failed; } @@ -792,7 +792,7 @@ int tdb1_wipe_all(struct tdb1_context *tdb) goto failed; } /* and the 2nd free list entry after the recovery area - if any */ - data_len = tdb->map_size - (recovery_head+recovery_size); + data_len = tdb->file->map_size - (recovery_head+recovery_size); if (tdb1_free_region(tdb, recovery_head+recovery_size, data_len) != 0) { goto failed; } |