tdb2: #ifdef out TDB_ERR_NOLOCK and TDB_ERR_LOCK_TIMEOUT.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 20 Jun 2011 09:10:32 +0000 (18:40 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 20 Jun 2011 09:18:35 +0000 (11:18 +0200)
These don't exist in tdb2.  The former is used in one weird place in
tdb1, and the latter not at all.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
source3/lib/gencache.c
source3/lib/util_tdb.c
source4/lib/ldb/ldb_tdb/ldb_tdb.c

index 296f50ebaead1565752f8d642b328dce2a0266b8..c00cc115af817333a21421f1f629e0afd40b8345 100644 (file)
@@ -463,7 +463,12 @@ bool gencache_stabilize(void)
        res = tdb_transaction_start_nonblock(cache);
        if (res != 0) {
 
-               if (tdb_error(cache) == TDB_ERR_NOLOCK) {
+#if BUILD_TDB2
+               if (res == TDB_ERR_LOCK)
+#else
+               if (tdb_error(cache) == TDB_ERR_NOLOCK)
+#endif
+               {
                        /*
                         * Someone else already does the stabilize,
                         * this does not have to be done twice
index e78dbec704f38dbb9603af56ff9a17ea6afb3be9..92c43d86057366e218a2ed506fab1dc5cedc12d9 100644 (file)
@@ -511,6 +511,7 @@ NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err)
                result = NT_STATUS_FILE_LOCK_CONFLICT;
                break;
 
+#ifndef BUILD_TDB2
        case TDB_ERR_NOLOCK:
        case TDB_ERR_LOCK_TIMEOUT:
                /*
@@ -518,6 +519,7 @@ NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err)
                 */
                result = NT_STATUS_FILE_LOCK_CONFLICT;
                break;
+#endif
        case TDB_ERR_NOEXIST:
                result = NT_STATUS_NOT_FOUND;
                break;
@@ -527,9 +529,11 @@ NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err)
        case TDB_ERR_RDONLY:
                result = NT_STATUS_ACCESS_DENIED;
                break;
+#ifndef BUILD_TDB2
        case TDB_ERR_NESTING:
                result = NT_STATUS_INTERNAL_ERROR;
                break;
+#endif
        };
        return result;
 }
index 6033f84ef39603ccc5751aba9377c6a0ee1f6415..0d4be49123501d4de36d0a016130595d6aafc0a3 100644 (file)
@@ -68,9 +68,13 @@ int ltdb_err_map(enum TDB_ERROR tdb_code)
        case TDB_ERR_IO:
                return LDB_ERR_PROTOCOL_ERROR;
        case TDB_ERR_LOCK:
+#ifndef BUILD_TDB2
        case TDB_ERR_NOLOCK:
+#endif
                return LDB_ERR_BUSY;
+#ifndef BUILD_TDB2
        case TDB_ERR_LOCK_TIMEOUT:
+#endif
                return LDB_ERR_TIME_LIMIT_EXCEEDED;
        case TDB_ERR_EXISTS:
                return LDB_ERR_ENTRY_ALREADY_EXISTS;