diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index 73c2e65ecdc..28f4358fcb7 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -41,6 +41,7 @@ #include "common/reqid.h" #include "common/system.h" +#include "common/common.h" /* allocate a packet for use in client<->daemon communication diff --git a/ctdb/common/cmdline.c b/ctdb/common/cmdline.c index fa7221d571e..69e82314dd7 100644 --- a/ctdb/common/cmdline.c +++ b/ctdb/common/cmdline.c @@ -32,6 +32,7 @@ #include "ctdb_client.h" #include "common/rb_tree.h" +#include "common/common.h" #include "common/cmdline.h" diff --git a/ctdb/common/common.h b/ctdb/common/common.h new file mode 100644 index 00000000000..49c5faf8a10 --- /dev/null +++ b/ctdb/common/common.h @@ -0,0 +1,156 @@ +/* + ctdb database library + + Copyright (C) Amitay Isaacs 2015 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . +*/ + +#ifndef __CTDB_COMMON_H__ +#define __CTDB_COMMON_H__ + +/* From common/ctdb_fork.c */ + +void ctdb_set_child_info(TALLOC_CTX *mem_ctx, const char *child_name_fmt, ...); + +void ctdb_track_child(struct ctdb_context *ctdb, pid_t pid); + +pid_t ctdb_fork(struct ctdb_context *ctdb); + +struct tevent_signal *ctdb_init_sigchld(struct ctdb_context *ctdb); + +int ctdb_kill(struct ctdb_context *ctdb, pid_t pid, int signum); + +/* From common/ctdb_io.c */ + +int ctdb_queue_length(struct ctdb_queue *queue); + +int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length); + +int ctdb_queue_set_fd(struct ctdb_queue *queue, int fd); + +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_data, const char *fmt, ...) + PRINTF_ATTRIBUTE(7,8); + +/* From common/ctdb_ltdb.c */ + +struct ctdb_db_context *ctdb_db_handle(struct ctdb_context *ctdb, + const char *name); + +uint32_t ctdb_lmaster(struct ctdb_context *ctdb, const TDB_DATA *key); + +int ctdb_ltdb_fetch(struct ctdb_db_context *ctdb_db, + TDB_DATA key, struct ctdb_ltdb_header *header, + TALLOC_CTX *mem_ctx, TDB_DATA *data); + +int ctdb_ltdb_fetch_with_header(struct ctdb_db_context *ctdb_db, + TDB_DATA key, struct ctdb_ltdb_header *header, + TALLOC_CTX *mem_ctx, TDB_DATA *data); + +int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key, + struct ctdb_ltdb_header *header, TDB_DATA data); + +int ctdb_ltdb_lock(struct ctdb_db_context *ctdb_db, TDB_DATA key); + +int ctdb_ltdb_unlock(struct ctdb_db_context *ctdb_db, TDB_DATA key); + +int ctdb_ltdb_delete(struct ctdb_db_context *ctdb_db, TDB_DATA key); + +int ctdb_trackingdb_add_pnn(struct ctdb_context *ctdb, TDB_DATA *data, uint32_t pnn); + +typedef void (*ctdb_trackingdb_cb)(struct ctdb_context *ctdb, uint32_t pnn, + void *private_data); + +void ctdb_trackingdb_traverse(struct ctdb_context *ctdb, TDB_DATA data, + ctdb_trackingdb_cb cb, void *private_data); + +int ctdb_null_func(struct ctdb_call_info *call); + +int ctdb_fetch_func(struct ctdb_call_info *call); + +int ctdb_fetch_with_header_func(struct ctdb_call_info *call); + +/* from common/ctdb_util.c */ + +const char *ctdb_errstr(struct ctdb_context *ctdb); + +void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...); + +void ctdb_fatal(struct ctdb_context *ctdb, const char *msg); + +void ctdb_die(struct ctdb_context *ctdb, const char *msg); + +bool ctdb_set_helper(const char *type, char *helper, size_t size, + const char *envvar, + const char *dir, const char *file); + +void ctdb_external_trace(void); + +int ctdb_parse_address(TALLOC_CTX *mem_ctx, const char *str, + ctdb_sock_addr *address); + +bool ctdb_same_address(ctdb_sock_addr *a1, ctdb_sock_addr *a2); + +uint32_t ctdb_hash(const TDB_DATA *key); + +struct ctdb_rec_data *ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid, + TDB_DATA key, + struct ctdb_ltdb_header *header, + TDB_DATA data); + +struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx, + struct ctdb_marshall_buffer *m, + uint64_t db_id, + uint32_t reqid, + TDB_DATA key, + struct ctdb_ltdb_header *header, + TDB_DATA data); + +TDB_DATA ctdb_marshall_finish(struct ctdb_marshall_buffer *m); + +struct ctdb_rec_data *ctdb_marshall_loop_next(struct ctdb_marshall_buffer *m, + struct ctdb_rec_data *r, + uint32_t *reqid, + struct ctdb_ltdb_header *header, + TDB_DATA *key, TDB_DATA *data); + +void ctdb_canonicalize_ip(const ctdb_sock_addr *ip, ctdb_sock_addr *cip); + +bool ctdb_same_ip(const ctdb_sock_addr *tip1, const ctdb_sock_addr *tip2); + +bool ctdb_same_sockaddr(const ctdb_sock_addr *ip1, const ctdb_sock_addr *ip2); + +char *ctdb_addr_to_str(ctdb_sock_addr *addr); + +unsigned ctdb_addr_to_port(ctdb_sock_addr *addr); + +struct ctdb_node_map *ctdb_read_nodes_file(TALLOC_CTX *mem_ctx, + const char *nlist); + +struct ctdb_node_map *ctdb_node_list_to_map(struct ctdb_node **nodes, + uint32_t num_nodes, + TALLOC_CTX *mem_ctx); + +const char *runstate_to_string(enum ctdb_runstate runstate); + +enum ctdb_runstate runstate_from_string(const char *label); + +void ctdb_set_runstate(struct ctdb_context *ctdb, enum ctdb_runstate runstate); + +uint32_t *ctdb_key_to_idkey(TALLOC_CTX *mem_ctx, TDB_DATA key); + +#endif /* __CTDB_COMMON_H__ */ diff --git a/ctdb/common/ctdb_fork.c b/ctdb/common/ctdb_fork.c index c6673eb8661..46b0a13a7d9 100644 --- a/ctdb/common/ctdb_fork.c +++ b/ctdb/common/ctdb_fork.c @@ -32,6 +32,7 @@ #include "common/rb_tree.h" #include "common/system.h" +#include "common/common.h" void ctdb_set_child_info(TALLOC_CTX *mem_ctx, const char *child_name_fmt, ...) { diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c index 46199b8c015..fca9be05021 100644 --- a/ctdb/common/ctdb_io.c +++ b/ctdb/common/ctdb_io.c @@ -36,6 +36,7 @@ #include "ctdb_client.h" #include "common/system.h" +#include "common/common.h" #define QUEUE_BUFFER_SIZE (16*1024) diff --git a/ctdb/common/ctdb_ltdb.c b/ctdb/common/ctdb_ltdb.c index 4e7fcafb54f..39775be706e 100644 --- a/ctdb/common/ctdb_ltdb.c +++ b/ctdb/common/ctdb_ltdb.c @@ -31,6 +31,8 @@ #include "ctdb_logging.h" #include "ctdb_private.h" +#include "common/common.h" + /* find an attached ctdb_db handle given a name */ diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c index d158143f920..90907081bdd 100644 --- a/ctdb/common/ctdb_util.c +++ b/ctdb/common/ctdb_util.c @@ -32,6 +32,7 @@ #include "common/reqid.h" #include "common/system.h" +#include "common/common.h" /* return error string for last error diff --git a/ctdb/ib/ibw_ctdb.c b/ctdb/ib/ibw_ctdb.c index 35d0514b682..3e17a707783 100644 --- a/ctdb/ib/ibw_ctdb.c +++ b/ctdb/ib/ibw_ctdb.c @@ -33,6 +33,8 @@ #include "ctdb_logging.h" #include "ctdb_private.h" +#include "common/common.h" + #include "ibwrapper.h" #include "ibw_ctdb.h" diff --git a/ctdb/ib/ibw_ctdb_init.c b/ctdb/ib/ibw_ctdb_init.c index ec4d933b3da..2c5a6c056a5 100644 --- a/ctdb/ib/ibw_ctdb_init.c +++ b/ctdb/ib/ibw_ctdb_init.c @@ -33,6 +33,8 @@ #include "ctdb_logging.h" #include "ctdb_private.h" +#include "common/common.h" + #include "ibwrapper.h" #include "ibw_ctdb.h" diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h index 2f03b14d407..4fc207e826e 100644 --- a/ctdb/include/ctdb_client.h +++ b/ctdb/include/ctdb_client.h @@ -96,16 +96,6 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, int ctdb_detach(struct ctdb_context *ctdb, uint32_t db_id); -/* - find an attached ctdb_db handle given a name - */ -struct ctdb_db_context *ctdb_db_handle(struct ctdb_context *ctdb, const char *name); - -/* - error string for last ctdb error -*/ -const char *ctdb_errstr(struct ctdb_context *); - /* a ctdb call function */ typedef int (*ctdb_fn_t)(struct ctdb_call_info *); @@ -164,9 +154,6 @@ int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, struct ctdb_db_context *find_ctdb_db(struct ctdb_context *ctdb, uint32_t id); -struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev, - struct timeval req_timeout); - struct ctdb_statistics; int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_statistics *status); int ctdb_ctrl_dbstatistics(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid, @@ -497,15 +484,6 @@ struct ctdb_client_control_state *ctdb_ctrl_getcapabilities_send(struct ctdb_con int ctdb_ctrl_getcapabilities_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, uint32_t *capabilities); -struct ctdb_marshall_buffer *ctdb_marshall_add(TALLOC_CTX *mem_ctx, - struct ctdb_marshall_buffer *m, - uint64_t db_id, - uint32_t reqid, - TDB_DATA key, - struct ctdb_ltdb_header *header, - TDB_DATA data); -TDB_DATA ctdb_marshall_finish(struct ctdb_marshall_buffer *m); - struct ctdb_transaction_handle *ctdb_transaction_start(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx); int ctdb_transaction_fetch(struct ctdb_transaction_handle *h, diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 15197ed612a..8e200732d5a 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -411,10 +411,6 @@ enum ctdb_runstate { CTDB_RUNSTATE_SHUTDOWN, }; -const char *runstate_to_string(enum ctdb_runstate runstate); -enum ctdb_runstate runstate_from_string(const char *label); -void ctdb_set_runstate(struct ctdb_context *ctdb, enum ctdb_runstate runstate); - void ctdb_shutdown_sequence(struct ctdb_context *ctdb, int exit_code); #define CTDB_MONITORING_ACTIVE 0 @@ -677,19 +673,6 @@ struct ctdb_fetch_handle { }; /* internal prototypes */ -void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); -void ctdb_fatal(struct ctdb_context *ctdb, const char *msg); -void ctdb_die(struct ctdb_context *ctdb, const char *msg); -bool ctdb_set_helper(const char *type, char *helper, size_t size, - const char *envvar, const char *dir, const char *file); -void ctdb_external_trace(void); -bool ctdb_same_address(ctdb_sock_addr *a1, ctdb_sock_addr *a2); -int ctdb_parse_address(TALLOC_CTX *mem_ctx, const char *str, - ctdb_sock_addr *address); -bool ctdb_same_ip(const ctdb_sock_addr *ip1, const ctdb_sock_addr *ip2); -bool ctdb_same_sockaddr(const ctdb_sock_addr *ip1, const ctdb_sock_addr *ip2); -uint32_t ctdb_hash(const TDB_DATA *key); -uint32_t *ctdb_key_to_idkey(TALLOC_CTX *mem_ctx, TDB_DATA key); void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr); void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr); @@ -698,16 +681,6 @@ void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr); void ctdb_reply_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr); void ctdb_reply_error(struct ctdb_context *ctdb, struct ctdb_req_header *hdr); -uint32_t ctdb_lmaster(struct ctdb_context *ctdb, const TDB_DATA *key); -int ctdb_ltdb_fetch(struct ctdb_db_context *ctdb_db, - TDB_DATA key, struct ctdb_ltdb_header *header, - TALLOC_CTX *mem_ctx, TDB_DATA *data); -int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key, - struct ctdb_ltdb_header *header, TDB_DATA data); -int ctdb_ltdb_delete(struct ctdb_db_context *ctdb_db, TDB_DATA key); -int ctdb_ltdb_fetch_with_header(struct ctdb_db_context *ctdb_db, - TDB_DATA key, struct ctdb_ltdb_header *header, - TALLOC_CTX *mem_ctx, TDB_DATA *data); int32_t ctdb_control_start_persistent_update(struct ctdb_context *ctdb, struct ctdb_req_control *c, TDB_DATA recdata); @@ -735,26 +708,6 @@ struct ctdb_call_state *ctdb_call_local_send(struct ctdb_db_context *ctdb_db, int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork); -/* - queue a packet for sending -*/ -int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length); - -/* - setup the fd used by the queue - */ -int ctdb_queue_set_fd(struct ctdb_queue *queue, int fd); - -/* - setup a packet queue on a socket - */ -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_data, const char *fmt, ...) - PRINTF_ATTRIBUTE(7,8); - /* allocate a packet for use in client<->daemon communication */ @@ -774,19 +727,6 @@ struct ctdb_req_header *_ctdb_transport_allocate(struct ctdb_context *ctdb, #define ctdb_transport_allocate(ctdb, mem_ctx, operation, length, type) \ (type *)_ctdb_transport_allocate(ctdb, mem_ctx, operation, length, sizeof(type), #type) -int ctdb_queue_length(struct ctdb_queue *queue); - -/* - lock a record in the ltdb, given a key - */ -int ctdb_ltdb_lock(struct ctdb_db_context *ctdb_db, TDB_DATA key); - -/* - unlock a record in the ltdb, given a key - */ -int ctdb_ltdb_unlock(struct ctdb_db_context *ctdb_db, TDB_DATA key); - - int ctdb_client_send_message(struct ctdb_context *ctdb, uint32_t vnn, uint64_t srvid, TDB_DATA data); @@ -956,14 +896,6 @@ int daemon_check_srvids(struct ctdb_context *ctdb, TDB_DATA indata, int32_t ctdb_ltdb_enable_seqnum(struct ctdb_context *ctdb, uint32_t db_id); int32_t ctdb_ltdb_update_seqnum(struct ctdb_context *ctdb, uint32_t db_id, uint32_t srcnode); -struct ctdb_rec_data *ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid, - TDB_DATA key, struct ctdb_ltdb_header *, TDB_DATA data); - -struct ctdb_rec_data *ctdb_marshall_loop_next(struct ctdb_marshall_buffer *m, struct ctdb_rec_data *r, - uint32_t *reqid, - struct ctdb_ltdb_header *header, - TDB_DATA *key, TDB_DATA *data); - int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DATA *outdata); int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata); @@ -1011,12 +943,6 @@ void ctdb_node_dead(struct ctdb_node *node); void ctdb_node_connected(struct ctdb_node *node); bool ctdb_blocking_freeze(struct ctdb_context *ctdb); -struct tevent_signal *ctdb_init_sigchld(struct ctdb_context *ctdb); -void ctdb_track_child(struct ctdb_context *ctdb, pid_t pid); -pid_t ctdb_fork(struct ctdb_context *ctdb); -void ctdb_set_child_info(TALLOC_CTX *mem_ctx, const char *child_name_fmt, ...); -int ctdb_kill(struct ctdb_context *ctdb, pid_t pid, int signum); - int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb, struct ctdb_req_control *c, TDB_DATA indata, @@ -1262,11 +1188,6 @@ int ctdb_client_async_control(struct ctdb_context *ctdb, client_async_callback fail_callback, void *callback_data); -struct ctdb_node_map * -ctdb_node_list_to_map(struct ctdb_node **nodes, uint32_t num_nodes, - TALLOC_CTX *mem_ctx); -struct ctdb_node_map *ctdb_read_nodes_file(TALLOC_CTX *mem_ctx, - const char *nlist); void ctdb_load_nodes_file(struct ctdb_context *ctdb); int ctdb_control_reload_nodes_file(struct ctdb_context *ctdb, uint32_t opcode); @@ -1274,10 +1195,6 @@ int ctdb_control_reload_nodes_file(struct ctdb_context *ctdb, uint32_t opcode); int32_t ctdb_dump_memory(struct ctdb_context *ctdb, TDB_DATA *outdata); int32_t ctdb_control_get_capabilities(struct ctdb_context *ctdb, TDB_DATA *outdata); -char *ctdb_addr_to_str(ctdb_sock_addr *addr); -unsigned ctdb_addr_to_port(ctdb_sock_addr *addr); -void ctdb_canonicalize_ip(const ctdb_sock_addr *ip, ctdb_sock_addr *cip); - int32_t ctdb_control_recd_ping(struct ctdb_context *ctdb); int32_t ctdb_control_set_recmaster(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata); @@ -1381,12 +1298,6 @@ void ctdb_local_remove_from_delete_queue(struct ctdb_db_context *ctdb_db, struct ctdb_ltdb_header *ctdb_header_from_record_handle(struct ctdb_record_handle *h); -int ctdb_trackingdb_add_pnn(struct ctdb_context *ctdb, TDB_DATA *data, uint32_t pnn); - -typedef void (*ctdb_trackingdb_cb)(struct ctdb_context *ctdb, uint32_t pnn, void *private_data); - -void ctdb_trackingdb_traverse(struct ctdb_context *ctdb, TDB_DATA data, ctdb_trackingdb_cb cb, void *private_data); - int ctdb_start_revoke_ro_record(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db, TDB_DATA key, struct ctdb_ltdb_header *header, TDB_DATA data); typedef void (*deferred_requeue_fn)(void *call_context, struct ctdb_req_header *hdr); @@ -1395,12 +1306,6 @@ int ctdb_add_revoke_deferred_call(struct ctdb_context *ctdb, struct ctdb_db_cont int ctdb_set_db_readonly(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db); -int ctdb_null_func(struct ctdb_call_info *call); - -int ctdb_fetch_func(struct ctdb_call_info *call); - -int ctdb_fetch_with_header_func(struct ctdb_call_info *call); - void ctdb_db_statistics_reset(struct ctdb_db_context *ctdb_db); int32_t ctdb_control_get_db_statistics(struct ctdb_context *ctdb, diff --git a/ctdb/server/ctdb_banning.c b/ctdb/server/ctdb_banning.c index 8bc87257d47..3c5f8854890 100644 --- a/ctdb/server/ctdb_banning.c +++ b/ctdb/server/ctdb_banning.c @@ -32,6 +32,7 @@ #include "ctdb_client.h" #include "ctdb_logging.h" +#include "common/common.h" static void ctdb_ban_node_event(struct tevent_context *ev, struct tevent_timer *te, diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c index 80716cdae05..16fe53aa530 100644 --- a/ctdb/server/ctdb_call.c +++ b/ctdb/server/ctdb_call.c @@ -38,6 +38,7 @@ #include "common/rb_tree.h" #include "common/reqid.h" #include "common/system.h" +#include "common/common.h" struct ctdb_sticky_record { struct ctdb_context *ctdb; diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c index 5e4516cbb37..21ace77471d 100644 --- a/ctdb/server/ctdb_control.c +++ b/ctdb/server/ctdb_control.c @@ -35,6 +35,7 @@ #include "ctdb_logging.h" #include "common/reqid.h" +#include "common/common.h" struct ctdb_control_state { diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index 7371b05b1d9..ef5dd3f25c0 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -42,6 +42,7 @@ #include "common/rb_tree.h" #include "common/reqid.h" #include "common/system.h" +#include "common/common.h" struct ctdb_client_pid_list { struct ctdb_client_pid_list *next, *prev; diff --git a/ctdb/server/ctdb_freeze.c b/ctdb/server/ctdb_freeze.c index 9d370648a00..83a088fea03 100644 --- a/ctdb/server/ctdb_freeze.c +++ b/ctdb/server/ctdb_freeze.c @@ -32,7 +32,7 @@ #include "ctdb_logging.h" #include "common/rb_tree.h" - +#include "common/common.h" /** * Cancel a transaction on database diff --git a/ctdb/server/ctdb_keepalive.c b/ctdb/server/ctdb_keepalive.c index 6873d75f50a..05aa77ec9a2 100644 --- a/ctdb/server/ctdb_keepalive.c +++ b/ctdb/server/ctdb_keepalive.c @@ -33,6 +33,8 @@ #include "ctdb_private.h" #include "ctdb_logging.h" +#include "common/common.h" + /* see if any nodes are dead diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c index cdda7ea85d0..3621ff1faad 100644 --- a/ctdb/server/ctdb_lock.c +++ b/ctdb/server/ctdb_lock.c @@ -34,6 +34,7 @@ #include "ctdb_logging.h" #include "common/system.h" +#include "common/common.h" /* * Non-blocking Locking API diff --git a/ctdb/server/ctdb_logging.c b/ctdb/server/ctdb_logging.c index d4545a9d4c6..ba2cf836ffa 100644 --- a/ctdb/server/ctdb_logging.c +++ b/ctdb/server/ctdb_logging.c @@ -34,6 +34,7 @@ #include "ctdb_logging.h" #include "common/system.h" +#include "common/common.h" struct ctdb_log_backend { struct ctdb_log_backend *prev, *next; diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c index 1affada5f0f..54cf7a01857 100644 --- a/ctdb/server/ctdb_ltdb_server.c +++ b/ctdb/server/ctdb_ltdb_server.c @@ -39,6 +39,7 @@ #include "common/rb_tree.h" #include "common/reqid.h" #include "common/system.h" +#include "common/common.h" #define PERSISTENT_HEALTH_TDB "persistent_health.tdb" diff --git a/ctdb/server/ctdb_monitor.c b/ctdb/server/ctdb_monitor.c index 4f861e82e2c..50a3da45a17 100644 --- a/ctdb/server/ctdb_monitor.c +++ b/ctdb/server/ctdb_monitor.c @@ -33,6 +33,7 @@ #include "ctdb_logging.h" #include "common/system.h" +#include "common/common.h" struct ctdb_monitor_state { uint32_t monitoring_mode; diff --git a/ctdb/server/ctdb_persistent.c b/ctdb/server/ctdb_persistent.c index aa878044d33..e5ad2fa7f6d 100644 --- a/ctdb/server/ctdb_persistent.c +++ b/ctdb/server/ctdb_persistent.c @@ -35,6 +35,7 @@ #include "ctdb_logging.h" #include "common/reqid.h" +#include "common/common.h" struct ctdb_persistent_state { struct ctdb_context *ctdb; diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c index 23226d3bf08..c898b95e1ab 100644 --- a/ctdb/server/ctdb_recover.c +++ b/ctdb/server/ctdb_recover.c @@ -37,6 +37,7 @@ #include "ctdb_logging.h" #include "common/system.h" +#include "common/common.h" int ctdb_control_getvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata) diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 8eaed2b7bed..1db768120e8 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -39,6 +39,7 @@ #include "common/system.h" #include "common/cmdline.h" +#include "common/common.h" /* List of SRVID requests that need to be processed */ diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c index 95ded142671..3ad24c977f7 100644 --- a/ctdb/server/ctdb_server.c +++ b/ctdb/server/ctdb_server.c @@ -32,6 +32,8 @@ #include "ctdb_client.h" #include "ctdb_logging.h" +#include "common/common.h" + /* choose the transport we will use */ diff --git a/ctdb/server/ctdb_serverids.c b/ctdb/server/ctdb_serverids.c index 9186cc5beee..80878fe1701 100644 --- a/ctdb/server/ctdb_serverids.c +++ b/ctdb/server/ctdb_serverids.c @@ -28,6 +28,7 @@ #include "common/rb_tree.h" #include "common/reqid.h" +#include "common/common.h" #define SERVER_ID_KEY_SIZE 3 diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index c806178b50a..61a3a8d5a2c 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -38,6 +38,7 @@ #include "common/rb_tree.h" #include "common/reqid.h" #include "common/system.h" +#include "common/common.h" #define TAKEOVER_TIMEOUT() timeval_current_ofs(ctdb->tunable.takeover_timeout,0) diff --git a/ctdb/server/ctdb_traverse.c b/ctdb/server/ctdb_traverse.c index 4cdb3d02dfd..da13a0e692f 100644 --- a/ctdb/server/ctdb_traverse.c +++ b/ctdb/server/ctdb_traverse.c @@ -37,6 +37,7 @@ #include "common/reqid.h" #include "common/system.h" +#include "common/common.h" typedef void (*ctdb_traverse_fn_t)(void *private_data, TDB_DATA key, TDB_DATA data); diff --git a/ctdb/server/ctdb_tunables.c b/ctdb/server/ctdb_tunables.c index 230a315b73a..0644a67497d 100644 --- a/ctdb/server/ctdb_tunables.c +++ b/ctdb/server/ctdb_tunables.c @@ -27,6 +27,8 @@ #include "ctdb_private.h" #include "ctdb_logging.h" +#include "common/common.h" + static const struct { const char *name; uint32_t default_v; diff --git a/ctdb/server/ctdb_update_record.c b/ctdb/server/ctdb_update_record.c index 1c3fef2a071..17d4df5450e 100644 --- a/ctdb/server/ctdb_update_record.c +++ b/ctdb/server/ctdb_update_record.c @@ -34,6 +34,7 @@ #include "ctdb_logging.h" #include "common/system.h" +#include "common/common.h" struct ctdb_persistent_write_state { struct ctdb_db_context *ctdb_db; diff --git a/ctdb/server/ctdb_uptime.c b/ctdb/server/ctdb_uptime.c index 7968cdc37d6..3e028e8a4e1 100644 --- a/ctdb/server/ctdb_uptime.c +++ b/ctdb/server/ctdb_uptime.c @@ -31,6 +31,8 @@ #include "ctdb_client.h" #include "ctdb_logging.h" +#include "common/common.h" + /* returns the ctdb uptime */ diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c index 3d61befd620..53b20b92b3d 100644 --- a/ctdb/server/ctdb_vacuum.c +++ b/ctdb/server/ctdb_vacuum.c @@ -38,6 +38,7 @@ #include "common/rb_tree.h" #include "common/system.h" +#include "common/common.h" #define TIMELIMIT() timeval_current_ofs(10, 0) diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index 58313844174..7e5bf951696 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -38,6 +38,7 @@ #include "common/reqid.h" #include "common/system.h" #include "common/cmdline.h" +#include "common/common.h" static struct { const char *nlist; diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c index 2fac047626a..2c5dfae9165 100644 --- a/ctdb/server/eventscript.c +++ b/ctdb/server/eventscript.c @@ -37,6 +37,7 @@ #include "common/rb_tree.h" #include "common/system.h" +#include "common/common.h" static void ctdb_event_script_timeout(struct tevent_context *ev, diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c index 0b18c968e1e..0fee1acb22e 100644 --- a/ctdb/tcp/tcp_connect.c +++ b/ctdb/tcp/tcp_connect.c @@ -32,6 +32,7 @@ #include "ctdb_private.h" #include "common/system.h" +#include "common/common.h" #include "ctdb_tcp.h" diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 02f580277ef..c1791e08813 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -30,6 +30,8 @@ #include "ctdb_logging.h" #include "ctdb_private.h" +#include "common/common.h" + #include "ctdb_tcp.h" static int tnode_destructor(struct ctdb_tcp_node *tnode) diff --git a/ctdb/tcp/tcp_io.c b/ctdb/tcp/tcp_io.c index 5be8d85e533..210881988ee 100644 --- a/ctdb/tcp/tcp_io.c +++ b/ctdb/tcp/tcp_io.c @@ -27,6 +27,8 @@ #include "ctdb_logging.h" #include "ctdb_private.h" +#include "common/common.h" + #include "ctdb_tcp.h" diff --git a/ctdb/tests/src/ctdb_bench.c b/ctdb/tests/src/ctdb_bench.c index 1b0c30bc6ab..536782c8e6b 100644 --- a/ctdb/tests/src/ctdb_bench.c +++ b/ctdb/tests/src/ctdb_bench.c @@ -28,12 +28,13 @@ #include "lib/util/time.h" #include "lib/util/debug.h" -#include "common/cmdline.h" - #include "ctdb_logging.h" #include "ctdb_private.h" #include "ctdb_client.h" +#include "common/cmdline.h" +#include "common/common.h" + static struct timeval tp1,tp2; static void start_timer(void) diff --git a/ctdb/tests/src/ctdb_fetch.c b/ctdb/tests/src/ctdb_fetch.c index 592332b14c0..600504b82b2 100644 --- a/ctdb/tests/src/ctdb_fetch.c +++ b/ctdb/tests/src/ctdb_fetch.c @@ -30,9 +30,11 @@ #include "lib/util/time.h" +#include "ctdb_private.h" #include "ctdb_client.h" #include "common/cmdline.h" +#include "common/common.h" static struct timeval tp1,tp2; diff --git a/ctdb/tests/src/ctdb_fetch_one.c b/ctdb/tests/src/ctdb_fetch_one.c index b92014a383f..e24684f615a 100644 --- a/ctdb/tests/src/ctdb_fetch_one.c +++ b/ctdb/tests/src/ctdb_fetch_one.c @@ -29,9 +29,11 @@ #include "lib/util/time.h" +#include "ctdb_private.h" #include "ctdb_client.h" #include "common/cmdline.h" +#include "common/common.h" static int timelimit = 10; static int lock_count = 0; diff --git a/ctdb/tests/src/ctdb_fetch_readonly_loop.c b/ctdb/tests/src/ctdb_fetch_readonly_loop.c index 29d7c2dcee6..3e4cc038d7a 100644 --- a/ctdb/tests/src/ctdb_fetch_readonly_loop.c +++ b/ctdb/tests/src/ctdb_fetch_readonly_loop.c @@ -34,6 +34,7 @@ #include "ctdb_client.h" #include "common/cmdline.h" +#include "common/common.h" static struct ctdb_db_context *ctdb_db; diff --git a/ctdb/tests/src/ctdb_fetch_readonly_once.c b/ctdb/tests/src/ctdb_fetch_readonly_once.c index 206f52da7a0..211927363fc 100644 --- a/ctdb/tests/src/ctdb_fetch_readonly_once.c +++ b/ctdb/tests/src/ctdb_fetch_readonly_once.c @@ -29,8 +29,12 @@ #include "lib/util/time.h" +#include "ctdb_private.h" #include "ctdb_client.h" +#include "common/common.h" +#include "common/cmdline.h" + const char *TESTKEY = "testkey"; /* diff --git a/ctdb/tests/src/ctdb_persistent.c b/ctdb/tests/src/ctdb_persistent.c index ac3e15d457e..df777f4878f 100644 --- a/ctdb/tests/src/ctdb_persistent.c +++ b/ctdb/tests/src/ctdb_persistent.c @@ -30,11 +30,13 @@ #include "lib/util/debug.h" #include "lib/util/time.h" -#include "common/cmdline.h" - +#include "ctdb_private.h" #include "ctdb_logging.h" #include "ctdb_client.h" +#include "common/cmdline.h" +#include "common/common.h" + static struct timeval tp1,tp2; static void start_timer(void) diff --git a/ctdb/tests/src/ctdb_porting_tests.c b/ctdb/tests/src/ctdb_porting_tests.c index 8718faaa7df..f539422df4a 100644 --- a/ctdb/tests/src/ctdb_porting_tests.c +++ b/ctdb/tests/src/ctdb_porting_tests.c @@ -28,11 +28,13 @@ #include "lib/util/debug.h" +#include "ctdb_private.h" #include "ctdb_logging.h" #include "ctdb_client.h" #include "common/cmdline.h" #include "common/system.h" +#include "common/common.h" static struct { diff --git a/ctdb/tests/src/ctdb_randrec.c b/ctdb/tests/src/ctdb_randrec.c index c861d318d31..6d9a3d1a637 100644 --- a/ctdb/tests/src/ctdb_randrec.c +++ b/ctdb/tests/src/ctdb_randrec.c @@ -30,12 +30,13 @@ #include "lib/util/debug.h" #include "lib/util/time.h" -#include "common/cmdline.h" - #include "ctdb_logging.h" #include "ctdb_private.h" #include "ctdb_client.h" +#include "common/cmdline.h" +#include "common/common.h" + static struct timeval tp1,tp2; static void start_timer(void) diff --git a/ctdb/tests/src/ctdb_store.c b/ctdb/tests/src/ctdb_store.c index 756c98db3ec..0405e831f82 100644 --- a/ctdb/tests/src/ctdb_store.c +++ b/ctdb/tests/src/ctdb_store.c @@ -29,10 +29,12 @@ #include "lib/util/time.h" -#include "common/cmdline.h" - +#include "ctdb_private.h" #include "ctdb_client.h" +#include "common/cmdline.h" +#include "common/common.h" + static int num_records = 10; static int base_rec; diff --git a/ctdb/tests/src/ctdb_trackingdb_test.c b/ctdb/tests/src/ctdb_trackingdb_test.c index a3764e35ab1..0e0471c3431 100644 --- a/ctdb/tests/src/ctdb_trackingdb_test.c +++ b/ctdb/tests/src/ctdb_trackingdb_test.c @@ -34,10 +34,11 @@ #include "lib/tdb_wrap/tdb_wrap.h" #include "lib/util/time.h" -#include "common/cmdline.h" - #include "ctdb_private.h" +#include "common/cmdline.h" +#include "common/common.h" + #define MAXINDEX 64 char indices[MAXINDEX]; diff --git a/ctdb/tests/src/ctdb_transaction.c b/ctdb/tests/src/ctdb_transaction.c index 50ff6ce20b3..b7a3e32d9f6 100644 --- a/ctdb/tests/src/ctdb_transaction.c +++ b/ctdb/tests/src/ctdb_transaction.c @@ -30,10 +30,12 @@ #include "lib/util/debug.h" #include "lib/util/time.h" +#include "ctdb_private.h" #include "ctdb_logging.h" #include "ctdb_client.h" #include "common/cmdline.h" +#include "common/common.h" static struct timeval tp1,tp2; diff --git a/ctdb/tests/src/ctdb_traverse.c b/ctdb/tests/src/ctdb_traverse.c index 7dc347e59c4..d69c8e043db 100644 --- a/ctdb/tests/src/ctdb_traverse.c +++ b/ctdb/tests/src/ctdb_traverse.c @@ -29,10 +29,12 @@ #include "lib/util/time.h" -#include "common/cmdline.h" - +#include "ctdb_private.h" #include "ctdb_client.h" +#include "common/cmdline.h" +#include "common/common.h" + static const char *dbname = "test.tdb"; static int traverse_callback(TDB_DATA key, TDB_DATA data, void *private_data) diff --git a/ctdb/tests/src/ctdb_update_record.c b/ctdb/tests/src/ctdb_update_record.c index 971afc73bd9..7b5b5449967 100644 --- a/ctdb/tests/src/ctdb_update_record.c +++ b/ctdb/tests/src/ctdb_update_record.c @@ -32,6 +32,7 @@ #include "ctdb_client.h" #include "common/cmdline.h" +#include "common/common.h" static struct ctdb_db_context *ctdb_db; diff --git a/ctdb/tests/src/ctdb_update_record_persistent.c b/ctdb/tests/src/ctdb_update_record_persistent.c index ca138914fd7..10dc54bbfdf 100644 --- a/ctdb/tests/src/ctdb_update_record_persistent.c +++ b/ctdb/tests/src/ctdb_update_record_persistent.c @@ -33,6 +33,7 @@ #include "ctdb_client.h" #include "common/cmdline.h" +#include "common/common.h" static void update_once(struct ctdb_context *ctdb, struct tevent_context *ev, diff --git a/ctdb/tests/src/rb_test.c b/ctdb/tests/src/rb_test.c index 283a3141abf..1f94fd13216 100644 --- a/ctdb/tests/src/rb_test.c +++ b/ctdb/tests/src/rb_test.c @@ -19,6 +19,7 @@ #include "replace.h" #include "system/filesys.h" +#include "system/network.h" #include "system/time.h" #include @@ -27,8 +28,11 @@ #include "lib/util/dlinklist.h" -#include "common/cmdline.h" +#include "ctdb_private.h" + #include "common/rb_tree.h" +#include "common/cmdline.h" +#include "common/common.h" static struct timeval tp1,tp2; diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 976fe6178f8..d731fb4da42 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -45,6 +45,7 @@ #include "common/cmdline.h" #include "common/rb_tree.h" #include "common/system.h" +#include "common/common.h" #define ERR_TIMEOUT 20 /* timed out trying to reach node */ #define ERR_NONODE 21 /* node does not exist */ diff --git a/ctdb/utils/pmda/pmda_ctdb.c b/ctdb/utils/pmda/pmda_ctdb.c index 13c2d6fea1f..e76b4b2e262 100644 --- a/ctdb/utils/pmda/pmda_ctdb.c +++ b/ctdb/utils/pmda/pmda_ctdb.c @@ -32,6 +32,7 @@ #include "ctdb_protocol.h" #include "common/system.h" +#include "common/common.h" #include #include