From 16b1c77644217796f70a3a0bf1d95c245f9ee2d9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 8 Jun 2011 14:05:55 +1000 Subject: lib/util Bring procid_str() into lib/util as server_id_string() This is needed for OpenChange, which prints Samba struct server_id values in debug messages. Andrew Bartlett --- source4/cluster/cluster.c | 11 ----------- source4/cluster/cluster.h | 1 - source4/cluster/cluster_private.h | 2 -- source4/cluster/local.c | 11 ----------- source4/lib/messaging/messaging.c | 8 ++++---- source4/smb_server/smb/receive.c | 2 +- source4/smbd/service_stream.c | 2 +- 7 files changed, 6 insertions(+), 31 deletions(-) (limited to 'source4') diff --git a/source4/cluster/cluster.c b/source4/cluster/cluster.c index 767e6a719f..757489ebce 100644 --- a/source4/cluster/cluster.c +++ b/source4/cluster/cluster.c @@ -56,17 +56,6 @@ struct server_id cluster_id(uint64_t pid, uint32_t task_id) return ops->cluster_id(ops, pid, task_id); } - -/* - return a server_id as a string -*/ -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 */ diff --git a/source4/cluster/cluster.h b/source4/cluster/cluster.h index a6f74f956c..3dd9f4ce7c 100644 --- a/source4/cluster/cluster.h +++ b/source4/cluster/cluster.h @@ -41,7 +41,6 @@ typedef void (*cluster_message_fn_t)(struct imessaging_context *, DATA_BLOB); /* prototypes */ struct server_id cluster_id(uint64_t id, uint32_t task_id); -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 5f038dd92f..6f68ad62bd 100644 --- a/source4/cluster/cluster_private.h +++ b/source4/cluster/cluster_private.h @@ -24,8 +24,6 @@ struct cluster_ops { struct server_id (*cluster_id)(struct cluster_ops *ops, uint64_t id, uint32_t id2); - 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 *, diff --git a/source4/cluster/local.c b/source4/cluster/local.c index e7b648fc9b..833a86b07f 100644 --- a/source4/cluster/local.c +++ b/source4/cluster/local.c @@ -41,16 +41,6 @@ static struct server_id local_id(struct cluster_ops *ops, uint64_t pid, uint32_t } -/* - return a server_id as a string -*/ -static 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.vnn, (unsigned long long)id.pid, id.task_id); -} - - /* 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 @@ -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, diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 3a330d5794..aa1b43308f 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -109,7 +109,7 @@ static void irpc_handler(struct imessaging_context *, void *, static void ping_message(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data) { - char *task_id = cluster_id_string(NULL, src); + char *task_id = server_id_str(NULL, &src); DEBUG(1,("INFO: Received PING message from server %s [%.*s]\n", task_id, (int)data->length, data->data?(const char *)data->data:"")); @@ -134,7 +134,7 @@ static NTSTATUS irpc_uptime(struct irpc_message *msg, static char *imessaging_path(struct imessaging_context *msg, struct server_id server_id) { TALLOC_CTX *tmp_ctx = talloc_new(msg); - const char *id = cluster_id_string(tmp_ctx, server_id); + const char *id = server_id_str(tmp_ctx, &server_id); char *s; if (id == NULL) { return NULL; @@ -284,8 +284,8 @@ static void imessaging_send_handler(struct imessaging_context *msg) if (!NT_STATUS_IS_OK(status)) { TALLOC_CTX *tmp_ctx = talloc_new(msg); DEBUG(1,("messaging: Lost message from %s to %s of type %u - %s\n", - cluster_id_string(tmp_ctx, rec->header->from), - cluster_id_string(tmp_ctx, rec->header->to), + server_id_str(tmp_ctx, &rec->header->from), + server_id_str(tmp_ctx, &rec->header->to), rec->header->msg_type, nt_errstr(status))); talloc_free(tmp_ctx); diff --git a/source4/smb_server/smb/receive.c b/source4/smb_server/smb/receive.c index 1e5d5681f4..1379fe31cf 100644 --- a/source4/smb_server/smb/receive.c +++ b/source4/smb_server/smb/receive.c @@ -502,7 +502,7 @@ static void switch_message(int type, struct smbsrv_request *req) } } - task_id = cluster_id_string(NULL, req->smb_conn->connection->server_id); + task_id = server_id_str(NULL, &req->smb_conn->connection->server_id); DEBUG(5,("switch message %s (task_id %s)\n", smb_fn_name(type), task_id)); talloc_free(task_id); diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c index efbcfb490a..6e65122063 100644 --- a/source4/smbd/service_stream.c +++ b/source4/smbd/service_stream.c @@ -217,7 +217,7 @@ static void stream_new_connection(struct tevent_context *ev, stream_socket->ops->name, tsocket_address_string(srv_conn->remote_address, tmp_ctx), tsocket_address_string(srv_conn->local_address, tmp_ctx), - cluster_id_string(tmp_ctx, server_id)); + server_id_str(tmp_ctx, &server_id)); if (title) { stream_connection_set_title(srv_conn, title); } -- cgit