Commit 02d83e6a authored by Rusty Russell's avatar Rusty Russell

tdb2: remove nesting support.

We don't actually support it, so take it away for the moment.  If you
try to nmest you get a TDB_LOG_USE_ERROR message.
parent 58798295
......@@ -324,7 +324,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
/* Is it already in the open list? If so, fail. */
if (tdb_already_open(st.st_dev, st.st_ino)) {
/* FIXME */
tdb_logerr(tdb, TDB_ERR_NESTING, TDB_LOG_USE_ERROR,
tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_USE_ERROR,
"tdb_open: %s (%d,%d) is already open in this"
" process",
name, (int)st.st_dev, (int)st.st_ino);
......@@ -374,9 +374,6 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
case TDB_ERR_EINVAL:
saved_errno = EINVAL;
break;
case TDB_ERR_NESTING:
saved_errno = EBUSY;
break;
default:
saved_errno = EINVAL;
break;
......@@ -702,7 +699,6 @@ const char *tdb_errorstr(const struct tdb_context *tdb)
case TDB_ERR_LOCK: return "Locking error";
case TDB_ERR_OOM: return "Out of memory";
case TDB_ERR_EXISTS: return "Record exists";
case TDB_ERR_NESTING: return "Transaction already started";
case TDB_ERR_EINVAL: return "Invalid parameter";
case TDB_ERR_NOEXIST: return "Record does not exist";
case TDB_ERR_RDONLY: return "write not permitted";
......
......@@ -57,12 +57,11 @@ extern "C" {
#define TDB_NOSYNC 64 /* don't use synchronous transactions */
#define TDB_SEQNUM 128 /* maintain a sequence number */
#define TDB_VOLATILE 256 /* Activate the per-hashchain freelist, default 5 */
#define TDB_ALLOW_NESTING 512 /* Allow transactions to nest */
/* error codes */
enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK,
TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOEXIST,
TDB_ERR_EINVAL, TDB_ERR_RDONLY, TDB_ERR_NESTING };
TDB_ERR_EINVAL, TDB_ERR_RDONLY };
/* flags for tdb_summary. Logical or to combine. */
enum tdb_summary_flags { TDB_SUMMARY_HISTOGRAMS = 1 };
......
......@@ -11,23 +11,19 @@ int main(int argc, char *argv[])
{
struct tdb_context *tdb;
plan_tests(1 + TDB_ERR_NESTING + 2);
plan_tests(1 + TDB_ERR_RDONLY + 2);
tdb = tdb_open("run-tdb_errorstr.tdb", TDB_DEFAULT,
O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
ok1(tdb);
if (tdb) {
enum TDB_ERROR err;
for (err = TDB_SUCCESS; err <= TDB_ERR_NESTING; err++) {
for (err = TDB_SUCCESS; err <= TDB_ERR_RDONLY; err++) {
tdb->ecode = err;
switch (err) {
case TDB_SUCCESS:
ok1(!strcmp(tdb_errorstr(tdb),
"Success"));
break;
case TDB_ERR_NESTING:
ok1(!strcmp(tdb_errorstr(tdb),
"Transaction already started"));
break;
case TDB_ERR_IO:
ok1(!strcmp(tdb_errorstr(tdb),
"IO Error"));
......
......@@ -509,7 +509,7 @@ int tdb_transaction_start(struct tdb_context *tdb)
/* cope with nested tdb_transaction_start() calls */
if (tdb->transaction != NULL) {
tdb_logerr(tdb, TDB_ERR_NESTING, TDB_LOG_USE_ERROR,
tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_USE_ERROR,
"tdb_transaction_start:"
" already inside transaction");
return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment