From 007a7e4e8df8f43c61126599bcc582750cbf17fe Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 7 Apr 2011 13:06:11 +0930 Subject: [PATCH] tdb2: shorten attribute members. It's redundant calling hash.hash_fn for example. Standardize on fn and data as names (private conflicts with C++). --- ccan/tdb2/check.c | 40 +++++++++++------------ ccan/tdb2/hash.c | 5 ++- ccan/tdb2/open.c | 16 +++++----- ccan/tdb2/private.h | 8 ++--- ccan/tdb2/tdb.c | 18 +++++------ ccan/tdb2/tdb2.h | 48 ++++++++++++++-------------- ccan/tdb2/test/logging.c | 2 +- ccan/tdb2/test/run-04-basichash.c | 2 +- ccan/tdb2/test/run-12-store.c | 4 +-- ccan/tdb2/test/run-13-delete.c | 6 ++-- ccan/tdb2/test/run-20-growhash.c | 2 +- ccan/tdb2/test/run-25-hashoverload.c | 2 +- ccan/tdb2/test/run-missing-entries.c | 2 +- ccan/tdb2/test/run-seed.c | 2 +- ccan/tdb2/test/run-traverse.c | 4 +-- ccan/tdb2/tools/speed.c | 4 +-- ccan/tdb2/tools/tdbtool.c | 4 +-- ccan/tdb2/tools/tdbtorture.c | 4 +-- 18 files changed, 85 insertions(+), 88 deletions(-) diff --git a/ccan/tdb2/check.c b/ccan/tdb2/check.c index ab6621ea..88b86429 100644 --- a/ccan/tdb2/check.c +++ b/ccan/tdb2/check.c @@ -94,7 +94,7 @@ static enum TDB_ERROR check_hash_tree(struct tdb_context *tdb, size_t *num_found, enum TDB_ERROR (*check)(TDB_DATA, TDB_DATA, void *), - void *private_data); + void *data); static enum TDB_ERROR check_hash_chain(struct tdb_context *tdb, tdb_off_t off, @@ -105,7 +105,7 @@ static enum TDB_ERROR check_hash_chain(struct tdb_context *tdb, enum TDB_ERROR (*check)(TDB_DATA, TDB_DATA, void *), - void *private_data) + void *data) { struct tdb_used_record rec; enum TDB_ERROR ecode; @@ -141,7 +141,7 @@ static enum TDB_ERROR check_hash_chain(struct tdb_context *tdb, off += sizeof(rec); ecode = check_hash_tree(tdb, off, 0, hash, 64, - used, num_used, num_found, check, private_data); + used, num_used, num_found, check, data); if (ecode != TDB_SUCCESS) { return ecode; } @@ -154,7 +154,7 @@ static enum TDB_ERROR check_hash_chain(struct tdb_context *tdb, return TDB_SUCCESS; (*num_found)++; return check_hash_chain(tdb, off, hash, used, num_used, num_found, - check, private_data); + check, data); } static enum TDB_ERROR check_hash_record(struct tdb_context *tdb, @@ -167,14 +167,14 @@ static enum TDB_ERROR check_hash_record(struct tdb_context *tdb, enum TDB_ERROR (*check)(TDB_DATA, TDB_DATA, void *), - void *private_data) + void *data) { struct tdb_used_record rec; enum TDB_ERROR ecode; if (hprefix_bits >= 64) return check_hash_chain(tdb, off, hprefix, used, num_used, - num_found, check, private_data); + num_found, check, data); ecode = tdb_read_convert(tdb, off, &rec, sizeof(rec)); if (ecode != TDB_SUCCESS) { @@ -210,7 +210,7 @@ static enum TDB_ERROR check_hash_record(struct tdb_context *tdb, return check_hash_tree(tdb, off, TDB_SUBLEVEL_HASH_BITS-TDB_HASH_GROUP_BITS, hprefix, hprefix_bits, - used, num_used, num_found, check, private_data); + used, num_used, num_found, check, data); } static int off_cmp(const tdb_off_t *a, const tdb_off_t *b) @@ -237,7 +237,7 @@ static enum TDB_ERROR check_hash_tree(struct tdb_context *tdb, size_t *num_found, enum TDB_ERROR (*check)(TDB_DATA, TDB_DATA, void *), - void *private_data) + void *data) { unsigned int g, b; const tdb_off_t *hash; @@ -318,7 +318,7 @@ static enum TDB_ERROR check_hash_tree(struct tdb_context *tdb, + group_bits + TDB_HASH_GROUP_BITS, used, num_used, num_found, - check, private_data); + check, data); if (ecode != TDB_SUCCESS) { goto fail; } @@ -401,7 +401,7 @@ static enum TDB_ERROR check_hash_tree(struct tdb_context *tdb, check: if (check) { - TDB_DATA key, data; + TDB_DATA k, d; const unsigned char *kptr; kptr = tdb_access_read(tdb, @@ -414,10 +414,10 @@ static enum TDB_ERROR check_hash_tree(struct tdb_context *tdb, goto fail; } - key = tdb_mkdata(kptr, rec_key_length(&rec)); - data = tdb_mkdata(kptr + key.dsize, - rec_data_length(&rec)); - ecode = check(key, data, private_data); + k = tdb_mkdata(kptr, rec_key_length(&rec)); + d = tdb_mkdata(kptr + k.dsize, + rec_data_length(&rec)); + ecode = check(k, d, data); tdb_access_release(tdb, kptr); if (ecode != TDB_SUCCESS) { goto fail; @@ -437,7 +437,7 @@ static enum TDB_ERROR check_hash(struct tdb_context *tdb, tdb_off_t used[], size_t num_used, size_t num_ftables, int (*check)(TDB_DATA, TDB_DATA, void *), - void *private_data) + void *data) { /* Free tables also show up as used. */ size_t num_found = num_ftables; @@ -446,7 +446,7 @@ static enum TDB_ERROR check_hash(struct tdb_context *tdb, ecode = check_hash_tree(tdb, offsetof(struct tdb_header, hashtable), TDB_TOPLEVEL_HASH_BITS-TDB_HASH_GROUP_BITS, 0, 0, used, num_used, &num_found, - check, private_data); + check, data); if (ecode == TDB_SUCCESS) { if (num_found != num_used) { ecode = tdb_logerr(tdb, TDB_ERR_CORRUPT, TDB_LOG_ERROR, @@ -772,9 +772,8 @@ static enum TDB_ERROR check_linear(struct tdb_context *tdb, } enum TDB_ERROR tdb_check_(struct tdb_context *tdb, - enum TDB_ERROR (*check)(TDB_DATA key, TDB_DATA data, - void *private_data), - void *private_data) + enum TDB_ERROR (*check)(TDB_DATA, TDB_DATA, void *), + void *data) { tdb_off_t *fr = NULL, *used = NULL, ft, recovery; size_t num_free = 0, num_used = 0, num_found = 0, num_ftables = 0; @@ -815,8 +814,7 @@ enum TDB_ERROR tdb_check_(struct tdb_context *tdb, } /* FIXME: Check key uniqueness? */ - ecode = check_hash(tdb, used, num_used, num_ftables, check, - private_data); + ecode = check_hash(tdb, used, num_used, num_ftables, check, data); if (ecode != TDB_SUCCESS) goto out; diff --git a/ccan/tdb2/hash.c b/ccan/tdb2/hash.c index 2b997008..b1307d98 100644 --- a/ccan/tdb2/hash.c +++ b/ccan/tdb2/hash.c @@ -31,13 +31,12 @@ static uint64_t jenkins_hash(const void *key, size_t length, uint64_t seed, void tdb_hash_init(struct tdb_context *tdb) { - tdb->khash = jenkins_hash; - tdb->hash_priv = NULL; + tdb->hashfn = jenkins_hash; } uint64_t tdb_hash(struct tdb_context *tdb, const void *ptr, size_t len) { - return tdb->khash(ptr, len, tdb->hash_seed, tdb->hash_priv); + return tdb->hashfn(ptr, len, tdb->hash_seed, tdb->hash_data); } uint64_t hash_record(struct tdb_context *tdb, tdb_off_t off) diff --git a/ccan/tdb2/open.c b/ccan/tdb2/open.c index 7bb50f1d..a26148fc 100644 --- a/ccan/tdb2/open.c +++ b/ccan/tdb2/open.c @@ -101,10 +101,10 @@ static enum TDB_ERROR tdb_new_database(struct tdb_context *tdb, else newdb.hdr.hash_seed = random_number(tdb); newdb.hdr.hash_test = TDB_HASH_MAGIC; - newdb.hdr.hash_test = tdb->khash(&newdb.hdr.hash_test, - sizeof(newdb.hdr.hash_test), - newdb.hdr.hash_seed, - tdb->hash_priv); + newdb.hdr.hash_test = tdb->hashfn(&newdb.hdr.hash_test, + sizeof(newdb.hdr.hash_test), + newdb.hdr.hash_seed, + tdb->hash_data); newdb.hdr.recovery = 0; newdb.hdr.features_used = newdb.hdr.features_offered = TDB_FEATURE_MASK; newdb.hdr.seqnum = 0; @@ -217,12 +217,12 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags, while (attr) { switch (attr->base.attr) { case TDB_ATTRIBUTE_LOG: - tdb->logfn = attr->log.log_fn; - tdb->log_private = attr->log.log_private; + tdb->logfn = attr->log.fn; + tdb->log_data = attr->log.data; break; case TDB_ATTRIBUTE_HASH: - tdb->khash = attr->hash.hash_fn; - tdb->hash_priv = attr->hash.hash_private; + tdb->hashfn = attr->hash.fn; + tdb->hash_data = attr->hash.data; break; case TDB_ATTRIBUTE_SEED: seed = &attr->seed; diff --git a/ccan/tdb2/private.h b/ccan/tdb2/private.h index 0a030d6e..ab9dc35f 100644 --- a/ccan/tdb2/private.h +++ b/ccan/tdb2/private.h @@ -367,13 +367,13 @@ struct tdb_context { /* Logging function */ void (*logfn)(struct tdb_context *tdb, enum tdb_log_level level, - void *log_private, + void *data, const char *message); - void *log_private; + void *log_data; /* Hash function. */ - uint64_t (*khash)(const void *key, size_t len, uint64_t seed, void *); - void *hash_priv; + uint64_t (*hashfn)(const void *key, size_t len, uint64_t seed, void *); + void *hash_data; uint64_t hash_seed; /* Set if we are in a transaction. */ diff --git a/ccan/tdb2/tdb.c b/ccan/tdb2/tdb.c index 1dbbb7e9..01e77733 100644 --- a/ccan/tdb2/tdb.c +++ b/ccan/tdb2/tdb.c @@ -406,11 +406,11 @@ enum TDB_ERROR COLD tdb_logerr(struct tdb_context *tdb, va_end(ap); if (len < 0) { - tdb->logfn(tdb, TDB_LOG_ERROR, tdb->log_private, + tdb->logfn(tdb, TDB_LOG_ERROR, tdb->log_data, "out of memory formatting message:"); - tdb->logfn(tdb, level, tdb->log_private, fmt); + tdb->logfn(tdb, level, tdb->log_data, fmt); } else { - tdb->logfn(tdb, level, tdb->log_private, message); + tdb->logfn(tdb, level, tdb->log_data, message); free(message); } errno = saved_errno; @@ -419,10 +419,10 @@ enum TDB_ERROR COLD tdb_logerr(struct tdb_context *tdb, enum TDB_ERROR tdb_parse_record_(struct tdb_context *tdb, TDB_DATA key, - enum TDB_ERROR (*parse)(TDB_DATA key, - TDB_DATA data, - void *p), - void *p) + enum TDB_ERROR (*parse)(TDB_DATA k, + TDB_DATA d, + void *data), + void *data) { tdb_off_t off; struct tdb_used_record rec; @@ -443,9 +443,9 @@ enum TDB_ERROR tdb_parse_record_(struct tdb_context *tdb, if (TDB_PTR_IS_ERR(dptr)) { ecode = TDB_PTR_ERR(dptr); } else { - TDB_DATA data = tdb_mkdata(dptr, rec_data_length(&rec)); + TDB_DATA d = tdb_mkdata(dptr, rec_data_length(&rec)); - ecode = parse(key, data, p); + ecode = parse(key, d, data); tdb_access_release(tdb, dptr); } } diff --git a/ccan/tdb2/tdb2.h b/ccan/tdb2/tdb2.h index 802bcdbe..47ec3041 100644 --- a/ccan/tdb2/tdb2.h +++ b/ccan/tdb2/tdb2.h @@ -324,7 +324,7 @@ int64_t tdb_traverse_(struct tdb_context *tdb, * @tdb: the tdb context returned from tdb_open() * @key: the key whose record we should hand to @parse * @parse: the function to call for the data - * @p: the private pointer to hand to @parse (types must match). + * @data: the private pointer to hand to @parse (types must match). * * This avoids a copy for many cases, by handing you a pointer into * the memory-mapped database. It also locks the record to prevent @@ -332,18 +332,18 @@ int64_t tdb_traverse_(struct tdb_context *tdb, * * Do not alter the data handed to parse()! */ -#define tdb_parse_record(tdb, key, parse, p) \ +#define tdb_parse_record(tdb, key, parse, data) \ tdb_parse_record_((tdb), (key), \ typesafe_cb_preargs(enum TDB_ERROR, void *, \ - (parse), (p), \ - TDB_DATA, TDB_DATA), (p)) + (parse), (data), \ + TDB_DATA, TDB_DATA), (data)) enum TDB_ERROR tdb_parse_record_(struct tdb_context *tdb, TDB_DATA key, - enum TDB_ERROR (*parse)(TDB_DATA key, - TDB_DATA data, - void *p), - void *p); + enum TDB_ERROR (*parse)(TDB_DATA k, + TDB_DATA d, + void *data), + void *data); /** * tdb_get_seqnum - get a database sequence number @@ -490,7 +490,7 @@ enum TDB_ERROR tdb_wipe_all(struct tdb_context *tdb); * tdb_check - check a TDB for consistency * @tdb: the tdb context returned from tdb_open() * @check: function to check each key/data pair (or NULL) - * @private_data: argument for @check, must match type. + * @data: argument for @check, must match type. * * This performs a consistency check of the open database, optionally calling * a check() function on each record so you can do your own data consistency @@ -499,18 +499,18 @@ enum TDB_ERROR tdb_wipe_all(struct tdb_context *tdb); * * Returns TDB_SUCCESS or an error. */ -#define tdb_check(tdb, check, private_data) \ +#define tdb_check(tdb, check, data) \ tdb_check_((tdb), typesafe_cb_preargs(enum TDB_ERROR, void *, \ - (check), (private_data), \ + (check), (data), \ struct tdb_data, \ struct tdb_data), \ - (private_data)) + (data)) enum TDB_ERROR tdb_check_(struct tdb_context *tdb, - enum TDB_ERROR (*check)(struct tdb_data key, - struct tdb_data data, - void *private_data), - void *private_data); + enum TDB_ERROR (*check)(struct tdb_data k, + struct tdb_data d, + void *data), + void *data); /** * tdb_error - get the last error (not threadsafe) @@ -640,11 +640,11 @@ enum tdb_log_level { */ struct tdb_attribute_log { struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_LOG */ - void (*log_fn)(struct tdb_context *tdb, - enum tdb_log_level level, - void *log_private, - const char *message); - void *log_private; + void (*fn)(struct tdb_context *tdb, + enum tdb_log_level level, + void *data, + const char *message); + void *data; }; /** @@ -661,9 +661,9 @@ struct tdb_attribute_log { */ struct tdb_attribute_hash { struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_HASH */ - uint64_t (*hash_fn)(const void *key, size_t len, uint64_t seed, - void *priv); - void *hash_private; + uint64_t (*fn)(const void *key, size_t len, uint64_t seed, + void *data); + void *data; }; /** diff --git a/ccan/tdb2/test/logging.c b/ccan/tdb2/test/logging.c index dfb33247..a3ddb329 100644 --- a/ccan/tdb2/test/logging.c +++ b/ccan/tdb2/test/logging.c @@ -9,7 +9,7 @@ bool suppress_logging; union tdb_attribute tap_log_attr = { .log = { .base = { .attr = TDB_ATTRIBUTE_LOG }, - .log_fn = tap_log_fn } + .fn = tap_log_fn } }; void tap_log_fn(struct tdb_context *tdb, diff --git a/ccan/tdb2/test/run-04-basichash.c b/ccan/tdb2/test/run-04-basichash.c index 0f962f82..50c7c77d 100644 --- a/ccan/tdb2/test/run-04-basichash.c +++ b/ccan/tdb2/test/run-04-basichash.c @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) struct tdb_data key = { (unsigned char *)&v, sizeof(v) }; struct tdb_data dbuf = { (unsigned char *)&v, sizeof(v) }; union tdb_attribute hattr = { .hash = { .base = { TDB_ATTRIBUTE_HASH }, - .hash_fn = clash } }; + .fn = clash } }; int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP, TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, TDB_NOMMAP|TDB_CONVERT, diff --git a/ccan/tdb2/test/run-12-store.c b/ccan/tdb2/test/run-12-store.c index 5c21e3a1..97166553 100644 --- a/ccan/tdb2/test/run-12-store.c +++ b/ccan/tdb2/test/run-12-store.c @@ -23,8 +23,8 @@ int main(int argc, char *argv[]) uint64_t seed = 16014841315512641303ULL; union tdb_attribute fixed_hattr = { .hash = { .base = { TDB_ATTRIBUTE_HASH }, - .hash_fn = fixedhash, - .hash_private = &seed } }; + .fn = fixedhash, + .data = &seed } }; int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP, TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, TDB_NOMMAP|TDB_CONVERT }; diff --git a/ccan/tdb2/test/run-13-delete.c b/ccan/tdb2/test/run-13-delete.c index c70fec84..3b464d92 100644 --- a/ccan/tdb2/test/run-13-delete.c +++ b/ccan/tdb2/test/run-13-delete.c @@ -146,11 +146,11 @@ int main(int argc, char *argv[]) uint64_t seed = 16014841315512641303ULL; union tdb_attribute clash_hattr = { .hash = { .base = { TDB_ATTRIBUTE_HASH }, - .hash_fn = clash } }; + .fn = clash } }; union tdb_attribute fixed_hattr = { .hash = { .base = { TDB_ATTRIBUTE_HASH }, - .hash_fn = fixedhash, - .hash_private = &seed } }; + .fn = fixedhash, + .data = &seed } }; int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP, TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, TDB_NOMMAP|TDB_CONVERT }; diff --git a/ccan/tdb2/test/run-20-growhash.c b/ccan/tdb2/test/run-20-growhash.c index 1b6e7450..22a88c45 100644 --- a/ccan/tdb2/test/run-20-growhash.c +++ b/ccan/tdb2/test/run-20-growhash.c @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) struct tdb_data key = { (unsigned char *)&kdata, sizeof(kdata) }; struct tdb_data dbuf = { (unsigned char *)&kdata, sizeof(kdata) }; union tdb_attribute hattr = { .hash = { .base = { TDB_ATTRIBUTE_HASH }, - .hash_fn = myhash } }; + .fn = myhash } }; int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP, TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, TDB_NOMMAP|TDB_CONVERT, diff --git a/ccan/tdb2/test/run-25-hashoverload.c b/ccan/tdb2/test/run-25-hashoverload.c index 4ddb54bc..83f549d6 100644 --- a/ccan/tdb2/test/run-25-hashoverload.c +++ b/ccan/tdb2/test/run-25-hashoverload.c @@ -29,7 +29,7 @@ int main(int argc, char *argv[]) struct tdb_data key = { (unsigned char *)&j, sizeof(j) }; struct tdb_data dbuf = { (unsigned char *)&j, sizeof(j) }; union tdb_attribute hattr = { .hash = { .base = { TDB_ATTRIBUTE_HASH }, - .hash_fn = badhash } }; + .fn = badhash } }; int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP, TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, TDB_NOMMAP|TDB_CONVERT, diff --git a/ccan/tdb2/test/run-missing-entries.c b/ccan/tdb2/test/run-missing-entries.c index 9bc77877..e99572f6 100644 --- a/ccan/tdb2/test/run-missing-entries.c +++ b/ccan/tdb2/test/run-missing-entries.c @@ -27,7 +27,7 @@ int main(int argc, char *argv[]) struct tdb_data key = { (unsigned char *)&i, sizeof(i) }; struct tdb_data data = { (unsigned char *)&i, sizeof(i) }; union tdb_attribute hattr = { .hash = { .base = { TDB_ATTRIBUTE_HASH }, - .hash_fn = failhash } }; + .fn = failhash } }; hattr.base.next = &tap_log_attr; plan_tests(1 + 2 * NUM_RECORDS + 1); diff --git a/ccan/tdb2/test/run-seed.c b/ccan/tdb2/test/run-seed.c index 09ed1cb3..624bb15c 100644 --- a/ccan/tdb2/test/run-seed.c +++ b/ccan/tdb2/test/run-seed.c @@ -21,7 +21,7 @@ static void my_log_fn(struct tdb_context *tdb, static union tdb_attribute log_attr = { .log = { .base = { .attr = TDB_ATTRIBUTE_LOG }, - .log_fn = my_log_fn } + .fn = my_log_fn } }; int main(int argc, char *argv[]) diff --git a/ccan/tdb2/test/run-traverse.c b/ccan/tdb2/test/run-traverse.c index 36077e4a..583e649d 100644 --- a/ccan/tdb2/test/run-traverse.c +++ b/ccan/tdb2/test/run-traverse.c @@ -114,8 +114,8 @@ int main(int argc, char *argv[]) TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, TDB_NOMMAP|TDB_CONVERT }; union tdb_attribute hattr = { .hash = { .base = { TDB_ATTRIBUTE_HASH }, - .hash_fn = fixedhash, - .hash_private = &seed } }; + .fn = fixedhash, + .data = &seed } }; hattr.base.next = &tap_log_attr; diff --git a/ccan/tdb2/tools/speed.c b/ccan/tdb2/tools/speed.c index dc5f0ad8..c9fb0d05 100644 --- a/ccan/tdb2/tools/speed.c +++ b/ccan/tdb2/tools/speed.c @@ -95,7 +95,7 @@ static void dump_and_clear_stats(struct tdb_attribute_stats *stats) } static void tdb_log(struct tdb_context *tdb, enum tdb_log_level level, - void *private, const char *message) + void *data, const char *message) { fputs(message, stderr); } @@ -118,7 +118,7 @@ int main(int argc, char *argv[]) log.base.attr = TDB_ATTRIBUTE_LOG; log.base.next = &seed; - log.log.log_fn = tdb_log; + log.log.fn = tdb_log; memset(&stats, 0, sizeof(stats)); stats.base.attr = TDB_ATTRIBUTE_STATS; diff --git a/ccan/tdb2/tools/tdbtool.c b/ccan/tdb2/tools/tdbtool.c index 15ae052c..1cfcca8e 100644 --- a/ccan/tdb2/tools/tdbtool.c +++ b/ccan/tdb2/tools/tdbtool.c @@ -233,7 +233,7 @@ static void create_tdb(const char *tdbname) union tdb_attribute log_attr; log_attr.base.attr = TDB_ATTRIBUTE_LOG; log_attr.base.next = NULL; - log_attr.log.log_fn = tdb_log; + log_attr.log.fn = tdb_log; if (tdb) tdb_close(tdb); tdb = tdb_open(tdbname, (disable_mmap?TDB_NOMMAP:0), @@ -248,7 +248,7 @@ static void open_tdb(const char *tdbname) union tdb_attribute log_attr; log_attr.base.attr = TDB_ATTRIBUTE_LOG; log_attr.base.next = NULL; - log_attr.log.log_fn = tdb_log; + log_attr.log.fn = tdb_log; if (tdb) tdb_close(tdb); tdb = tdb_open(tdbname, disable_mmap?TDB_NOMMAP:0, O_RDWR, 0600, diff --git a/ccan/tdb2/tools/tdbtorture.c b/ccan/tdb2/tools/tdbtorture.c index a409dab9..42967751 100644 --- a/ccan/tdb2/tools/tdbtorture.c +++ b/ccan/tdb2/tools/tdbtorture.c @@ -43,7 +43,7 @@ static union tdb_attribute log_attr; static union tdb_attribute seed_attr; static void tdb_log(struct tdb_context *tdb, enum tdb_log_level level, - void *private, const char *message) + void *data, const char *message) { fputs(message, stdout); fflush(stdout); @@ -327,7 +327,7 @@ int main(int argc, char * const *argv) log_attr.base.attr = TDB_ATTRIBUTE_LOG; log_attr.base.next = &seed_attr; - log_attr.log.log_fn = tdb_log; + log_attr.log.fn = tdb_log; seed_attr.base.attr = TDB_ATTRIBUTE_SEED; while ((c = getopt(argc, argv, "n:l:s:thkS")) != -1) { -- 2.39.2