diff --git a/src/libnodeupdown/nodeupdown.c b/src/libnodeupdown/nodeupdown.c index a7ffb89..dc25208 100644 --- a/src/libnodeupdown/nodeupdown.c +++ b/src/libnodeupdown/nodeupdown.c @@ -415,72 +415,72 @@ nodeupdown_load_data(nodeupdown_t handle, if (port <= 0) { if (conffile_config.port_flag) - { - if (conffile_config.port <= 0) - { - handle->errnum = NODEUPDOWN_ERR_CONF_INPUT; - goto cleanup; - } - port = conffile_config.port; - } + { + if (conffile_config.port <= 0) + { + handle->errnum = NODEUPDOWN_ERR_CONF_INPUT; + goto cleanup; + } + port = conffile_config.port; + } else if (module_config.port_flag) - { - if (module_config.port <= 0) - { - handle->errnum = NODEUPDOWN_ERR_CONFIG_MODULE; - goto cleanup; - } - port = module_config.port; - } + { + if (module_config.port <= 0) + { + handle->errnum = NODEUPDOWN_ERR_CONFIG_MODULE; + goto cleanup; + } + port = module_config.port; + } else - { - if (backend_module_default_port(handle) <= 0) - { - handle->errnum = NODEUPDOWN_ERR_BACKEND_MODULE; - goto cleanup; - } - port = backend_module_default_port(handle); - } + { + if (backend_module_default_port(handle) <= 0) + { + handle->errnum = NODEUPDOWN_ERR_BACKEND_MODULE; + goto cleanup; + } + port = backend_module_default_port(handle); + } } if (timeout_len <= 0) { if (conffile_config.timeout_len_flag) - { - if (conffile_config.timeout_len <= 0) - { - handle->errnum = NODEUPDOWN_ERR_CONF_INPUT; - goto cleanup; - } - timeout_len = conffile_config.timeout_len; - } + { + if (conffile_config.timeout_len <= 0) + { + handle->errnum = NODEUPDOWN_ERR_CONF_INPUT; + goto cleanup; + } + timeout_len = conffile_config.timeout_len; + } else if (module_config.timeout_len_flag) - { - if (module_config.timeout_len <= 0) - { - handle->errnum = NODEUPDOWN_ERR_CONFIG_MODULE; - goto cleanup; - } - timeout_len = module_config.timeout_len; - } + { + if (module_config.timeout_len <= 0) + { + handle->errnum = NODEUPDOWN_ERR_CONFIG_MODULE; + goto cleanup; + } + timeout_len = module_config.timeout_len; + } else - { - if (backend_module_default_timeout_len(handle) < 0) - { - handle->errnum = NODEUPDOWN_ERR_BACKEND_MODULE; - goto cleanup; - } - timeout_len = backend_module_default_timeout_len(handle); - } + { + if (backend_module_default_timeout_len(handle) < 0) + { + handle->errnum = NODEUPDOWN_ERR_BACKEND_MODULE; + goto cleanup; + } + timeout_len = backend_module_default_timeout_len(handle); + } } if (hostname) { if (backend_module_get_updown_data(handle, - hostname, - port, - timeout_len, - module) < 0) + hostname, + port, + timeout_len, + module) < 0) goto cleanup; } else if (conffile_config.hostnames_flag || module_config.hostnames_flag) @@ -489,25 +489,25 @@ nodeupdown_load_data(nodeupdown_t handle, int i, hostnames_len; if (conffile_config.hostnames_flag) - { - hostnames = conffile_config.hostnames; - hostnames_len = conffile_config.hostnames_len; - } + { + hostnames = conffile_config.hostnames; + hostnames_len = conffile_config.hostnames_len; + } else - { - hostnames = module_config.hostnames; - hostnames_len = module_config.hostnames_len; - } + { + hostnames = module_config.hostnames; + hostnames_len = module_config.hostnames_len; + } for (i = 0; i < hostnames_len; i++) { if (strlen(hostnames[i]) > 0) { if (backend_module_get_updown_data(handle, - hostnames[i], - port, - timeout_len, - module) < 0) + hostnames[i], + port, + timeout_len, + module) < 0) continue; else break; @@ -528,10 +528,10 @@ nodeupdown_load_data(nodeupdown_t handle, goto cleanup; if (backend_module_get_updown_data(handle, - hostnamePtr, - port, - timeout_len, - module) < 0) + hostnamePtr, + port, + timeout_len, + module) < 0) goto cleanup; } @@ -745,19 +745,19 @@ _is_node(nodeupdown_t handle, const char *node, int up_or_down) if (clusterlist_module_found) { if ((rv = clusterlist_module_is_node_in_cluster(handle, node)) < 0) - return -1; + return -1; if (!rv) - { - handle->errnum = NODEUPDOWN_ERR_NOTFOUND; - return -1; - } + { + handle->errnum = NODEUPDOWN_ERR_NOTFOUND; + return -1; + } if (clusterlist_module_get_nodename(handle, - node, - buffer, - NODEUPDOWN_MAXNODENAMELEN+1) < 0) - return -1; + node, + buffer, + NODEUPDOWN_MAXNODENAMELEN+1) < 0) + return -1; nodePtr = buffer; } @@ -767,11 +767,11 @@ _is_node(nodeupdown_t handle, const char *node, int up_or_down) * loaded. */ if (hostlist_find(handle->up_nodes, node) < 0 - && hostlist_find(handle->down_nodes, node) < 0) - { - handle->errnum = NODEUPDOWN_ERR_NOTFOUND; - return -1; - } + && hostlist_find(handle->down_nodes, node) < 0) + { + handle->errnum = NODEUPDOWN_ERR_NOTFOUND; + return -1; + } nodePtr = (char *)node; } diff --git a/src/libnodeupdown/nodeupdown/nodeupdown_backend_module.h b/src/libnodeupdown/nodeupdown/nodeupdown_backend_module.h index a9a25bf..10ef718 100644 --- a/src/libnodeupdown/nodeupdown/nodeupdown_backend_module.h +++ b/src/libnodeupdown/nodeupdown/nodeupdown_backend_module.h @@ -83,10 +83,10 @@ typedef int (*Nodeupdown_backend_cleanup)(nodeupdown_t); * Returns 0 on success, -1 on error */ typedef int (*Nodeupdown_backend_get_updown_data)(nodeupdown_t, - const char *, - unsigned int, - unsigned int, - char *); + const char *, + unsigned int, + unsigned int, + char *); /* * struct nodeupdown_backend_module_info diff --git a/src/libnodeupdown/nodeupdown/nodeupdown_clusterlist_module.h b/src/libnodeupdown/nodeupdown/nodeupdown_clusterlist_module.h index 4631baa..c766abb 100644 --- a/src/libnodeupdown/nodeupdown/nodeupdown_clusterlist_module.h +++ b/src/libnodeupdown/nodeupdown/nodeupdown_clusterlist_module.h @@ -65,7 +65,7 @@ typedef int (*Nodeupdown_clusterlist_get_numnodes)(nodeupdown_t); * Returns 1 is node is in the cluster, 0 if not, -1 on error */ typedef int (*Nodeupdown_clusterlist_is_node_in_cluster)(nodeupdown_t, - const char *); + const char *); /* * Nodeupdown_clusterlist_get_nodename @@ -78,9 +78,9 @@ typedef int (*Nodeupdown_clusterlist_is_node_in_cluster)(nodeupdown_t, * Returns nodename in buffer, 0 on success, -1 on error */ typedef int (*Nodeupdown_clusterlist_get_nodename)(nodeupdown_t, - const char *, - char *, - unsigned int); + const char *, + char *, + unsigned int); /* * Nodeupdown_clusterlist_compare_to_clusterlist diff --git a/src/libnodeupdown/nodeupdown/nodeupdown_config_module.h b/src/libnodeupdown/nodeupdown/nodeupdown_config_module.h index 1393487..6c511da 100644 --- a/src/libnodeupdown/nodeupdown/nodeupdown_config_module.h +++ b/src/libnodeupdown/nodeupdown/nodeupdown_config_module.h @@ -56,7 +56,7 @@ typedef int (*Nodeupdown_config_cleanup)(nodeupdown_t); * Returns 0 on success, -1 on error */ typedef int (*Nodeupdown_config_load_config)(nodeupdown_t, - struct nodeupdown_config *); + struct nodeupdown_config *); /* * struct nodeupdown_config_module_info diff --git a/src/libnodeupdown/nodeupdown_backend_cerebro.c b/src/libnodeupdown/nodeupdown_backend_cerebro.c index f064cb5..beaca71 100644 --- a/src/libnodeupdown/nodeupdown_backend_cerebro.c +++ b/src/libnodeupdown/nodeupdown_backend_cerebro.c @@ -148,7 +148,7 @@ cerebro_backend_cleanup(nodeupdown_t handle) { #ifndef NDEBUG fprintf(stderr, "cerebro_handle_destroy: %s\n", - cerebro_strerror(cerebro_errnum(cerebro_handle))); + cerebro_strerror(cerebro_errnum(cerebro_handle))); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); return -1; @@ -177,7 +177,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, { #ifndef NDEBUG fprintf(stderr, "cerebro_set_hostname: %s\n", - cerebro_strerror(cerebro_errnum(cerebro_handle))); + cerebro_strerror(cerebro_errnum(cerebro_handle))); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); return -1; @@ -187,7 +187,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, { #ifndef NDEBUG fprintf(stderr, "cerebro_set_port: %s\n", - cerebro_strerror(cerebro_errnum(cerebro_handle))); + cerebro_strerror(cerebro_errnum(cerebro_handle))); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); return -1; @@ -197,7 +197,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, { #ifndef NDEBUG fprintf(stderr, "cerebro_set_timeout_len: %s\n", - cerebro_strerror(cerebro_errnum(cerebro_handle))); + cerebro_strerror(cerebro_errnum(cerebro_handle))); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); return -1; @@ -208,7 +208,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, { #ifndef NDEBUG fprintf(stderr, "cerebro_get_metric_data: %s\n", - cerebro_strerror(cerebro_errnum(cerebro_handle))); + cerebro_strerror(cerebro_errnum(cerebro_handle))); #endif /* NDEBUG */ if (cerebro_errnum(cerebro_handle) == CEREBRO_ERR_CONNECT) nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_CONNECT); @@ -225,7 +225,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, { #ifndef NDEBUG fprintf(stderr, "cerebro_nodelist_iterator_create: %s\n", - cerebro_strerror(cerebro_errnum(cerebro_handle))); + cerebro_strerror(cerebro_errnum(cerebro_handle))); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); goto cleanup; @@ -241,8 +241,8 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, if (cerebro_nodelist_iterator_nodename(itr, &nodename) < 0) { #ifndef NDEBUG - fprintf(stderr, "cerebro_nodelist_iterator_nodename: %s\n", - cerebro_strerror(cerebro_errnum(cerebro_handle))); + fprintf(stderr, "cerebro_nodelist_iterator_nodename: %s\n", + cerebro_strerror(cerebro_errnum(cerebro_handle))); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); goto cleanup; @@ -251,7 +251,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, if (!nodename) { #ifndef NDEBUG - fprintf(stderr, "cerebro_nodelist_iterator_create: null nodename\n"); + fprintf(stderr, "cerebro_nodelist_iterator_create: null nodename\n"); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); goto cleanup; @@ -264,8 +264,8 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, &mvalue) < 0) { #ifndef NDEBUG - fprintf(stderr, "cerebro_nodelist_iterator_metric_value: %s\n", - cerebro_strerror(cerebro_errnum(cerebro_handle))); + fprintf(stderr, "cerebro_nodelist_iterator_metric_value: %s\n", + cerebro_strerror(cerebro_errnum(cerebro_handle))); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); goto cleanup; @@ -278,7 +278,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, #endif /* !CEREBRO_METRIC_VALUE_TYPE_U_INT32 */ { #ifndef NDEBUG - fprintf(stderr, "cerebro_nodelist_iterator_metric_value: invalid mtype: %u\n", mtype); + fprintf(stderr, "cerebro_nodelist_iterator_metric_value: invalid mtype: %u\n", mtype); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); goto cleanup; @@ -287,7 +287,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, if (mlen != sizeof(u_int32_t)) { #ifndef NDEBUG - fprintf(stderr, "cerebro_nodelist_iterator_metric_value: invalid mlen: %u\n", mlen); + fprintf(stderr, "cerebro_nodelist_iterator_metric_value: invalid mlen: %u\n", mlen); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); goto cleanup; @@ -312,8 +312,8 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, if (cerebro_nodelist_iterator_next(itr) < 0) { #ifndef NDEBUG - fprintf(stderr, "cerebro_nodelist_iterator_next: %s\n", - cerebro_strerror(cerebro_errnum(cerebro_handle))); + fprintf(stderr, "cerebro_nodelist_iterator_next: %s\n", + cerebro_strerror(cerebro_errnum(cerebro_handle))); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); goto cleanup; @@ -324,7 +324,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle, { #ifndef NDEBUG fprintf(stderr, "cerebro_nodelist_iterator_at_end: %s\n", - cerebro_strerror(cerebro_errnum(cerebro_handle))); + cerebro_strerror(cerebro_errnum(cerebro_handle))); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE); goto cleanup; diff --git a/src/libnodeupdown/nodeupdown_backend_connect_util.c b/src/libnodeupdown/nodeupdown_backend_connect_util.c index f743f90..95e3d04 100644 --- a/src/libnodeupdown/nodeupdown_backend_connect_util.c +++ b/src/libnodeupdown/nodeupdown_backend_connect_util.c @@ -127,7 +127,7 @@ _low_timeout_connect(nodeupdown_t handle, if ((rv = select(fd+1, &rset, &wset, NULL, &tval)) < 0) { #ifndef NDEBUG - fprintf(stderr, "select: %s\n", strerror(errno)); + fprintf(stderr, "select: %s\n", strerror(errno)); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_INTERNAL); goto cleanup; @@ -150,7 +150,7 @@ _low_timeout_connect(nodeupdown_t handle, if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { #ifndef NDEBUG - fprintf(stderr, "getsockopt: %s\n", strerror(errno)); + fprintf(stderr, "getsockopt: %s\n", strerror(errno)); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_INTERNAL); goto cleanup; @@ -171,7 +171,7 @@ _low_timeout_connect(nodeupdown_t handle, else { #ifndef NDEBUG - fprintf(stderr, "select: invalid state\n"); + fprintf(stderr, "select: invalid state\n"); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_INTERNAL); goto cleanup; diff --git a/src/libnodeupdown/nodeupdown_backend_ganglia.c b/src/libnodeupdown/nodeupdown_backend_ganglia.c index f502eb7..bd69a0f 100644 --- a/src/libnodeupdown/nodeupdown_backend_ganglia.c +++ b/src/libnodeupdown/nodeupdown_backend_ganglia.c @@ -59,7 +59,7 @@ #include #else /* !HAVE_LIBEXPAT */ #include "xmlparse.h" -#endif /* !HAVE_LIBEXPAT */ +#endif /* !HAVE_LIBEXPAT */ /* Used to pass multiple variables as one during XML parsing */ struct parse_vars @@ -181,12 +181,12 @@ _xml_parse_start(void *data, const char *e1, const char **attr) /* store as up or down */ reported = atol(attr[5]); /* With ganglia 3.2.0, attr[4] is actually TAGS, and we want the - next pair. */ + next pair. */ if (!reported) reported = atol(attr[7]); if (abs(localtime - reported) < timeout_len) - nodeupdown_add_up_node(handle, attr[1]); + nodeupdown_add_up_node(handle, attr[1]); else - nodeupdown_add_down_node(handle, attr[1]); + nodeupdown_add_down_node(handle, attr[1]); } } @@ -255,27 +255,27 @@ ganglia_backend_get_updown_data(nodeupdown_t handle, if (!(buff = XML_GetBuffer(xml_parser, BUFSIZ))) { #ifndef NDEBUG - fprintf(stderr, "XML_GetBuffer: %s\n", strerror(errno)); + fprintf(stderr, "XML_GetBuffer: %s\n", strerror(errno)); #endif /* NDEBUG */ - nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_INTERNAL); + nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_INTERNAL); goto cleanup; } if ((bytes_read = read(fd, buff, BUFSIZ)) < 0) { #ifndef NDEBUG - fprintf(stderr, "read: %s\n", strerror(errno)); + fprintf(stderr, "read: %s\n", strerror(errno)); #endif /* NDEBUG */ - nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_INTERNAL); + nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_INTERNAL); goto cleanup; } if (!XML_ParseBuffer(xml_parser, bytes_read, bytes_read == 0)) { #ifndef NDEBUG - fprintf(stderr, "XML_ParseBuffer: %s\n", strerror(errno)); + fprintf(stderr, "XML_ParseBuffer: %s\n", strerror(errno)); #endif /* NDEBUG */ - nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_INTERNAL); + nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_INTERNAL); goto cleanup; } diff --git a/src/libnodeupdown/nodeupdown_backend_pingd.c b/src/libnodeupdown/nodeupdown_backend_pingd.c index 8ee67fd..8f909b6 100644 --- a/src/libnodeupdown/nodeupdown_backend_pingd.c +++ b/src/libnodeupdown/nodeupdown_backend_pingd.c @@ -183,7 +183,7 @@ pingd_backend_get_updown_data(nodeupdown_t handle, if ((len = fd_read_line(fd, buf, PINGD_BACKEND_BUFLEN)) < 0) { #ifndef NDEBUG - fprintf(stderr, "fd_read_line: %s\n", strerror(errno)); + fprintf(stderr, "fd_read_line: %s\n", strerror(errno)); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_INTERNAL); goto cleanup; @@ -196,7 +196,7 @@ pingd_backend_get_updown_data(nodeupdown_t handle, if (num != 2) { #ifndef NDEBUG - fprintf(stderr, "sscanf: parse error\n"); + fprintf(stderr, "sscanf: parse error\n"); #endif /* NDEBUG */ nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_INTERNAL); goto cleanup; diff --git a/src/libnodeupdown/nodeupdown_clusterlist_default.c b/src/libnodeupdown/nodeupdown_clusterlist_default.c index 75dfde5..32ddedd 100644 --- a/src/libnodeupdown/nodeupdown_clusterlist_default.c +++ b/src/libnodeupdown/nodeupdown_clusterlist_default.c @@ -98,9 +98,9 @@ default_clusterlist_is_node_in_cluster(nodeupdown_t handle, const char *node) */ int default_clusterlist_get_nodename(nodeupdown_t handle, - const char *node, - char *buf, - unsigned int buflen) + const char *node, + char *buf, + unsigned int buflen) { int len; diff --git a/src/libnodeupdown/nodeupdown_clusterlist_genders.c b/src/libnodeupdown/nodeupdown_clusterlist_genders.c index 2164106..8af32af 100644 --- a/src/libnodeupdown/nodeupdown_clusterlist_genders.c +++ b/src/libnodeupdown/nodeupdown_clusterlist_genders.c @@ -128,9 +128,9 @@ genders_clusterlist_is_node_in_cluster(nodeupdown_t handle, const char *node) */ static int genders_clusterlist_get_nodename(nodeupdown_t handle, - const char *node, - char *buf, - unsigned int buflen) + const char *node, + char *buf, + unsigned int buflen) { char nodebuf[NODEUPDOWN_MAXNODENAMELEN+1]; char *nodePtr = NULL; diff --git a/src/libnodeupdown/nodeupdown_clusterlist_genders_util.c b/src/libnodeupdown/nodeupdown_clusterlist_genders_util.c index 96bbf77..59595f6 100644 --- a/src/libnodeupdown/nodeupdown_clusterlist_genders_util.c +++ b/src/libnodeupdown/nodeupdown_clusterlist_genders_util.c @@ -88,7 +88,7 @@ genders_util_clusterlist_compare_to_clusterlist(nodeupdown_t handle, for (i = 0; i < num; i++) { if (nodeupdown_not_discovered_check(handle, nlist[i]) < 0) - goto cleanup; + goto cleanup; } if (genders_nodelist_destroy(genders_handle, nlist) < 0) diff --git a/src/libnodeupdown/nodeupdown_clusterlist_genders_util.h b/src/libnodeupdown/nodeupdown_clusterlist_genders_util.h index 7b738d8..b59530f 100644 --- a/src/libnodeupdown/nodeupdown_clusterlist_genders_util.h +++ b/src/libnodeupdown/nodeupdown_clusterlist_genders_util.h @@ -35,7 +35,7 @@ * common genders clusterlist get_numnodes function */ int genders_util_clusterlist_get_numnodes(nodeupdown_t handle, - genders_t genders_handle); + genders_t genders_handle); /* * genders_util_clusterlist_compare_to_clusterlist diff --git a/src/libnodeupdown/nodeupdown_clusterlist_hostsfile.c b/src/libnodeupdown/nodeupdown_clusterlist_hostsfile.c index 5156cbe..9ae82bd 100644 --- a/src/libnodeupdown/nodeupdown_clusterlist_hostsfile.c +++ b/src/libnodeupdown/nodeupdown_clusterlist_hostsfile.c @@ -240,18 +240,18 @@ hostsfile_clusterlist_setup(nodeupdown_t handle) if (strchr(hostPtr, ' ') || strchr(hostPtr, '\t')) { #ifndef NDEBUG - fprintf(stderr, "parse error\n"); + fprintf(stderr, "parse error\n"); #endif /* NDEBUG */ - nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_CLUSTERLIST_MODULE); + nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_CLUSTERLIST_MODULE); goto cleanup; } if (strlen(hostPtr) > NODEUPDOWN_MAXHOSTNAMELEN) { #ifndef NDEBUG - fprintf(stderr, "parse error\n"); + fprintf(stderr, "parse error\n"); #endif /* NDEBUG */ - nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_CLUSTERLIST_MODULE); + nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_CLUSTERLIST_MODULE); goto cleanup; } @@ -261,16 +261,16 @@ hostsfile_clusterlist_setup(nodeupdown_t handle) if (!(str = strdup(hostPtr))) { - nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_OUTMEM); + nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_OUTMEM); goto cleanup; } if (!list_append(hosts, str)) { #ifndef NDEBUG - fprintf(stderr, "list_append: %s\n", strerror(errno)); + fprintf(stderr, "list_append: %s\n", strerror(errno)); #endif /* NDEBUG */ - nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_CLUSTERLIST_MODULE); + nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_CLUSTERLIST_MODULE); goto cleanup; } } @@ -410,7 +410,7 @@ hostsfile_clusterlist_compare_to_clusterlist(nodeupdown_t handle) while ((nodename = list_next(itr))) { if (nodeupdown_not_discovered_check(handle, nodename) < 0) - goto cleanup; + goto cleanup; } list_iterator_destroy(itr); diff --git a/src/libnodeupdown/nodeupdown_config_default.c b/src/libnodeupdown/nodeupdown_config_default.c index 7e3e952..d6aa202 100644 --- a/src/libnodeupdown/nodeupdown_config_default.c +++ b/src/libnodeupdown/nodeupdown_config_default.c @@ -67,7 +67,7 @@ default_config_cleanup(nodeupdown_t handle) */ int default_config_load_default(nodeupdown_t handle, - struct nodeupdown_config *conf) + struct nodeupdown_config *conf) { return 0; } diff --git a/src/libnodeupdown/nodeupdown_module.c b/src/libnodeupdown/nodeupdown_module.c index 68befe7..0bf8ca5 100644 --- a/src/libnodeupdown/nodeupdown_module.c +++ b/src/libnodeupdown/nodeupdown_module.c @@ -503,10 +503,10 @@ backend_module_cleanup(nodeupdown_t handle) int backend_module_get_updown_data(nodeupdown_t handle, - const char *hostname, - unsigned int port, - unsigned int timeout_len, - char *reserved) + const char *hostname, + unsigned int port, + unsigned int timeout_len, + char *reserved) { if (!backend_module_info) { @@ -699,9 +699,9 @@ clusterlist_module_is_node_in_cluster(nodeupdown_t handle, const char *node) int clusterlist_module_get_nodename(nodeupdown_t handle, - const char *node, - char *buffer, - unsigned int buflen) + const char *node, + char *buffer, + unsigned int buflen) { if (!clusterlist_module_info) { diff --git a/src/libnodeupdown/nodeupdown_module.h b/src/libnodeupdown/nodeupdown_module.h index a77bbad..74ed0b8 100644 --- a/src/libnodeupdown/nodeupdown_module.h +++ b/src/libnodeupdown/nodeupdown_module.h @@ -168,9 +168,9 @@ int clusterlist_module_is_node_in_cluster(nodeupdown_t handle, const char *node) * call clusterlist module get_nodename function */ int clusterlist_module_get_nodename(nodeupdown_t handle, - const char *node, - char *buffer, - unsigned int buflen); + const char *node, + char *buffer, + unsigned int buflen); /* * clusterlist_module_compare_to_clusterlist @@ -225,6 +225,6 @@ int config_module_cleanup(nodeupdown_t handle); * call config module load_config function */ int config_module_load_config(nodeupdown_t handle, - struct nodeupdown_config *conf); + struct nodeupdown_config *conf); #endif /* _NODEUPDOWN_MODULE_H */ diff --git a/src/whatsup/whatsup.c b/src/whatsup/whatsup.c index 189c230..3094107 100644 --- a/src/whatsup/whatsup.c +++ b/src/whatsup/whatsup.c @@ -284,7 +284,7 @@ _load_options_modules_in_dir(char *search_dir) memset(filebuf, '\0', WHATSUP_MAXPATHLEN+1); snprintf(filebuf, WHATSUP_MAXPATHLEN, "%s/%s", search_dir, filename); - _load_options_module(filebuf); + _load_options_module(filebuf); } } @@ -354,19 +354,19 @@ static void _usage(void) { fprintf(stderr, - "Usage: whatsup [OPTIONS]... [NODES]...\n" - " -h --help Print help and exit\n" - " -v --version Print version and exit\n" - " -o STRING --hostname=STRING Server hostname\n" - " -p INT --port=INT Server port\n" - " -b --updown Output up and down nodes\n" - " -u --up Output only up nodes\n" - " -d --down Output only down nodes\n" - " -t --count Output only node counts\n" - " -q --hostrange Output in hostrange format\n" - " -c --comma Output in comma separated list\n" - " -n --newline Output in newline separated list\n" - " -s --space Output in space separated list\n" + "Usage: whatsup [OPTIONS]... [NODES]...\n" + " -h --help Print help and exit\n" + " -v --version Print version and exit\n" + " -o STRING --hostname=STRING Server hostname\n" + " -p INT --port=INT Server port\n" + " -b --updown Output up and down nodes\n" + " -u --up Output only up nodes\n" + " -d --down Output only down nodes\n" + " -t --count Output only node counts\n" + " -q --hostrange Output in hostrange format\n" + " -c --comma Output in comma separated list\n" + " -n --newline Output in newline separated list\n" + " -s --space Output in space separated list\n" " -m --module Specify backend module\n" " -r --last-up-time Output last known up time of nodes\n" " -l --log Output up/down state log\n" @@ -1178,25 +1178,25 @@ _log_mode(void) while (1) { if (!(handle = nodeupdown_handle_create())) - err_exit("%s: nodeupdown_handle_create()", __FUNCTION__); + err_exit("%s: nodeupdown_handle_create()", __FUNCTION__); if (nodeupdown_load_data(handle, hostname, port, 0, module) < 0) - { - int errnum = nodeupdown_errnum(handle); - char *msg = nodeupdown_errormsg(handle); - - /* Check for "legit" errors and output appropriate message */ - if (errnum == NODEUPDOWN_ERR_CONF_PARSE) - err_exit("Parse error in conf file"); - else if (errnum == NODEUPDOWN_ERR_CONNECT) - err_exit("Cannot connect to server"); - else if (errnum == NODEUPDOWN_ERR_CONNECT_TIMEOUT) - err_exit("Timeout connecting to server"); - else if (errnum == NODEUPDOWN_ERR_HOSTNAME) - err_exit("Invalid hostname"); - else - err_exit("%s: nodeupdown_load_data(): %s", __FUNCTION__, msg); - } + { + int errnum = nodeupdown_errnum(handle); + char *msg = nodeupdown_errormsg(handle); + + /* Check for "legit" errors and output appropriate message */ + if (errnum == NODEUPDOWN_ERR_CONF_PARSE) + err_exit("Parse error in conf file"); + else if (errnum == NODEUPDOWN_ERR_CONNECT) + err_exit("Cannot connect to server"); + else if (errnum == NODEUPDOWN_ERR_CONNECT_TIMEOUT) + err_exit("Timeout connecting to server"); + else if (errnum == NODEUPDOWN_ERR_HOSTNAME) + err_exit("Invalid hostname"); + else + err_exit("%s: nodeupdown_load_data(): %s", __FUNCTION__, msg); + } memset(upnodesbuf, '\0', WHATSUP_BUFFERLEN); memset(downnodesbuf, '\0', WHATSUP_BUFFERLEN); @@ -1209,36 +1209,36 @@ _log_mode(void) /* Don't output the first time through */ if (nodes_init) - { - hostlist_t newupnodes, newdownnodes; - hostlist_iterator_t upitr, downitr; - char *node; - - if (!(newupnodes = hostlist_create(upnodesbuf))) - err_exit("%s: hostlist_create()", __FUNCTION__); - - if (!(newdownnodes = hostlist_create(downnodesbuf))) - err_exit("%s: hostlist_create()", __FUNCTION__); - - if (!(upitr = hostlist_iterator_create(newupnodes))) - err_exit("%s: hostlist_iterator_create()", __FUNCTION__); - - if (!(downitr = hostlist_iterator_create(newdownnodes))) - err_exit("%s: hostlist_iterator_create()", __FUNCTION__); - - while ((node = hostlist_next(upitr))) - { - if (hostlist_find(upnodes, node) < 0) - { - time_t t; - struct tm *tt; - char timebuf[WHATSUP_BUFFERLEN]; + { + hostlist_t newupnodes, newdownnodes; + hostlist_iterator_t upitr, downitr; + char *node; + + if (!(newupnodes = hostlist_create(upnodesbuf))) + err_exit("%s: hostlist_create()", __FUNCTION__); + + if (!(newdownnodes = hostlist_create(downnodesbuf))) + err_exit("%s: hostlist_create()", __FUNCTION__); + + if (!(upitr = hostlist_iterator_create(newupnodes))) + err_exit("%s: hostlist_iterator_create()", __FUNCTION__); + + if (!(downitr = hostlist_iterator_create(newdownnodes))) + err_exit("%s: hostlist_iterator_create()", __FUNCTION__); + + while ((node = hostlist_next(upitr))) + { + if (hostlist_find(upnodes, node) < 0) + { + time_t t; + struct tm *tt; + char timebuf[WHATSUP_BUFFERLEN]; char writebuf[WHATSUP_BUFFERLEN]; int write_len; - t = time(NULL); - tt = localtime(&t); - strftime(timebuf, WHATSUP_BUFFERLEN, "%Y/%m/%d %T", tt); + t = time(NULL); + tt = localtime(&t); + strftime(timebuf, WHATSUP_BUFFERLEN, "%Y/%m/%d %T", tt); if ((write_len = snprintf(writebuf, WHATSUP_BUFFERLEN, "%s %s UP\n", @@ -1258,23 +1258,23 @@ _log_mode(void) printf("%s", writebuf); fflush(stdout); } - } - free(node); - } - - while ((node = hostlist_next(downitr))) - { - if (hostlist_find(downnodes, node) < 0) - { - time_t t; - struct tm *tt; - char timebuf[WHATSUP_BUFFERLEN]; + } + free(node); + } + + while ((node = hostlist_next(downitr))) + { + if (hostlist_find(downnodes, node) < 0) + { + time_t t; + struct tm *tt; + char timebuf[WHATSUP_BUFFERLEN]; char writebuf[WHATSUP_BUFFERLEN]; int write_len; - t = time(NULL); - tt = localtime(&t); - strftime(timebuf, WHATSUP_BUFFERLEN, "%Y/%m/%d %T", tt); + t = time(NULL); + tt = localtime(&t); + strftime(timebuf, WHATSUP_BUFFERLEN, "%Y/%m/%d %T", tt); if ((write_len = snprintf(writebuf, WHATSUP_BUFFERLEN, "%s %s DOWN\n", @@ -1294,26 +1294,26 @@ _log_mode(void) printf("%s", writebuf); fflush(stdout); } - } - free(node); - } + } + free(node); + } - hostlist_destroy(upnodes); - hostlist_destroy(downnodes); - upnodes = newupnodes; - downnodes = newdownnodes; - } + hostlist_destroy(upnodes); + hostlist_destroy(downnodes); + upnodes = newupnodes; + downnodes = newdownnodes; + } else - { - if (!(upnodes = hostlist_create(upnodesbuf))) - err_exit("%s: hostlist_create()", __FUNCTION__); + { + if (!(upnodes = hostlist_create(upnodesbuf))) + err_exit("%s: hostlist_create()", __FUNCTION__); - if (!(downnodes = hostlist_create(downnodesbuf))) - err_exit("%s: hostlist_create()", __FUNCTION__); + if (!(downnodes = hostlist_create(downnodesbuf))) + err_exit("%s: hostlist_create()", __FUNCTION__); - nodes_init++; - } + nodes_init++; + } (void)nodeupdown_handle_destroy(handle); sleep(log_poll);