It's redundant calling hash.hash_fn for example. Standardize on fn
and data as names (private conflicts with C++).
18 files changed:
size_t *num_found,
enum TDB_ERROR (*check)(TDB_DATA,
TDB_DATA, void *),
size_t *num_found,
enum TDB_ERROR (*check)(TDB_DATA,
TDB_DATA, void *),
static enum TDB_ERROR check_hash_chain(struct tdb_context *tdb,
tdb_off_t off,
static enum TDB_ERROR check_hash_chain(struct tdb_context *tdb,
tdb_off_t off,
enum TDB_ERROR (*check)(TDB_DATA,
TDB_DATA,
void *),
enum TDB_ERROR (*check)(TDB_DATA,
TDB_DATA,
void *),
{
struct tdb_used_record rec;
enum TDB_ERROR ecode;
{
struct tdb_used_record rec;
enum TDB_ERROR ecode;
off += sizeof(rec);
ecode = check_hash_tree(tdb, off, 0, hash, 64,
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;
}
if (ecode != TDB_SUCCESS) {
return ecode;
}
return TDB_SUCCESS;
(*num_found)++;
return check_hash_chain(tdb, off, hash, used, num_used, num_found,
return TDB_SUCCESS;
(*num_found)++;
return check_hash_chain(tdb, off, hash, used, num_used, num_found,
}
static enum TDB_ERROR check_hash_record(struct tdb_context *tdb,
}
static enum TDB_ERROR check_hash_record(struct tdb_context *tdb,
enum TDB_ERROR (*check)(TDB_DATA,
TDB_DATA,
void *),
enum TDB_ERROR (*check)(TDB_DATA,
TDB_DATA,
void *),
{
struct tdb_used_record rec;
enum TDB_ERROR ecode;
if (hprefix_bits >= 64)
return check_hash_chain(tdb, off, hprefix, used, num_used,
{
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) {
ecode = tdb_read_convert(tdb, off, &rec, sizeof(rec));
if (ecode != TDB_SUCCESS) {
return check_hash_tree(tdb, off,
TDB_SUBLEVEL_HASH_BITS-TDB_HASH_GROUP_BITS,
hprefix, hprefix_bits,
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)
}
static int off_cmp(const tdb_off_t *a, const tdb_off_t *b)
size_t *num_found,
enum TDB_ERROR (*check)(TDB_DATA,
TDB_DATA, void *),
size_t *num_found,
enum TDB_ERROR (*check)(TDB_DATA,
TDB_DATA, void *),
{
unsigned int g, b;
const tdb_off_t *hash;
{
unsigned int g, b;
const tdb_off_t *hash;
+ group_bits
+ TDB_HASH_GROUP_BITS,
used, num_used, num_found,
+ group_bits
+ TDB_HASH_GROUP_BITS,
used, num_used, num_found,
if (ecode != TDB_SUCCESS) {
goto fail;
}
if (ecode != TDB_SUCCESS) {
goto fail;
}
const unsigned char *kptr;
kptr = tdb_access_read(tdb,
const unsigned char *kptr;
kptr = tdb_access_read(tdb,
- 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;
tdb_access_release(tdb, kptr);
if (ecode != TDB_SUCCESS) {
goto fail;
tdb_off_t used[],
size_t num_used, size_t num_ftables,
int (*check)(TDB_DATA, TDB_DATA, void *),
tdb_off_t used[],
size_t num_used, size_t num_ftables,
int (*check)(TDB_DATA, TDB_DATA, void *),
{
/* Free tables also show up as used. */
size_t num_found = num_ftables;
{
/* Free tables also show up as used. */
size_t num_found = num_ftables;
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,
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,
if (ecode == TDB_SUCCESS) {
if (num_found != num_used) {
ecode = tdb_logerr(tdb, TDB_ERR_CORRUPT, TDB_LOG_ERROR,
if (ecode == TDB_SUCCESS) {
if (num_found != num_used) {
ecode = tdb_logerr(tdb, TDB_ERR_CORRUPT, TDB_LOG_ERROR,
}
enum TDB_ERROR tdb_check_(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;
{
tdb_off_t *fr = NULL, *used = NULL, ft, recovery;
size_t num_free = 0, num_used = 0, num_found = 0, num_ftables = 0;
}
/* FIXME: Check key uniqueness? */
}
/* 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;
if (ecode != TDB_SUCCESS)
goto out;
void tdb_hash_init(struct tdb_context *tdb)
{
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)
{
}
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)
}
uint64_t hash_record(struct tdb_context *tdb, tdb_off_t off)
else
newdb.hdr.hash_seed = random_number(tdb);
newdb.hdr.hash_test = TDB_HASH_MAGIC;
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;
newdb.hdr.recovery = 0;
newdb.hdr.features_used = newdb.hdr.features_offered = TDB_FEATURE_MASK;
newdb.hdr.seqnum = 0;
while (attr) {
switch (attr->base.attr) {
case TDB_ATTRIBUTE_LOG:
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:
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;
break;
case TDB_ATTRIBUTE_SEED:
seed = &attr->seed;
/* Logging function */
void (*logfn)(struct tdb_context *tdb,
enum tdb_log_level level,
/* Logging function */
void (*logfn)(struct tdb_context *tdb,
enum tdb_log_level level,
- 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. */
uint64_t hash_seed;
/* Set if we are in a transaction. */
va_end(ap);
if (len < 0) {
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:");
"out of memory formatting message:");
- tdb->logfn(tdb, level, tdb->log_private, fmt);
+ tdb->logfn(tdb, level, tdb->log_data, fmt);
- tdb->logfn(tdb, level, tdb->log_private, message);
+ tdb->logfn(tdb, level, tdb->log_data, message);
free(message);
}
errno = saved_errno;
free(message);
}
errno = saved_errno;
enum TDB_ERROR tdb_parse_record_(struct tdb_context *tdb,
TDB_DATA key,
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;
{
tdb_off_t off;
struct tdb_used_record rec;
if (TDB_PTR_IS_ERR(dptr)) {
ecode = TDB_PTR_ERR(dptr);
} else {
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);
}
}
tdb_access_release(tdb, dptr);
}
}
* @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
* @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
*
* This avoids a copy for many cases, by handing you a pointer into
* the memory-mapped database. It also locks the record to prevent
*
* Do not alter the data handed to parse()!
*/
*
* 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 *, \
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 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
/**
* tdb_get_seqnum - get a database sequence number
* 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)
* 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
*
* 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
*
* Returns TDB_SUCCESS or an error.
*/
*
* 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 *, \
tdb_check_((tdb), typesafe_cb_preargs(enum TDB_ERROR, void *, \
- (check), (private_data), \
struct tdb_data, \
struct tdb_data), \
struct tdb_data, \
struct tdb_data), \
enum TDB_ERROR tdb_check_(struct tdb_context *tdb,
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)
/**
* tdb_error - get the last error (not threadsafe)
*/
struct tdb_attribute_log {
struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_LOG */
*/
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;
*/
struct tdb_attribute_hash {
struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_HASH */
*/
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;
union tdb_attribute tap_log_attr = {
.log = { .base = { .attr = TDB_ATTRIBUTE_LOG },
union tdb_attribute tap_log_attr = {
.log = { .base = { .attr = TDB_ATTRIBUTE_LOG },
};
void tap_log_fn(struct tdb_context *tdb,
};
void tap_log_fn(struct tdb_context *tdb,
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 },
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 },
int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT,
TDB_NOMMAP|TDB_CONVERT,
int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT,
TDB_NOMMAP|TDB_CONVERT,
uint64_t seed = 16014841315512641303ULL;
union tdb_attribute fixed_hattr
= { .hash = { .base = { TDB_ATTRIBUTE_HASH },
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 };
int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT,
TDB_NOMMAP|TDB_CONVERT };
uint64_t seed = 16014841315512641303ULL;
union tdb_attribute clash_hattr
= { .hash = { .base = { TDB_ATTRIBUTE_HASH },
uint64_t seed = 16014841315512641303ULL;
union tdb_attribute clash_hattr
= { .hash = { .base = { TDB_ATTRIBUTE_HASH },
union tdb_attribute fixed_hattr
= { .hash = { .base = { TDB_ATTRIBUTE_HASH },
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 };
int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT,
TDB_NOMMAP|TDB_CONVERT };
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 },
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 },
int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT,
TDB_NOMMAP|TDB_CONVERT,
int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT,
TDB_NOMMAP|TDB_CONVERT,
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 },
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 } };
int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT,
TDB_NOMMAP|TDB_CONVERT,
int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT,
TDB_NOMMAP|TDB_CONVERT,
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 },
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 } };
hattr.base.next = &tap_log_attr;
plan_tests(1 + 2 * NUM_RECORDS + 1);
hattr.base.next = &tap_log_attr;
plan_tests(1 + 2 * NUM_RECORDS + 1);
static union tdb_attribute log_attr = {
.log = { .base = { .attr = TDB_ATTRIBUTE_LOG },
static union tdb_attribute log_attr = {
.log = { .base = { .attr = TDB_ATTRIBUTE_LOG },
};
int main(int argc, char *argv[])
};
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 },
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;
hattr.base.next = &tap_log_attr;
}
static void tdb_log(struct tdb_context *tdb, enum tdb_log_level level,
}
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);
}
{
fputs(message, stderr);
}
log.base.attr = TDB_ATTRIBUTE_LOG;
log.base.next = &seed;
log.base.attr = TDB_ATTRIBUTE_LOG;
log.base.next = &seed;
- log.log.log_fn = tdb_log;
memset(&stats, 0, sizeof(stats));
stats.base.attr = TDB_ATTRIBUTE_STATS;
memset(&stats, 0, sizeof(stats));
stats.base.attr = TDB_ATTRIBUTE_STATS;
union tdb_attribute log_attr;
log_attr.base.attr = TDB_ATTRIBUTE_LOG;
log_attr.base.next = NULL;
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),
if (tdb) tdb_close(tdb);
tdb = tdb_open(tdbname, (disable_mmap?TDB_NOMMAP:0),
union tdb_attribute log_attr;
log_attr.base.attr = TDB_ATTRIBUTE_LOG;
log_attr.base.next = NULL;
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,
if (tdb) tdb_close(tdb);
tdb = tdb_open(tdbname, disable_mmap?TDB_NOMMAP:0, O_RDWR, 0600,
static union tdb_attribute seed_attr;
static void tdb_log(struct tdb_context *tdb, enum tdb_log_level level,
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);
{
fputs(message, stdout);
fflush(stdout);
log_attr.base.attr = TDB_ATTRIBUTE_LOG;
log_attr.base.next = &seed_attr;
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) {
seed_attr.base.attr = TDB_ATTRIBUTE_SEED;
while ((c = getopt(argc, argv, "n:l:s:thkS")) != -1) {