Просмотр исходного кода

avoid prototype warnings

* test/evsbench.c: Declare functions/vars static.
* test/evsverify.c: Likewise.
* test/testcpg2.c: Likewise.
* test/testcpg.c: Likewise.
* test/logsysbench.c: Likewise.
* test/cpgbench.c: Likewise.
* exec/sync.c: Likewise.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1982 fd59a12c-fef9-0310-b244-a6a79926bd2f
Jim Meyering 17 лет назад
Родитель
Сommit
3965e378e6
7 измененных файлов с 50 добавлено и 49 удалено
  1. 2 1
      exec/sync.c
  2. 14 14
      test/cpgbench.c
  3. 12 12
      test/evsbench.c
  4. 9 9
      test/evsverify.c
  5. 5 5
      test/logsysbench.c
  6. 6 6
      test/testcpg.c
  7. 2 2
      test/testcpg2.c

+ 2 - 1
exec/sync.c

@@ -318,7 +318,8 @@ void sync_primary_callback_fn (
 
 
 static struct memb_ring_id deliver_ring_id;
 static struct memb_ring_id deliver_ring_id;
 
 
-void sync_endian_convert (struct req_exec_sync_barrier_start *req_exec_sync_barrier_start)
+static void sync_endian_convert (struct req_exec_sync_barrier_start
+				 *req_exec_sync_barrier_start)
 {
 {
 	totemip_copy_endian_convert(&req_exec_sync_barrier_start->ring_id.rep,
 	totemip_copy_endian_convert(&req_exec_sync_barrier_start->ring_id.rep,
 		&req_exec_sync_barrier_start->ring_id.rep);
 		&req_exec_sync_barrier_start->ring_id.rep);

+ 14 - 14
test/cpgbench.c

@@ -1,13 +1,13 @@
 #include <assert.h>
 #include <assert.h>
 /*
 /*
- * Copyright (c) 2006 Red Hat, Inc.
+ * Copyright (c) 2006, 2009 Red Hat, Inc.
  *
  *
  * All rights reserved.
  * All rights reserved.
  *
  *
  * Author: Steven Dake (sdake@redhat.com)
  * Author: Steven Dake (sdake@redhat.com)
  *
  *
  * This software licensed under BSD license, the text of which follows:
  * This software licensed under BSD license, the text of which follows:
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
  * modification, are permitted provided that the following conditions are met:
  *
  *
@@ -67,9 +67,9 @@
     } while (0)
     } while (0)
 #endif
 #endif
 
 
-int alarm_notice;
+static int alarm_notice;
 
 
-void cpg_bm_confchg_fn (
+static void cpg_bm_confchg_fn (
 	cpg_handle_t handle,
 	cpg_handle_t handle,
 	struct cpg_name *group_name,
 	struct cpg_name *group_name,
 	struct cpg_address *member_list, int member_list_entries,
 	struct cpg_address *member_list, int member_list_entries,
@@ -78,9 +78,9 @@ void cpg_bm_confchg_fn (
 {
 {
 }
 }
 
 
-unsigned int write_count;
+static unsigned int write_count;
 
 
-void cpg_bm_deliver_fn (
+static void cpg_bm_deliver_fn (
         cpg_handle_t handle,
         cpg_handle_t handle,
         struct cpg_name *group_name,
         struct cpg_name *group_name,
         uint32_t nodeid,
         uint32_t nodeid,
@@ -91,14 +91,14 @@ void cpg_bm_deliver_fn (
 	write_count++;
 	write_count++;
 }
 }
 
 
-cpg_callbacks_t callbacks = {
+static cpg_callbacks_t callbacks = {
 	.cpg_deliver_fn 	= cpg_bm_deliver_fn,
 	.cpg_deliver_fn 	= cpg_bm_deliver_fn,
 	.cpg_confchg_fn		= cpg_bm_confchg_fn
 	.cpg_confchg_fn		= cpg_bm_confchg_fn
 };
 };
 
 
-char data[500000];
+static char data[500000];
 
 
-void cpg_benchmark (
+static void cpg_benchmark (
 	cpg_handle_t handle,
 	cpg_handle_t handle,
 	int write_size)
 	int write_size)
 {
 {
@@ -138,15 +138,15 @@ retry:
 
 
 	printf ("%5d messages received ", write_count);
 	printf ("%5d messages received ", write_count);
 	printf ("%5d bytes per write ", write_size);
 	printf ("%5d bytes per write ", write_size);
-	printf ("%7.3f Seconds runtime ", 
+	printf ("%7.3f Seconds runtime ",
 		(tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
 		(tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
 	printf ("%9.3f TP/s ",
 	printf ("%9.3f TP/s ",
 		((float)write_count) /  (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
 		((float)write_count) /  (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
-	printf ("%7.3f MB/s.\n", 
+	printf ("%7.3f MB/s.\n",
 		((float)write_count) * ((float)write_size) /  ((tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)) * 1000000.0));
 		((float)write_count) * ((float)write_size) /  ((tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)) * 1000000.0));
 }
 }
 
 
-void sigalrm_handler (int num)
+static void sigalrm_handler (int num)
 {
 {
 	alarm_notice = 1;
 	alarm_notice = 1;
 }
 }
@@ -161,7 +161,7 @@ int main (void) {
 	unsigned int size;
 	unsigned int size;
 	int i;
 	int i;
 	unsigned int res;
 	unsigned int res;
-	
+
 	size = 1000;
 	size = 1000;
 	signal (SIGALRM, sigalrm_handler);
 	signal (SIGALRM, sigalrm_handler);
 	res = cpg_initialize (&handle, &callbacks);
 	res = cpg_initialize (&handle, &callbacks);
@@ -169,7 +169,7 @@ int main (void) {
 		printf ("cpg_initialize failed with result %d\n", res);
 		printf ("cpg_initialize failed with result %d\n", res);
 		exit (1);
 		exit (1);
 	}
 	}
-	
+
 	res = cpg_join (handle, &group_name);
 	res = cpg_join (handle, &group_name);
 	if (res != CS_OK) {
 	if (res != CS_OK) {
 		printf ("cpg_join failed with result %d\n", res);
 		printf ("cpg_join failed with result %d\n", res);

+ 12 - 12
test/evsbench.c

@@ -7,7 +7,7 @@
  * Author: Steven Dake (sdake@redhat.com)
  * Author: Steven Dake (sdake@redhat.com)
  *
  *
  * This software licensed under BSD license, the text of which follows:
  * This software licensed under BSD license, the text of which follows:
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
  * modification, are permitted provided that the following conditions are met:
  *
  *
@@ -68,7 +68,7 @@
 
 
 volatile static int alarm_notice = 0;
 volatile static int alarm_notice = 0;
 
 
-void evs_deliver_fn (
+static void evs_deliver_fn (
 	unsigned int nodeid,
 	unsigned int nodeid,
 	void *msg,
 	void *msg,
 	int msg_len)
 	int msg_len)
@@ -77,7 +77,7 @@ void evs_deliver_fn (
   printf ("Delivering message %s\n", m);
   printf ("Delivering message %s\n", m);
 }
 }
 
 
-void evs_confchg_fn (
+static void evs_confchg_fn (
 	unsigned int *member_list, int member_list_entries,
 	unsigned int *member_list, int member_list_entries,
 	unsigned int *left_list, int left_list_entries,
 	unsigned int *left_list, int left_list_entries,
 	unsigned int *joined_list, int joined_list_entries)
 	unsigned int *joined_list, int joined_list_entries)
@@ -100,7 +100,7 @@ void evs_confchg_fn (
 	}
 	}
 }
 }
 
 
-evs_callbacks_t callbacks = {
+static evs_callbacks_t callbacks = {
 	evs_deliver_fn,
 	evs_deliver_fn,
 	evs_confchg_fn
 	evs_confchg_fn
 };
 };
@@ -111,14 +111,14 @@ struct evs_group groups[3] = {
 	{ "key3" }
 	{ "key3" }
 };
 };
 
 
-char buffer[200000];
+static char buffer[200000];
 
 
-struct iovec iov = {
+static struct iovec iov = {
 	.iov_base = buffer,
 	.iov_base = buffer,
 	.iov_len = sizeof (buffer)
 	.iov_len = sizeof (buffer)
 };
 };
 
 
-void evs_benchmark (evs_handle_t handle,
+static void evs_benchmark (evs_handle_t handle,
 	int write_size)
 	int write_size)
 {
 {
 	struct timeval tv1, tv2, tv_elapsed;
 	struct timeval tv1, tv2, tv_elapsed;
@@ -146,23 +146,23 @@ void evs_benchmark (evs_handle_t handle,
 
 
 	printf ("%5d Writes ", write_count);
 	printf ("%5d Writes ", write_count);
 	printf ("%5d bytes per write ", write_size);
 	printf ("%5d bytes per write ", write_size);
-	printf ("%7.3f Seconds runtime ", 
+	printf ("%7.3f Seconds runtime ",
 		(tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
 		(tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
 	printf ("%9.3f TP/s ",
 	printf ("%9.3f TP/s ",
 		((float)write_count) /  (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
 		((float)write_count) /  (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
-	printf ("%7.3f MB/s.\n", 
+	printf ("%7.3f MB/s.\n",
 		((float)write_count) * ((float)write_size) /  ((tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)) * 1000000.0));
 		((float)write_count) * ((float)write_size) /  ((tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)) * 1000000.0));
 
 
 	alarm_notice = 0;
 	alarm_notice = 0;
 }
 }
 
 
-void sigalrm_handler (int num)
+static void sigalrm_handler (int num)
 {
 {
 	alarm_notice = 1;
 	alarm_notice = 1;
 }
 }
 
 
-void sigintr_handler (int num) __attribute__((__noreturn__));
-void sigintr_handler (int num)
+static void sigintr_handler (int num) __attribute__((__noreturn__));
+static void sigintr_handler (int num)
 {
 {
 	exit (1);
 	exit (1);
 }
 }

+ 9 - 9
test/evsverify.c

@@ -7,7 +7,7 @@
  * Author: Steven Dake (sdake@redhat.com)
  * Author: Steven Dake (sdake@redhat.com)
  *
  *
  * This software licensed under BSD license, the text of which follows:
  * This software licensed under BSD license, the text of which follows:
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
  * modification, are permitted provided that the following conditions are met:
  *
  *
@@ -53,8 +53,8 @@ struct my_msg {
 	unsigned char buffer[0];
 	unsigned char buffer[0];
 };
 };
 
 
-int deliveries = 0;
-void evs_deliver_fn (
+static int deliveries = 0;
+static void evs_deliver_fn (
 	unsigned int nodeid,
 	unsigned int nodeid,
 	void *m,
 	void *m,
 	int msg_len)
 	int msg_len)
@@ -80,7 +80,7 @@ printf ("\n");
 	deliveries++;
 	deliveries++;
 }
 }
 
 
-void evs_confchg_fn (
+static void evs_confchg_fn (
 	unsigned int *member_list, int member_list_entries,
 	unsigned int *member_list, int member_list_entries,
 	unsigned int *left_list, int left_list_entries,
 	unsigned int *left_list, int left_list_entries,
 	unsigned int *joined_list, int joined_list_entries)
 	unsigned int *joined_list, int joined_list_entries)
@@ -103,7 +103,7 @@ void evs_confchg_fn (
 	}
 	}
 }
 }
 
 
-evs_callbacks_t callbacks = {
+static evs_callbacks_t callbacks = {
 	evs_deliver_fn,
 	evs_deliver_fn,
 	evs_confchg_fn
 	evs_confchg_fn
 };
 };
@@ -114,9 +114,9 @@ struct evs_group groups[3] = {
 	{ "key3" }
 	{ "key3" }
 };
 };
 
 
-struct my_msg msg;
+static struct my_msg msg;
 
 
-unsigned char buffer[200000];
+static unsigned char buffer[200000];
 int main (void)
 int main (void)
 {
 {
 	evs_handle_t handle;
 	evs_handle_t handle;
@@ -135,7 +135,7 @@ int main (void)
 		printf ("Couldn't initialize EVS service %d\n", result);
 		printf ("Couldn't initialize EVS service %d\n", result);
 		exit (0);
 		exit (0);
 	}
 	}
-	
+
 	result = evs_membership_get (handle, &local_nodeid,
 	result = evs_membership_get (handle, &local_nodeid,
 		member_list, &member_list_entries);
 		member_list, &member_list_entries);
 	printf ("Current membership from evs_membership_get entries %d\n",
 	printf ("Current membership from evs_membership_get entries %d\n",
@@ -180,7 +180,7 @@ try_again_one:
 	}
 	}
 
 
 	evs_fd_get (handle, &fd);
 	evs_fd_get (handle, &fd);
-	
+
 	evs_finalize (handle);
 	evs_finalize (handle);
 
 
 	return (0);
 	return (0);

+ 5 - 5
test/logsysbench.c

@@ -6,7 +6,7 @@
  * Author: Steven Dake (sdake@redhat.com)
  * Author: Steven Dake (sdake@redhat.com)
  *
  *
  * This software licensed under BSD license, the text of which follows:
  * This software licensed under BSD license, the text of which follows:
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
  * modification, are permitted provided that the following conditions are met:
  *
  *
@@ -54,7 +54,7 @@ LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO);
 #define LOGREC_ARGS_CHECKPOINT_CREATE 2
 #define LOGREC_ARGS_CHECKPOINT_CREATE 2
 #define ITERATIONS 1000000
 #define ITERATIONS 1000000
 
 
-struct timeval tv1, tv2, tv_elapsed;
+static struct timeval tv1, tv2, tv_elapsed;
 
 
 #define timersub(a, b, result)					\
 #define timersub(a, b, result)					\
 do {								\
 do {								\
@@ -66,11 +66,11 @@ do {								\
 	}							\
 	}							\
 } while (0)
 } while (0)
 
 
-void bm_start (void)
+static void bm_start (void)
 {
 {
         gettimeofday (&tv1, NULL);
         gettimeofday (&tv1, NULL);
 }
 }
-void bm_finish (const char *operation)
+static void bm_finish (const char *operation)
 {
 {
         gettimeofday (&tv2, NULL);
         gettimeofday (&tv2, NULL);
         timersub (&tv2, &tv1, &tv_elapsed);
         timersub (&tv2, &tv1, &tv_elapsed);
@@ -84,7 +84,7 @@ void bm_finish (const char *operation)
                 ((float)ITERATIONS) /  (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
                 ((float)ITERATIONS) /  (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
 }
 }
 
 
-char buffer[256];
+static char buffer[256];
 int main (void)
 int main (void)
 {
 {
 	int i;
 	int i;

+ 6 - 6
test/testcpg.c

@@ -53,7 +53,7 @@
 static int quit = 0;
 static int quit = 0;
 static int show_ip = 0;
 static int show_ip = 0;
 
 
-void print_cpgname (struct cpg_name *name)
+static void print_cpgname (struct cpg_name *name)
 {
 {
 	int i;
 	int i;
 
 
@@ -62,7 +62,7 @@ void print_cpgname (struct cpg_name *name)
 	}
 	}
 }
 }
 
 
-void DeliverCallback (
+static void DeliverCallback (
 	cpg_handle_t handle,
 	cpg_handle_t handle,
 	struct cpg_name *groupName,
 	struct cpg_name *groupName,
 	uint32_t nodeid,
 	uint32_t nodeid,
@@ -81,7 +81,7 @@ void DeliverCallback (
 	}
 	}
 }
 }
 
 
-void ConfchgCallback (
+static void ConfchgCallback (
 	cpg_handle_t handle,
 	cpg_handle_t handle,
 	struct cpg_name *groupName,
 	struct cpg_name *groupName,
 	struct cpg_address *member_list, int member_list_entries,
 	struct cpg_address *member_list, int member_list_entries,
@@ -143,13 +143,13 @@ void ConfchgCallback (
 	}
 	}
 }
 }
 
 
-cpg_callbacks_t callbacks = {
+static cpg_callbacks_t callbacks = {
 	.cpg_deliver_fn =            DeliverCallback,
 	.cpg_deliver_fn =            DeliverCallback,
 	.cpg_confchg_fn =            ConfchgCallback,
 	.cpg_confchg_fn =            ConfchgCallback,
 };
 };
 
 
-void sigintr_handler (int signum) __attribute__((__noreturn__));
-void sigintr_handler (int signum) {
+static void sigintr_handler (int signum) __attribute__((__noreturn__));
+static void sigintr_handler (int signum) {
 	exit (0);
 	exit (0);
 }
 }
 static struct cpg_name group_name;
 static struct cpg_name group_name;

+ 2 - 2
test/testcpg2.c

@@ -43,7 +43,7 @@
 #include <corosync/corotypes.h>
 #include <corosync/corotypes.h>
 #include <corosync/cpg.h>
 #include <corosync/cpg.h>
 
 
-void deliver(
+static void deliver(
 	cpg_handle_t handle,
 	cpg_handle_t handle,
 	struct cpg_name *group_name,
 	struct cpg_name *group_name,
 	uint32_t nodeid,
 	uint32_t nodeid,
@@ -54,7 +54,7 @@ void deliver(
     printf("self delivered nodeid: %x\n", nodeid);
     printf("self delivered nodeid: %x\n", nodeid);
 }
 }
 
 
-void confch(
+static void confch(
 	cpg_handle_t handle,
 	cpg_handle_t handle,
 	struct cpg_name *group_name,
 	struct cpg_name *group_name,
 	struct cpg_address *member_list, int member_list_entries,
 	struct cpg_address *member_list, int member_list_entries,