1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

merge from ronnie

(This used to be ctdb commit d21de127cceea7174b2e05701c8846c0b0c881c0)
This commit is contained in:
Andrew Tridgell 2007-04-27 16:53:52 +02:00
commit e629252b2c
10 changed files with 32 additions and 34 deletions

View File

@ -376,7 +376,7 @@ int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call)
tell the daemon what messaging srvid we will use, and register the message
handler function in the client
*/
int ctdb_set_message_handler(struct ctdb_context *ctdb, uint32_t srvid,
int ctdb_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
ctdb_message_fn_t handler,
void *private_data)
@ -411,7 +411,7 @@ int ctdb_set_message_handler(struct ctdb_context *ctdb, uint32_t srvid,
send a message - from client context
*/
int ctdb_send_message(struct ctdb_context *ctdb, uint32_t vnn,
uint32_t srvid, TDB_DATA data)
uint64_t srvid, TDB_DATA data)
{
struct ctdb_req_message *r;
int len, res;
@ -665,7 +665,7 @@ static void ctdb_client_reply_control(struct ctdb_context *ctdb,
/*
send a ctdb control message
*/
int ctdb_control(struct ctdb_context *ctdb, uint32_t destnode, uint32_t srvid,
int ctdb_control(struct ctdb_context *ctdb, uint32_t destnode, uint64_t srvid,
uint32_t opcode, TDB_DATA data,
TALLOC_CTX *mem_ctx, TDB_DATA *outdata, int32_t *status)
{

View File

@ -224,7 +224,7 @@ static int ctdb_control_destructor(struct ctdb_control_state *state)
send a control message to a node
*/
int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
uint32_t srvid, uint32_t opcode, TDB_DATA data,
uint64_t srvid, uint32_t opcode, TDB_DATA data,
ctdb_control_callback_fn_t callback,
void *private_data)
{

View File

@ -105,7 +105,7 @@ static int daemon_queue_send(struct ctdb_client *client, struct ctdb_req_header
message handler for when we are in daemon mode. This redirects the message
to the right client
*/
static void daemon_message_handler(struct ctdb_context *ctdb, uint32_t srvid,
static void daemon_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
TDB_DATA data, void *private_data)
{
struct ctdb_client *client = talloc_get_type(private_data, struct ctdb_client);
@ -146,10 +146,10 @@ static void daemon_request_register_message_handler(struct ctdb_client *client,
c->srvid, daemon_message_handler,
client);
if (res != 0) {
DEBUG(0,(__location__ " Failed to register handler %u in daemon\n",
DEBUG(0,(__location__ " Failed to register handler %llu in daemon\n",
c->srvid));
} else {
DEBUG(2,(__location__ " Registered message handler for srvid=%u\n",
DEBUG(2,(__location__ " Registered message handler for srvid=%llu\n",
c->srvid));
}
}

View File

@ -32,12 +32,10 @@
/*
this dispatches the messages to the registered ctdb message handler
*/
static int ctdb_dispatch_message(struct ctdb_context *ctdb, uint32_t srvid, TDB_DATA data)
static int ctdb_dispatch_message(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA data)
{
struct ctdb_message_list *ml;
/* XXX we need a must faster way of finding the matching srvid
- maybe a tree? */
for (ml=ctdb->message_list;ml;ml=ml->next) {
if (ml->srvid == srvid || ml->srvid == CTDB_SRVID_ALL) {
ml->message_handler(ctdb, srvid, data, ml->message_private);
@ -69,7 +67,7 @@ void ctdb_request_message(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
*/
struct ctdb_local_message {
struct ctdb_context *ctdb;
uint32_t srvid;
uint64_t srvid;
TDB_DATA data;
};
@ -82,12 +80,12 @@ static void ctdb_local_message_trigger(struct event_context *ev, struct timed_ev
res = ctdb_dispatch_message(m->ctdb, m->srvid, m->data);
if (res != 0) {
DEBUG(0, (__location__ " Failed to dispatch message for srvid=%u\n", m->srvid));
DEBUG(0, (__location__ " Failed to dispatch message for srvid=%llu\n", m->srvid));
}
talloc_free(m);
}
static int ctdb_local_message(struct ctdb_context *ctdb, uint32_t srvid, TDB_DATA data)
static int ctdb_local_message(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA data)
{
struct ctdb_local_message *m;
m = talloc(ctdb, struct ctdb_local_message);
@ -111,7 +109,7 @@ static int ctdb_local_message(struct ctdb_context *ctdb, uint32_t srvid, TDB_DAT
send a ctdb message
*/
int ctdb_daemon_send_message(struct ctdb_context *ctdb, uint32_t vnn,
uint32_t srvid, TDB_DATA data)
uint64_t srvid, TDB_DATA data)
{
struct ctdb_req_message *r;
int len;
@ -178,7 +176,7 @@ static int message_handler_destructor(struct ctdb_message_list *m)
*/
int ctdb_register_message_handler(struct ctdb_context *ctdb,
TALLOC_CTX *mem_ctx,
uint32_t srvid,
uint64_t srvid,
ctdb_message_fn_t handler,
void *private_data)
{

View File

@ -56,7 +56,7 @@ struct ctdb_call_info {
/*
a message handler ID meaning "give me all messages"
*/
#define CTDB_SRVID_ALL 0xFFFFFFFF
#define CTDB_SRVID_ALL (~(uint64_t)0)
struct event_context;
@ -160,9 +160,9 @@ uint32_t ctdb_get_vnn(struct ctdb_context *ctdb);
uint32_t ctdb_get_num_nodes(struct ctdb_context *ctdb);
/* setup a handler for ctdb messages */
typedef void (*ctdb_message_fn_t)(struct ctdb_context *, uint32_t srvid,
typedef void (*ctdb_message_fn_t)(struct ctdb_context *, uint64_t srvid,
TDB_DATA data, void *);
int ctdb_set_message_handler(struct ctdb_context *ctdb, uint32_t srvid,
int ctdb_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
ctdb_message_fn_t handler,
void *private_data);
@ -173,7 +173,7 @@ int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call)
/* send a ctdb message */
int ctdb_send_message(struct ctdb_context *ctdb, uint32_t vnn,
uint32_t srvid, TDB_DATA data);
uint64_t srvid, TDB_DATA data);
/*
@ -203,7 +203,7 @@ int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data);
int ctdb_register_message_handler(struct ctdb_context *ctdb,
TALLOC_CTX *mem_ctx,
uint32_t srvid,
uint64_t srvid,
ctdb_message_fn_t handler,
void *private_data);

View File

@ -110,7 +110,7 @@ struct ctdb_upcalls {
struct ctdb_message_list {
struct ctdb_context *ctdb;
struct ctdb_message_list *next, *prev;
uint32_t srvid;
uint64_t srvid;
ctdb_message_fn_t message_handler;
void *message_private;
};
@ -366,12 +366,12 @@ struct ctdb_reply_dmaster {
struct ctdb_req_register {
struct ctdb_req_header hdr;
uint32_t srvid;
uint64_t srvid;
};
struct ctdb_req_message {
struct ctdb_req_header hdr;
uint32_t srvid;
uint64_t srvid;
uint32_t datalen;
uint8_t data[1];
};
@ -408,7 +408,7 @@ struct ctdb_reply_getdbpath {
struct ctdb_req_control {
struct ctdb_req_header hdr;
uint32_t opcode;
uint32_t srvid;
uint64_t srvid;
uint32_t datalen;
uint8_t data[1];
};
@ -518,18 +518,18 @@ struct ctdb_call_state *ctdb_client_call_send(struct ctdb_db_context *ctdb_db,
*/
int ctdb_client_call_recv(struct ctdb_call_state *state, struct ctdb_call *call);
int ctdb_daemon_set_message_handler(struct ctdb_context *ctdb, uint32_t srvid,
int ctdb_daemon_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
ctdb_message_fn_t handler,
void *private_data);
int ctdb_client_send_message(struct ctdb_context *ctdb, uint32_t vnn,
uint32_t srvid, TDB_DATA data);
uint64_t srvid, TDB_DATA data);
/*
send a ctdb message
*/
int ctdb_daemon_send_message(struct ctdb_context *ctdb, uint32_t vnn,
uint32_t srvid, TDB_DATA data);
uint64_t srvid, TDB_DATA data);
/*
@ -573,7 +573,7 @@ void ctdb_request_control(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
void ctdb_reply_control(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
uint32_t srvid, uint32_t opcode, TDB_DATA data,
uint64_t srvid, uint32_t opcode, TDB_DATA data,
ctdb_control_callback_fn_t callback,
void *private_data);

View File

@ -84,7 +84,7 @@ static int msg_plus, msg_minus;
/*
handler for messages in bench_ring()
*/
static void ring_message_handler(struct ctdb_context *ctdb, uint32_t srvid,
static void ring_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
TDB_DATA data, void *private_data)
{
int incr = *(int *)data.dptr;

View File

@ -107,7 +107,7 @@ static void bench_fetch_1node(struct ctdb_context *ctdb)
/*
handler for messages in bench_ring()
*/
static void message_handler(struct ctdb_context *ctdb, uint32_t srvid,
static void message_handler(struct ctdb_context *ctdb, uint64_t srvid,
TDB_DATA data, void *private_data)
{
msg_count++;

View File

@ -47,12 +47,12 @@ static double end_timer(void)
(tp1.tv_sec + (tp1.tv_usec*1.0e-6));
}
static void message_handler(struct ctdb_context *ctdb, uint32_t srvid,
static void message_handler(struct ctdb_context *ctdb, uint64_t srvid,
TDB_DATA data, void *private_data)
{
num_msg++;
}
static void child_handler(struct ctdb_context *ctdb, uint32_t srvid,
static void child_handler(struct ctdb_context *ctdb, uint64_t srvid,
TDB_DATA data, void *private_data)
{
num_msg++;

View File

@ -33,10 +33,10 @@ static int num_clients = 2;
/*
handler for messages in bench_ring()
*/
static void message_handler(struct ctdb_context *ctdb, uint32_t srvid,
static void message_handler(struct ctdb_context *ctdb, uint64_t srvid,
TDB_DATA data, void *private_data)
{
printf("client vnn:%d received a message to srvid:%d [%s]\n",ctdb_get_vnn(ctdb),srvid,data.dptr);
printf("client vnn:%d received a message to srvid:%lld [%s]\n",ctdb_get_vnn(ctdb),srvid,data.dptr);
fflush(stdout);
}