diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-02-04 17:51:38 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-02-04 17:51:38 +1100 |
commit | 77f71c1b65358723771354fd9ff1dc418b227ccc (patch) | |
tree | 2b1b96d1f3dcd55997fd6d48e75085ff506fb0a2 /source4/cluster | |
parent | 23d681caf9c1186999ac676d70a1eb0e8a43e358 (diff) | |
download | samba-77f71c1b65358723771354fd9ff1dc418b227ccc.tar.gz samba-77f71c1b65358723771354fd9ff1dc418b227ccc.tar.bz2 samba-77f71c1b65358723771354fd9ff1dc418b227ccc.zip |
Rework cluster_id() to take an additional argument, as we need
<node>.<pid>.<fd> to be unique in a prefork process environment.
Andrew Bartlett and David Disseldorp
(This used to be commit 931994a7f185bbc98924823e9e8cef1011dd0957)
Diffstat (limited to 'source4/cluster')
-rw-r--r-- | source4/cluster/cluster.c | 6 | ||||
-rw-r--r-- | source4/cluster/cluster.h | 2 | ||||
-rw-r--r-- | source4/cluster/cluster_private.h | 2 | ||||
-rw-r--r-- | source4/cluster/ctdb/ctdb_cluster.c | 5 | ||||
-rw-r--r-- | source4/cluster/local.c | 5 |
5 files changed, 11 insertions, 9 deletions
diff --git a/source4/cluster/cluster.c b/source4/cluster/cluster.c index 6bac1dcbe5..cc61974cbd 100644 --- a/source4/cluster/cluster.c +++ b/source4/cluster/cluster.c @@ -47,12 +47,12 @@ static void cluster_init(void) } /* - server a server_id for the local node + create a server_id for the local node */ -struct server_id cluster_id(uint32_t id) +struct server_id cluster_id(uint64_t id, uint32_t id2) { cluster_init(); - return ops->cluster_id(ops, id); + return ops->cluster_id(ops, id, id2); } diff --git a/source4/cluster/cluster.h b/source4/cluster/cluster.h index 7cd31282cc..203aef439c 100644 --- a/source4/cluster/cluster.h +++ b/source4/cluster/cluster.h @@ -36,7 +36,7 @@ struct messaging_context; typedef void (*cluster_message_fn_t)(struct messaging_context *, DATA_BLOB); /* prototypes */ -struct server_id cluster_id(uint32_t id); +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 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); diff --git a/source4/cluster/cluster_private.h b/source4/cluster/cluster_private.h index 1c895b8640..79394b46db 100644 --- a/source4/cluster/cluster_private.h +++ b/source4/cluster/cluster_private.h @@ -23,7 +23,7 @@ #define _CLUSTER_PRIVATE_H_ struct cluster_ops { - struct server_id (*cluster_id)(struct cluster_ops *ops, uint32_t id); + 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 *, diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 53df1e968e..ce295c4474 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -52,13 +52,14 @@ struct cluster_state { /* return a server_id for a ctdb node */ -static struct server_id ctdb_id(struct cluster_ops *ops, uint32_t id) +static struct server_id ctdb_id(struct cluster_ops *ops, uint64_t id, uint32_t id2) { struct cluster_state *state = (struct cluster_state *)ops->private; struct ctdb_context *ctdb = state->ctdb; struct server_id server_id; server_id.node = ctdb_get_vnn(ctdb); server_id.id = id; + server_id.id2 = id2; return server_id; } @@ -69,7 +70,7 @@ static struct server_id ctdb_id(struct cluster_ops *ops, uint32_t id) static const char *ctdb_id_string(struct cluster_ops *ops, TALLOC_CTX *mem_ctx, struct server_id id) { - return talloc_asprintf(mem_ctx, "%u.%u", id.node, id.id); + return talloc_asprintf(mem_ctx, "%u.%llu.%u", id.node, (unsigned long long)id.id, id.id2); } /* diff --git a/source4/cluster/local.c b/source4/cluster/local.c index 539e47d271..96636927f1 100644 --- a/source4/cluster/local.c +++ b/source4/cluster/local.c @@ -31,11 +31,12 @@ /* server a server_id for the local node */ -static struct server_id local_id(struct cluster_ops *ops, uint32_t id) +static struct server_id local_id(struct cluster_ops *ops, uint64_t id, uint32_t id2) { struct server_id server_id; ZERO_STRUCT(server_id); server_id.id = id; + server_id.id2 = id2; return server_id; } @@ -46,7 +47,7 @@ static struct server_id local_id(struct cluster_ops *ops, uint32_t id) static const char *local_id_string(struct cluster_ops *ops, TALLOC_CTX *mem_ctx, struct server_id id) { - return talloc_asprintf(mem_ctx, "%u.%u", id.node, id.id); + return talloc_asprintf(mem_ctx, "%u.%llu.%u", id.node, (unsigned long long)id.id, id.id2); } |