Whamcloud - gitweb
LU-8191 lnet: convert functions in utils to static 27/51427/3
authorTimothy Day <timday@amazon.com>
Fri, 23 Jun 2023 20:44:17 +0000 (20:44 +0000)
committerOleg Drokin <green@whamcloud.com>
Sat, 19 Aug 2023 05:37:50 +0000 (05:37 +0000)
Static analysis shows that a number of functions
could be made static. This patch declares several
functions in various LNet utils and lnetconfig to
static.

In LNet selftest (lst), one unused function was
removed entirely. Some declarations were moved to
made static.

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: Ia4528281b3c87d77e46abb95f47ab0bdc72168c0
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51427
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/utils/lnetconfig/cyaml.c
lnet/utils/lnetconfig/liblnetconfig.c
lnet/utils/lnetconfig/liblnetconfig_netlink.c
lnet/utils/lnetconfig/liblnetconfig_udsp.c
lnet/utils/lst.c
lnet/utils/routerstat.c
lnet/utils/wirecheck.c

index 3466ca7..5d153c5 100644 (file)
@@ -767,7 +767,7 @@ bool cYAML_is_sequence(struct cYAML *node)
        return (node != NULL ? node->cy_type == CYAML_TYPE_ARRAY : 0);
 }
 
-void cYAML_tree_recursive_walk(struct cYAML *node, cYAML_walk_cb cb,
+static void cYAML_tree_recursive_walk(struct cYAML *node, cYAML_walk_cb cb,
                                      bool cb_first,
                                      void *usr_data,
                                      void **out)
index 15d9879..36bb891 100644 (file)
@@ -83,7 +83,7 @@ struct lustre_lnet_ip2nets {
        struct list_head ip2nets_ip_ranges;
 };
 
-int open_sysfs_file(const char *path, const char *attr, const int mode)
+static int open_sysfs_file(const char *path, const char *attr, const int mode)
 {
        int fd;
        char filename[LNET_MAX_STR_LEN];
@@ -143,7 +143,7 @@ close_fd:
  * free_intf_descr
  *     frees the memory allocated for an intf descriptor.
  */
-void free_intf_descr(struct lnet_dlc_intf_descr *intf_descr)
+static void free_intf_descr(struct lnet_dlc_intf_descr *intf_descr)
 {
        if (!intf_descr)
                return;
@@ -165,7 +165,7 @@ void free_intf_descr(struct lnet_dlc_intf_descr *intf_descr)
  *             As a result of lnetctl command
  *             When building a NID or P2P selection rules
  */
-int lustre_lnet_add_ip_range(struct list_head *list, char *str_ip_range)
+static int lustre_lnet_add_ip_range(struct list_head *list, char *str_ip_range)
 {
        struct lustre_lnet_ip_range_descr *ip_range;
        int rc;
@@ -187,7 +187,8 @@ int lustre_lnet_add_ip_range(struct list_head *list, char *str_ip_range)
        return LUSTRE_CFG_RC_NO_ERR;
 }
 
-int lustre_lnet_add_intf_descr(struct list_head *list, char *intf, int len)
+static int lustre_lnet_add_intf_descr(struct list_head *list, char *intf,
+                                     int len)
 {
        char *open_sq_bracket = NULL, *close_sq_bracket = NULL,
             *intf_name;
@@ -790,9 +791,9 @@ out:
        return rc;
 }
 
-int lustre_lnet_route_common(char *nw, char *nidstr, int hops, int prio,
-                            int sen, int seq_no, struct cYAML **err_rc,
-                            int cmd)
+static int lustre_lnet_route_common(char *nw, char *nidstr, int hops, int prio,
+                                   int sen, int seq_no, struct cYAML **err_rc,
+                                   int cmd)
 {
        int rc, num_nids, idx;
        __u32 rnet;
@@ -1326,9 +1327,9 @@ failed:
  *
  *     The result is that all the interfaces have to match.
  */
-int lustre_lnet_match_ip_to_intf(struct ifaddrs *ifa,
-                                struct list_head *intf_list,
-                                struct list_head *ip_ranges)
+static int lustre_lnet_match_ip_to_intf(struct ifaddrs *ifa,
+                                       struct list_head *intf_list,
+                                       struct list_head *ip_ranges)
 {
        int rc;
        __u32 ip;
@@ -1577,7 +1578,7 @@ lustre_lnet_ioctl_config_ni(struct list_head *intf_list,
        return LUSTRE_CFG_RC_NO_ERR;
 }
 
-int
+static int
 lustre_lnet_config_ip2nets(struct lustre_lnet_ip2nets *ip2nets,
                           struct lnet_ioctl_config_lnd_tunables *tunables,
                           struct cfs_expr_list *global_cpts,
@@ -2544,8 +2545,8 @@ out:
        return rc;
 }
 
-int ioctl_set_value(__u32 val, int ioc, char *name,
-                   int seq_no, struct cYAML **err_rc)
+static int ioctl_set_value(__u32 val, int ioc, char *name,
+                          int seq_no, struct cYAML **err_rc)
 {
        struct lnet_ioctl_set_value data;
        int rc = LUSTRE_CFG_RC_NO_ERR;
@@ -3910,7 +3911,7 @@ out:
        return rc;
 }
 
-unsigned int
+static unsigned int
 lnet_nid_cpt_hash(lnet_nid_t nid, long int number, unsigned int cpt_bits)
 {
        __u64 key = nid;
@@ -3976,8 +3977,9 @@ int lustre_lnet_calc_cpt_of_nid(char *nidc, long int ncpts)
        return (int)lnet_nid_cpt_hash(nid, ncpts, cpt_bits);
 }
 
-int show_recovery_queue(enum lnet_health_type type, char *name, int seq_no,
-                       struct cYAML **show_rc, struct cYAML **err_rc)
+static int show_recovery_queue(enum lnet_health_type type, char *name,
+                              int seq_no, struct cYAML **show_rc,
+                              struct cYAML **err_rc)
 {
        struct lnet_ioctl_recovery_list nid_list;
        struct cYAML *root = NULL, *nids = NULL;
index 7e056ca..1fb25da 100644 (file)
@@ -220,7 +220,7 @@ int lnet_genlmsg_parse(struct nlmsghdr *nlh, int hdrlen, struct nlattr *tb[],
  *
  * Return      0 on success or a Netlink error code.
  */
-int nl_socket_enable_broadcast_error(struct nl_sock *sk)
+static int nl_socket_enable_broadcast_error(struct nl_sock *sk)
 {
        const int state = 1; /* enable errors */
        int err;
@@ -245,7 +245,7 @@ int nl_socket_enable_broadcast_error(struct nl_sock *sk)
  *
  * @return 0 on success or a negative error code
  */
-int nl_socket_set_ext_ack(struct nl_sock *sk, int state)
+static int nl_socket_set_ext_ack(struct nl_sock *sk, int state)
 {
        int err;
 
@@ -270,7 +270,7 @@ int nl_socket_set_ext_ack(struct nl_sock *sk, int state)
  *
  * Return              0 on success or a negative error code.
  */
-int lustre_netlink_register(struct nl_sock *sk, bool async_events)
+static int lustre_netlink_register(struct nl_sock *sk, bool async_events)
 {
        int rc;
 
@@ -306,8 +306,8 @@ int lustre_netlink_register(struct nl_sock *sk, bool async_events)
  *
  * Return      0 on success or a negative error code.
  */
-int lustre_netlink_add_group(struct nl_sock *nl, const char *family,
-                            const char *group)
+static int lustre_netlink_add_group(struct nl_sock *nl, const char *family,
+                                   const char *group)
 {
        int group_id;
 
index 2167aaa..a2fd249 100644 (file)
@@ -51,7 +51,7 @@ lnet_udsp_criteria_present(struct lnet_ud_nid_descr *descr)
        return descr->ud_net_id.udn_net_type != 0;
 }
 
-struct lnet_udsp *lnet_udsp_alloc(void)
+static struct lnet_udsp *lnet_udsp_alloc(void)
 {
        struct lnet_udsp *udsp;
 
@@ -97,7 +97,7 @@ lnet_udsp_nid_descr_free(struct lnet_ud_nid_descr *nid_descr, bool blk)
        }
 }
 
-void
+static void
 lnet_udsp_free(struct lnet_udsp *udsp, bool blk)
 {
        lnet_udsp_nid_descr_free(&udsp->udsp_src, blk);
@@ -231,7 +231,7 @@ copy_ioc_udsp_descr(struct lnet_ud_nid_descr *nid_descr, char *type,
        return 0;
 }
 
-struct lnet_udsp *
+static struct lnet_udsp *
 lnet_udsp_demarshal(void *bulk, __u32 bulk_size)
 {
        struct lnet_ioctl_udsp *ioc_udsp;
@@ -317,7 +317,7 @@ lnet_size_marshaled_nid_descr(struct lnet_ud_nid_descr *descr)
        return size;
 }
 
-size_t
+static size_t
 lnet_get_udsp_size(struct lnet_udsp *udsp)
 {
        size_t size = sizeof(struct lnet_ioctl_udsp);
@@ -625,7 +625,7 @@ int lustre_lnet_del_udsp(unsigned int idx, int seq_no, struct cYAML **err_rc)
        return rc;
 }
 
-int lustre_lnet_nid_descr2str(struct lnet_ud_nid_descr *d,
+static int lustre_lnet_nid_descr2str(struct lnet_ud_nid_descr *d,
                                     char *str, size_t size)
 {
        int left = size;
@@ -669,7 +669,7 @@ int lustre_lnet_nid_descr2str(struct lnet_ud_nid_descr *d,
        return 0;
 }
 
-int yaml_add_udsp_action(struct cYAML *y, struct lnet_udsp *udsp)
+static int yaml_add_udsp_action(struct cYAML *y, struct lnet_udsp *udsp)
 {
        struct cYAML *action;
 
index d8e7162..da4d061 100644 (file)
 #include <linux/lnet/nidstr.h>
 #include "lnetconfig/liblnetconfig.h"
 
+static int lst_info_batch_ioctl(char *batch, int test, int server,
+                      struct lstcon_test_batch_ent *entp, int *idxp,
+                      int *ndentp, struct lstcon_node_ent *dentsp);
+static int lst_info_group_ioctl(char *name, struct lstcon_ndlist_ent *gent,
+                       int *idx, int *count, struct lstcon_node_ent *dents);
+static int lst_query_batch_ioctl(char *batch, int test, int server,
+                        int timeout, struct list_head *head);
+
 struct lst_sid LST_INVALID_SID = { .ses_nid = LNET_NID_ANY, .ses_stamp = -1 };
 static unsigned int session_key;
 
@@ -73,7 +81,7 @@ typedef struct list_string {
 static int alloc_count = 0;
 static int alloc_nob   = 0;
 
-lstr_t *
+static lstr_t *
 alloc_lstr(int sz)
 {
         lstr_t  *lstr = malloc(offsetof(lstr_t, lstr_str[sz]));
@@ -91,7 +99,7 @@ alloc_lstr(int sz)
         return lstr;
 }
 
-void
+static void
 free_lstr(lstr_t *lstr)
 {
         alloc_count--;
@@ -99,18 +107,7 @@ free_lstr(lstr_t *lstr)
         free(lstr);
 }
 
-void
-free_lstrs(lstr_t **list)
-{
-        lstr_t   *lstr;
-
-        while ((lstr = *list) != NULL) {
-                *list = lstr->lstr_next;
-                free_lstr(lstr);
-        }
-}
-
-void
+static void
 new_lstrs(lstr_t **list, char *prefix, char *postfix,
           int lo, int hi, int stride)
 {
@@ -131,7 +128,7 @@ new_lstrs(lstr_t **list, char *prefix, char *postfix,
         } while (lo <= hi);
 }
 
-int
+static int
 expand_lstr(lstr_t **list, lstr_t *l)
 {
         int          nob = strlen(l->lstr_str);
@@ -197,7 +194,7 @@ expand_lstr(lstr_t **list, lstr_t *l)
         return 1;
 }
 
-int
+static int
 expand_strs(char *str, lstr_t **head)
 {
         lstr_t  *list = NULL;
@@ -250,7 +247,7 @@ expand_strs(char *str, lstr_t **head)
         return rc;
 }
 
-int
+static int
 lst_parse_nids(char *str, int *countp, struct lnet_process_id **idspp)
 {
         lstr_t  *head = NULL;
@@ -305,7 +302,7 @@ out:
         return rc;
 }
 
-char *
+static char *
 lst_node_state2str(int state)
 {
         if (state == LST_NODE_ACTIVE)
@@ -318,7 +315,7 @@ lst_node_state2str(int state)
         return "Unknown";
 }
 
-int
+static int
 lst_node_str2state(char *str)
 {
         if (strcasecmp(str, "active") == 0)
@@ -335,7 +332,7 @@ lst_node_str2state(char *str)
         return -1;
 }
 
-char *
+static char *
 lst_test_type2name(int type)
 {
         if (type == LST_TEST_PING)
@@ -346,7 +343,7 @@ lst_test_type2name(int type)
         return "unknown";
 }
 
-int
+static int
 lst_test_name2type(char *name)
 {
         if (strcasecmp(name, "ping") == 0)
@@ -357,7 +354,7 @@ lst_test_name2type(char *name)
         return -1;
 }
 
-void
+static void
 lst_print_usage(char *cmd)
 {
        char *argv[] = { "help", cmd };
@@ -365,7 +362,7 @@ lst_print_usage(char *cmd)
        cfs_parser(2, argv, NULL);
 }
 
-void
+static void
 lst_print_error(char *sub, const char *def_format, ...)
 {
         va_list ap;
@@ -402,7 +399,7 @@ lst_print_error(char *sub, const char *def_format, ...)
         }
 }
 
-void
+static void
 lst_free_rpcent(struct list_head *head)
 {
        struct lstcon_rpc_ent *ent;
@@ -415,7 +412,7 @@ lst_free_rpcent(struct list_head *head)
        }
 }
 
-void
+static void
 lst_reset_rpcent(struct list_head *head)
 {
        struct lstcon_rpc_ent *ent;
@@ -428,7 +425,7 @@ lst_reset_rpcent(struct list_head *head)
        }
 }
 
-int
+static int
 lst_alloc_rpcent(struct list_head *head, int count, int offset)
 {
        struct lstcon_rpc_ent *ent;
@@ -452,7 +449,7 @@ lst_alloc_rpcent(struct list_head *head, int count, int offset)
        return 0;
 }
 
-void
+static void
 lst_print_transerr(struct list_head *head, char *optstr)
 {
        struct lstcon_rpc_ent *ent;
@@ -474,17 +471,7 @@ lst_print_transerr(struct list_head *head, char *optstr)
         }
 }
 
-int lst_info_batch_ioctl(char *batch, int test, int server,
-                       struct lstcon_test_batch_ent *entp, int *idxp,
-                       int *ndentp, struct lstcon_node_ent *dentsp);
-
-int lst_info_group_ioctl(char *name, struct lstcon_ndlist_ent *gent,
-                        int *idx, int *count, struct lstcon_node_ent *dents);
-
-int lst_query_batch_ioctl(char *batch, int test, int server,
-                         int timeout, struct list_head *head);
-
-int
+static int
 lst_ioctl(unsigned int opc, void *buf, int len)
 {
         struct libcfs_ioctl_data data;
@@ -516,8 +503,8 @@ lst_ioctl(unsigned int opc, void *buf, int len)
         return 0;
 }
 
-int lst_yaml_session(const char *label, const char *timeout, int nlflags,
-                    const char *errmsg)
+static int lst_yaml_session(const char *label, const char *timeout, int nlflags,
+                           const char *errmsg)
 {
        struct lstcon_ndlist_ent ndinfo = { };
        struct lst_sid sid = LST_INVALID_SID;
@@ -775,7 +762,7 @@ parser_error:
        return rc == 0 ? -1 : 0;
 }
 
-int
+static int
 lst_new_session_ioctl(char *name, int timeout, int force, struct lst_sid *sid)
 {
        struct lstio_session_new_args args = { 0 };
@@ -791,7 +778,7 @@ lst_new_session_ioctl(char *name, int timeout, int force, struct lst_sid *sid)
         return lst_ioctl (LSTIO_SESSION_NEW, &args, sizeof(args));
 }
 
-int
+static int
 jt_lst_new_session(int argc, char **argv)
 {
        char  buf[LST_NAME_SIZE * 2 + 1];
@@ -887,7 +874,7 @@ success:
        return 0;
 }
 
-int
+static int
 lst_session_info_ioctl(char *name, int len, int *key, unsigned *featp,
                       struct lst_sid *sid, struct lstcon_ndlist_ent *ndinfo)
 {
@@ -903,7 +890,7 @@ lst_session_info_ioctl(char *name, int len, int *key, unsigned *featp,
        return lst_ioctl(LSTIO_SESSION_INFO, &args, sizeof(args));
 }
 
-int
+static int
 jt_lst_show_session(int argc, char **argv)
 {
        struct lstcon_ndlist_ent ndinfo;
@@ -933,7 +920,7 @@ jt_lst_show_session(int argc, char **argv)
         return 0;
 }
 
-int
+static int
 lst_end_session_ioctl(void)
 {
        struct lstio_session_end_args args = { 0 };
@@ -942,7 +929,7 @@ lst_end_session_ioctl(void)
        return lst_ioctl(LSTIO_SESSION_END, &args, sizeof(args));
 }
 
-int
+static int
 jt_lst_end_session(int argc, char **argv)
 {
         int             rc;
@@ -1374,7 +1361,7 @@ parser_error:
        return rc;
 }
 
-int
+static int
 lst_ping_ioctl(char *str, int type, int timeout,
               int count, struct lnet_process_id *ids, struct list_head *head)
 {
@@ -1393,7 +1380,7 @@ lst_ping_ioctl(char *str, int type, int timeout,
         return lst_ioctl (LSTIO_DEBUG, &args, sizeof(args));
 }
 
-int
+static int
 lst_get_node_count(int type, char *str, int *countp,
                   struct lnet_process_id **idspp)
 {
@@ -1442,7 +1429,7 @@ lst_get_node_count(int type, char *str, int *countp,
         return rc;
 }
 
-int
+static int
 jt_lst_ping(int argc,  char **argv)
 {
        struct list_head   head;
@@ -1574,7 +1561,7 @@ out:
 
 }
 
-int
+static int
 lst_add_nodes_ioctl(char *name, int count, struct lnet_process_id *ids,
                    unsigned *featp, struct list_head *resultp)
 {
@@ -1591,7 +1578,7 @@ lst_add_nodes_ioctl(char *name, int count, struct lnet_process_id *ids,
         return lst_ioctl(LSTIO_NODES_ADD, &args, sizeof(args));
 }
 
-int
+static int
 lst_del_group_ioctl(char *name)
 {
        struct lstio_group_del_args args = { 0 };
@@ -1603,7 +1590,7 @@ lst_del_group_ioctl(char *name)
        return lst_ioctl(LSTIO_GROUP_DEL, &args, sizeof(args));
 }
 
-int
+static int
 lst_del_group(char *grp_name)
 {
        int     rc;
@@ -1639,7 +1626,7 @@ lst_del_group(char *grp_name)
        return -1;
 }
 
-int
+static int
 lst_add_group_ioctl(char *name)
 {
        struct lstio_group_add_args args = { 0 };
@@ -1651,7 +1638,7 @@ lst_add_group_ioctl(char *name)
         return lst_ioctl(LSTIO_GROUP_ADD, &args, sizeof(args));
 }
 
-int
+static int
 jt_lst_add_group(int argc, char **argv)
 {
        struct list_head   head;
@@ -1783,7 +1770,7 @@ failed:
        return rc;
 }
 
-int
+static int
 jt_lst_del_group(int argc, char **argv)
 {
         int     rc;
@@ -1804,7 +1791,7 @@ jt_lst_del_group(int argc, char **argv)
        return rc;
 }
 
-int
+static int
 lst_update_group_ioctl(int opc, char *name, int clean, int count,
                       struct lnet_process_id *ids, struct list_head *resultp)
 {
@@ -1822,7 +1809,7 @@ lst_update_group_ioctl(int opc, char *name, int clean, int count,
         return lst_ioctl(LSTIO_GROUP_UPDATE, &args, sizeof(args));
 }
 
-int
+static int
 jt_lst_update_group(int argc, char **argv)
 {
        struct list_head   head;
@@ -1945,7 +1932,7 @@ jt_lst_update_group(int argc, char **argv)
         return rc;
 }
 
-int
+static int
 lst_list_group_ioctl(int len, char *name, int idx)
 {
        struct lstio_group_list_args args = { 0 };
@@ -1958,7 +1945,7 @@ lst_list_group_ioctl(int len, char *name, int idx)
         return lst_ioctl(LSTIO_GROUP_LIST, &args, sizeof(args));
 }
 
-int
+static int
 lst_info_group_ioctl(char *name, struct lstcon_ndlist_ent *gent,
                     int *idx, int *count, struct lstcon_node_ent *dents)
 {
@@ -1975,7 +1962,7 @@ lst_info_group_ioctl(char *name, struct lstcon_ndlist_ent *gent,
         return lst_ioctl(LSTIO_GROUP_INFO, &args, sizeof(args));
 }
 
-int
+static int
 lst_list_group_all(void)
 {
         char  name[LST_NAME_SIZE];
@@ -2003,7 +1990,7 @@ lst_list_group_all(void)
         return 0;
 }
 
-int
+static int
 jt_lst_list_group(int argc, char **argv)
 {
        struct lstcon_ndlist_ent gent;
@@ -2174,7 +2161,7 @@ old_api:
         return rc;
 }
 
-int
+static int
 lst_stat_ioctl(char *name, int count, struct lnet_process_id *idsp,
               int timeout, struct list_head *resultp)
 {
@@ -2536,7 +2523,7 @@ lst_print_stat(char *name, struct list_head *resultp,
        lst_print_lnet_stat(name, bwrt, rdwr, type, mbs);
 }
 
-int
+static int
 jt_lst_stat(int argc, char **argv)
 {
        struct list_head        head;
@@ -2714,7 +2701,7 @@ out:
        return rc;
 }
 
-int
+static int
 jt_lst_show_error(int argc, char **argv)
 {
        struct list_head       head;
@@ -2837,7 +2824,7 @@ out:
        return rc;
 }
 
-int
+static int
 lst_add_batch_ioctl(char *name)
 {
        struct lstio_batch_add_args args = { 0 };
@@ -2849,7 +2836,7 @@ lst_add_batch_ioctl(char *name)
         return lst_ioctl (LSTIO_BATCH_ADD, &args, sizeof(args));
 }
 
-int
+static int
 jt_lst_add_batch(int argc, char **argv)
 {
         char   *name;
@@ -2883,7 +2870,7 @@ jt_lst_add_batch(int argc, char **argv)
         return -1;
 }
 
-int
+static int
 lst_start_batch_ioctl(char *name, int timeout, struct list_head *resultp)
 {
        struct lstio_batch_run_args args = { 0 };
@@ -2897,7 +2884,7 @@ lst_start_batch_ioctl(char *name, int timeout, struct list_head *resultp)
         return lst_ioctl(LSTIO_BATCH_START, &args, sizeof(args));
 }
 
-int
+static int
 jt_lst_start_batch(int argc, char **argv)
 {
        struct list_head  head;
@@ -2984,7 +2971,7 @@ jt_lst_start_batch(int argc, char **argv)
         return rc;
 }
 
-int
+static int
 lst_stop_batch_ioctl(char *name, int force, struct list_head *resultp)
 {
        struct lstio_batch_stop_args args = { 0 };
@@ -2998,7 +2985,7 @@ lst_stop_batch_ioctl(char *name, int force, struct list_head *resultp)
         return lst_ioctl(LSTIO_BATCH_STOP, &args, sizeof(args));
 }
 
-int
+static int
 jt_lst_stop_batch(int argc, char **argv)
 {
        struct list_head  head;
@@ -3102,7 +3089,7 @@ out:
         return rc;
 }
 
-int
+static int
 lst_list_batch_ioctl(int len, char *name, int index)
 {
        struct lstio_batch_list_args args = { 0 };
@@ -3115,7 +3102,7 @@ lst_list_batch_ioctl(int len, char *name, int index)
         return lst_ioctl(LSTIO_BATCH_LIST, &args, sizeof(args));
 }
 
-int
+static int
 lst_info_batch_ioctl(char *batch, int test, int server,
                     struct lstcon_test_batch_ent *entp, int *idxp,
                     int *ndentp, struct lstcon_node_ent *dentsp)
@@ -3135,7 +3122,7 @@ lst_info_batch_ioctl(char *batch, int test, int server,
         return lst_ioctl(LSTIO_BATCH_INFO, &args, sizeof(args));
 }
 
-int
+static int
 lst_list_batch_all(void)
 {
         char name[LST_NAME_SIZE];
@@ -3162,7 +3149,7 @@ lst_list_batch_all(void)
         return 0;
 }
 
-int
+static int
 lst_list_tsb_nodes(char *batch, int test, int server,
                    int count, int active, int invalid)
 {
@@ -3212,7 +3199,7 @@ lst_list_tsb_nodes(char *batch, int test, int server,
         return 0;
 }
 
-int
+static int
 jt_lst_list_batch(int argc, char **argv)
 {
        struct lstcon_test_batch_ent ent;
@@ -3348,7 +3335,7 @@ loop:
         return 0;
 }
 
-int
+static int
 lst_query_batch_ioctl(char *batch, int test, int server,
                      int timeout, struct list_head *head)
 {
@@ -3365,7 +3352,7 @@ lst_query_batch_ioctl(char *batch, int test, int server,
         return lst_ioctl(LSTIO_BATCH_QUERY, &args, sizeof(args));
 }
 
-void
+static void
 lst_print_tsb_verbose(struct list_head *head,
                       int active, int idle, int error)
 {
@@ -3390,7 +3377,7 @@ lst_print_tsb_verbose(struct list_head *head,
         }
 }
 
-int
+static int
 jt_lst_query_batch(int argc, char **argv)
 {
        struct lstcon_test_batch_ent ent;
@@ -3571,7 +3558,7 @@ jt_lst_query_batch(int argc, char **argv)
         return rc;
 }
 
-int
+static int
 lst_parse_distribute(char *dstr, int *dist, int *span)
 {
         *dist = atoi(dstr);
@@ -3589,7 +3576,7 @@ lst_parse_distribute(char *dstr, int *dist, int *span)
         return 0;
 }
 
-int
+static int
 lst_get_bulk_param(int argc, char **argv, struct lst_test_bulk_param *bulk)
 {
         char   *tok = NULL;
@@ -3680,7 +3667,7 @@ lst_get_bulk_param(int argc, char **argv, struct lst_test_bulk_param *bulk)
         return rc;
 }
 
-int
+static int
 lst_get_test_param(char *test, int argc, char **argv, void **param, int *plen)
 {
        struct lst_test_bulk_param *bulk = NULL;
@@ -3735,7 +3722,7 @@ lst_get_test_param(char *test, int argc, char **argv, void **param, int *plen)
         return type;
 }
 
-int
+static int
 lst_add_test_ioctl(char *batch, int type, int loop, int concur,
                    int dist, int span, char *sgrp, char *dgrp,
                   void *param, int plen, int *retp, struct list_head *resultp)
@@ -3763,7 +3750,7 @@ lst_add_test_ioctl(char *batch, int type, int loop, int concur,
         return lst_ioctl(LSTIO_TEST_ADD, &args, sizeof(args));
 }
 
-int
+static int
 jt_lst_add_test(int argc, char **argv)
 {
        struct list_head head;
@@ -3956,7 +3943,7 @@ static command_t lst_cmdlist[] = {
         {0,                     0,                      0,      NULL                    }
 };
 
-int
+static int
 lst_initialize(void)
 {
        char   *key;
index 547bd56..e63deea 100644 (file)
@@ -42,8 +42,7 @@
 
 #include <libcfs/util/param.h>
 
-double
-timenow ()
+static double timenow(void)
 {
    struct timeval tv;
 
@@ -65,7 +64,7 @@ typedef struct {
         unsigned long long   drop_length;
 } counters_t;
 
-unsigned long long subull(unsigned long long a, unsigned long long b)
+static unsigned long long subull(unsigned long long a, unsigned long long b)
 {
        if (a < b)
                return -1ULL - b + a + 1;
@@ -73,7 +72,7 @@ unsigned long long subull(unsigned long long a, unsigned long long b)
        return a - b;
 }
 
-unsigned long long subul(unsigned long a, unsigned long b)
+static unsigned long long subul(unsigned long a, unsigned long b)
 {
        if (a < b)
                return -1UL - b + a + 1;
@@ -81,18 +80,17 @@ unsigned long long subul(unsigned long a, unsigned long b)
        return a - b;
 }
 
-double rul(unsigned long a, double secs)
+static double rul(unsigned long a, double secs)
 {
        return (double)a/secs;
 }
 
-double rull(unsigned long long a, double secs)
+static double rull(unsigned long long a, double secs)
 {
        return (double)a/secs;
 }
 
-void
-do_stat (int fd)
+static void do_stat(int fd)
 {
    static char  buffer[1024];
    static double last = 0.0;
index e67d75c..e663d15 100644 (file)
@@ -100,7 +100,7 @@ do {                                            \
         CHECK_VALUE((int)sizeof(s));            \
 } while (0)
 
-void
+static void
 check_lnet_handle_wire(void)
 {
        CHECK_STRUCT(struct lnet_handle_wire);
@@ -108,7 +108,7 @@ check_lnet_handle_wire(void)
        CHECK_MEMBER(struct lnet_handle_wire, wh_object_cookie);
 }
 
-void
+static void
 check_lnet_magicversion (void)
 {
        CHECK_STRUCT(struct lnet_magicversion);
@@ -117,7 +117,7 @@ check_lnet_magicversion (void)
        CHECK_MEMBER(struct lnet_magicversion, version_minor);
 }
 
-void
+static void
 check_lnet_hdr_nid4(void)
 {
        CHECK_STRUCT(struct _lnet_hdr_nid4);
@@ -161,7 +161,7 @@ check_lnet_hdr_nid4(void)
        CHECK_MEMBER(struct _lnet_hdr_nid4, msg.hello.type);
 }
 
-void
+static void
 check_lnet_ni_status(void)
 {
        BLANK_LINE();
@@ -181,7 +181,7 @@ check_lnet_ni_status(void)
        CHECK_MEMBER(struct lnet_ni_large_status, ns_nid);
 }
 
-void
+static void
 check_lnet_ping_info(void)
 {
        BLANK_LINE();
@@ -206,7 +206,7 @@ check_lnet_ping_info(void)
        CHECK_MEMBER_IS_FLEXIBLE(struct lnet_ping_info, pi_ni);
 }
 
-void
+static void
 system_string(char *cmdline, char *str, int len)
 {
         int   fds[2];