summaryrefslogtreecommitdiffstats
path: root/source4/cluster
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
commit6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch)
tree850c71039563c16a5d563c47e7ba2ab645baf198 /source4/cluster
parent6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff)
parent2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff)
downloadsamba-4.0.0alpha16.tar.gz
samba-4.0.0alpha16.tar.xz
samba-4.0.0alpha16.zip
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16samba-4.0.0alpha16
Diffstat (limited to 'source4/cluster')
-rw-r--r--source4/cluster/cluster.c19
-rw-r--r--source4/cluster/cluster.h19
-rw-r--r--source4/cluster/cluster_private.h4
-rw-r--r--source4/cluster/local.c25
4 files changed, 21 insertions, 46 deletions
diff --git a/source4/cluster/cluster.c b/source4/cluster/cluster.c
index 746c0048202..757489ebce6 100644
--- a/source4/cluster/cluster.c
+++ b/source4/cluster/cluster.c
@@ -23,7 +23,7 @@
#include "cluster/cluster.h"
#include "cluster/cluster_private.h"
#include "librpc/gen_ndr/misc.h"
-#include "librpc/gen_ndr/server_id4.h"
+#include "librpc/gen_ndr/server_id.h"
static struct cluster_ops *ops;
@@ -50,23 +50,12 @@ static void cluster_init(void)
/*
create a server_id for the local node
*/
-struct server_id cluster_id(uint64_t id, uint32_t id2)
+struct server_id cluster_id(uint64_t pid, uint32_t task_id)
{
cluster_init();
- return ops->cluster_id(ops, id, id2);
+ return ops->cluster_id(ops, pid, task_id);
}
-
-/*
- return a server_id as a string
-*/
-const char *cluster_id_string(TALLOC_CTX *mem_ctx, struct server_id id)
-{
- cluster_init();
- return ops->cluster_id_string(ops, mem_ctx, id);
-}
-
-
/*
open a temporary tdb in a cluster friendly manner
*/
@@ -80,7 +69,7 @@ struct tdb_wrap *cluster_tdb_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_conte
/*
register a callback function for a messaging endpoint
*/
-NTSTATUS cluster_message_init(struct messaging_context *msg, struct server_id server,
+NTSTATUS cluster_message_init(struct imessaging_context *msg, struct server_id server,
cluster_message_fn_t handler)
{
cluster_init();
diff --git a/source4/cluster/cluster.h b/source4/cluster/cluster.h
index 6cfcb9b21b3..3dd9f4ce7c5 100644
--- a/source4/cluster/cluster.h
+++ b/source4/cluster/cluster.h
@@ -22,30 +22,29 @@
#ifndef __CLUSTER_H__
#define __CLUSTER_H__
-#include "librpc/gen_ndr/server_id4.h"
+#include "librpc/gen_ndr/server_id.h"
/*
test for same cluster id
*/
-#define cluster_id_equal(id_1, id_2) ((id_1)->id == (id_2)->id \
- && (id_1)->id2 == (id_2)->id2 \
- && (id_1)->node == (id_2)->node)
+#define cluster_id_equal(id_1, id_2) ((id_1)->pid == (id_2)->pid \
+ && (id_1)->task_id == (id_2)->task_id \
+ && (id_1)->vnn == (id_2)->vnn)
/*
test for same cluster node
*/
-#define cluster_node_equal(id1, id2) ((id1)->node == (id2)->node)
+#define cluster_node_equal(id1, id2) ((id1)->vnn == (id2)->vnn)
-struct messaging_context;
-typedef void (*cluster_message_fn_t)(struct messaging_context *, DATA_BLOB);
+struct imessaging_context;
+typedef void (*cluster_message_fn_t)(struct imessaging_context *, DATA_BLOB);
/* prototypes */
-struct server_id cluster_id(uint64_t id, uint32_t id2);
-const char *cluster_id_string(TALLOC_CTX *mem_ctx, struct server_id id);
+struct server_id cluster_id(uint64_t id, uint32_t task_id);
struct tdb_wrap *cluster_tdb_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *dbname, int flags);
void *cluster_backend_handle(void);
-NTSTATUS cluster_message_init(struct messaging_context *msg, struct server_id server,
+NTSTATUS cluster_message_init(struct imessaging_context *msg, struct server_id server,
cluster_message_fn_t handler);
NTSTATUS cluster_message_send(struct server_id server, DATA_BLOB *data);
diff --git a/source4/cluster/cluster_private.h b/source4/cluster/cluster_private.h
index e57c983ed0c..6f68ad62bd7 100644
--- a/source4/cluster/cluster_private.h
+++ b/source4/cluster/cluster_private.h
@@ -24,15 +24,13 @@
struct cluster_ops {
struct server_id (*cluster_id)(struct cluster_ops *ops, uint64_t id, uint32_t id2);
- const char *(*cluster_id_string)(struct cluster_ops *ops,
- TALLOC_CTX *, struct server_id );
struct tdb_wrap *(*cluster_tdb_tmp_open)(struct cluster_ops *,
TALLOC_CTX *,
struct loadparm_context *,
const char *, int);
void *(*backend_handle)(struct cluster_ops *);
NTSTATUS (*message_init)(struct cluster_ops *ops,
- struct messaging_context *msg, struct server_id server,
+ struct imessaging_context *msg, struct server_id server,
cluster_message_fn_t handler);
NTSTATUS (*message_send)(struct cluster_ops *ops,
struct server_id server, DATA_BLOB *data);
diff --git a/source4/cluster/local.c b/source4/cluster/local.c
index a93b0a65ede..0a294b4d1d1 100644
--- a/source4/cluster/local.c
+++ b/source4/cluster/local.c
@@ -22,36 +22,26 @@
#include "includes.h"
#include "cluster/cluster.h"
#include "cluster/cluster_private.h"
-#include <tdb.h>
-#include "tdb_wrap.h"
+#include "tdb_compat.h"
+#include "lib/util/tdb_wrap.h"
#include "system/filesys.h"
#include "param/param.h"
-#include "librpc/gen_ndr/server_id4.h"
+#include "librpc/gen_ndr/server_id.h"
/*
server a server_id for the local node
*/
-static struct server_id local_id(struct cluster_ops *ops, uint64_t id, uint32_t id2)
+static struct server_id local_id(struct cluster_ops *ops, uint64_t pid, uint32_t task_id)
{
struct server_id server_id;
ZERO_STRUCT(server_id);
- server_id.id = id;
- server_id.id2 = id2;
+ server_id.pid = pid;
+ server_id.task_id = task_id;
return server_id;
}
/*
- return a server_id as a string
-*/
-static const char *local_id_string(struct cluster_ops *ops,
- TALLOC_CTX *mem_ctx, struct server_id id)
-{
- return talloc_asprintf(mem_ctx, "%u.%llu.%u", id.node, (unsigned long long)id.id, id.id2);
-}
-
-
-/*
open a tmp tdb for the local node. By using smbd_tmp_path() we don't need
TDB_CLEAR_IF_FIRST as the tmp path is wiped at startup
*/
@@ -80,7 +70,7 @@ static void *local_backend_handle(struct cluster_ops *ops)
dummy message init function - not needed as all messages are local
*/
static NTSTATUS local_message_init(struct cluster_ops *ops,
- struct messaging_context *msg,
+ struct imessaging_context *msg,
struct server_id server,
cluster_message_fn_t handler)
{
@@ -98,7 +88,6 @@ static NTSTATUS local_message_send(struct cluster_ops *ops,
static struct cluster_ops cluster_local_ops = {
.cluster_id = local_id,
- .cluster_id_string = local_id_string,
.cluster_tdb_tmp_open = local_tdb_tmp_open,
.backend_handle = local_backend_handle,
.message_init = local_message_init,