]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ip: make local functions static
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 12 Feb 2013 19:09:03 +0000 (11:09 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 12 Feb 2013 19:38:35 +0000 (11:38 -0800)
40 files changed:
bridge/monitor.c
genl/ctrl.c
ip/ipaddress.c
ip/iplink.c
ip/ipmaddr.c
ip/ipmonitor.c
ip/ipneigh.c
ip/ipnetconf.c
ip/ipprefix.c
ip/iproute.c
ip/ipxfrm.c
ip/rtmon.c
ip/xfrm_monitor.c
ip/xfrm_policy.c
ip/xfrm_state.c
misc/arpd.c
misc/ifstat.c
misc/nstat.c
misc/rtacct.c
misc/ss.c
tc/f_rsvp.c
tc/f_u32.c
tc/m_action.c
tc/m_estimator.c
tc/m_gact.c
tc/m_mirred.c
tc/m_pedit.c
tc/m_police.c
tc/m_xt.c
tc/q_mqprio.c
tc/q_multiq.c
tc/q_netem.c
tc/q_rr.c
tc/tc_class.c
tc/tc_core.c
tc/tc_filter.c
tc/tc_monitor.c
tc/tc_qdisc.c
tc/tc_util.c
tc/tc_util.h

index 29bb931b807f54acf6a94e61f040dd4ad2425ff2..e96fcaf7ae676d5092584e5883668e490ecc11ad 100644 (file)
@@ -46,8 +46,8 @@ static int show_mark(FILE *fp, const struct nlmsghdr *n)
        return 0;
 }
 
-int accept_msg(const struct sockaddr_nl *who,
-              struct nlmsghdr *n, void *arg)
+static int accept_msg(const struct sockaddr_nl *who,
+                     struct nlmsghdr *n, void *arg)
 {
        FILE *fp = arg;
 
index 6d97c2690f4966ac9bc9a981d80438189b737772..7c425788775d56dfef413652853960ffbba915d9 100644 (file)
@@ -112,7 +112,7 @@ errout:
        return ret;
 }
 
