1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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
This commit is contained in:
Andrew Bartlett 2011-05-02 10:05:46 +10:00
parent 8da8c36b53
commit 85eb4377db
7 changed files with 28 additions and 21 deletions

View 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)

View File

@ -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);
}

View 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;

View 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);
}

View 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;
}

View 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);

View 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) {