tests: Mark some functions as static
authorMartin Schwenke <martin@meltin.net>
Thu, 4 Sep 2014 03:28:34 +0000 (13:28 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Fri, 27 Mar 2015 02:51:31 +0000 (13:51 +1100)
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>
(Imported from commit 6674949317dd4b2c1855571ea378eb6bc3b2e86c)

server/ctdb_lock.c
tests/src/ctdb_lock_tdb.c
tests/src/ctdb_porting_tests.c
tests/src/ctdb_takeover_tests.c
tests/src/ctdb_test_stubs.c
tests/src/ctdb_trackingdb_test.c
tests/src/rb_test.c
utils/ping_pong/ping_pong.c

index 9833a75c95a28ae858472f430148f8b968024fc4..fd1b4db01d041659ef07502cef761dd17b0173f9 100644 (file)
@@ -689,7 +689,7 @@ static bool lock_helper_args(TALLOC_CTX *mem_ctx,
 /*
  * 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;
index ad2a3297d31431d88620d52c51c870bfa04d1ff3..a53ffa13f9517d5622663006528a3b19611792d4 100644 (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);
 }
index 6752f84cbea8ab333120fa2fec49f73341262cda..bd7836108655e8216fdcdfd25ab37c3efa004d18 100644 (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++;
index 7fd989eaf6e5fcf3e06420099c5c836d769a7111..04b49e879b2da7d2e2978efcfa84a0a97468adbf 100644 (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);
index d36fe815678c73efd5295103d01e98e817c56928..82e82f3a4cc1ccafc7d49624432dfb723a3032a2 100644 (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];
 
index ee473c012474e7300e15e761661c2a28efc4dad7..760d3140791556c1e7ed09ab4fabb8a0979c584f 100644 (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)) {
index 092732bcf9b6cdda02b294229aee5ec0cef29bd5..44842e68a2f1e318733037ca0f8bf4bd68333345 100644 (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)++;
index 16f58d8af2b6dc76ca318ec80abf38a53a922434..1d134a1462cf6e5a82da34bece73e0d600a7a74b 100644 (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;