-void print_ctrl_cmd_flags(FILE *fp, __u32 fl)
+static void print_ctrl_cmd_flags(FILE *fp, __u32 fl)
 {
        fprintf(fp, "\n\t\tCapabilities (0x%x):\n ", fl);
        if (!fl) {
index 0bd8a76ec018079552848a149feb7a590b3af97a..cff503fe24a4551823135c9b7588508789469c9f 100644 (file)
@@ -89,7 +89,7 @@ static void usage(void)
        exit(-1);
 }
 
-void print_link_flags(FILE *fp, unsigned flags, unsigned mdown)
+static void print_link_flags(FILE *fp, unsigned flags, unsigned mdown)
 {
        fprintf(fp, "<");
        if (flags & IFF_UP && !(flags & IFF_RUNNING))
@@ -699,8 +699,8 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
        return 0;
 }
 
-int print_addrinfo_primary(const struct sockaddr_nl *who, struct nlmsghdr *n,
-                          void *arg)
+static int print_addrinfo_primary(const struct sockaddr_nl *who,
+                                 struct nlmsghdr *n, void *arg)
 {
        struct ifaddrmsg *ifa = NLMSG_DATA(n);
 
@@ -710,8 +710,8 @@ int print_addrinfo_primary(const struct sockaddr_nl *who, struct nlmsghdr *n,
        return print_addrinfo(who, n, arg);
 }
 
-int print_addrinfo_secondary(const struct sockaddr_nl *who, struct nlmsghdr *n,
-                            void *arg)
+static int print_addrinfo_secondary(const struct sockaddr_nl *who,
+                                   struct nlmsghdr *n, void *arg)
 {
        struct ifaddrmsg *ifa = NLMSG_DATA(n);
 
index c24f0cebb4edfc2f08a740cf3a309a617fb1b3b1..ad33611415c03d3feadd73bb00ec2a2edeebf3c2 100644 (file)
@@ -135,7 +135,7 @@ struct link_util *get_link_kind(const char *id)
        return l;
 }
 
-int get_link_mode(const char *mode)
+static int get_link_mode(const char *mode)
 {
        if (strcasecmp(mode, "default") == 0)
                return IF_LINK_MODE_DEFAULT;
@@ -194,7 +194,7 @@ struct iplink_req {
        char                    buf[1024];
 };
 
-int iplink_parse_vf(int vf, int *argcp, char ***argvp,
+static int iplink_parse_vf(int vf, int *argcp, char ***argvp,
                           struct iplink_req *req)
 {
        int len, argc = *argcp;
index 3ae947800ef4bf1f7e6f1e2e95614b54fcd54a93..6e19465f0f660f05a1c95066e61728961651cab7 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "rt_names.h"
 #include "utils.h"
+#include "ip_common.h"
 
 static struct {
        char *dev;
@@ -70,7 +71,7 @@ struct ma_info
        inet_prefix     addr;
 };
 
-void maddr_ins(struct ma_info **lst, struct ma_info *m)
+static void maddr_ins(struct ma_info **lst, struct ma_info *m)
 {
        struct ma_info *mp;
 
@@ -82,7 +83,7 @@ void maddr_ins(struct ma_info **lst, struct ma_info *m)
        *lst = m;
 }
 
-void read_dev_mcast(struct ma_info **result_p)
+static void read_dev_mcast(struct ma_info **result_p)
 {
        char buf[256];
        FILE *fp = fopen("/proc/net/dev_mcast", "r");
@@ -119,7 +120,7 @@ void read_dev_mcast(struct ma_info **result_p)
        fclose(fp);
 }
 
-void read_igmp(struct ma_info **result_p)
+static void read_igmp(struct ma_info **result_p)
 {
        struct ma_info m;
        char buf[256];
@@ -158,7 +159,7 @@ void read_igmp(struct ma_info **result_p)
 }
 
 
-void read_igmp6(struct ma_info **result_p)
+static void read_igmp6(struct ma_info **result_p)
 {
        char buf[256];
        FILE *fp = fopen("/proc/net/igmp6", "r");
@@ -275,7 +276,7 @@ static int multiaddr_list(int argc, char **argv)
        return 0;
 }
 
-int multiaddr_modify(int cmd, int argc, char **argv)
+static int multiaddr_modify(int cmd, int argc, char **argv)
 {
        struct ifreq ifr;
        int fd;
index a9ff1e85cfe9167131a1e8c43f126525995f6f52..86c473e9cfa4244a50f128dba3179d6aedb173cc 100644 (file)
@@ -37,8 +37,8 @@ static void usage(void)
 }
 
 
-int accept_msg(const struct sockaddr_nl *who,
-              struct nlmsghdr *n, void *arg)
+static int accept_msg(const struct sockaddr_nl *who,
+                     struct nlmsghdr *n, void *arg)
 {
        FILE *fp = (FILE*)arg;
 
index 1b7600bbbfc626f19600bd8facfa3810fa32d927..d76e035c449c988e1e39389ddb4cc1cb5701fd74 100644 (file)
@@ -52,7 +52,7 @@ static void usage(void)
        exit(-1);
 }
 
-int nud_state_a2n(unsigned *state, char *arg)
+static int nud_state_a2n(unsigned *state, const char *arg)
 {
        if (matches(arg, "permanent") == 0)
                *state = NUD_PERMANENT;
@@ -313,13 +313,13 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
        return 0;
 }
 
-void ipneigh_reset_filter()
+void ipneigh_reset_filter(void)
 {
        memset(&filter, 0, sizeof(filter));
        filter.state = ~0;
 }
 
-int do_show_or_flush(int argc, char **argv, int flush)
+static int do_show_or_flush(int argc, char **argv, int flush)
 {
        char *filter_dev = NULL;
        int state_given = 0;
index 66d667bcd16d99ce419e3dabdd04f87667ace10b..8ceadfe4360bc09b3491d9ea127722b7b970d814 100644 (file)
@@ -119,12 +119,12 @@ int print_netconf(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
        return 0;
 }
 
-void ipnetconf_reset_filter(void)
+static void ipnetconf_reset_filter(void)
 {
        memset(&filter, 0, sizeof(filter));
 }
 
-int do_show(int argc, char **argv)
+static int do_show(int argc, char **argv)
 {
        struct {
                struct nlmsghdr         n;
index cf68f897ddb8a4ecea67dfa81c6121e56cc71e15..9725077830b75f7a82d55acc395f89e7f0e36573 100644 (file)
@@ -28,7 +28,9 @@
 #include <string.h>
 #include <sys/socket.h>
 #include <netinet/icmp6.h>
+
 #include "utils.h"
+#include "ip_common.h"
 
 /* prefix flags; see kernel's net/ipv6/addrconf.c and include/net/if_inet6.h */
 #define IF_PREFIX_ONLINK       0x01
index 309cc8704a756609819d3af42963227863210422..5dc443716815be164c89d41ca3460995c62c7ab2 100644 (file)
@@ -124,7 +124,7 @@ static int flush_update(void)
        return 0;
 }
 
-int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
+static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
 {
        struct rtmsg *r = NLMSG_DATA(n);
        inet_prefix dst;
@@ -263,7 +263,7 @@ int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
        return 1;
 }
 
-int calc_host_len(struct rtmsg *r)
+static int calc_host_len(const struct rtmsg *r)
 {
        if (r->rtm_family == AF_INET6)
                return 128;
@@ -625,7 +625,9 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 }
 
 
-int parse_one_nh(struct rtmsg *r, struct rtattr *rta, struct rtnexthop *rtnh, int *argcp, char ***argvp)
+static int parse_one_nh(struct rtmsg *r, struct rtattr *rta,
+                       struct rtnexthop *rtnh,
+                       int *argcp, char ***argvp)
 {
        int argc = *argcp;
        char **argv = *argvp;
@@ -668,7 +670,8 @@ int parse_one_nh(struct rtmsg *r, struct rtattr *rta, struct rtnexthop *rtnh, in
        return 0;
 }
 
-int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r, int argc, char **argv)
+static int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r,
+                         int argc, char **argv)
 {
        char buf[1024];
        struct rtattr *rta = (void*)buf;
@@ -699,8 +702,7 @@ int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r, int argc, char **argv)
        return 0;
 }
 
-
-int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
+static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
 {
        struct {
                struct nlmsghdr         n;
@@ -1070,7 +1072,8 @@ static int iproute_flush_cache(void)
 
 static __u32 route_dump_magic = 0x45311224;
 
-int save_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+static int save_route(const struct sockaddr_nl *who, struct nlmsghdr *n,
+                     void *arg)
 {
        int ret;
        int len = n->nlmsg_len;
@@ -1363,7 +1366,7 @@ static int iproute_list_flush_or_save(int argc, char **argv, int action)
 }
 
 
-int iproute_get(int argc, char **argv)
+static int iproute_get(int argc, char **argv)
 {
        struct {
                struct nlmsghdr         n;
@@ -1528,7 +1531,8 @@ int iproute_get(int argc, char **argv)
        exit(0);
 }
 
-int restore_handler(const struct sockaddr_nl *nl, struct nlmsghdr *n, void *arg)
+static int restore_handler(const struct sockaddr_nl *nl, struct nlmsghdr *n,
+                          void *arg)
 {
        int ret;
 
@@ -1562,7 +1566,7 @@ static int route_dump_check_magic(void)
        return 0;
 }
 
-int iproute_restore(void)
+static int iproute_restore(void)
 {
        if (route_dump_check_magic())
                exit(-1);
@@ -1584,7 +1588,7 @@ static int iproute_showdump(void)
        exit(rtnl_from_file(stdin, &show_handler, NULL));
 }
 
-void iproute_reset_filter()
+void iproute_reset_filter(void)
 {
        memset(&filter, 0, sizeof(filter));
        filter.mdst.bitlen = -1;
index 5a0f215f8a0d944a7016d7e56db7b678f1332e6f..db5191851b4ec431c131244989acc71611f7cc5e 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "utils.h"
 #include "xfrm.h"
+#include "ip_common.h"
 
 #define STRBUF_SIZE    (128)
 #define STRBUF_CAT(buf, str) \
index c1416a0bdf0b7b55c0f54ea1e55b8f9bbe0e4efd..9227eacc10f835372fd63d719c060349a22bc9dd 100644 (file)
@@ -56,7 +56,7 @@ static int dump_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
        return 0;
 }
 
-void usage(void)
+static void usage(void)
 {
        fprintf(stderr, "Usage: rtmon file FILE [ all | LISTofOBJECTS]\n");
        fprintf(stderr, "LISTofOBJECTS := [ link ] [ address ] [ route ]\n");
index ea17987d6849f9ff8f19dc1501acc0144d1e77db..bfc48f1b516b8571c4aae835af186a784fe3c254 100644 (file)
@@ -206,7 +206,7 @@ static int xfrm_report_print(const struct sockaddr_nl *who,
        return 0;
 }
 
-void xfrm_ae_flags_print(__u32 flags, void *arg)
+static void xfrm_ae_flags_print(__u32 flags, void *arg)
 {
        FILE *fp = (FILE*)arg;
        fprintf(fp, " (0x%x) ", flags);
index 8e3aec503b0aeb4d3f878a76c137c7b634340584..bf263e0df781846b18b2a896f6d6409f391f54ef 100644 (file)
@@ -896,7 +896,7 @@ static int xfrm_policy_list_or_deleteall(int argc, char **argv, int deleteall)
        exit(0);
 }
 
-int print_spdinfo( struct nlmsghdr *n, void *arg)
+static int print_spdinfo( struct nlmsghdr *n, void *arg)
 {
        FILE *fp = (FILE*)arg;
        __u32 *f = NLMSG_DATA(n);
index 0d98e78729da01595787c166dcf5df0c00de6d98..35957bdde621a7407db709123da5bb5670f659c6 100644 (file)
@@ -1053,7 +1053,7 @@ static int xfrm_state_list_or_deleteall(int argc, char **argv, int deleteall)
        exit(0);
 }
 
-int print_sadinfo(struct nlmsghdr *n, void *arg)
+static int print_sadinfo(struct nlmsghdr *n, void *arg)
 {
        FILE *fp = (FILE*)arg;
        __u32 *f = NLMSG_DATA(n);
index dd1de80c0d85925f28d40c6f5b7c716cfab5cfd8..ec9d570f86d6c8e36f48fde44aa28d2ccd1a9932 100644 (file)
@@ -92,7 +92,7 @@ int broadcast_rate = 1000;
 int broadcast_burst = 3000;
 int poll_timeout = 30000;
 
-void usage(void)
+static void usage(void)
 {
        fprintf(stderr,
                "Usage: arpd [ -lkh? ] [ -a N ] [ -b dbase ] [ -B number ]"
@@ -100,7 +100,7 @@ void usage(void)
        exit(1);
 }
 
-int handle_if(int ifindex)
+static int handle_if(int ifindex)
 {
        int i;
 
@@ -115,7 +115,7 @@ int handle_if(int ifindex)
 
 int sysctl_adjusted;
 
-void do_sysctl_adjustments(void)
+static void do_sysctl_adjustments(void)
 {
        int i;
 
@@ -148,7 +148,7 @@ void do_sysctl_adjustments(void)
        sysctl_adjusted = 1;
 }
 
-void undo_sysctl_adjustments(void)
+static void undo_sysctl_adjustments(void)
 {
        int i;
 
@@ -178,7 +178,7 @@ void undo_sysctl_adjustments(void)
 }
 
 
-int send_probe(int ifindex, __u32 addr)
+static int send_probe(int ifindex, __u32 addr)
 {
        struct ifreq ifr;
        struct sockaddr_in dst;
@@ -238,7 +238,7 @@ int send_probe(int ifindex, __u32 addr)
 
 /* Be very tough on sending probes: 1 per second with burst of 3. */
 
-int queue_active_probe(int ifindex, __u32 addr)
+static int queue_active_probe(int ifindex, __u32 addr)
 {
        static struct timeval prev;
        static int buckets;
@@ -262,7 +262,7 @@ int queue_active_probe(int ifindex, __u32 addr)
        return -1;
 }
 
-int respond_to_kernel(int ifindex, __u32 addr, char *lla, int llalen)
+static int respond_to_kernel(int ifindex, __u32 addr, char *lla, int llalen)
 {
        struct {
                struct nlmsghdr         n;
@@ -286,7 +286,7 @@ int respond_to_kernel(int ifindex, __u32 addr, char *lla, int llalen)
        return rtnl_send(&rth, &req, req.n.nlmsg_len) <= 0;
 }
 
-void prepare_neg_entry(__u8 *ndata, __u32 stamp)
+static void prepare_neg_entry(__u8 *ndata, __u32 stamp)
 {
        ndata[0] = 0xFF;
        ndata[1] = 0;
@@ -297,7 +297,7 @@ void prepare_neg_entry(__u8 *ndata, __u32 stamp)
 }
 
 
-int do_one_request(struct nlmsghdr *n)
+static int do_one_request(struct nlmsghdr *n)
 {
        struct ndmsg *ndm = NLMSG_DATA(n);
        int len = n->nlmsg_len;
@@ -426,12 +426,12 @@ int do_one_request(struct nlmsghdr *n)
        return 0;
 }
 
-void load_initial_table(void)
+static void load_initial_table(void)
 {
        rtnl_wilddump_request(&rth, AF_INET, RTM_GETNEIGH);
 }
 
-void get_kern_msg(void)
+static void get_kern_msg(void)
 {
        int status;
        struct nlmsghdr *h;
@@ -477,7 +477,7 @@ void get_kern_msg(void)
 }
 
 /* Receive gratuitous ARP messages and store them, that's all. */
-void get_arp_pkt(void)
+static void get_arp_pkt(void)
 {
        unsigned char buf[1024];
        struct sockaddr_ll sll;
@@ -532,7 +532,7 @@ void get_arp_pkt(void)
        dbase->put(dbase, &dbkey, &dbdat, 0);
 }
 
-void catch_signal(int sig, void (*handler)(int))
+static void catch_signal(int sig, void (*handler)(int))
 {
        struct sigaction sa;
 
@@ -548,21 +548,21 @@ void catch_signal(int sig, void (*handler)(int))
 sigjmp_buf env;
 volatile int in_poll;
 
-void sig_exit(int signo)
+static void sig_exit(int signo)
 {
        do_exit = 1;
        if (in_poll)
                siglongjmp(env, 1);
 }
 
-void sig_sync(int signo)
+static void sig_sync(int signo)
 {
        do_sync = 1;
        if (in_poll)
                siglongjmp(env, 1);
 }
 
-void sig_stats(int signo)
+static void sig_stats(int signo)
 {
        do_sync = 1;
        do_stats = 1;
@@ -570,7 +570,7 @@ void sig_stats(int signo)
                siglongjmp(env, 1);
 }
 
-void send_stats(void)
+static void send_stats(void)
 {
        syslog(LOG_INFO, "arp_rcv: n%lu c%lu app_rcv: tot %lu hits %lu bad %lu neg %lu sup %lu",
               stats.arp_new, stats.arp_change,
index e7fbaa8d4e97b966dda2dfc81ae3ca4e760642dd..6d0ad8cc78a8f91a378d9e6a5442313479f83ba3 100644 (file)
@@ -115,7 +115,7 @@ static int get_nlmsg(const struct sockaddr_nl *who,
        return 0;
 }
 
-void load_info(void)
+static void load_info(void)
 {
        struct ifstat_ent *db, *n;
        struct rtnl_handle rth;
@@ -146,7 +146,7 @@ void load_info(void)
        }
 }
 
-void load_raw_table(FILE *fp)
+static void load_raw_table(FILE *fp)
 {
        char buf[4096];
        struct ifstat_ent *db = NULL;
@@ -209,7 +209,7 @@ void load_raw_table(FILE *fp)
        }
 }
 
-void dump_raw_db(FILE *fp, int to_hist)
+static void dump_raw_db(FILE *fp, int to_hist)
 {
        struct ifstat_ent *n, *h;
        h = hist_db;
@@ -244,7 +244,8 @@ static const unsigned long long giga = 1000000000ull;
 static const unsigned long long mega = 1000000;
 static const unsigned long long kilo = 1000;
 
-void format_rate(FILE *fp, unsigned long long *vals, double *rates, int i)
+static void format_rate(FILE *fp, unsigned long long *vals,
+                       double *rates, int i)
 {
        char temp[64];
        if (vals[i] > giga)
@@ -264,7 +265,7 @@ void format_rate(FILE *fp, unsigned long long *vals, double *rates, int i)
                fprintf(fp, "%-6u ", (unsigned)rates[i]);
 }
 
-void format_pair(FILE *fp, unsigned long long *vals, int i, int k)
+static void format_pair(FILE *fp, unsigned long long *vals, int i, int k)
 {
        char temp[64];
        if (vals[i] > giga)
@@ -284,7 +285,7 @@ void format_pair(FILE *fp, unsigned long long *vals, int i, int k)
                fprintf(fp, "%-6u ", (unsigned)vals[k]);
 }
 
-void print_head(FILE *fp)
+static void print_head(FILE *fp)
 {
        fprintf(fp, "#%s\n", info_source);
        fprintf(fp, "%-15s ", "Interface");
@@ -327,7 +328,8 @@ void print_head(FILE *fp)
        }
 }
 
-void print_one_if(FILE *fp, struct ifstat_ent *n, unsigned long long *vals)
+static void print_one_if(FILE *fp, struct ifstat_ent *n,
+                        unsigned long long *vals)
 {
        int i;
        fprintf(fp, "%-15s ", n->name);
@@ -374,7 +376,7 @@ void print_one_if(FILE *fp, struct ifstat_ent *n, unsigned long long *vals)
 }
 
 
-void dump_kern_db(FILE *fp)
+static void dump_kern_db(FILE *fp)
 {
        struct ifstat_ent *n;
 
@@ -388,7 +390,7 @@ void dump_kern_db(FILE *fp)
 }
 
 
-void dump_incr_db(FILE *fp)
+static void dump_incr_db(FILE *fp)
 {
        struct ifstat_ent *n, *h;
        h = hist_db;
@@ -419,11 +421,11 @@ void dump_incr_db(FILE *fp)
 
 static int children;
 
-void sigchild(int signo)
+static void sigchild(int signo)
 {
 }
 
-void update_db(int interval)
+static void update_db(int interval)
 {
        struct ifstat_ent *n, *h;
 
@@ -482,7 +484,7 @@ void update_db(int interval)
 #define T_DIFF(a,b) (((a).tv_sec-(b).tv_sec)*1000 + ((a).tv_usec-(b).tv_usec)/1000)
 
 
-void server_loop(int fd)
+static void server_loop(int fd)
 {
        struct timeval snaptime = { 0 };
        struct pollfd p;
@@ -534,7 +536,7 @@ void server_loop(int fd)
        }
 }
 
-int verify_forging(int fd)
+static int verify_forging(int fd)
 {
        struct ucred cred;
        socklen_t olen = sizeof(cred);
index 2f06ffdd6a15c01b5c078492f2dd32e4cefaba6c..b68597870c1df75eda8484038fcf29a91cf9f2f2 100644 (file)
@@ -55,17 +55,17 @@ static int generic_proc_open(const char *env, char *name)
        return open(p, O_RDONLY);
 }
 
-int net_netstat_open(void)
+static int net_netstat_open(void)
 {
        return generic_proc_open("PROC_NET_NETSTAT", "net/netstat");
 }
 
-int net_snmp_open(void)
+static int net_snmp_open(void)
 {
        return generic_proc_open("PROC_NET_SNMP", "net/snmp");
 }
 
-int net_snmp6_open(void)
+static int net_snmp6_open(void)
 {
        return generic_proc_open("PROC_NET_SNMP6", "net/snmp6");
 }
@@ -82,13 +82,13 @@ struct nstat_ent
 struct nstat_ent *kern_db;
 struct nstat_ent *hist_db;
 
-char *useless_numbers[] = {
-"IpForwarding", "IpDefaultTTL",
-"TcpRtoAlgorithm", "TcpRtoMin", "TcpRtoMax",
-"TcpMaxConn", "TcpCurrEstab"
+static const char *useless_numbers[] = {
+       "IpForwarding", "IpDefaultTTL",
+       "TcpRtoAlgorithm", "TcpRtoMin", "TcpRtoMax",
+       "TcpMaxConn", "TcpCurrEstab"
 };
 
-int useless_number(char *id)
+static int useless_number(const char *id)
 {
        int i;
        for (i=0; i<sizeof(useless_numbers)/sizeof(*useless_numbers); i++)
@@ -97,7 +97,7 @@ int useless_number(char *id)
        return 0;
 }
 
-int match(char *id)
+static int match(const char *id)
 {
        int i;
 
@@ -111,7 +111,7 @@ int match(char *id)
        return 0;
 }
 
-void load_good_table(FILE *fp)
+static void load_good_table(FILE *fp)
 {
        char buf[4096];
        struct nstat_ent *db = NULL;
@@ -157,7 +157,7 @@ void load_good_table(FILE *fp)
 }
 
 
-void load_ugly_table(FILE *fp)
+static void load_ugly_table(FILE *fp)
 {
        char buf[4096];
        struct nstat_ent *db = NULL;
@@ -228,7 +228,7 @@ void load_ugly_table(FILE *fp)
        }
 }
 
-void load_snmp(void)
+static void load_snmp(void)
 {
        FILE *fp = fdopen(net_snmp_open(), "r");
        if (fp) {
@@ -237,7 +237,7 @@ void load_snmp(void)
        }
 }
 
-void load_snmp6(void)
+static void load_snmp6(void)
 {
        FILE *fp = fdopen(net_snmp6_open(), "r");
        if (fp) {
@@ -246,7 +246,7 @@ void load_snmp6(void)
        }
 }
 
-void load_netstat(void)
+static void load_netstat(void)
 {
        FILE *fp = fdopen(net_netstat_open(), "r");
        if (fp) {
@@ -255,7 +255,7 @@ void load_netstat(void)
        }
 }
 
-void dump_kern_db(FILE *fp, int to_hist)
+static void dump_kern_db(FILE *fp, int to_hist)
 {
        struct nstat_ent *n, *h;
        h = hist_db;
@@ -280,7 +280,7 @@ void dump_kern_db(FILE *fp, int to_hist)
        }
 }
 
-void dump_incr_db(FILE *fp)
+static void dump_incr_db(FILE *fp)
 {
        struct nstat_ent *n, *h;
        h = hist_db;
@@ -311,11 +311,11 @@ void dump_incr_db(FILE *fp)
 
 static int children;
 
-void sigchild(int signo)
+static void sigchild(int signo)
 {
 }
 
-void update_db(int interval)
+static void update_db(int interval)
 {
        struct nstat_ent *n, *h;
 
@@ -367,7 +367,7 @@ void update_db(int interval)
 #define T_DIFF(a,b) (((a).tv_sec-(b).tv_sec)*1000 + ((a).tv_usec-(b).tv_usec)/1000)
 
 
-void server_loop(int fd)
+static void server_loop(int fd)
 {
        struct timeval snaptime = { 0 };
        struct pollfd p;
@@ -419,7 +419,7 @@ void server_loop(int fd)
        }
 }
 
-int verify_forging(int fd)
+static int verify_forging(int fd)
 {
        struct ucred cred;
        socklen_t olen = sizeof(cred);
index 49168bdd6faef24550fde0a12ffac13252cf776b..bb8c90f98f5a621ca14dcdfd7753024d60fb40dc 100644 (file)
@@ -55,12 +55,12 @@ static int generic_proc_open(const char *env, const char *name)
        return open(p, O_RDONLY);
 }
 
-int net_rtacct_open(void)
+static int net_rtacct_open(void)
 {
        return generic_proc_open("PROC_NET_RTACCT", "net/rt_acct");
 }
 
-__u32 rmap[256/4];
+static __u32 rmap[256/4];
 
 struct rtacct_data
 {
@@ -71,12 +71,12 @@ struct rtacct_data
        char                    signature[128];
 };
 
-struct rtacct_data kern_db_static;
+static struct rtacct_data kern_db_static;
 
-struct rtacct_data *kern_db = &kern_db_static;
-struct rtacct_data *hist_db;
+static struct rtacct_data *kern_db = &kern_db_static;
+static struct rtacct_data *hist_db;
 
-void nread(int fd, char *buf, int tot)
+static void nread(int fd, char *buf, int tot)
 {
        int count = 0;
 
@@ -93,8 +93,7 @@ void nread(int fd, char *buf, int tot)
        }
 }
 
-
-__u32 *read_kern_table(__u32 *tbl)
+static __u32 *read_kern_table(__u32 *tbl)
 {
        static __u32 *tbl_ptr;
        int fd;
@@ -130,7 +129,7 @@ __u32 *read_kern_table(__u32 *tbl)
        return tbl;
 }
 
-void format_rate(FILE *fp, double rate)
+static void format_rate(FILE *fp, double rate)
 {
        char temp[64];
 
@@ -144,7 +143,7 @@ void format_rate(FILE *fp, double rate)
                fprintf(fp, " %-10u", (unsigned)rate);
 }
 
-void format_count(FILE *fp, unsigned long long val)
+static void format_count(FILE *fp, unsigned long long val)
 {
        if (val > 1024*1024*1024)
                fprintf(fp, " %10lluM", val/(1024*1024));
@@ -154,7 +153,7 @@ void format_count(FILE *fp, unsigned long long val)
                fprintf(fp, " %10llu", val);
 }
 
-void dump_abs_db(FILE *fp)
+static void dump_abs_db(FILE *fp)
 {
        int realm;
        char b1[16];
@@ -216,7 +215,7 @@ void dump_abs_db(FILE *fp)
 }
 
 
-void dump_incr_db(FILE *fp)
+static void dump_incr_db(FILE *fp)
 {
        int k, realm;
        char b1[16];
@@ -293,13 +292,13 @@ void dump_incr_db(FILE *fp)
 
 static int children;
 
-void sigchild(int signo)
+static void sigchild(int signo)
 {
 }
 
 /* Server side only: read kernel data, update tables, calculate rates. */
 
-void update_db(int interval)
+static void update_db(int interval)
 {
        int i;
        __u32 *ival;
@@ -331,7 +330,7 @@ void update_db(int interval)
        }
 }
 
-void send_db(int fd)
+static void send_db(int fd)
 {
        int tot = 0;
 
@@ -351,7 +350,7 @@ void send_db(int fd)
 #define T_DIFF(a,b) (((a).tv_sec-(b).tv_sec)*1000 + ((a).tv_usec-(b).tv_usec)/1000)
 
 
-void pad_kern_table(struct rtacct_data *dat, __u32 *ival)
+static void pad_kern_table(struct rtacct_data *dat, __u32 *ival)
 {
        int i;
        memset(dat->rate, 0, sizeof(dat->rate));
@@ -361,7 +360,7 @@ void pad_kern_table(struct rtacct_data *dat, __u32 *ival)
                dat->val[i] = ival[i];
 }
 
-void server_loop(int fd)
+static void server_loop(int fd)
 {
        struct timeval snaptime = { 0 };
        struct pollfd p;
@@ -410,7 +409,7 @@ void server_loop(int fd)
        }
 }
 
-int verify_forging(int fd)
+static int verify_forging(int fd)
 {
        struct ucred cred;
        socklen_t olen = sizeof(cred);
index b8cd60de20e751666eac71384592f6ebce28ae99..ff7c194d58151350bdd5d707e89c9bb9dc54fd36 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -309,7 +309,7 @@ static void user_ent_hash_build(void)
        closedir(dir);
 }
 
-int find_users(unsigned ino, char *buf, int buflen)
+static int find_users(unsigned ino, char *buf, int buflen)
 {
        struct user_ent *p;
        int cnt = 0;
@@ -365,7 +365,7 @@ static const char *slabstat_ids[] =
        "skbuff_head_cache",
 };
 
-int get_slabstat(struct slabstat *s)
+static int get_slabstat(struct slabstat *s)
 {
        char buf[256];
        FILE *fp;
@@ -455,7 +455,7 @@ static const char *tmr_name[] = {
        "unknown"
 };
 
-const char *print_ms_timer(int timeout)
+static const char *print_ms_timer(int timeout)
 {
        static char buf[64];
        int secs, msecs, minutes;
@@ -482,7 +482,7 @@ const char *print_ms_timer(int timeout)
        return buf;
 }
 
-const char *print_hz_timer(int timeout)
+static const char *print_hz_timer(int timeout)
 {
        int hz = get_user_hz();
        return print_ms_timer(((timeout*1000) + hz-1)/hz);
@@ -498,7 +498,7 @@ struct scache
 
 struct scache *rlist;
 
-void init_service_resolver(void)
+static void init_service_resolver(void)
 {
        char buf[128];
        FILE *fp = popen("/usr/sbin/rpcinfo -p 2>/dev/null", "r");
@@ -555,7 +555,7 @@ static int is_ephemeral(int port)
 }
 
 
-const char *__resolve_service(int port)
+static const char *__resolve_service(int port)
 {
        struct scache *c;
 
@@ -580,7 +580,7 @@ const char *__resolve_service(int port)
 }
 
 
-const char *resolve_service(int port)
+static const char *resolve_service(int port)
 {
        static char buf[128];
        static struct scache cache[256];
@@ -634,7 +634,7 @@ const char *resolve_service(int port)
        return buf;
 }
 
-void formatted_print(const inet_prefix *a, int port)
+static void formatted_print(const inet_prefix *a, int port)
 {
        char buf[1024];
        const char *ap = buf;
@@ -667,7 +667,8 @@ struct aafilter
        struct aafilter *next;
 };
 
-int inet2_addr_match(const inet_prefix *a, const inet_prefix *p, int plen)
+static int inet2_addr_match(const inet_prefix *a, const inet_prefix *p,
+                           int plen)
 {
        if (!inet_addr_match(a, p, plen))
                return 0;
@@ -686,7 +687,7 @@ int inet2_addr_match(const inet_prefix *a, const inet_prefix *p, int plen)
        return 1;
 }
 
-int unix_match(const inet_prefix *a, const inet_prefix *p)
+static int unix_match(const inet_prefix *a, const inet_prefix *p)
 {
        char *addr, *pattern;
        memcpy(&addr, a->data, sizeof(addr));
@@ -698,7 +699,7 @@ int unix_match(const inet_prefix *a, const inet_prefix *p)
        return !fnmatch(pattern, addr, 0);
 }
 
-int run_ssfilter(struct ssfilter *f, struct tcpstat *s)
+static int run_ssfilter(struct ssfilter *f, struct tcpstat *s)
 {
        switch (f->type) {
                case SSF_S_AUTO:
@@ -1882,7 +1883,7 @@ outerr:
 }
 
 
-int dgram_show_line(char *line, const struct filter *f, int family)
+static int dgram_show_line(char *line, const struct filter *f, int family)
 {
        struct tcpstat s;
        char *loc, *rem, *data;
@@ -1974,7 +1975,7 @@ int dgram_show_line(char *line, const struct filter *f, int family)
 }
 
 
-int udp_show(struct filter *f)
+static int udp_show(struct filter *f)
 {
        FILE *fp = NULL;
 
@@ -2010,7 +2011,7 @@ outerr:
        } while (0);
 }
 
-int raw_show(struct filter *f)
+static int raw_show(struct filter *f)
 {
        FILE *fp = NULL;
 
@@ -2063,7 +2064,7 @@ int unix_state_map[] = { SS_CLOSE, SS_SYN_SENT,
 
 #define MAX_UNIX_REMEMBER (1024*1024/sizeof(struct unixstat))
 
-void unix_list_free(struct unixstat *list)
+static void unix_list_free(struct unixstat *list)
 {
        while (list) {
                struct unixstat *s = list;
@@ -2074,7 +2075,7 @@ void unix_list_free(struct unixstat *list)
        }
 }
 
-void unix_list_print(struct unixstat *list, struct filter *f)
+static void unix_list_print(struct unixstat *list, struct filter *f)
 {
        struct unixstat *s;
        char *peer;
@@ -2283,7 +2284,7 @@ close_it:
        return 0;
 }
 
-int unix_show(struct filter *f)
+static int unix_show(struct filter *f)
 {
        FILE *fp;
        char buf[256];
@@ -2368,7 +2369,7 @@ int unix_show(struct filter *f)
 }
 
 
-int packet_show(struct filter *f)
+static int packet_show(struct filter *f)
 {
        FILE *fp;
        char buf[256];
@@ -2445,7 +2446,7 @@ int packet_show(struct filter *f)
        return 0;
 }
 
-int netlink_show(struct filter *f)
+static int netlink_show(struct filter *f)
 {
        FILE *fp;
        char buf[256];
@@ -2534,7 +2535,7 @@ struct snmpstat
        int tcp_estab;
 };
 
-int get_snmp_int(char *proto, char *key, int *result)
+static int get_snmp_int(char *proto, char *key, int *result)
 {
        char buf[1024];
        FILE *fp;
@@ -2629,7 +2630,7 @@ static void get_sockstat_line(char *line, struct sockstat *s)
                       &s->tcp_orphans, &s->tcp_tws, &s->tcp_total, &s->tcp_mem);
 }
 
-int get_sockstat(struct sockstat *s)
+static int get_sockstat(struct sockstat *s)
 {
        char buf[256];
        FILE *fp;
@@ -2651,7 +2652,7 @@ int get_sockstat(struct sockstat *s)
        return 0;
 }
 
-int print_summary(void)
+static int print_summary(void)
 {
        struct sockstat s;
        struct snmpstat sn;
@@ -2743,7 +2744,7 @@ static void usage(void)
 }
 
 
-int scan_state(const char *state)
+static int scan_state(const char *state)
 {
        int i;
        if (strcasecmp(state, "close") == 0 ||
index 8eaf85d815200d88f957dd4b16f69e2124389f1b..44d3bdfcf780470d7d6cd73890ee890f93b0b31f 100644 (file)
@@ -37,7 +37,7 @@ static void explain(void)
        fprintf(stderr, "\nNOTE: CLASSID is parsed as hexadecimal input.\n");
 }
 
-int get_addr_and_pi(int *argc_p, char ***argv_p, inet_prefix * addr,
+static int get_addr_and_pi(int *argc_p, char ***argv_p, inet_prefix * addr,
                    struct tc_rsvp_pinfo *pinfo, int dir, int family)
 {
        int argc = *argc_p;
index 66c3247213f67c4f06b9d435e797cca589dec86b..f2a862d0a56eea1c7ed94ff1ce3d8a5fd99c01f5 100644 (file)
@@ -45,7 +45,7 @@ static void explain(void)
        fprintf(stderr, "\nNOTE: CLASSID is parsed at hexadecimal input.\n");
 }
 
-int get_u32_handle(__u32 *handle, const char *str)
+static int get_u32_handle(__u32 *handle, const char *str)
 {
        __u32 htid=0, hash=0, nodeid=0;
        char *tmp = strchr(str, ':');
@@ -80,7 +80,7 @@ int get_u32_handle(__u32 *handle, const char *str)
        return 0;
 }
 
-char * sprint_u32_handle(__u32 handle, char *buf)
+static char * sprint_u32_handle(__u32 handle, char *buf)
 {
        int bsize = SPRINT_BSIZE-1;
        __u32 htid = TC_U32_HTID(handle);
@@ -194,7 +194,7 @@ static int pack_key8(struct tc_u32_sel *sel, __u32 key, __u32 mask, int off, int
 }
 
 
-int parse_at(int *argc_p, char ***argv_p, int *off, int *offmask)
+static int parse_at(int *argc_p, char ***argv_p, int *off, int *offmask)
 {
        int argc = *argc_p;
        char **argv = *argv_p;
index 1fe24314ed1e610397f6dc2dc4bfb92cc3a41b10..4acabef056db1b54e0d755c4cc4cba058a69c639 100644 (file)
@@ -35,7 +35,7 @@ int gact_ld = 0 ; //fuckin backward compatibility
 int batch_c = 0;
 int tab_flush = 0;
 
-void act_usage(void)
+static void act_usage(void)
 {
        /*XXX: In the near future add a action->print_help to improve
         * usability
@@ -83,7 +83,7 @@ static int parse_noaopt(struct action_util *au, int *argc_p, char ***argv_p, int
        return -1;
 }
 
-struct action_util *get_action_kind(char *str)
+static struct action_util *get_action_kind(char *str)
 {
        static void *aBODY;
        void *dlh;
@@ -138,7 +138,7 @@ noexist:
        return a;
 }
 
-int
+static int
 new_cmd(char **argv)
 {
        if ((matches(*argv, "change") == 0) ||
@@ -241,7 +241,7 @@ bad_val:
        return -1;
 }
 
-int
+static int
 tc_print_one_action(FILE * f, struct rtattr *arg)
 {
 
@@ -355,7 +355,7 @@ int print_action(const struct sockaddr_nl *who,
        return 0;
 }
 
-int tc_action_gd(int cmd, unsigned flags, int *argc_p, char ***argv_p)
+static int tc_action_gd(int cmd, unsigned flags, int *argc_p, char ***argv_p)
 {
        char k[16];
        struct action_util *a = NULL;
@@ -467,7 +467,7 @@ bad_val:
        return ret;
 }
 
-int tc_action_modify(int cmd, unsigned flags, int *argc_p, char ***argv_p)
+static int tc_action_modify(int cmd, unsigned flags, int *argc_p, char ***argv_p)
 {
        int argc = *argc_p;
        char **argv = *argv_p;
@@ -507,7 +507,7 @@ int tc_action_modify(int cmd, unsigned flags, int *argc_p, char ***argv_p)
        return ret;
 }
 
-int tc_act_list_or_flush(int argc, char **argv, int event)
+static int tc_act_list_or_flush(int argc, char **argv, int event)
 {
        int ret = 0, prio = 0, msg_size = 0;
        char k[16];
index a9e5dbc8e88c1a130d6f8a2d72c4dea9b801a2c0..3dc8624ff5f5652f2ec715c6861f4f534cbd6bd3 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "utils.h"
 #include "tc_util.h"
+#include "tc_common.h"
 
 static void est_help(void);
 
@@ -31,7 +32,6 @@ static void est_help(void)
        fprintf(stderr, "  INTERVAL is interval between measurements\n");
        fprintf(stderr, "  TIME-CONST is averaging time constant\n");
        fprintf(stderr, "Example: ... est 1sec 8sec\n");
-       return;
 }
 
 int parse_estimator(int *p_argc, char ***p_argv, struct tc_estimator *est)
index 9f07851a6dab9e9b03bd4f43f27f9397472c29cf..94bd5e7361c6c5d907d503cdddb967ca972b33fe 100644 (file)
@@ -68,7 +68,7 @@ usage(void)
        exit(-1);
 }
 
-int
+static int
 get_act(char ***argv_p)
 {
        char **argv = *argv_p;
@@ -89,8 +89,9 @@ get_act(char ***argv_p)
        }
 }
 
-int
-parse_gact(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
+static int
+parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
+          int tca_id, struct nlmsghdr *n)
 {
        int argc = *argc_p;
        char **argv = *argv_p;
@@ -202,7 +203,7 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struc
        return 0;
 }
 
-int
+static int
 print_gact(struct action_util *au,FILE * f, struct rtattr *arg)
 {
        SPRINT_BUF(b1);
index 0d771bc4715e1f80c9454fa339d2adbf54ec4ab6..1ef9f2bd2ce035e91017d8307b13989ba3a8007f 100644 (file)
@@ -45,7 +45,7 @@ usage(void)
        exit(-1);
 }
 
-char *mirred_n2a(int action)
+static const char *mirred_n2a(int action)
 {
        switch (action) {
        case TCA_EGRESS_REDIR:
@@ -61,8 +61,9 @@ char *mirred_n2a(int action)
        }
 }
 
-int
-parse_egress(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
+static int
+parse_egress(struct action_util *a, int *argc_p, char ***argv_p,
+            int tca_id, struct nlmsghdr *n)
 {
 
        int argc = *argc_p;
@@ -205,8 +206,9 @@ parse_egress(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, str
 }
 
 
-int
-parse_mirred(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
+static int
+parse_mirred(struct action_util *a, int *argc_p, char ***argv_p,
+            int tca_id, struct nlmsghdr *n)
 {
 
        int argc = *argc_p;
@@ -245,7 +247,7 @@ parse_mirred(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, str
 
 }
 
-int
+static int
 print_mirred(struct action_util *au,FILE * f, struct rtattr *arg)
 {
        struct tc_mirred *p;
index 7499846310ac33366e82ad353c4ffe4582f3e283..452d96f44db36ce00ef80f0e1e8249761efda137 100644 (file)
@@ -73,8 +73,7 @@ pedit_parse_nopopt (int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct
 
 }
 
-struct m_pedit_util
-*get_pedit_kind(char *str)
+static struct m_pedit_util *get_pedit_kind(const char *str)
 {
        static void *pBODY;
        void *dlh;
@@ -411,7 +410,7 @@ done:
        return res;
 }
 
-int
+static int
 parse_munge(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel)
 {
        struct tc_pedit_key tkey;
index c3869b66541d24369d9929c284ba7dc059471e66..53cbefcf8a99351d45e77d7b74923f19387f037d 100644 (file)
@@ -50,7 +50,7 @@ static void explain1(char *arg)
        fprintf(stderr, "Illegal \"%s\"\n", arg);
 }
 
-char *police_action_n2a(int action, char *buf, int len)
+static const char *police_action_n2a(int action, char *buf, int len)
 {
        switch (action) {
        case -1:
@@ -72,7 +72,7 @@ char *police_action_n2a(int action, char *buf, int len)
        }
 }
 
-int police_action_a2n(char *arg, int *result)
+static int police_action_a2n(const char *arg, int *result)
 {
        int res;
 
@@ -100,7 +100,7 @@ int police_action_a2n(char *arg, int *result)
 }
 
 
-int get_police_result(int *action, int *result, char *arg)
+static int get_police_result(int *action, int *result, char *arg)
 {
        char *p = strchr(arg, '/');
 
index 21dca000ef2e71b719c82e7525940a51b190d922..3edf5205f8688fc586eada05a93f4d8b9008b3b7 100644 (file)
--- a/tc/m_xt.c
+++ b/tc/m_xt.c
@@ -76,7 +76,7 @@ static struct xtables_globals tcipt_globals = {
 /*
  * we may need to check for version mismatch
 */
-int
+static int
 build_st(struct xtables_target *target, struct xt_entry_target *t)
 {
 
@@ -98,7 +98,7 @@ build_st(struct xtables_target *target, struct xt_entry_target *t)
 
 }
 
-inline void set_lib_dir(void)
+static void set_lib_dir(void)
 {
 
        lib_dir = getenv("XTABLES_LIBDIR");
index b2d8c12934ac3fc6c4832110716de604ce8d0664..fa1022be9fd3190b734b4a95124ec955ffce9bf7 100644 (file)
@@ -104,7 +104,7 @@ static int mqprio_parse_opt(struct qdisc_util *qu, int argc,
        return 0;
 }
 
-int mqprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+static int mqprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 {
        int i;
        struct tc_mqprio_qopt *qopt;
index 7ff9e74ea33d545bf673de05619546905b3b5cf6..546ae01150af59fe62aecac39fdc76dfe0b44d25 100644 (file)
@@ -61,7 +61,7 @@ static int multiq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
        return 0;
 }
 
-int multiq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+static int multiq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 {
        struct tc_multiq_qopt *qopt;
 
index 2583072a735e6512db77e5cd0cd369f88727561c..9dd8712fcf3c570ae13015b1c0b68156f200d299 100644 (file)
@@ -87,12 +87,12 @@ static int get_percent(__u32 *percent, const char *str)
        return 0;
 }
 
-void print_percent(char *buf, int len, __u32 per)
+static void print_percent(char *buf, int len, __u32 per)
 {
        snprintf(buf, len, "%g%%", 100. * (double) per / max_percent_value);
 }
 
-char * sprint_percent(__u32 per, char *buf)
+static char * sprint_percent(__u32 per, char *buf)
 {
        print_percent(buf, SPRINT_BSIZE-1, per);
        return buf;
index 79072ade6236241132135870655e19f470514ca9..e8a9165258086d54820759266ddb64a733d0751e 100644 (file)
--- a/tc/q_rr.c
+++ b/tc/q_rr.c
@@ -88,7 +88,7 @@ static int rr_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlm
        return 0;
 }
 
-int rr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+static int rr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 {
        int i;
        struct tc_prio_qopt *qopt;
index 95bf6156428550af6059c0da9ccdcd973d44fcd9..6c0850d09f874ffd0108cea9031402111ee6875d 100644 (file)
@@ -40,7 +40,7 @@ static void usage(void)
        return;
 }
 
-int tc_class_modify(int cmd, unsigned flags, int argc, char **argv)
+static int tc_class_modify(int cmd, unsigned flags, int argc, char **argv)
 {
        struct {
                struct nlmsghdr         n;
@@ -232,7 +232,7 @@ int print_class(const struct sockaddr_nl *who,
 }
 
 
-int tc_class_list(int argc, char **argv)
+static int tc_class_list(int argc, char **argv)
 {
        struct tcmsg t;
        char d[16];
index 9a0ff391df1760cf2057351293896c7007e2d135..85b072ef45ce01e66102a728b40f00ce15c6ec5a 100644 (file)
@@ -76,7 +76,7 @@ unsigned tc_calc_xmitsize(unsigned rate, unsigned ticks)
  * (as the table will always be aligned for 48 bytes).
  *  --Hawk, d.7/11-2004. <hawk@diku.dk>
  */
-unsigned tc_align_to_atm(unsigned size)
+static unsigned tc_align_to_atm(unsigned size)
 {
        int linksize, cells;
        cells = size / ATM_CELL_PAYLOAD;
@@ -87,7 +87,7 @@ unsigned tc_align_to_atm(unsigned size)
        return linksize;
 }
 
-unsigned tc_adjust_size(unsigned sz, unsigned mpu, enum link_layer linklayer)
+static unsigned tc_adjust_size(unsigned sz, unsigned mpu, enum link_layer linklayer)
 {
        if (sz < mpu)
                sz = mpu;
@@ -181,7 +181,7 @@ again:
        return 0;
 }
 
-int tc_core_init()
+int tc_core_init(void)
 {
        FILE *fp;
        __u32 clock_res;
index c9e09d8eff44fcfa38e86b9ed41043d845c59f82..c3f2d5fa863e908d23989f86c879606d53fd65ae 100644 (file)
@@ -45,7 +45,7 @@ static void usage(void)
 }
 
 
-int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
+static int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 {
        struct {
                struct nlmsghdr         n;
@@ -260,7 +260,7 @@ int print_filter(const struct sockaddr_nl *who,
 }
 
 
-int tc_filter_list(int argc, char **argv)
+static int tc_filter_list(int argc, char **argv)
 {
        struct tcmsg t;
        char d[16];
index bf587445a2be1add89e7180da5ce69a05ba99938..0efe0343db0becd181bb2d5376d8f9d0f0ca1b6a 100644 (file)
@@ -35,7 +35,8 @@ static void usage(void)
 }
 
 
-int accept_tcmsg(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+static int accept_tcmsg(const struct sockaddr_nl *who,
+                       struct nlmsghdr *n, void *arg)
 {
        FILE *fp = (FILE*)arg;
 
index c8d7335b746e102f389e137f6c8e9ae367381953..f3bf5b57064aca5acb6bf7a2fe924dee5ef3c781 100644 (file)
@@ -44,7 +44,7 @@ static int usage(void)
        return -1;
 }
 
-int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv)
+static int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv)
 {
        struct qdisc_util *q = NULL;
        struct tc_estimator est;
@@ -277,7 +277,7 @@ int print_qdisc(const struct sockaddr_nl *who,
 }
 
 
-int tc_qdisc_list(int argc, char **argv)
+static int tc_qdisc_list(int argc, char **argv)
 {
        struct tcmsg t;
        char d[16];
index ccf8fa4dcc1a72eb21c9d82306cdbdc8113c47d7..8e62a0101e7259e2739b2d9106b594770aa919f2 100644 (file)
@@ -167,35 +167,6 @@ int get_rate(unsigned *rate, const char *str)
        return -1;
 }
 
-int get_rate_and_cell(unsigned *rate, int *cell_log, char *str)
-{
-       char * slash = strchr(str, '/');
-
-       if (slash)
-               *slash = 0;
-
-       if (get_rate(rate, str))
-               return -1;
-
-       if (slash) {
-               int cell;
-               int i;
-
-               if (get_integer(&cell, slash+1, 0))
-                       return -1;
-               *slash = '/';
-
-               for (i=0; i<32; i++) {
-                       if ((1<<i) == cell) {
-                               *cell_log = i;
-                               return 0;
-                       }
-               }
-               return -1;
-       }
-       return 0;
-}
-
 void print_rate(char *buf, int len, __u32 rate)
 {
        double tmp = (double)rate*8;
index 6b3ed1eb21c3b14546ba5c4548ada202a1dd49a1..4f544363393b9d17e55f86bb828bbc987f444d6a 100644 (file)
@@ -97,5 +97,6 @@ extern int  tc_print_action(FILE *f, const struct rtattr *tb);
 extern int  tc_print_ipt(FILE *f, const struct rtattr *tb);
 extern int  parse_action(int *, char ***, int, struct nlmsghdr *);
 extern void print_tm(FILE *f, const struct tcf_t *tm);
+extern int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
 
 #endif