# HG changeset patch
# User Hannes Eder <[email protected]>
# Date 1242997877 -7200
# Node ID 684fe8e90e68db65f0a4b4e2bb02dc00fef4d1b3
# Parent  a8aff3dff21bfd17b9dd177f6a5091af759e551f
Low: cleanup: remove dead code, make symbols static, etc.

Fix following issues:
  - remove dead code and unused variables
  - make global symbols static
  - use ANSI style function declarations
  - use NULL instead of plain integer
  - remove trailing whitespace
  - etc.

diff -r a8aff3dff21b -r 684fe8e90e68 
contrib/drbd-outdate-peer/drbd-peer-outdater.c
--- a/contrib/drbd-outdate-peer/drbd-peer-outdater.c    Fri May 22 01:08:13 
2009 +0200
+++ b/contrib/drbd-outdate-peer/drbd-peer-outdater.c    Fri May 22 15:11:17 
2009 +0200
@@ -48,7 +48,7 @@ typedef struct dop_client_s
        int rc;
 } dop_client_t;
 
-const char *crm_system_name = "drbd-peer-outdater";
+static const char *crm_system_name = "drbd-peer-outdater";
 
 static void usage(const char* cmd, int exit_status);
 
diff -r a8aff3dff21b -r 684fe8e90e68 lib/clplumbing/GSource.c
--- a/lib/clplumbing/GSource.c  Fri May 22 01:08:13 2009 +0200
+++ b/lib/clplumbing/GSource.c  Fri May 22 15:11:17 2009 +0200
@@ -642,7 +642,6 @@ G_CH_dispatch_int(GSource * source,
 /*
  *     Free up our data, and notify the user process...
  */
-int    ch_destroy_debug_me = 0;
 void
 G_CH_destroy_int(GSource* source)
 {
diff -r a8aff3dff21b -r 684fe8e90e68 lib/clplumbing/cl_log.c
--- a/lib/clplumbing/cl_log.c   Fri May 22 01:08:13 2009 +0200
+++ b/lib/clplumbing/cl_log.c   Fri May 22 15:11:17 2009 +0200
@@ -762,7 +762,7 @@ cl_flush_logs(void)
        logging_daemon_chan->ops->waitout(logging_daemon_chan);
 }
 
-int
+static int
 LogToLoggingDaemon(int priority, const char * buf, 
                   int bufstrlen, gboolean use_pri_str)
 {
diff -r a8aff3dff21b -r 684fe8e90e68 lib/clplumbing/cl_msg.c
--- a/lib/clplumbing/cl_msg.c   Fri May 22 01:08:13 2009 +0200
+++ b/lib/clplumbing/cl_msg.c   Fri May 22 15:11:17 2009 +0200
@@ -55,7 +55,6 @@ static int    compression_threshold = (2*10
 static int     compression_threshold = (2*1024);
 
 static enum cl_msgfmt msgfmt = MSGFMT_NVPAIR;
-int    cl_max_msg_size = (512*1024);
 static gboolean use_traditional_compression = TRUE;
 
 const char*
diff -r a8aff3dff21b -r 684fe8e90e68 lib/clplumbing/cl_msg_types.c
--- a/lib/clplumbing/cl_msg_types.c     Fri May 22 01:08:13 2009 +0200
+++ b/lib/clplumbing/cl_msg_types.c     Fri May 22 15:11:17 2009 +0200
@@ -49,7 +49,7 @@ extern const char* FT_strings[];
 #define                NL_TO_SYM       0
 #define                SYM_TO_NL       1
 
-int            SPECIAL_SYMS[MAXDEPTH]={
+static const int SPECIAL_SYMS[MAXDEPTH] = {
        20,
        21,
        22,
diff -r a8aff3dff21b -r 684fe8e90e68 lib/clplumbing/coredumps.c
--- a/lib/clplumbing/coredumps.c        Fri May 22 01:08:13 2009 +0200
+++ b/lib/clplumbing/coredumps.c        Fri May 22 15:11:17 2009 +0200
@@ -249,7 +249,7 @@ cl_enable_coredumps(int doenable)
  * prctl(2).  This is an untested theory at this time...
  */
 void
-cl_set_all_coredump_signal_handlers()
+cl_set_all_coredump_signal_handlers(void)
 {
        static const int coresigs [] = {SIGQUIT, SIGILL, SIGABRT, SIGFPE, 
SIGSEGV
 #ifdef SIGBUS
diff -r a8aff3dff21b -r 684fe8e90e68 lib/clplumbing/cpulimits.c
--- a/lib/clplumbing/cpulimits.c        Fri May 22 01:08:13 2009 +0200
+++ b/lib/clplumbing/cpulimits.c        Fri May 22 15:11:17 2009 +0200
@@ -186,13 +186,13 @@ cl_cpu_limit_setpercent(int ipercent)
 }
 
 int
-cl_cpu_limit_ms_interval()
+cl_cpu_limit_ms_interval(void)
 {
        return  cpuinterval_ms;
 }
 
 int
-cl_cpu_limit_update()
+cl_cpu_limit_update(void)
 {
        longclock_t     now = time_longclock();
        long            msleft;
diff -r a8aff3dff21b -r 684fe8e90e68 lib/clplumbing/ipcsocket.c
--- a/lib/clplumbing/ipcsocket.c        Fri May 22 01:08:13 2009 +0200
+++ b/lib/clplumbing/ipcsocket.c        Fri May 22 15:11:17 2009 +0200
@@ -209,7 +209,7 @@ struct IPC_Stats {
        int     last_send_rc;
 };
 
-struct IPC_Stats       SocketIPCStats = {0,0,0,0};
+static struct IPC_Stats SocketIPCStats = {0, 0, 0, 0};
 extern int     debug_level;
 
 /* unix domain socket implementations of IPC functions. */
diff -r a8aff3dff21b -r 684fe8e90e68 lib/clplumbing/ipctest.c
--- a/lib/clplumbing/ipctest.c  Fri May 22 01:08:13 2009 +0200
+++ b/lib/clplumbing/ipctest.c  Fri May 22 15:11:17 2009 +0200
@@ -57,10 +57,10 @@ static int (*PollFunc)(struct pollfd * f
 =      (int (*)(struct pollfd * fds, unsigned int, int))  poll;
 static gboolean checkmsg(IPC_Message* rmsg, const char * who, int rcount);
 
-const char *procname;
+static const char *procname;
 
-int iter_def = 10000;  /* number of iterations */
-int verbosity = 0;     /* verbosity level */
+static const int iter_def = 10000;     /* number of iterations */
+static int verbosity;                  /* verbosity level */
 
 /*
  * The ipc interface can be invoked as either:
@@ -72,7 +72,7 @@ int verbosity = 0;    /* verbosity level */
  */
 /* *** CLIENTS_MAX currently 1 while coding *** */
 #define CLIENTS_MAX 1  /* max. number of independent clients */
-int clients_def = 0;   /* number of independent clients */
+static int clients_def;        /* number of independent clients */
 
 static int
 channelpair(TestFunc_t clientfunc, TestFunc_t serverfunc, int count)
@@ -394,7 +394,7 @@ transport_tests(int iterations, int clie
        return rc;
 }
 
-int data_size = 10;
+static int data_size = 10;
 
 int
 main(int argc, char ** argv)
diff -r a8aff3dff21b -r 684fe8e90e68 lib/clplumbing/ipctransientclient.c
--- a/lib/clplumbing/ipctransientclient.c       Fri May 22 01:08:13 2009 +0200
+++ b/lib/clplumbing/ipctransientclient.c       Fri May 22 15:11:17 2009 +0200
@@ -19,7 +19,7 @@
 #include <ipctransient.h>
 
 #define MAX_MESSAGES 3
-char *messages[MAX_MESSAGES];
+static char *messages[MAX_MESSAGES];
 
 IPC_Message *create_simple_message(const char *text, IPC_Channel *ch);
 IPC_Channel *init_client_ipctest_comms(
diff -r a8aff3dff21b -r 684fe8e90e68 lib/clplumbing/realtime.c
--- a/lib/clplumbing/realtime.c Fri May 22 01:08:13 2009 +0200
+++ b/lib/clplumbing/realtime.c Fri May 22 15:11:17 2009 +0200
@@ -236,7 +236,7 @@ cl_make_realtime(int spolicy, int priori
 }
 
 void
-cl_make_normaltime()
+cl_make_normaltime(void)
 {
 #ifdef DEFAULT_REALTIME
        struct sched_param      sp;
diff -r 684fe8e90e68 lib/lrm/racommon.c
--- a/lib/lrm/racommon.c        Fri May 22 15:11:17 2009 +0200
+++ b/lib/lrm/racommon.c        Fri May 22 15:16:51 2009 +0200
@@ -115,7 +115,7 @@ get_runnable_list(const char* class_path
                *rsc_info = NULL;
        }
 
-       file_num = scandir(class_path, &namelist, 0, alphasort);
+       file_num = scandir(class_path, &namelist, NULL, alphasort);
        if (file_num < 0) {
                cl_log(LOG_ERR, "scandir failed in RA plugin");
                return -2;
@@ -125,7 +125,7 @@ get_runnable_list(const char* class_path
 
                        tmp_buffer[0] = '\0';
                        tmp_buffer[FILENAME_MAX] = '\0';
-                       snprintf(tmp_buffer, FILENAME_MAX, "%s/%s", 
+                       snprintf(tmp_buffer, FILENAME_MAX, "%s/%s",
                                 class_path, namelist[file_num]->d_name );
                        if ( filtered(tmp_buffer) == TRUE ) {
                                *rsc_info = g_list_append(*rsc_info,
diff -r a8aff3dff21b -r 684fe8e90e68 lib/hbclient/api_test.c
--- a/lib/hbclient/api_test.c   Fri May 22 01:08:13 2009 +0200
+++ b/lib/hbclient/api_test.c   Fri May 22 15:11:17 2009 +0200
@@ -68,14 +68,14 @@ ClientStatus(const char * node, const ch
        ,       node, client, status);
 }
 
-int quitnow = 0;
+static int quitnow;
 void gotsig(int nsig)
 {
        (void)nsig;
        quitnow = 1;
 }
 
-const char * mandparms[] =
+static const char *mandparms[] =
 {      KEY_HBVERSION
 ,      KEY_HOPS
 ,      KEY_KEEPALIVE
@@ -91,7 +91,7 @@ const char * mandparms[] =
 ,      KEY_DEBUGLEVEL
 ,      KEY_NORMALPOLL};
 
-const char * optparms[] =
+static const char *optparms[] =
 {      KEY_LOGFILE
 ,      KEY_DBGFILE
 ,      KEY_FACILITY
diff -r a8aff3dff21b -r 684fe8e90e68 lib/plugins/lrm/raexechb.c
--- a/lib/plugins/lrm/raexechb.c        Fri May 22 01:08:13 2009 +0200
+++ b/lib/plugins/lrm/raexechb.c        Fri May 22 15:11:17 2009 +0200
@@ -129,8 +129,8 @@ static int get_provider_list(const char*
 #define MAX_PARAMETER_NUM 40
 typedef char * RA_ARGV[MAX_PARAMETER_NUM];
 
-const int MAX_LENGTH_OF_RSCNAME = 40,
-         MAX_LENGTH_OF_OPNAME = 40;
+static const int MAX_LENGTH_OF_RSCNAME = 40,
+                MAX_LENGTH_OF_OPNAME = 40;
 
 static int prepare_cmd_parameters(const char * rsc_type, const char * op_type,
                GHashTable * params, RA_ARGV params_argv);
diff -r a8aff3dff21b -r 684fe8e90e68 lib/stonith/sbd.c
--- a/lib/stonith/sbd.c Fri May 22 01:08:13 2009 +0200
+++ b/lib/stonith/sbd.c Fri May 22 15:11:17 2009 +0200
@@ -49,7 +49,7 @@ static int            timeout_msgwait         = 10;
 
 static int     watchdog_use            = 0;
 static int     go_daemon               = 0;
-const char *   watchdogdev             = "/dev/watchdog";
+static const char *watchdogdev         = "/dev/watchdog";
 static char *  local_uname;
 
 /* Global, non-tunable variables: */
@@ -59,10 +59,10 @@ static char *devname;
 static char    *devname;
 static char    *cmdname;
 
-void
-usage()
+static void
+usage(void)
 {
-       fprintf(stderr, 
+       fprintf(stderr,
 "Shared storage fencing tool.\n"
 "Syntax:\n"
 "      %s <options> <command> <cmdarguments>\n"
@@ -194,7 +194,7 @@ cmd2char(const char *cmd)
        return -1;
 }
 
-void *
+static void *
 sector_alloc(void)
 {
        void *x;
@@ -204,7 +204,7 @@ sector_alloc(void)
                exit(1);
        }
        memset(x, 0, sector_size);
-       
+
        return x;
 }
 
diff -r a8aff3dff21b -r 684fe8e90e68 logd/ha_logd.c
--- a/logd/ha_logd.c    Fri May 22 01:08:13 2009 +0200
+++ b/logd/ha_logd.c    Fri May 22 15:11:17 2009 +0200
@@ -76,17 +76,17 @@
 #define EOS '\0'
 #define        nullchk(a)      ((a) ? (a) : "<null>")
 
-int    logd_keepalive_ms = 1000;
-int    logd_warntime_ms = 5000;
-int    logd_deadtime_ms = 10000;
-gboolean RegisteredWithApphbd = FALSE;
-gboolean       verbose =FALSE;
-pid_t  write_process_pid;
-IPC_Channel*   chanspair[2];
-gboolean       stop_reading = FALSE;
-gboolean       needs_shutdown = FALSE;
+static const int logd_keepalive_ms = 1000;
+static const int logd_warntime_ms = 5000;
+static const int logd_deadtime_ms = 10000;
+static gboolean RegisteredWithApphbd = FALSE;
+static gboolean verbose = FALSE;
+static pid_t write_process_pid;
+static IPC_Channel *chanspair[2];
+static gboolean stop_reading = FALSE;
+static gboolean needs_shutdown = FALSE;
 
-struct {
+static struct {
        char            debugfile[MAXLINE];
        char            logfile[MAXLINE];
        char            entity[MAXLINE];
@@ -120,10 +120,10 @@ static char*                      cmdname = NULL;
 static char*                   cmdname = NULL;
 
 
-struct directive{
+static struct directive {
        const char* name;
        int (*add_func)(const char*);
-} Directives[]= {
+} Directives[] = {
        {"debugfile",   set_debugfile},
        {"logfile",     set_logfile},
        {"logfacility", set_facility},
diff -r a8aff3dff21b -r 684fe8e90e68 lrm/admin/lrmadmin.c
--- a/lrm/admin/lrmadmin.c      Fri May 22 01:08:13 2009 +0200
+++ b/lrm/admin/lrmadmin.c      Fri May 22 15:11:17 2009 +0200
@@ -47,36 +47,36 @@
 #include <clplumbing/GSource.h>
 #include <clplumbing/Gmain_timeout.h>
 
-const char * optstring = "A:D:X:dE:F:dg:p:M:O:P:c:S:LI:CT:n:h";
+static const char *optstring = "A:D:X:dE:F:dg:p:M:O:P:c:S:LI:CT:n:h";
 
 #ifdef HAVE_GETOPT_H
 static struct option long_options[] = {
-       {"daemon", 0, 0, 'd'},
-       {"executera", 1, 0, 'E'},
-       {"flush",1,0,'F'},
-       {"state",1,0,'S'},
-       {"listall",0,0,'L'},
-       {"information",1,0,'I'},
-       {"add",1,0,'A'},
-       {"delete",1,0,'D'},
-       {"fail",1,0,'X'},
-       {"raclass_supported",1,0,'C'},
-       {"ratype_supported",1,0,'T'},
-       {"all_type_metadata",1,0,'O'},
-       {"metadata",1,0,'M'},
-       {"provider",1,0,'P'},
-       {"set_lrmd_param", 1, 0, 'p'},
-       {"get_lrmd_param", 1, 0, 'g'},
-       {"help",0,0,'h'},
-       {0,0,0,0}
+       {"daemon",              0, NULL, 'd'},
+       {"executera",           1, NULL, 'E'},
+       {"flush",               1, NULL, 'F'},
+       {"state",               1, NULL, 'S'},
+       {"listall",             0, NULL, 'L'},
+       {"information",         1, NULL, 'I'},
+       {"add",                 1, NULL, 'A'},
+       {"delete",              1, NULL, 'D'},
+       {"fail",                1, NULL, 'X'},
+       {"raclass_supported",   1, NULL, 'C'},
+       {"ratype_supported",    1, NULL, 'T'},
+       {"all_type_metadata",   1, NULL, 'O'},
+       {"metadata",            1, NULL, 'M'},
+       {"provider",            1, NULL, 'P'},
+       {"set_lrmd_param",      1, NULL, 'p'},
+       {"get_lrmd_param",      1, NULL, 'g'},
+       {"help",                0, NULL, 'h'},
+       {NULL,                  0, NULL, 0}
 };
 #endif /* HAVE_GETOPT_H */
 
-GMainLoop *mainloop = NULL;
-const char * lrmadmin_name = "lrmadmin";
-const char * fake_name = NULL;
+static GMainLoop *mainloop;
+static const char *lrmadmin_name = "lrmadmin";
+static const char *fake_name;
 /* 20 is the length limit for a argv[x] */
-const int ARGVI_MAX_LEN = 48;
+static const int ARGVI_MAX_LEN = 48;
 
 typedef enum {
        ERROR_OPTION = -1,
@@ -138,7 +138,7 @@ static int call_id = 0;
 static int call_id = 0;
 static int TIMEOUT = -1; /* the unit is ms */
 
-const char * simple_help_screen =
+static const char *simple_help_screen =
 "lrmadmin {-d|--deamon}\n"
 "         {-A|--add} <rscid> <raclass> <ratype> <provider|NULL> 
[<rsc_params_list>]\n"
 "         {-D|--delete} <rscid>\n"
@@ -197,15 +197,15 @@ static gboolean lrm_op_timeout(gpointer 
 
 static void lrm_op_done_callback(lrm_op_t* op);
 
-int ret_value = 0; 
+static int ret_value;
 int main(int argc, char **argv)
 {
        int option_char;
        char rscid_arg_tmp[RID_LEN];
         ll_lrm_t* lrmd;
        lrm_rsc_t * lrm_rsc;
-       GList   *raclass_list = 0, 
-               *ratype_list = 0,
+       GList   *raclass_list = NULL,
+               *ratype_list = NULL,
                *rscid_list;
        GHashTable *all_meta = NULL;
        char raclass[20];
diff -r a8aff3dff21b -r 684fe8e90e68 lrm/test/callbacktest.c
--- a/lrm/test/callbacktest.c   Fri May 22 01:08:13 2009 +0200
+++ b/lrm/test/callbacktest.c   Fri May 22 15:11:17 2009 +0200
@@ -29,16 +29,15 @@
 #include <syslog.h>
 #include <clplumbing/GSource.h>
 
-void lrm_op_done_callback (lrm_op_t* op);
-void printf_rsc(lrm_rsc_t* rsc);
-void printf_op(lrm_op_t* op);
-void printf_hash_table(GHashTable* hash_table);
-void get_all_rsc(ll_lrm_t* lrm);
-void get_cur_state(lrm_rsc_t* rsc);
-gboolean lrm_dispatch(IPC_Channel* notused, gpointer user_data);
-GMainLoop* mainloop            = NULL;
+static void lrm_op_done_callback(lrm_op_t *op);
+static void printf_rsc(lrm_rsc_t *rsc);
+static void printf_op(lrm_op_t *op);
+static void printf_hash_table(GHashTable *hash_table);
+static gboolean lrm_dispatch(IPC_Channel *notused, gpointer user_data);
+static GMainLoop *mainloop;
 
-int main (int argc, char* argv[])
+int
+main(int argc, char *argv[])
 {
        ll_lrm_t* lrm;
        lrm_rsc_t* rsc = NULL;
@@ -128,22 +127,27 @@ int main (int argc, char* argv[])
 
        puts("signoff...");
        lrm->lrm_ops->signoff(lrm);
-       
+
        return 0;
 }
-void lrm_op_done_callback(lrm_op_t* op)
+
+static void
+lrm_op_done_callback(lrm_op_t *op)
 {
        puts("lrm_op_done_callback...");
        printf_op(op);
 }
-gboolean lrm_dispatch(IPC_Channel* notused, gpointer user_data)
+
+static gboolean
+lrm_dispatch(IPC_Channel *notused, gpointer user_data)
 {
        ll_lrm_t *lrm = (ll_lrm_t*)user_data;
        lrm->lrm_ops->rcvmsg(lrm, FALSE);
        return TRUE;
 }
 
-void printf_rsc(lrm_rsc_t* rsc)
+static void
+printf_rsc(lrm_rsc_t *rsc)
 {
        printf("print resource\n");
        if (NULL == rsc) {
@@ -159,7 +163,8 @@ void printf_rsc(lrm_rsc_t* rsc)
        printf("print end\n");
 }
 
-void printf_op(lrm_op_t* op)
+static void
+printf_op(lrm_op_t *op)
 {
        printf("print op\n");
 
@@ -188,8 +193,9 @@ printf_pair(gpointer key, gpointer value
 {
        printf("\t\t%s=%s\n",(char*)key,(char*)value);
 }
-void
-printf_hash_table(GHashTable* hash_table)
+
+static void
+printf_hash_table(GHashTable *hash_table)
 {
        if (NULL == hash_table) {
                printf("\t\tnull\n");
@@ -197,39 +203,3 @@ printf_hash_table(GHashTable* hash_table
        }
        g_hash_table_foreach(hash_table, printf_pair, NULL);
 }
-void
-get_all_rsc(ll_lrm_t* lrm)
-{
-       GList* element = NULL, * rid_list = NULL;
-
-       puts("get_all_rscs...");
-       rid_list = lrm->lrm_ops->get_all_rscs(lrm);
-       if (NULL != rid_list) {
-               element = g_list_first(rid_list);
-               while (NULL != element) {
-                       printf("\tid:%s\n",(char*)element->data);
-                       element = g_list_next(element);
-               }
-       } else {
-               puts("\tnone.");
-       }
-}
-void
-get_cur_state(lrm_rsc_t* rsc)
-{
-       state_flag_t state;
-       GList* node = NULL, * op_list = NULL;
-       lrm_op_t* op = NULL;
-
-       op_list = rsc->ops->get_cur_state(rsc, &state);
-
-       printf("\tcurrent state:%s\n",state==LRM_RSC_IDLE?"Idel":"Busy");
-
-       
-       for(node = g_list_first(op_list); NULL != node;
-                node = g_list_next(node)) {
-               op = (lrm_op_t*)node->data;
-               printf_op(op);
-       }
-
-}
diff -r a8aff3dff21b -r 684fe8e90e68 membership/ccm/ccm_testclient.c
--- a/membership/ccm/ccm_testclient.c   Fri May 22 01:08:13 2009 +0200
+++ b/membership/ccm/ccm_testclient.c   Fri May 22 15:11:17 2009 +0200
@@ -30,7 +30,7 @@
 #include <clplumbing/cl_log.h>
 
 
-oc_ev_t *ev_token;
+static oc_ev_t *ev_token;
 
 extern void oc_ev_special(const oc_ev_t *, oc_ev_class_t , int );
 
diff -r a8aff3dff21b -r 684fe8e90e68 membership/ccm/ccmlib_clm.c
--- a/membership/ccm/ccmlib_clm.c       Fri May 22 01:08:13 2009 +0200
+++ b/membership/ccm/ccmlib_clm.c       Fri May 22 15:11:17 2009 +0200
@@ -70,14 +70,14 @@ static SaErrorT retrieve_node_buffer(SaC
 static SaErrorT retrieve_node_buffer(SaClmNodeIdT nodeId
 ,              SaClmClusterNodeT *clusterNode);
 
-static void pthread_lock()
+static void pthread_lock(void)
 {
 #ifdef POSIX_THREADS
        pthread_mutex_lock(&__clmlib_mutex);
 #endif
 }
 
-static void pthread_unlock()
+static void pthread_unlock(void)
 {
 #ifdef POSIX_THREADS
        pthread_mutex_unlock(&__clmlib_mutex);
@@ -85,7 +85,7 @@ static void pthread_unlock()
 }
 
 static void
-clm_init()
+clm_init(void)
 {
        static gboolean clminit_flag = FALSE;
 
diff -r a8aff3dff21b -r 684fe8e90e68 telecom/apphbd/apphbd.c
--- a/telecom/apphbd/apphbd.c   Fri May 22 01:08:13 2009 +0200
+++ b/telecom/apphbd/apphbd.c   Fri May 22 15:11:17 2009 +0200
@@ -112,7 +112,7 @@
 #endif
 /* End: Mirrored from ipcsocket.c */
 
-const char *   cmdname = "apphbd";
+static const char *cmdname = "apphbd";
 #define                DBGMIN          1
 #define                DBGDETAIL       2
 static int     usenormalpoll = TRUE;
@@ -155,12 +155,12 @@ struct apphb_client {
 };
 
 /* Probably ought to eventually make this configurable, but it's a start */
-uid_t  critical_uid_list [] = {0, HA_CCMUID};
+static uid_t critical_uid_list[] = {0, HA_CCMUID};
 
 #define        MAXNOTIFYPLUGIN 100
 
-AppHBNotifyOps*        NotificationPlugins[MAXNOTIFYPLUGIN];
-int            n_Notification_Plugins = 0;
+static AppHBNotifyOps *NotificationPlugins[MAXNOTIFYPLUGIN];
+static int n_Notification_Plugins;
 
 static void apphb_notify(apphb_client_t* client, apphb_event_t event);
 static void make_daemon(void);
@@ -200,7 +200,7 @@ static int set_notify_plugin(const char*
 static int set_notify_plugin(const char* option);
 static int set_debugfile(const char* option);
 static int set_logfile(const char* option);
-struct {
+static struct {
        int             debug_level;
        char            wdt_dev[MAXLINE];
        int             wdt_interval_ms;
@@ -209,10 +209,10 @@ struct {
        char            logfile[MAXLINE];
 } apphbd_config;
 
-struct directive{
+static struct directive {
        const char* name;
        int (*add_func)(const char*);
-} Directives[]=
+} Directives[] =
 {
        {"debug_level", set_debug_level}
 ,      {"watchdog_device", set_watchdog_device}
@@ -559,7 +559,7 @@ struct hbcmd {
 /*
  * Put HEARTBEAT message first - it is by far the most common message...
  */
-struct hbcmd   hbcmds[] =
+static struct hbcmd hbcmds[] =
 {
        {HEARTBEAT,     FALSE, apphb_client_hb},
        {REGISTER,      TRUE, apphb_client_register},
@@ -908,10 +908,10 @@ set_logfile(const char* option)
 /*
  *     Main program for monitoring application heartbeats...
  */
-GMainLoop*     mainloop = NULL;
+static GMainLoop *mainloop;
 
 
-void
+static void
 usage(const char* cmd, int exit_status)
 {
        FILE* stream;
@@ -1027,7 +1027,7 @@ cpu_limit_timer(gpointer unused)
 
 
 static int
-init_start()
+init_start(void)
 {
        char            path[] = IPC_PATH_ATTR;
        char            commpath[] = APPHBSOCKPATH;
@@ -1281,7 +1281,7 @@ static GHashTable*        Notifications = NULL;
 static GHashTable*     Notifications = NULL;
 
 
-AppHBNotifyImports     piimports = {
+static AppHBNotifyImports piimports = {
        authenticate_client
 };
 
diff -r a8aff3dff21b -r 684fe8e90e68 telecom/apphbd/apphbtest.c
--- a/telecom/apphbd/apphbtest.c        Fri May 22 01:08:13 2009 +0200
+++ b/telecom/apphbd/apphbtest.c        Fri May 22 15:11:17 2009 +0200
@@ -37,7 +37,7 @@
 #include <clplumbing/cl_log.h>
 #include <apphb.h>
 
-int debug = 0;
+static int debug;
 
 void doafailtest(void);
 
@@ -373,7 +373,7 @@ apphb_setwarn_test(int warnhb_ms, int hb
        errno = 0;
 }
 
-void dup_reg_test()
+void dup_reg_test(void)
 {
        /* apphbd should not allow a process register two times */
        int     rc;
diff -r a8aff3dff21b -r 684fe8e90e68 tools/cl_status.c
--- a/tools/cl_status.c Fri May 22 01:08:13 2009 +0200
+++ b/tools/cl_status.c Fri May 22 15:11:17 2009 +0200
@@ -42,11 +42,12 @@
 
 
 /* exit code */
-const int OK = 0,
-         NORMAL_FAIL = 1,              /* such as the local node is down */
-         PARAMETER_ERROR = 11,
-         TIMEOUT = 12,
-         UNKNOWN_ERROR = 13;           /* error due to unkown causes */ 
+static const int
+       OK = 0,
+       NORMAL_FAIL = 1,                /* such as the local node is down */
+       PARAMETER_ERROR = 11,
+       TIMEOUT = 12,
+       UNKNOWN_ERROR = 13;             /* error due to unkown causes */
 /*
  * The exit values under some situations proposed by Alan.
  * nodestatus    fail when the node is down
@@ -238,7 +239,7 @@ static const char * cl_status_name = "cl
  * The following is to avoid cl_status sleeping forever. This is due to the 
  * hearbeat's abnormal status or even its crash.  
  */
-unsigned int DEFAULT_TIMEOUT = 5;
+static const unsigned int DEFAULT_TIMEOUT = 5;
 /* the handler of signal SIGALRM */
 static void quit(int signum);
 
diff -r a8aff3dff21b -r 684fe8e90e68 tools/send_arp.linux.c
--- a/tools/send_arp.linux.c    Fri May 22 01:08:13 2009 +0200
+++ b/tools/send_arp.linux.c    Fri May 22 15:11:17 2009 +0200
@@ -34,38 +34,38 @@
 
 static void usage(void) __attribute__((noreturn));
 
-int quit_on_reply=0;
-char *device = NULL;
-int ifindex;
-char *source;
-struct in_addr src, dst;
-char *target;
-int dad, unsolicited, advert;
-int quiet;
-int count=-1;
-int timeout;
-int unicasting;
-int s;
-int broadcast_only;
+static int quit_on_reply;
+static char *device;
+static int ifindex;
+static char *source;
+static struct in_addr src, dst;
+static char *target;
+static int dad, unsolicited, advert;
+static int quiet;
+static int count = -1;
+static int timeout;
+static int unicasting;
+static int s;
+static int broadcast_only;
 
-struct sockaddr_ll me;
-struct sockaddr_ll he;
+static struct sockaddr_ll me;
+static struct sockaddr_ll he;
 
-struct timeval start, last;
+static struct timeval start, last;
 
-int sent, brd_sent;
-int received, brd_recv, req_recv;
+static int sent, brd_sent;
+static int received, brd_recv, req_recv;
 
 #define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
                           ((tv1).tv_usec-(tv2).tv_usec)/1000 )
 
-void print_hex(unsigned char *p, int len);
-int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM);
-void set_signal(int signo, void (*handler)(void));
-int send_pack(int s, struct in_addr src, struct in_addr dst,
+static void print_hex(unsigned char *p, int len);
+static int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM);
+static void set_signal(int signo, void (*handler)(void));
+static int send_pack(int s, struct in_addr src, struct in_addr dst,
              struct sockaddr_ll *ME, struct sockaddr_ll *HE);
-void finish(void);
-void catcher(void);
+static void finish(void);
+static void catcher(void);
 
 void usage(void)
 {
diff -r a8aff3dff21b -r 684fe8e90e68 tools/sfex_daemon.c
--- a/tools/sfex_daemon.c       Fri May 22 01:08:13 2009 +0200
+++ b/tools/sfex_daemon.c       Fri May 22 15:11:17 2009 +0200
@@ -14,22 +14,22 @@
 #include "sfex.h"
 #include "sfex_lib.h"
 
-int sysrq_fd;
-int lock_index = 1;        /* default 1st lock */
-time_t collision_timeout = 1; /* default 1 sec */
-time_t lock_timeout = 60; /* default 60 sec */
+static int sysrq_fd;
+static int lock_index = 1;        /* default 1st lock */
+static time_t collision_timeout = 1; /* default 1 sec */
+static time_t lock_timeout = 60; /* default 60 sec */
 time_t unlock_timeout = 60;
-time_t monitor_interval = 10;
+static time_t monitor_interval = 10;
 
-sfex_controldata cdata;
-sfex_lockdata ldata;
-sfex_lockdata ldata_new;
+static sfex_controldata cdata;
+static sfex_lockdata ldata;
+static sfex_lockdata ldata_new;
 
-const char *device;
+static const char *device;
 const char *progname;
 char *nodename;
-const char *rsc_id = "sfex";
-const char *rscpidfile = NULL;
+static const char *rsc_id = "sfex";
+static const char *rscpidfile;
 
 static void usage(FILE *dist) {
          fprintf(dist, "usage: %s [-i <index>] [-c <collision_timeout>] [-t 
<lock_timeout>] <device>\n", progname);
diff -r a8aff3dff21b -r 684fe8e90e68 tools/sfex_lib.c
--- a/tools/sfex_lib.c  Fri May 22 01:08:13 2009 +0200
+++ b/tools/sfex_lib.c  Fri May 22 15:11:17 2009 +0200
@@ -45,8 +45,8 @@
 #include "sfex.h"
 #include "sfex_lib.h"
 
-void *locked_mem = NULL;
-int dev_fd = 0;
+static void *locked_mem;
+static int dev_fd;
 unsigned long sector_size = 0;
 
 int
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to