1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

ldb_tdb: Add errorstr to the key value ops

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Gary Lockyer 2018-02-13 15:21:34 +13:00 committed by Andrew Bartlett
parent c66a0054fb
commit 141148edd3
2 changed files with 10 additions and 3 deletions

View File

@ -423,6 +423,11 @@ static int ltdb_error(struct ltdb_private *ltdb)
return ltdb_err_map(tdb_error(ltdb->tdb));
}
static const char *ltdb_errorstr(struct ltdb_private *ltdb)
{
return tdb_errorstr(ltdb->tdb);
}
/*
store a record into the db
*/
@ -1465,8 +1470,8 @@ static int ltdb_prepare_commit(struct ldb_module *module)
ldb_debug_set(ldb_module_get_ctx(module),
LDB_DEBUG_FATAL,
"Failure during "
"tdb_transaction_prepare_commit(): %s -> %s",
tdb_errorstr(ltdb->tdb),
"prepare_write): %s -> %s",
ltdb->kv_ops->errorstr(ltdb),
ldb_strerror(ret));
return ret;
}
@ -1496,7 +1501,7 @@ static int ltdb_end_trans(struct ldb_module *module)
ret = ltdb->kv_ops->error(ltdb);
ldb_asprintf_errstring(ldb_module_get_ctx(module),
"Failure during tdb_transaction_commit(): %s -> %s",
tdb_errorstr(ltdb->tdb),
ltdb->kv_ops->errorstr(ltdb),
ldb_strerror(ret));
return ret;
}
@ -1733,6 +1738,7 @@ static const struct kv_db_ops key_value_ops = {
.finish_write = ltdb_tdb_transaction_commit,
.abort_write = ltdb_tdb_transaction_cancel,
.error = ltdb_error,
.errorstr = ltdb_errorstr,
.name = ltdb_tdb_name,
.has_changed = ltdb_tdb_changed,
};

View File

@ -15,6 +15,7 @@ struct kv_db_ops {
int (*abort_write)(struct ltdb_private *);
int (*finish_write)(struct ltdb_private *);
int (*error)(struct ltdb_private *ltdb);
const char * (*errorstr)(struct ltdb_private *ltdb);
const char * (*name)(struct ltdb_private *ltdb);
bool (*has_changed)(struct ltdb_private *ltdb);
};