s4:cluster Rename .id to .pid in server_id
authorAndrew Bartlett <abartlet@samba.org>
Mon, 2 May 2011 00:05:46 +0000 (10:05 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 3 May 2011 05:37:06 +0000 (07:37 +0200)
This also changes some DEBUG messages to use cluster_id_string()
rather than .id, to isolate them from this and other changes.

Andrew Bartlett

source4/cluster/cluster.h
source4/cluster/local.c
source4/lib/messaging/messaging.c
source4/lib/messaging/pymessaging.c
source4/librpc/idl/server_id4.idl
source4/smb_server/smb/negprot.c
source4/smb_server/smb/receive.c

index 6cfcb9b21b387c35a9d9fbeaecbf80d8de347fad..f3b47b2838050c0b03a13d64056b2f194c0f9f1a 100644 (file)
@@ -27,7 +27,7 @@
 /*
   test for same cluster id
 */
-#define cluster_id_equal(id_1, id_2) ((id_1)->id == (id_2)->id \
+#define cluster_id_equal(id_1, id_2) ((id_1)->pid == (id_2)->pid \
                                    && (id_1)->id2 == (id_2)->id2 \
                                    && (id_1)->node == (id_2)->node)
 
index a93b0a65ede864f8ca24136d3e31c97e6c70e45a..0dc8b869dca3788dd8c454c8cd45f6213c1c05c8 100644 (file)
 /*
   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 id2)
 {
        struct server_id server_id;
        ZERO_STRUCT(server_id);
-       server_id.id = id;
+       server_id.pid = pid;
        server_id.id2 = id2;
        return server_id;
 }
@@ -47,7 +47,7 @@ static struct server_id local_id(struct cluster_ops *ops, uint64_t id, uint32_t
 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);
+       return talloc_asprintf(mem_ctx, "%u.%llu.%u", id.node, (unsigned long long)id.pid, id.id2);
 }
 
 
index f9d63203f212f7858c43428340e1a54eb94ff8e9..48c9c16fb981d239c0145a32b5ff3f8dd7b4c565 100644 (file)
@@ -109,9 +109,11 @@ static void irpc_handler(struct messaging_context *, void *,
 static void ping_message(struct messaging_context *msg, void *private_data,
                         uint32_t msg_type, struct server_id src, DATA_BLOB *data)
 {
-       DEBUG(1,("INFO: Received PING message from server %u.%u [%.*s]\n",
-                (unsigned int)src.node, (unsigned int)src.id, (int)data->length,
+       char *task_id = cluster_id_string(NULL, src);
+       DEBUG(1,("INFO: Received PING message from server %s [%.*s]\n",
+                task_id, (int)data->length,
                 data->data?(const char *)data->data:""));
+       talloc_free(task_id);
        messaging_send(msg, src, MSG_PONG, data);
 }
 
@@ -638,7 +640,7 @@ struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx,
 {
        struct server_id id;
        ZERO_STRUCT(id);
-       id.id = random() % 0x10000000;
+       id.pid = random() % 0x10000000;
        return messaging_init(mem_ctx, dir, id, ev);
 }
 /*
@@ -1312,7 +1314,7 @@ struct dcerpc_binding_handle *irpc_binding_handle_by_name(TALLOC_CTX *mem_ctx,
                errno = EADDRNOTAVAIL;
                return NULL;
        }
-       if (sids[0].id == 0) {
+       if (sids[0].pid == 0) {
                talloc_free(sids);
                errno = EADDRNOTAVAIL;
                return NULL;
index 358d205b53b53039bfeacb51e7d58a370fe275b3..017b6f91a2ef72a9c42cbf8605c98eb90f61b1d8 100644 (file)
@@ -45,12 +45,12 @@ static bool server_id_from_py(PyObject *object, struct server_id *server_id)
        }
 
        if (PyTuple_Size(object) == 3) {
-               return PyArg_ParseTuple(object, "iii", &server_id->id, &server_id->id2, &server_id->node);
+               return PyArg_ParseTuple(object, "iii", &server_id->pid, &server_id->id2, &server_id->node);
        } else {
-               int id, id2;
-               if (!PyArg_ParseTuple(object, "ii", &id, &id2))
+               int pid, id2;
+               if (!PyArg_ParseTuple(object, "ii", &pid, &id2))
                        return false;
-               *server_id = cluster_id(id, id2);
+               *server_id = cluster_id(pid, id2);
                return true;
        }
 }
@@ -159,7 +159,7 @@ static void py_msg_callback_wrapper(struct messaging_context *msg, void *private
        PyObject *callback = (PyObject *)private_data;
 
        PyObject_CallFunction(callback, discard_const_p(char, "i(iii)s#"), msg_type, 
-                             server_id.id, server_id.id2, server_id.node, 
+                             server_id.pid, server_id.id2, server_id.node,
                              data->data, data->length);
 }
 
@@ -229,7 +229,7 @@ static PyObject *py_messaging_server_id(PyObject *obj, void *closure)
        messaging_Object *iface = (messaging_Object *)obj;
        struct server_id server_id = messaging_get_server_id(iface->msg_ctx);
 
-       return Py_BuildValue("(iii)", server_id.id, server_id.id2, 
+       return Py_BuildValue("(iii)", server_id.pid, server_id.id2,
                             server_id.node);
 }
 
index 486143546b66e70544aa2459831043b81e8ae840..872d3067566ab03296a27295b133add160de4f7d 100644 (file)
@@ -5,8 +5,9 @@ interface server_id
 {
        /* id used to identify a endpoint, possibly in a cluster */
        typedef [public] struct {
-               hyper id;
+               hyper pid;
                uint32 id2;
                uint32 node;
+               udlong unique_id;
        } server_id;
 }
