From: Andrew Tridgell Date: Fri, 13 Apr 2007 10:38:24 +0000 (+1000) Subject: private -> private_data for samba3 X-Git-Tag: tevent-0.9.20~348^2~2928 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=65cdf2297ac6c5b298ba303660d6aa83cd9d1775;p=thirdparty%2Fsamba.git private -> private_data for samba3 (This used to be ctdb commit 080b6901173afb2ad618dd0621876ff478c7d6e5) --- diff --git a/ctdb/common/ctdb_call.c b/ctdb/common/ctdb_call.c index 0b7b3bc6c81..b03c8729edb 100644 --- a/ctdb/common/ctdb_call.c +++ b/ctdb/common/ctdb_call.c @@ -528,9 +528,9 @@ static int ctdb_call_destructor(struct ctdb_call_state *state) called when a ctdb_call times out */ void ctdb_call_timeout(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) + struct timeval t, void *private_data) { - struct ctdb_call_state *state = talloc_get_type(private, struct ctdb_call_state); + struct ctdb_call_state *state = talloc_get_type(private_data, struct ctdb_call_state); state->state = CTDB_CALL_ERROR; ctdb_set_error(state->node->ctdb, "ctdb_call %u timed out", state->c->hdr.reqid); @@ -543,9 +543,9 @@ void ctdb_call_timeout(struct event_context *ev, struct timed_event *te, this allows the caller to setup a async.fn */ static void call_local_trigger(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) + struct timeval t, void *private_data) { - struct ctdb_call_state *state = talloc_get_type(private, struct ctdb_call_state); + struct ctdb_call_state *state = talloc_get_type(private_data, struct ctdb_call_state); if (state->async.fn) { state->async.fn(state); } diff --git a/ctdb/common/ctdb_client.c b/ctdb/common/ctdb_client.c index fc6cefb7f9d..d6853fd2de6 100644 --- a/ctdb/common/ctdb_client.c +++ b/ctdb/common/ctdb_client.c @@ -354,7 +354,7 @@ struct ctdb_call_state *ctdb_client_call_send(struct ctdb_db_context *ctdb_db, */ int ctdb_client_set_message_handler(struct ctdb_context *ctdb, uint32_t srvid, ctdb_message_fn_t handler, - void *private) + void *private_data) { struct ctdb_req_register c; @@ -379,7 +379,7 @@ int ctdb_client_set_message_handler(struct ctdb_context *ctdb, uint32_t srvid, } /* also need to register the handler with our ctdb structure */ - return ctdb_register_message_handler(ctdb, ctdb, srvid, handler, private); + return ctdb_register_message_handler(ctdb, ctdb, srvid, handler, private_data); } @@ -390,12 +390,12 @@ int ctdb_client_set_message_handler(struct ctdb_context *ctdb, uint32_t srvid, int ctdb_set_message_handler(struct ctdb_context *ctdb, uint32_t srvid, ctdb_message_fn_t handler, - void *private) + void *private_data) { if (ctdb->flags & CTDB_FLAG_DAEMON_MODE) { - return ctdb_client_set_message_handler(ctdb, srvid, handler, private); + return ctdb_client_set_message_handler(ctdb, srvid, handler, private_data); } - return ctdb_daemon_set_message_handler(ctdb, srvid, handler, private); + return ctdb_daemon_set_message_handler(ctdb, srvid, handler, private_data); } diff --git a/ctdb/common/ctdb_daemon.c b/ctdb/common/ctdb_daemon.c index b727bd62b23..b97b31ccb4c 100644 --- a/ctdb/common/ctdb_daemon.c +++ b/ctdb/common/ctdb_daemon.c @@ -63,9 +63,9 @@ struct ctdb_client { to the right client */ static void daemon_message_handler(struct ctdb_context *ctdb, uint32_t srvid, - TDB_DATA data, void *private) + TDB_DATA data, void *private_data) { - struct ctdb_client *client = talloc_get_type(private, struct ctdb_client); + struct ctdb_client *client = talloc_get_type(private_data, struct ctdb_client); struct ctdb_req_message *r; int len; @@ -147,7 +147,7 @@ struct client_fetch_lock_data { static void daemon_fetch_lock_complete(struct ctdb_call_state *state) { struct ctdb_reply_fetch_lock *r; - struct client_fetch_lock_data *data = talloc_get_type(state->async.private, struct client_fetch_lock_data); + struct client_fetch_lock_data *data = talloc_get_type(state->async.private_data, struct client_fetch_lock_data); struct ctdb_client *client = talloc_get_type(data->client, struct ctdb_client); int length, res; @@ -201,7 +201,7 @@ static void daemon_request_fetch_lock(struct ctdb_client *client, fl_data->client = client; fl_data->reqid = f->hdr.reqid; state->async.fn = daemon_fetch_lock_complete; - state->async.private = fl_data; + state->async.private_data = fl_data; } /* @@ -445,12 +445,12 @@ static void ctdb_client_read_cb(uint8_t *data, size_t cnt, void *args) } static void ctdb_accept_client(struct event_context *ev, struct fd_event *fde, - uint16_t flags, void *private) + uint16_t flags, void *private_data) { struct sockaddr_in addr; socklen_t len; int fd; - struct ctdb_context *ctdb = talloc_get_type(private, struct ctdb_context); + struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context); struct ctdb_client *client; memset(&addr, 0, sizeof(addr)); @@ -474,9 +474,9 @@ static void ctdb_accept_client(struct event_context *ev, struct fd_event *fde, static void ctdb_read_from_parent(struct event_context *ev, struct fd_event *fde, - uint16_t flags, void *private) + uint16_t flags, void *private_data) { - int *fd = private; + int *fd = private_data; int cnt; char buf; @@ -600,8 +600,8 @@ void *ctdbd_allocate_pkt(struct ctdb_context *ctdb, size_t len) int ctdb_daemon_set_message_handler(struct ctdb_context *ctdb, uint32_t srvid, ctdb_message_fn_t handler, - void *private) + void *private_data) { - return ctdb_register_message_handler(ctdb, ctdb, srvid, handler, private); + return ctdb_register_message_handler(ctdb, ctdb, srvid, handler, private_data); } diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c index eb1d47bae39..d998540e834 100644 --- a/ctdb/common/ctdb_io.c +++ b/ctdb/common/ctdb_io.c @@ -49,7 +49,7 @@ struct ctdb_queue { struct fd_event *fde; int fd; size_t alignment; - void *private; + void *private_data; ctdb_queue_cb_fn_t callback; }; @@ -93,7 +93,7 @@ static void queue_io_read(struct ctdb_queue *queue) if (nread >= 4 && *(uint32_t *)data == nread) { /* it is the responsibility of the incoming packet function to free 'data' */ - queue->callback(data, nread, queue->private); + queue->callback(data, nread, queue->private_data); return; } @@ -109,7 +109,7 @@ static void queue_io_read(struct ctdb_queue *queue) /* sigh */ goto failed; } - queue->callback(d2, len, queue->private); + queue->callback(d2, len, queue->private_data); data += len; nread -= len; } @@ -134,16 +134,16 @@ static void queue_io_read(struct ctdb_queue *queue) return; failed: - queue->callback(NULL, 0, queue->private); + queue->callback(NULL, 0, queue->private_data); } /* used when an event triggers a dead queue */ static void queue_dead(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) + struct timeval t, void *private_data) { - struct ctdb_queue *queue = talloc_get_type(private, struct ctdb_queue); - queue->callback(NULL, 0, queue->private); + struct ctdb_queue *queue = talloc_get_type(private_data, struct ctdb_queue); + queue->callback(NULL, 0, queue->private_data); } @@ -183,9 +183,9 @@ static void queue_io_write(struct ctdb_queue *queue) called when an incoming connection is readable or writeable */ static void queue_io_handler(struct event_context *ev, struct fd_event *fde, - uint16_t flags, void *private) + uint16_t flags, void *private_data) { - struct ctdb_queue *queue = talloc_get_type(private, struct ctdb_queue); + struct ctdb_queue *queue = talloc_get_type(private_data, struct ctdb_queue); if (flags & EVENT_FD_READ) { queue_io_read(queue); @@ -280,7 +280,7 @@ struct ctdb_queue *ctdb_queue_setup(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, int fd, int alignment, ctdb_queue_cb_fn_t callback, - void *private) + void *private_data) { struct ctdb_queue *queue; @@ -290,7 +290,7 @@ struct ctdb_queue *ctdb_queue_setup(struct ctdb_context *ctdb, queue->ctdb = ctdb; queue->fd = fd; queue->alignment = alignment; - queue->private = private; + queue->private_data = private_data; queue->callback = callback; if (fd != -1) { if (ctdb_queue_set_fd(queue, fd) != 0) { diff --git a/ctdb/common/ctdb_message.c b/ctdb/common/ctdb_message.c index 0ee77f252b6..b291258b013 100644 --- a/ctdb/common/ctdb_message.c +++ b/ctdb/common/ctdb_message.c @@ -78,9 +78,9 @@ struct ctdb_local_message { }; static void ctdb_local_message_trigger(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) + struct timeval t, void *private_data) { - struct ctdb_local_message *m = talloc_get_type(private, + struct ctdb_local_message *m = talloc_get_type(private_data, struct ctdb_local_message); int res; @@ -176,7 +176,7 @@ int ctdb_register_message_handler(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, uint32_t srvid, ctdb_message_fn_t handler, - void *private) + void *private_data) { struct ctdb_message_list *m; @@ -186,7 +186,7 @@ int ctdb_register_message_handler(struct ctdb_context *ctdb, m->ctdb = ctdb; m->srvid = srvid; m->message_handler = handler; - m->message_private = private; + m->message_private = private_data; DLIST_ADD(ctdb->message_list, m); diff --git a/ctdb/ib/ibw_ctdb.c b/ctdb/ib/ibw_ctdb.c index 50dd8d68d43..dfe4adc6d3e 100644 --- a/ctdb/ib/ibw_ctdb.c +++ b/ctdb/ib/ibw_ctdb.c @@ -31,7 +31,7 @@ int ctdb_ibw_node_connect(struct ctdb_node *node) { - struct ctdb_ibw_node *cn = talloc_get_type(node->private, struct ctdb_ibw_node); + struct ctdb_ibw_node *cn = talloc_get_type(node->private_data, struct ctdb_ibw_node); int rc; assert(cn!=NULL); @@ -56,9 +56,9 @@ int ctdb_ibw_node_connect(struct ctdb_node *node) } void ctdb_ibw_node_connect_event(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) + struct timeval t, void *private_data) { - struct ctdb_node *node = talloc_get_type(private, struct ctdb_node); + struct ctdb_node *node = talloc_get_type(private_data, struct ctdb_node); ctdb_ibw_node_connect(node); } @@ -98,7 +98,7 @@ int ctdb_ibw_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn) case IBWC_CONNECTED: { /* after ibw_accept or ibw_connect */ struct ctdb_node *node = talloc_get_type(conn->conn_userdata, struct ctdb_node); if (node!=NULL) { /* after ibw_connect */ - struct ctdb_ibw_node *cn = talloc_get_type(node->private, struct ctdb_ibw_node); + struct ctdb_ibw_node *cn = talloc_get_type(node->private_data, struct ctdb_ibw_node); node->ctdb->upcalls->node_connected(node); ctdb_flush_cn_queue(cn); @@ -116,7 +116,7 @@ int ctdb_ibw_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn) case IBWC_ERROR: { struct ctdb_node *node = talloc_get_type(conn->conn_userdata, struct ctdb_node); if (node!=NULL) { - struct ctdb_ibw_node *cn = talloc_get_type(node->private, struct ctdb_ibw_node); + struct ctdb_ibw_node *cn = talloc_get_type(node->private_data, struct ctdb_ibw_node); struct ibw_ctx *ictx = cn->conn->ctx; DEBUG(10, ("IBWC_ERROR, reconnecting...\n")); diff --git a/ctdb/ib/ibw_ctdb.h b/ctdb/ib/ibw_ctdb.h index 24adeb7233e..8286eef65aa 100644 --- a/ctdb/ib/ibw_ctdb.h +++ b/ctdb/ib/ibw_ctdb.h @@ -41,6 +41,6 @@ int ctdb_ibw_receive_handler(struct ibw_conn *conn, void *buf, int n); int ctdb_ibw_node_connect(struct ctdb_node *node); void ctdb_ibw_node_connect_event(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private); + struct timeval t, void *private_data); int ctdb_flush_cn_queue(struct ctdb_ibw_node *cn); diff --git a/ctdb/ib/ibw_ctdb_init.c b/ctdb/ib/ibw_ctdb_init.c index 9c0300c4f4c..3b0c6ad28fb 100644 --- a/ctdb/ib/ibw_ctdb_init.c +++ b/ctdb/ib/ibw_ctdb_init.c @@ -31,7 +31,7 @@ static int ctdb_ibw_listen(struct ctdb_context *ctdb, int backlog) { - struct ibw_ctx *ictx = talloc_get_type(ctdb->private, struct ibw_ctx); + struct ibw_ctx *ictx = talloc_get_type(ctdb->private_data, struct ibw_ctx); struct sockaddr_in my_addr; assert(ictx!=NULL); @@ -81,12 +81,12 @@ static int ctdb_ibw_start(struct ctdb_context *ctdb) */ static int ctdb_ibw_add_node(struct ctdb_node *node) { - struct ibw_ctx *ictx = talloc_get_type(node->ctdb->private, struct ibw_ctx); + struct ibw_ctx *ictx = talloc_get_type(node->ctdb->private_data, struct ibw_ctx); struct ctdb_ibw_node *cn = talloc_zero(node, struct ctdb_ibw_node); assert(cn!=NULL); cn->conn = ibw_conn_new(ictx, node); - node->private = (void *)cn; + node->private_data = (void *)cn; return (cn->conn!=NULL ? 0 : -1); } @@ -127,7 +127,7 @@ int ctdb_flush_cn_queue(struct ctdb_ibw_node *cn) static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t length) { - struct ctdb_ibw_node *cn = talloc_get_type(node->private, struct ctdb_ibw_node); + struct ctdb_ibw_node *cn = talloc_get_type(node->private_data, struct ctdb_ibw_node); int rc; assert(length>=sizeof(uint32_t)); @@ -168,7 +168,7 @@ static void *ctdb_ibw_allocate_pkt(struct ctdb_context *ctdb, size_t size) static int ctdb_ibw_stop(struct ctdb_context *cctx) { - struct ibw_ctx *ictx = talloc_get_type(cctx->private, struct ibw_ctx); + struct ibw_ctx *ictx = talloc_get_type(cctx->private_data, struct ibw_ctx); assert(ictx!=NULL); return ibw_stop(ictx); @@ -207,7 +207,7 @@ int ctdb_ibw_init(struct ctdb_context *ctdb) } ctdb->methods = &ctdb_ibw_methods; - ctdb->private = ictx; + ctdb->private_data = ictx; DEBUG(10, ("ctdb_ibw_init succeeded.\n")); return 0; diff --git a/ctdb/ib/ibwrapper_test.c b/ctdb/ib/ibwrapper_test.c index 2ab4c97158b..fa506500e46 100644 --- a/ctdb/ib/ibwrapper_test.c +++ b/ctdb/ib/ibwrapper_test.c @@ -378,9 +378,9 @@ error: } void ibwtest_timeout_handler(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) + struct timeval t, void *private_data) { - struct ibwtest_ctx *tcx = talloc_get_type(private, struct ibwtest_ctx); + struct ibwtest_ctx *tcx = talloc_get_type(private_data, struct ibwtest_ctx); int rc; if (!tcx->is_server) { diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 10f85e670f1..c50b481cf35 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -195,7 +195,7 @@ struct ctdb_call_state { void *fetch_private; struct { void (*fn)(struct ctdb_call_state *); - void *private; + void *private_data; } async; }; diff --git a/ctdb/tcp/ctdb_tcp.h b/ctdb/tcp/ctdb_tcp.h index 50cde530f02..a34cd9736da 100644 --- a/ctdb/tcp/ctdb_tcp.h +++ b/ctdb/tcp/ctdb_tcp.h @@ -46,8 +46,8 @@ struct ctdb_tcp_node { int ctdb_tcp_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t length); int ctdb_tcp_listen(struct ctdb_context *ctdb); void ctdb_tcp_node_connect(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private); + struct timeval t, void *private_data); void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args); -void ctdb_tcp_tnode_cb(uint8_t *data, size_t cnt, void *private); +void ctdb_tcp_tnode_cb(uint8_t *data, size_t cnt, void *private_data); #define CTDB_TCP_ALIGNMENT 8 diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c index a6f562e2377..a1f2d331cff 100644 --- a/ctdb/tcp/tcp_connect.c +++ b/ctdb/tcp/tcp_connect.c @@ -37,9 +37,9 @@ static void set_nonblocking(int fd) /* called when a complete packet has come in - should not happen on this socket */ -void ctdb_tcp_tnode_cb(uint8_t *data, size_t cnt, void *private) +void ctdb_tcp_tnode_cb(uint8_t *data, size_t cnt, void *private_data) { - struct ctdb_node *node = talloc_get_type(private, struct ctdb_node); + struct ctdb_node *node = talloc_get_type(private_data, struct ctdb_node); struct ctdb_tcp_node *tnode = talloc_get_type( node->private_data, struct ctdb_tcp_node); @@ -171,7 +171,7 @@ static int ctdb_incoming_destructor(struct ctdb_incoming *in) node in our cluster */ static void ctdb_listen_event(struct event_context *ev, struct fd_event *fde, - uint16_t flags, void *private) + uint16_t flags, void *private_data) { struct ctdb_context *ctdb; struct ctdb_tcp *ctcp; @@ -180,7 +180,7 @@ static void ctdb_listen_event(struct event_context *ev, struct fd_event *fde, int fd; struct ctdb_incoming *in; - ctdb = talloc_get_type(private, struct ctdb_context); + ctdb = talloc_get_type(private_data, struct ctdb_context); ctcp = talloc_get_type(ctdb->private_data, struct ctdb_tcp); memset(&addr, 0, sizeof(addr)); len = sizeof(addr); diff --git a/ctdb/tests/ctdb_bench.c b/ctdb/tests/ctdb_bench.c index 658a2e4dadd..78d66f6f2cc 100644 --- a/ctdb/tests/ctdb_bench.c +++ b/ctdb/tests/ctdb_bench.c @@ -130,10 +130,10 @@ static int msg_plus, msg_minus; handler for messages in bench_ring() */ static void ring_message_handler(struct ctdb_context *ctdb, uint32_t srvid, - TDB_DATA data, void *private) + TDB_DATA data, void *private_data) { int incr = *(int *)data.dptr; - int *count = (int *)private; + int *count = (int *)private_data; int dest; (*count)++; dest = (ctdb_get_vnn(ctdb) + incr) % ctdb_get_num_nodes(ctdb); diff --git a/ctdb/tests/ctdb_fetch.c b/ctdb/tests/ctdb_fetch.c index eb2f25b9c4b..45e52489800 100644 --- a/ctdb/tests/ctdb_fetch.c +++ b/ctdb/tests/ctdb_fetch.c @@ -106,7 +106,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, - TDB_DATA data, void *private) + TDB_DATA data, void *private_data) { msg_count++; bench_fetch_1node(ctdb); diff --git a/ctdb/tests/ctdb_fetch1.c b/ctdb/tests/ctdb_fetch1.c index 4e5bf63b605..f9c1b379b6a 100644 --- a/ctdb/tests/ctdb_fetch1.c +++ b/ctdb/tests/ctdb_fetch1.c @@ -25,7 +25,7 @@ static void message_handler(struct ctdb_context *ctdb, uint32_t srvid, - TDB_DATA data, void *private) + TDB_DATA data, void *private_data) { printf("received a message\n"); } diff --git a/ctdb/tests/ctdb_messaging.c b/ctdb/tests/ctdb_messaging.c index 0fa6bf66d2d..050f14de380 100644 --- a/ctdb/tests/ctdb_messaging.c +++ b/ctdb/tests/ctdb_messaging.c @@ -34,7 +34,7 @@ static int num_clients = 2; handler for messages in bench_ring() */ static void message_handler(struct ctdb_context *ctdb, uint32_t srvid, - TDB_DATA data, void *private) + 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); fflush(stdout);