diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2002-12-16 23:06:29 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2002-12-16 23:06:29 +0000 |
commit | a96e4aefd26b2d906b57dfc719ff4b7294d9345f (patch) | |
tree | 721c7870645c83063bb20b1f8e6ce34db4c2dba4 /sbin | |
parent | 602286ed035ffd90c696d49fb1ba167561af5ae8 (diff) |
KNF
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/pfctl/pfctl_altq.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c index b3c12b9460e..95c207eda41 100644 --- a/sbin/pfctl/pfctl_altq.c +++ b/sbin/pfctl/pfctl_altq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_altq.c,v 1.20 2002/12/08 00:19:47 henning Exp $ */ +/* $OpenBSD: pfctl_altq.c,v 1.21 2002/12/16 23:06:28 henning Exp $ */ /* * Copyright (C) 2002 @@ -49,20 +49,20 @@ #include "pfctl_parser.h" #include "pfctl_altq.h" -static int eval_pfqueue_cbq(struct pfctl *pf, struct pf_altq *); -static int cbq_compute_idletime(struct pfctl *, struct pf_altq *); -static int check_commit_cbq(int, int, struct pf_altq *); -static void print_cbq_opts(const struct pf_altq *); -static char *rate2str(double); -u_int32_t getifspeed(char *); -u_long getifmtu(char *); +static int eval_pfqueue_cbq(struct pfctl *pf, struct pf_altq *); +static int cbq_compute_idletime(struct pfctl *, struct pf_altq *); +static int check_commit_cbq(int, int, struct pf_altq *); +static void print_cbq_opts(const struct pf_altq *); +static char *rate2str(double); +u_int32_t getifspeed(char *); +u_long getifmtu(char *); TAILQ_HEAD(altqs, pf_altq) altqs = TAILQ_HEAD_INITIALIZER(altqs); void pfaltq_store(struct pf_altq *a) { - struct pf_altq *altq; + struct pf_altq *altq; if ((altq = malloc(sizeof(*altq))) == NULL) err(1, "malloc"); @@ -73,7 +73,7 @@ pfaltq_store(struct pf_altq *a) void pfaltq_free(struct pf_altq *a) { - struct pf_altq *altq; + struct pf_altq *altq; TAILQ_FOREACH(altq, &altqs, entries) { if (strncmp(a->ifname, altq->ifname, IFNAMSIZ) == 0 && @@ -88,7 +88,7 @@ pfaltq_free(struct pf_altq *a) struct pf_altq * pfaltq_lookup(const char *ifname) { - struct pf_altq *altq; + struct pf_altq *altq; TAILQ_FOREACH(altq, &altqs, entries) { if (strncmp(ifname, altq->ifname, IFNAMSIZ) == 0 && @@ -101,7 +101,7 @@ pfaltq_lookup(const char *ifname) struct pf_altq * qname_to_pfaltq(const char *qname, const char *ifname) { - struct pf_altq *altq; + struct pf_altq *altq; TAILQ_FOREACH(altq, &altqs, entries) { if (strncmp(ifname, altq->ifname, IFNAMSIZ) == 0 && @@ -114,7 +114,7 @@ qname_to_pfaltq(const char *qname, const char *ifname) u_int32_t qname_to_qid(const char *qname, const char *ifname) { - struct pf_altq *altq; + struct pf_altq *altq; TAILQ_FOREACH(altq, &altqs, entries) { if (strncmp(ifname, altq->ifname, IFNAMSIZ) == 0 && @@ -127,7 +127,7 @@ qname_to_qid(const char *qname, const char *ifname) char * qid_to_qname(u_int32_t qid, const char *ifname) { - struct pf_altq *altq; + struct pf_altq *altq; TAILQ_FOREACH(altq, &altqs, entries) { if (strncmp(ifname, altq->ifname, IFNAMSIZ) == 0 && @@ -221,8 +221,8 @@ eval_pfaltq(struct pfctl *pf, struct pf_altq *pa, u_int32_t bw_absolute, int check_commit_altq(int dev, int opts) { - struct pf_altq *altq; - int error = 0; + struct pf_altq *altq; + int error = 0; TAILQ_FOREACH(altq, &altqs, entries) { if (altq->qname[0] == 0) { @@ -243,8 +243,8 @@ eval_pfqueue(struct pfctl *pf, struct pf_altq *pa, u_int32_t bw_absolute, u_int16_t bw_percent) { /* should be merged with expand_queue */ - struct pf_altq *if_pa, *parent; - int error = 0; + struct pf_altq *if_pa, *parent; + int error = 0; /* find the corresponding interface and copy fields used by queues */ if_pa = pfaltq_lookup(pa->ifname); @@ -296,8 +296,8 @@ eval_pfqueue(struct pfctl *pf, struct pf_altq *pa, u_int32_t bw_absolute, static int eval_pfqueue_cbq(struct pfctl *pf, struct pf_altq *pa) { - struct cbq_opts *opts; - u_int ifmtu; + struct cbq_opts *opts; + u_int ifmtu; ifmtu = getifmtu(pa->ifname); opts = &pa->pq_u.cbq_opts; @@ -330,11 +330,11 @@ eval_pfqueue_cbq(struct pfctl *pf, struct pf_altq *pa) static int cbq_compute_idletime(struct pfctl *pf, struct pf_altq *pa) { - struct cbq_opts *opts; - double maxidle_s, maxidle, minidle; - double offtime, nsPerByte, ifnsPerByte, ptime, cptime; - double z, g, f, gton, gtom, maxrate; - u_int minburst, maxburst; + struct cbq_opts *opts; + double maxidle_s, maxidle, minidle; + double offtime, nsPerByte, ifnsPerByte, ptime, cptime; + double z, g, f, gton, gtom, maxrate; + u_int minburst, maxburst; opts = &pa->pq_u.cbq_opts; ifnsPerByte = (1.0 / (double)pa->ifbandwidth) * RM_NS_PER_SEC * 8; @@ -411,9 +411,9 @@ cbq_compute_idletime(struct pfctl *pf, struct pf_altq *pa) static int check_commit_cbq(int dev, int opts, struct pf_altq *pa) { - struct pf_altq *altq; - int root_class, default_class; - int error = 0; + struct pf_altq *altq; + int root_class, default_class; + int error = 0; /* * check if cbq has one root class and one default class @@ -444,7 +444,7 @@ check_commit_cbq(int dev, int opts, struct pf_altq *pa) static void print_cbq_opts(const struct pf_altq *a) { - const struct cbq_opts *opts; + const struct cbq_opts *opts; opts = &a->pq_u.cbq_opts; @@ -486,7 +486,7 @@ void pfctl_insert_altq_node(struct pf_altq_node **root, const struct pf_altq altq) { - struct pf_altq_node *node; + struct pf_altq_node *node; node = calloc(1, sizeof(struct pf_altq_node)); if (node == NULL) { @@ -528,7 +528,7 @@ struct pf_altq_node * pfctl_find_altq_node(struct pf_altq_node *root, const char *qname, const char *ifname) { - struct pf_altq_node *node, *child; + struct pf_altq_node *node, *child; for (node = root; node != NULL; node = node->next) { if (!strcmp(node->altq.qname, qname) @@ -547,7 +547,7 @@ pfctl_find_altq_node(struct pf_altq_node *root, const char *qname, void pfctl_print_altq_node(const struct pf_altq_node *node, unsigned level) { - const struct pf_altq_node *child; + const struct pf_altq_node *child; if (node == NULL) return; @@ -592,9 +592,9 @@ pfctl_free_altq_node(struct pf_altq_node *node) static char * rate2str(double rate) { - char *buf; - static char r2sbuf[R2S_BUFS][RATESTR_MAX]; /* ring bufer */ - static int idx = 0; + char *buf; + static char r2sbuf[R2S_BUFS][RATESTR_MAX]; /* ring bufer */ + static int idx = 0; buf = r2sbuf[idx++]; if (idx == R2S_BUFS) @@ -617,9 +617,9 @@ rate2str(double rate) u_int32_t getifspeed(char *ifname) { - int s; - struct ifreq ifr; - struct if_data ifrdat; + int s; + struct ifreq ifr; + struct if_data ifrdat; if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) err(1, "socket"); @@ -635,8 +635,8 @@ getifspeed(char *ifname) u_long getifmtu(char *ifname) { - int s; - struct ifreq ifr; + int s; + struct ifreq ifr; if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) err(1, "socket"); |