index 2466a6070598edbb83d750bb72f875eecc2cc5b2..0a07ab93e2da82d4bdd2f1bc74e2ef6684d60602 100644 (file)
@@ -145,7 +145,7 @@ static void reply_lanman1(struct smbsrv_request *req, uint16_t choice)
        SSVAL(req->out.vwv, VWV(3), lpcfg_maxmux(req->smb_conn->lp_ctx));
        SSVAL(req->out.vwv, VWV(4), 1);
        SSVAL(req->out.vwv, VWV(5), raw); 
-       SIVAL(req->out.vwv, VWV(6), req->smb_conn->connection->server_id.id);
+       SIVAL(req->out.vwv, VWV(6), req->smb_conn->connection->server_id.pid);
        srv_push_dos_date(req->smb_conn, req->out.vwv, VWV(8), t);
        SSVAL(req->out.vwv, VWV(10), req->smb_conn->negotiate.zone_offset/60);
        SIVAL(req->out.vwv, VWV(11), 0); /* reserved */
@@ -199,7 +199,7 @@ static void reply_lanman2(struct smbsrv_request *req, uint16_t choice)
        SSVAL(req->out.vwv, VWV(3), lpcfg_maxmux(req->smb_conn->lp_ctx));
        SSVAL(req->out.vwv, VWV(4), 1);
        SSVAL(req->out.vwv, VWV(5), raw); 
-       SIVAL(req->out.vwv, VWV(6), req->smb_conn->connection->server_id.id);
+       SIVAL(req->out.vwv, VWV(6), req->smb_conn->connection->server_id.pid);
        srv_push_dos_date(req->smb_conn, req->out.vwv, VWV(8), t);
        SSVAL(req->out.vwv, VWV(10), req->smb_conn->negotiate.zone_offset/60);
        SIVAL(req->out.vwv, VWV(11), 0);
@@ -332,7 +332,8 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice)
        SSVAL(req->out.vwv+1, VWV(2), 1); /* num vcs */
        SIVAL(req->out.vwv+1, VWV(3), req->smb_conn->negotiate.max_recv);
        SIVAL(req->out.vwv+1, VWV(5), 0x10000); /* raw size. full 64k */
-       SIVAL(req->out.vwv+1, VWV(7), req->smb_conn->connection->server_id.id); /* session key */
+       SIVAL(req->out.vwv+1, VWV(7), req->smb_conn->connection->server_id.pid); /* session key */
+
        SIVAL(req->out.vwv+1, VWV(9), capabilities);
        push_nttime(req->out.vwv+1, VWV(11), nttime);
        SSVALS(req->out.vwv+1,VWV(15), req->smb_conn->negotiate.zone_offset/60);
index c2503efabc8b7f5b658920185cf40158e39661a7..1e5d5681f46ed1b6e6119497f43f9be1a61b6695 100644 (file)
@@ -25,7 +25,7 @@
 #include "smb_server/smb_server.h"
 #include "system/filesys.h"
 #include "param/param.h"
-
+#include "cluster/cluster.h"
 
 /*
   send an oplock break request to a client
@@ -471,6 +471,7 @@ static void switch_message(int type, struct smbsrv_request *req)
        int flags;
        struct smbsrv_connection *smb_conn = req->smb_conn;
        NTSTATUS status;
+       char *task_id;
 
        type &= 0xff;
 
@@ -501,8 +502,10 @@ static void switch_message(int type, struct smbsrv_request *req)
                }
        }
 
-       DEBUG(5,("switch message %s (task_id %u)\n",
-                smb_fn_name(type), (unsigned)req->smb_conn->connection->server_id.id));
+       task_id = cluster_id_string(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);
 
        /* this must be called before we do any reply */
        if (flags & SIGNING_NO_REPLY) {