diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-05-02 10:05:46 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-05-03 07:37:06 +0200 |
commit | 85eb4377dbc9e2d25e0ee2e358e785347b09f0a7 (patch) | |
tree | 6f9f20fc991926620678fba7df5aeb12b9241901 /source4 | |
parent | 8da8c36b53cc115f0d446b666fc24fc9423d808e (diff) | |
download | samba-85eb4377dbc9e2d25e0ee2e358e785347b09f0a7.tar.gz samba-85eb4377dbc9e2d25e0ee2e358e785347b09f0a7.tar.bz2 samba-85eb4377dbc9e2d25e0ee2e358e785347b09f0a7.zip |
s4:cluster Rename .id to .pid in server_id
This also changes some DEBUG messages to use cluster_id_string()
rather than .id, to isolate them from this and other changes.
Andrew Bartlett
Diffstat (limited to 'source4')
-rw-r--r-- | source4/cluster/cluster.h | 2 | ||||
-rw-r--r-- | source4/cluster/local.c | 6 | ||||
-rw-r--r-- | source4/lib/messaging/messaging.c | 10 | ||||
-rw-r--r-- | source4/lib/messaging/pymessaging.c | 12 | ||||
-rw-r--r-- | source4/librpc/idl/server_id4.idl | 3 | ||||
-rw-r--r-- | source4/smb_server/smb/negprot.c | 7 | ||||
-rw-r--r-- | source4/smb_server/smb/receive.c | 9 |
7 files changed, 28 insertions, 21 deletions
diff --git a/source4/cluster/cluster.h b/source4/cluster/cluster.h index 6cfcb9b21b..f3b47b2838 100644 --- a/source4/cluster/cluster.h +++ b/source4/cluster/cluster.h @@ -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) diff --git a/source4/cluster/local.c b/source4/cluster/local.c index a93b0a65ed..0dc8b869dc 100644 --- a/source4/cluster/local.c +++ b/source4/cluster/local.c @@ -31,11 +31,11 @@ /* 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); } diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index f9d63203f2..48c9c16fb9 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -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; diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c index 358d205b53..017b6f91a2 100644 --- a/source4/lib/messaging/pymessaging.c +++ b/source4/lib/messaging/pymessaging.c @@ -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); } diff --git a/source4/librpc/idl/server_id4.idl b/source4/librpc/idl/server_id4.idl index 486143546b..872d306756 100644 --- a/source4/librpc/idl/server_id4.idl +++ b/source4/librpc/idl/server_id4.idl @@ -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; } diff --git a/source4/smb_server/smb/negprot.c b/source4/smb_server/smb/negprot.c index 2466a60705..0a07ab93e2 100644 --- a/source4/smb_server/smb/negprot.c +++ b/source4/smb_server/smb/negprot.c @@ -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); diff --git a/source4/smb_server/smb/receive.c b/source4/smb_server/smb/receive.c index c2503efabc..1e5d5681f4 100644 --- a/source4/smb_server/smb/receive.c +++ b/source4/smb_server/smb/receive.c @@ -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) { |