1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

ctdb-tests: Mark some functions as static

To avoid warnings when using --enable-developer, which uses
-Wmissing-prototypes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2014-09-04 13:28:34 +10:00 committed by Amitay Isaacs
parent 5de4a97fe9
commit 6674949317
8 changed files with 48 additions and 41 deletions

View File

@ -655,7 +655,7 @@ static char **lock_helper_args(TALLOC_CTX *mem_ctx, struct lock_context *lock_ct
/*
* Find a lock request that can be scheduled
*/
struct lock_context *ctdb_find_lock_context(struct ctdb_context *ctdb)
static struct lock_context *ctdb_find_lock_context(struct ctdb_context *ctdb)
{
struct lock_context *lock_ctx, *next_ctx;
struct ctdb_db_context *ctdb_db;

View File

@ -6,7 +6,7 @@
const char *tdb_file;
TDB_CONTEXT *tdb;
void signal_handler(int signum)
static void signal_handler(int signum)
{
tdb_close(tdb);
}

View File

@ -191,7 +191,7 @@ static int fork_helper(void)
/*
tests
*/
int test_ctdb_sys_check_iface_exists(void)
static int test_ctdb_sys_check_iface_exists(void)
{
const char *fakename = "fake";
bool test;
@ -206,7 +206,7 @@ int test_ctdb_sys_check_iface_exists(void)
return 0;
}
int test_ctdb_get_peer_pid(void)
static int test_ctdb_get_peer_pid(void)
{
int ret;
int fd;
@ -233,7 +233,7 @@ int test_ctdb_get_peer_pid(void)
return 0;
}
int test_ctdb_get_process_name(void)
static int test_ctdb_get_process_name(void)
{
char *process_name = NULL;
globals.testcount++;

View File

@ -74,7 +74,7 @@ read_ctdb_public_ip_list(TALLOC_CTX *ctx)
return ret;
}
void print_ctdb_public_ip_list(struct ctdb_public_ip_list * ips)
static void print_ctdb_public_ip_list(struct ctdb_public_ip_list * ips)
{
while (ips) {
printf("%s %d\n", ctdb_addr_to_str(&(ips->addr)), ips->pnn);
@ -84,7 +84,7 @@ void print_ctdb_public_ip_list(struct ctdb_public_ip_list * ips)
/* Read some IPs from stdin, 1 per line, parse them and then print
* them back out. */
void ctdb_test_read_ctdb_public_ip_list(void)
static void ctdb_test_read_ctdb_public_ip_list(void)
{
struct ctdb_public_ip_list *l;
@ -212,7 +212,8 @@ read_ctdb_public_ip_info(TALLOC_CTX *ctx,
return true;
}
void print_ctdb_available_ips(int numnodes, struct ctdb_all_public_ips **avail)
static void print_ctdb_available_ips(int numnodes,
struct ctdb_all_public_ips **avail)
{
int n, i;
@ -229,7 +230,7 @@ void print_ctdb_available_ips(int numnodes, struct ctdb_all_public_ips **avail)
}
}
void ctdb_test_read_ctdb_public_ip_info(const char nodestates[])
static void ctdb_test_read_ctdb_public_ip_info(const char nodestates[])
{
int numnodes;
struct ctdb_public_ip_list *l;
@ -261,7 +262,7 @@ void ctdb_test_read_ctdb_public_ip_info(const char nodestates[])
}
/* Read 2 IPs from stdin, calculate the IP distance and print it. */
void ctdb_test_ip_distance(void)
static void ctdb_test_ip_distance(void)
{
struct ctdb_public_ip_list *l;
uint32_t distance;
@ -281,7 +282,7 @@ void ctdb_test_ip_distance(void)
/* Read some IPs from stdin, calculate the sum of the squares of the
* IP distances between the 1st argument and those read that are on
* the given node. The given IP must one of the ones in the list. */
void ctdb_test_ip_distance_2_sum(const char ip[], int pnn)
static void ctdb_test_ip_distance_2_sum(const char ip[], int pnn)
{
struct ctdb_public_ip_list *l;
struct ctdb_public_ip_list *t;
@ -318,7 +319,7 @@ void ctdb_test_ip_distance_2_sum(const char ip[], int pnn)
/* Read some IPs from stdin, calculate the sume of the squares of the
* IP distances between the first and the rest, and print it. */
void ctdb_test_lcp2_imbalance(int pnn)
static void ctdb_test_lcp2_imbalance(int pnn)
{
struct ctdb_public_ip_list *l;
uint32_t imbalance;
@ -405,11 +406,11 @@ static enum ctdb_runstate *get_runstate(TALLOC_CTX *tmp_ctx,
* create_merged_ip_list(), so should only be used in tests of
* ctdb_takeover_run_core(). Yes, it is a hack... :-)
*/
void ctdb_test_init(const char nodestates[],
struct ctdb_context **ctdb,
struct ctdb_public_ip_list **all_ips,
struct ctdb_ipflags **ipflags,
bool read_ips_for_multiple_nodes)
static void ctdb_test_init(const char nodestates[],
struct ctdb_context **ctdb,
struct ctdb_public_ip_list **all_ips,
struct ctdb_ipflags **ipflags,
bool read_ips_for_multiple_nodes)
{
struct ctdb_all_public_ips **avail;
int i, numnodes;
@ -501,7 +502,7 @@ void ctdb_test_init(const char nodestates[],
}
/* IP layout is read from stdin. */
void ctdb_test_lcp2_allocate_unassigned(const char nodestates[])
static void ctdb_test_lcp2_allocate_unassigned(const char nodestates[])
{
struct ctdb_context *ctdb;
struct ctdb_public_ip_list *all_ips;
@ -524,7 +525,7 @@ void ctdb_test_lcp2_allocate_unassigned(const char nodestates[])
}
/* IP layout is read from stdin. */
void ctdb_test_lcp2_failback(const char nodestates[])
static void ctdb_test_lcp2_failback(const char nodestates[])
{
struct ctdb_context *ctdb;
struct ctdb_public_ip_list *all_ips;
@ -547,7 +548,7 @@ void ctdb_test_lcp2_failback(const char nodestates[])
}
/* IP layout is read from stdin. */
void ctdb_test_lcp2_failback_loop(const char nodestates[])
static void ctdb_test_lcp2_failback_loop(const char nodestates[])
{
struct ctdb_context *ctdb;
struct ctdb_public_ip_list *all_ips;
@ -572,8 +573,8 @@ void ctdb_test_lcp2_failback_loop(const char nodestates[])
/* IP layout is read from stdin. See comment for ctdb_test_init() for
* explanation of read_ips_for_multiple_nodes.
*/
void ctdb_test_ctdb_takeover_run_core(const char nodestates[],
bool read_ips_for_multiple_nodes)
static void ctdb_test_ctdb_takeover_run_core(const char nodestates[],
bool read_ips_for_multiple_nodes)
{
struct ctdb_context *ctdb;
struct ctdb_public_ip_list *all_ips;
@ -589,7 +590,7 @@ void ctdb_test_ctdb_takeover_run_core(const char nodestates[],
talloc_free(ctdb);
}
void usage(void)
static void usage(void)
{
fprintf(stderr, "usage: ctdb_takeover_tests <op>\n");
exit(1);

View File

@ -34,7 +34,7 @@ static struct ctdb_context *ctdb_global;
/* A fake flag that is only supported by some functions */
#define NODE_FLAGS_FAKE_TIMEOUT 0x80000000
void ctdb_test_stubs_read_nodemap(struct ctdb_context *ctdb)
static void ctdb_test_stubs_read_nodemap(struct ctdb_context *ctdb)
{
char line[1024];
@ -131,7 +131,8 @@ void ctdb_test_stubs_read_nodemap(struct ctdb_context *ctdb)
}
}
void ctdb_test_stubs_print_nodemap(struct ctdb_context *ctdb)
#ifdef CTDB_TEST_OVERRIDE_MAIN
static void ctdb_test_stubs_print_nodemap(struct ctdb_context *ctdb)
{
int i;
@ -143,6 +144,7 @@ void ctdb_test_stubs_print_nodemap(struct ctdb_context *ctdb)
ctdb->nodes[i]->pnn == ctdb->recovery_master ? "\tRECMASTER" : "");
}
}
#endif
/* Read interfaces information. Same format as "ctdb ifaces -Y"
* output:
@ -158,7 +160,7 @@ struct ctdb_iface {
uint32_t references;
};
void ctdb_test_stubs_read_ifaces(struct ctdb_context *ctdb)
static void ctdb_test_stubs_read_ifaces(struct ctdb_context *ctdb)
{
char line[1024];
struct ctdb_iface *iface;
@ -218,7 +220,8 @@ void ctdb_test_stubs_read_ifaces(struct ctdb_context *ctdb)
}
}
void ctdb_test_stubs_print_ifaces(struct ctdb_context *ctdb)
#ifdef CTDB_TEST_OVERRIDE_MAIN
static void ctdb_test_stubs_print_ifaces(struct ctdb_context *ctdb)
{
struct ctdb_iface *iface;
@ -230,6 +233,7 @@ void ctdb_test_stubs_print_ifaces(struct ctdb_context *ctdb)
iface->references);
}
}
#endif
/* Read vnn map.
* output:
@ -246,7 +250,7 @@ struct ctdb_vnn_map {
uint32_t *map;
};
*/
void ctdb_test_stubs_read_vnnmap(struct ctdb_context *ctdb)
static void ctdb_test_stubs_read_vnnmap(struct ctdb_context *ctdb)
{
char line[1024];
@ -290,7 +294,8 @@ void ctdb_test_stubs_read_vnnmap(struct ctdb_context *ctdb)
}
}
void ctdb_test_stubs_print_vnnmap(struct ctdb_context *ctdb)
#ifdef CTDB_TEST_OVERRIDE_MAIN
static void ctdb_test_stubs_print_vnnmap(struct ctdb_context *ctdb)
{
int i;
@ -299,8 +304,9 @@ void ctdb_test_stubs_print_vnnmap(struct ctdb_context *ctdb)
printf("%d\n", ctdb->vnn_map->map[i]);
}
}
#endif
void ctdb_test_stubs_fake_setup(struct ctdb_context *ctdb)
static void ctdb_test_stubs_fake_setup(struct ctdb_context *ctdb)
{
char line[1024];

View File

@ -33,7 +33,7 @@
#define MAXINDEX 64
char indices[MAXINDEX];
void vn_cb(struct ctdb_context *ctdb, uint32_t pnn, void *private_data)
static void vn_cb(struct ctdb_context *ctdb, uint32_t pnn, void *private_data)
{
char *ind = private_data;
@ -45,7 +45,7 @@ void vn_cb(struct ctdb_context *ctdb, uint32_t pnn, void *private_data)
ind[pnn] = 0;
}
void verify_nodes(struct ctdb_context *ctdb, TDB_DATA data)
static void verify_nodes(struct ctdb_context *ctdb, TDB_DATA data)
{
int i;
@ -61,7 +61,7 @@ void verify_nodes(struct ctdb_context *ctdb, TDB_DATA data)
void add_node(struct ctdb_context *ctdb, TDB_DATA *data, int pnn)
static void add_node(struct ctdb_context *ctdb, TDB_DATA *data, int pnn)
{
printf("Add node %d\n", pnn);
if (ctdb_trackingdb_add_pnn(ctdb, data, pnn)) {

View File

@ -43,7 +43,7 @@ static double end_timer(void)
int num_records=5;
void *callback(void *p, void *d)
static void *callback(void *p, void *d)
{
uint32_t *data = (uint32_t *)d;
@ -56,12 +56,12 @@ void *callback(void *p, void *d)
return data;
}
void *random_add(void *p, void *d)
static void *random_add(void *p, void *d)
{
return p;
}
int traverse(void *p, void *d)
static int traverse(void *p, void *d)
{
uint32_t *data = (uint32_t *)d;
@ -69,14 +69,14 @@ int traverse(void *p, void *d)
return 0;
}
int random_traverse(void *p, void *d)
static int random_traverse(void *p, void *d)
{
printf("%s ",(char *)d);
return 0;
}
static uint32_t calc_checksum = 0;
int traverse_checksum(void *p, void *d)
static int traverse_checksum(void *p, void *d)
{
int i,j,k;
@ -85,14 +85,14 @@ int traverse_checksum(void *p, void *d)
return 0;
}
int count_traverse(void *p, void *d)
static int count_traverse(void *p, void *d)
{
int *count = p;
(*count)++;
return 0;
}
int count_traverse_abort(void *p, void *d)
static int count_traverse_abort(void *p, void *d)
{
int *count = p;
(*count)++;

View File

@ -71,7 +71,7 @@ static int lock_range(int fd, int offset, int len)
}
/* check whether we could place a lock */
int check_lock(int fd, int offset, int len)
static int check_lock(int fd, int offset, int len)
{
struct flock lock;
int ret;