summaryrefslogtreecommitdiff
path: root/lib/tdb2/tdb1_summary.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:37:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:37:13 +0930
commitc5b7c4aea8a1d2be1d61c3b909177cb5ef07fd62 (patch)
treedb52ef46f4f127ffba98916a42b73eff780450af /lib/tdb2/tdb1_summary.c
parent5a3f207318bee2fc2236ac1e19eda8ac2ae80829 (diff)
downloadsamba-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_summary.c')
-rw-r--r--lib/tdb2/tdb1_summary.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/tdb2/tdb1_summary.c b/lib/tdb2/tdb1_summary.c
index b6889bc444..329cb268fc 100644
--- a/lib/tdb2/tdb1_summary.c
+++ b/lib/tdb2/tdb1_summary.c
@@ -96,7 +96,7 @@ char *tdb1_summary(struct tdb1_context *tdb)
/* Read-only databases use no locking at all: it's best-effort.
* We may have a write lock already, so skip that case too. */
- if (tdb->read_only || tdb->allrecord_lock.count != 0) {
+ if (tdb->read_only || tdb->file->allrecord_lock.count != 0) {
locked = false;
} else {
if (tdb1_lockall_read(tdb) == -1)
@@ -117,7 +117,7 @@ char *tdb1_summary(struct tdb1_context *tdb)
tally1_init(&uncoal);
for (off = TDB1_DATA_START(tdb->header.hash_size);
- off < tdb->map_size - 1;
+ off < tdb->file->map_size - 1;
off += sizeof(rec) + rec.rec_len) {
if (tdb->methods->tdb1_read(tdb, off, &rec, sizeof(rec),
TDB1_DOCONV()) == -1)
@@ -171,7 +171,7 @@ char *tdb1_summary(struct tdb1_context *tdb)
goto unlock;
snprintf(ret, len, SUMMARY_FORMAT1,
- tdb->map_size, keys.total+data.total,
+ (tdb1_len_t)tdb->file->map_size, keys.total+data.total,
keys.num,
keys.min, tally1_mean(&keys), keys.max,
data.min, tally1_mean(&data), data.max,
@@ -184,16 +184,16 @@ char *tdb1_summary(struct tdb1_context *tdb)
hash.min, tally1_mean(&hash), hash.max,
uncoal.total,
uncoal.min, tally1_mean(&uncoal), uncoal.max,
- keys.total * 100.0 / tdb->map_size,
- data.total * 100.0 / tdb->map_size,
- extra.total * 100.0 / tdb->map_size,
- freet.total * 100.0 / tdb->map_size,
- dead.total * 100.0 / tdb->map_size,
+ keys.total * 100.0 / tdb->file->map_size,
+ data.total * 100.0 / tdb->file->map_size,
+ extra.total * 100.0 / tdb->file->map_size,
+ freet.total * 100.0 / tdb->file->map_size,
+ dead.total * 100.0 / tdb->file->map_size,
(keys.num + freet.num + dead.num)
* (sizeof(struct tdb1_record) + sizeof(uint32_t))
- * 100.0 / tdb->map_size,
+ * 100.0 / tdb->file->map_size,
tdb->header.hash_size * sizeof(tdb1_off_t)
- * 100.0 / tdb->map_size);
+ * 100.0 / (tdb1_len_t)tdb->file->map_size);
unlock:
if (locked) {