opendb: add odb_get_key() function to get the key back from a struct odb_lock
authorStefan Metzmacher <metze@samba.org>
Fri, 22 Feb 2008 09:18:13 +0000 (10:18 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 25 Feb 2008 10:50:30 +0000 (11:50 +0100)
metze
(This used to be commit 11f35a2a4d383b506ced35ba06120f9531bac70c)

source4/cluster/ctdb/opendb_ctdb.c
source4/ntvfs/common/opendb.c
source4/ntvfs/common/opendb.h
source4/ntvfs/common/opendb_tdb.c

index aaab3aa55dc9b1e59777a833f20c16c0e7433b55..f056e2171660b66a1577541d558582053c09124f 100644 (file)
@@ -133,6 +133,16 @@ static struct odb_lock *odb_ctdb_lock(TALLOC_CTX *mem_ctx,
        return lck;
 }
 
+static DATA_BLOB odb_ctdb_get_key(TALLOC_CTX *mem_ctx, struct odb_lock *lck)
+{
+       /*
+        * as this file will went away and isn't used yet,
+        * copy the implementation from the tdb backend
+        * --metze
+        */
+       return data_blob_const(NULL, 0);
+}
+
 /*
   determine if two odb_entry structures conflict
 
@@ -610,6 +620,7 @@ static NTSTATUS odb_ctdb_can_open(struct odb_lock *lck,
 static const struct opendb_ops opendb_ctdb_ops = {
        .odb_init                = odb_ctdb_init,
        .odb_lock                = odb_ctdb_lock,
+       .odb_get_key             = odb_ctdb_get_key,
        .odb_open_file           = odb_ctdb_open_file,
        .odb_open_file_pending   = odb_ctdb_open_file_pending,
        .odb_close_file          = odb_ctdb_close_file,
index 4826ca5c267a25ada8e02d2fcb5917f542b4ce21..f12f23817db80944c3fe175fed232c27b68e95de 100644 (file)
@@ -81,6 +81,10 @@ _PUBLIC_ struct odb_lock *odb_lock(TALLOC_CTX *mem_ctx,
        return ops->odb_lock(mem_ctx, odb, file_key);
 }
 
+_PUBLIC_ DATA_BLOB odb_get_key(TALLOC_CTX *mem_ctx, struct odb_lock *lck)
+{
+       return ops->odb_get_key(mem_ctx, lck);
+}
 
 /*
   register an open file in the open files database. This implements the share_access
index 231ae3d7deb05417d42181a86190c8455ff6cdbc..5472cea418165095d38d947c5171d83e100c8904 100644 (file)
@@ -24,6 +24,7 @@ struct opendb_ops {
                                        struct ntvfs_context *ntvfs_ctx);
        struct odb_lock *(*odb_lock)(TALLOC_CTX *mem_ctx,
                                     struct odb_context *odb, DATA_BLOB *file_key);
+       DATA_BLOB (*odb_get_key)(TALLOC_CTX *mem_ctx, struct odb_lock *lck);
        NTSTATUS (*odb_open_file)(struct odb_lock *lck, void *file_handle,
                                  uint32_t stream_id, uint32_t share_access, 
                                  uint32_t access_mask, bool delete_on_close,
index abd9ca708b145e4cfc93c3ab62382be9287f59a5..469cf28374e7313001d379e2defadcac52010bfb 100644 (file)
@@ -134,6 +134,12 @@ static struct odb_lock *odb_tdb_lock(TALLOC_CTX *mem_ctx,
        return lck;
 }
 
+static DATA_BLOB odb_tdb_get_key(TALLOC_CTX *mem_ctx, struct odb_lock *lck)
+{
+       return data_blob_talloc(mem_ctx, lck->key.dptr, lck->key.dsize);
+}
+
+
 /*
   determine if two odb_entry structures conflict
 
@@ -609,6 +615,7 @@ static NTSTATUS odb_tdb_can_open(struct odb_lock *lck,
 static const struct opendb_ops opendb_tdb_ops = {
        .odb_init                = odb_tdb_init,
        .odb_lock                = odb_tdb_lock,
+       .odb_get_key             = odb_tdb_get_key,
        .odb_open_file           = odb_tdb_open_file,
        .odb_open_file_pending   = odb_tdb_open_file_pending,
        .odb_close_file          = odb_tdb_close_file,