summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2011-10-07 17:10:09 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2011-10-07 17:10:09 +0000
commit9159a47401161354ebe99adc3be8eda11d9eaa1c (patch)
tree7e5e306f3c1dada50f7c5eda854d31d664aa15cf
parent6a23c1b6a9f7b5f85e35f156f1c09f787321b8c2 (diff)
rename some vars and functions
unfortunately altq is one giant namespace violation. rename just those that conflict with new stuff for now only to be found on my laptop. reduce pain, the diff is huge already. ok ryan
-rw-r--r--sys/altq/altq.h4
-rw-r--r--sys/altq/altq_subr.c60
-rw-r--r--sys/altq/altq_var.h6
-rw-r--r--sys/altq/if_altq.h11
-rw-r--r--sys/net/if.h8
-rw-r--r--sys/net/pf_ioctl.c43
-rw-r--r--sys/net/pfvar.h5
7 files changed, 68 insertions, 69 deletions
diff --git a/sys/altq/altq.h b/sys/altq/altq.h
index d28297ca769..6f32bd679d1 100644
--- a/sys/altq/altq.h
+++ b/sys/altq/altq.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq.h,v 1.8 2011/07/03 23:47:04 henning Exp $ */
+/* $OpenBSD: altq.h,v 1.9 2011/10/07 17:10:08 henning Exp $ */
/* $KAME: altq.h,v 1.6 2000/12/14 08:12:45 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#define ALTQT_MAX 12 /* should be max discipline type + 1 */
/* simple token bucket meter profile */
-struct tb_profile {
+struct oldtb_profile {
u_int rate; /* rate in bit-per-sec */
u_int depth; /* depth in bytes */
};
diff --git a/sys/altq/altq_subr.c b/sys/altq/altq_subr.c
index 9c62920a605..fefd45d5158 100644
--- a/sys/altq/altq_subr.c
+++ b/sys/altq/altq_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_subr.c,v 1.27 2011/07/03 23:48:41 henning Exp $ */
+/* $OpenBSD: altq_subr.c,v 1.28 2011/10/07 17:10:08 henning Exp $ */
/* $KAME: altq_subr.c,v 1.11 2002/01/11 08:11:49 kjc Exp $ */
/*
@@ -59,10 +59,10 @@
/*
* internal function prototypes
*/
-static void tbr_timeout(void *);
+static void oldtbr_timeout(void *);
int (*altq_input)(struct mbuf *, int) = NULL;
-static int tbr_timer = 0; /* token bucket regulator timer */
-static struct callout tbr_callout = CALLOUT_INITIALIZER;
+static int oldtbr_timer = 0; /* token bucket regulator timer */
+static struct callout oldtbr_callout = CALLOUT_INITIALIZER;
/*
* alternate queueing support routines
@@ -195,16 +195,14 @@ altq_assert(file, line, failedexpr)
* depth: byte << 32
*
*/
-#define TBR_SHIFT 32
-#define TBR_SCALE(x) ((int64_t)(x) << TBR_SHIFT)
-#define TBR_UNSCALE(x) ((x) >> TBR_SHIFT)
+#define OLDTBR_SHIFT 32
+#define OLDTBR_SCALE(x) ((int64_t)(x) << OLDTBR_SHIFT)
+#define OLDTBR_UNSCALE(x) ((x) >> OLDTBR_SHIFT)
struct mbuf *
-tbr_dequeue(ifq, op)
- struct ifaltq *ifq;
- int op;
+oldtbr_dequeue(struct ifaltq *ifq, int op)
{
- struct tb_regulator *tbr;
+ struct oldtb_regulator *tbr;
struct mbuf *m;
int64_t interval;
u_int64_t now;
@@ -241,7 +239,7 @@ tbr_dequeue(ifq, op)
}
if (m != NULL && op == ALTDQ_REMOVE)
- tbr->tbr_token -= TBR_SCALE(m_pktlen(m));
+ tbr->tbr_token -= OLDTBR_SCALE(m_pktlen(m));
tbr->tbr_lastop = op;
return (m);
}
@@ -251,16 +249,16 @@ tbr_dequeue(ifq, op)
* if the specified rate is zero, the token bucket regulator is deleted.
*/
int
-tbr_set(ifq, profile)
+oldtbr_set(ifq, profile)
struct ifaltq *ifq;
- struct tb_profile *profile;
+ struct oldtb_profile *profile;
{
- struct tb_regulator *tbr, *otbr;
+ struct oldtb_regulator *tbr, *otbr;
if (machclk_freq == 0)
init_machclk();
if (machclk_freq == 0) {
- printf("tbr_set: no cpu clock available!\n");
+ printf("oldtbr_set: no cpu clock available!\n");
return (ENXIO);
}
@@ -273,10 +271,10 @@ tbr_set(ifq, profile)
return (0);
}
- tbr = malloc(sizeof(struct tb_regulator), M_DEVBUF, M_WAITOK|M_ZERO);
+ tbr = malloc(sizeof(struct oldtb_regulator), M_DEVBUF, M_WAITOK|M_ZERO);
- tbr->tbr_rate = TBR_SCALE(profile->rate / 8) / machclk_freq;
- tbr->tbr_depth = TBR_SCALE(profile->depth);
+ tbr->tbr_rate = OLDTBR_SCALE(profile->rate / 8) / machclk_freq;
+ tbr->tbr_depth = OLDTBR_SCALE(profile->depth);
if (tbr->tbr_rate > 0)
tbr->tbr_filluptime = tbr->tbr_depth / tbr->tbr_rate;
else
@@ -291,9 +289,9 @@ tbr_set(ifq, profile)
if (otbr != NULL)
free(otbr, M_DEVBUF);
else {
- if (tbr_timer == 0) {
- CALLOUT_RESET(&tbr_callout, 1, tbr_timeout, (void *)0);
- tbr_timer = 1;
+ if (oldtbr_timer == 0) {
+ CALLOUT_RESET(&oldtbr_callout, 1, oldtbr_timeout, NULL);
+ oldtbr_timer = 1;
}
}
return (0);
@@ -304,7 +302,7 @@ tbr_set(ifq, profile)
* if necessary.
*/
static void
-tbr_timeout(arg)
+oldtbr_timeout(arg)
void *arg;
{
struct ifnet *ifp;
@@ -313,7 +311,7 @@ tbr_timeout(arg)
active = 0;
s = splnet();
for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) {
- if (!TBR_IS_ENABLED(&ifp->if_snd))
+ if (!OLDTBR_IS_ENABLED(&ifp->if_snd))
continue;
active++;
if (!IFQ_IS_EMPTY(&ifp->if_snd) && ifp->if_start != NULL)
@@ -321,28 +319,28 @@ tbr_timeout(arg)
}
splx(s);
if (active > 0)
- CALLOUT_RESET(&tbr_callout, 1, tbr_timeout, (void *)0);
+ CALLOUT_RESET(&oldtbr_callout, 1, oldtbr_timeout, NULL);
else
- tbr_timer = 0; /* don't need tbr_timer anymore */
+ oldtbr_timer = 0; /* don't need tbr_timer anymore */
}
/*
* get token bucket regulator profile
*/
int
-tbr_get(ifq, profile)
+oldtbr_get(ifq, profile)
struct ifaltq *ifq;
- struct tb_profile *profile;
+ struct oldtb_profile *profile;
{
- struct tb_regulator *tbr;
+ struct oldtb_regulator *tbr;
if ((tbr = ifq->altq_tbr) == NULL) {
profile->rate = 0;
profile->depth = 0;
} else {
profile->rate =
- (u_int)TBR_UNSCALE(tbr->tbr_rate * 8 * machclk_freq);
- profile->depth = (u_int)TBR_UNSCALE(tbr->tbr_depth);
+ (u_int)OLDTBR_UNSCALE(tbr->tbr_rate * 8 * machclk_freq);
+ profile->depth = (u_int)OLDTBR_UNSCALE(tbr->tbr_depth);
}
return (0);
}
diff --git a/sys/altq/altq_var.h b/sys/altq/altq_var.h
index f01ab9c03b2..bda6527269b 100644
--- a/sys/altq/altq_var.h
+++ b/sys/altq/altq_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_var.h,v 1.16 2011/07/03 23:48:41 henning Exp $ */
+/* $OpenBSD: altq_var.h,v 1.17 2011/10/07 17:10:08 henning Exp $ */
/* $KAME: altq_var.h,v 1.8 2001/02/09 09:44:41 kjc Exp $ */
/*
@@ -99,8 +99,8 @@ struct pf_altq; struct pf_qstats;
void *altq_lookup(char *, int);
void write_dsfield(struct mbuf *, struct altq_pktattr *, u_int8_t);
void altq_assert(const char *, int, const char *);
-int tbr_set(struct ifaltq *, struct tb_profile *);
-int tbr_get(struct ifaltq *, struct tb_profile *);
+int oldtbr_set(struct ifaltq *, struct oldtb_profile *);
+int oldtbr_get(struct ifaltq *, struct oldtb_profile *);
int altq_pfattach(struct pf_altq *);
int altq_pfdetach(struct pf_altq *);
diff --git a/sys/altq/if_altq.h b/sys/altq/if_altq.h
index b294d200fee..2570d841c00 100644
--- a/sys/altq/if_altq.h
+++ b/sys/altq/if_altq.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_altq.h,v 1.14 2011/07/08 18:48:50 henning Exp $ */
+/* $OpenBSD: if_altq.h,v 1.15 2011/10/07 17:10:08 henning Exp $ */
/* $KAME: if_altq.h,v 1.6 2001/01/29 19:59:09 itojun Exp $ */
/*
@@ -63,7 +63,7 @@ struct ifaltq {
void *(*altq_classify)(void *, struct mbuf *, int);
/* token bucket regulator */
- struct tb_regulator *altq_tbr;
+ struct oldtb_regulator *altq_tbr;
};
#ifdef _KERNEL
@@ -94,7 +94,7 @@ struct altq_pktattr {
* a token-bucket is used to control the burst size in a device
* independent manner.
*/
-struct tb_regulator {
+struct oldtb_regulator {
int64_t tbr_rate; /* (scaled) token bucket rate */
int64_t tbr_depth; /* (scaled) token bucket depth */
@@ -141,7 +141,8 @@ struct tb_regulator {
#define ALTQ_PURGE(ifq) \
(void)(*(ifq)->altq_request)((ifq), ALTRQ_PURGE, (void *)0)
#define ALTQ_IS_EMPTY(ifq) ((ifq)->ifq_len == 0)
-#define TBR_IS_ENABLED(ifq) ((ifq)->altq_tbr != NULL)
+#define OLDTBR_IS_ENABLED(ifq) ((ifq)->altq_tbr != NULL)
+#define TBR_IS_ENABLED(ifq) OLDTBR_IS_ENABLED(ifq)
extern int altq_attach(struct ifaltq *, int, void *,
int (*)(struct ifaltq *, struct mbuf *,
@@ -153,7 +154,7 @@ extern int altq_attach(struct ifaltq *, int, void *,
extern int altq_detach(struct ifaltq *);
extern int altq_enable(struct ifaltq *);
extern int altq_disable(struct ifaltq *);
-extern struct mbuf *tbr_dequeue(struct ifaltq *, int);
+extern struct mbuf *oldtbr_dequeue(struct ifaltq *, int);
extern int (*altq_input)(struct mbuf *, int);
#endif /* _KERNEL */
diff --git a/sys/net/if.h b/sys/net/if.h
index 602780b946e..fb521924cdb 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.128 2011/07/08 18:48:51 henning Exp $ */
+/* $OpenBSD: if.h,v 1.129 2011/10/07 17:10:08 henning Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -724,8 +724,8 @@ do { \
#define IFQ_DEQUEUE(ifq, m) \
do { \
- if (TBR_IS_ENABLED((ifq))) \
- (m) = tbr_dequeue((ifq), ALTDQ_REMOVE); \
+ if (OLDTBR_IS_ENABLED((ifq))) \
+ (m) = oldtbr_dequeue((ifq), ALTDQ_REMOVE); \
else if (ALTQ_IS_ENABLED((ifq))) \
ALTQ_DEQUEUE((ifq), (m)); \
else \
@@ -735,7 +735,7 @@ do { \
#define IFQ_POLL(ifq, m) \
do { \
if (TBR_IS_ENABLED((ifq))) \
- (m) = tbr_dequeue((ifq), ALTDQ_POLL); \
+ (m) = oldtbr_dequeue((ifq), ALTDQ_POLL); \
else if (ALTQ_IS_ENABLED((ifq))) \
ALTQ_POLL((ifq), (m)); \
else \
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index 7e652ab561a..fcd7cefdd33 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_ioctl.c,v 1.242 2011/08/30 00:40:47 mikeb Exp $ */
+/* $OpenBSD: pf_ioctl.c,v 1.243 2011/10/07 17:10:08 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -114,6 +114,9 @@ void pf_trans_set_commit(void);
void pf_pool_copyin(struct pf_pool *, struct pf_pool *);
int pf_rule_copyin(struct pf_rule *, struct pf_rule *,
struct pf_ruleset *);
+u_int32_t pf_oqname2qid(char *);
+void pf_oqid2qname(u_int32_t, char *);
+void pf_oqid_unref(u_int32_t);
struct pf_rule pf_default_rule, pf_default_rule_new;
struct rwlock pf_consistency_lock = RWLOCK_INITIALIZER("pfcnslk");
@@ -136,7 +139,7 @@ struct {
#define TAGID_MAX 50000
TAILQ_HEAD(pf_tags, pf_tagname) pf_tags = TAILQ_HEAD_INITIALIZER(pf_tags),
- pf_qids = TAILQ_HEAD_INITIALIZER(pf_qids);
+ pf_oqids = TAILQ_HEAD_INITIALIZER(pf_oqids);
#if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE)
#error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE
@@ -289,8 +292,8 @@ pf_rm_rule(struct pf_rulequeue *rulequeue, struct pf_rule *rule)
pf_tag_unref(rule->match_tag);
#ifdef ALTQ
if (rule->pqid != rule->qid)
- pf_qid_unref(rule->pqid);
- pf_qid_unref(rule->qid);
+ pf_oqid_unref(rule->pqid);
+ pf_oqid_unref(rule->qid);
#endif
pf_rtlabel_remove(&rule->src.addr);
pf_rtlabel_remove(&rule->dst.addr);
@@ -473,21 +476,21 @@ pf_rtlabel_copyout(struct pf_addr_wrap *a)
#ifdef ALTQ
u_int32_t
-pf_qname2qid(char *qname)
+pf_oqname2qid(char *qname)
{
- return ((u_int32_t)tagname2tag(&pf_qids, qname));
+ return ((u_int32_t)tagname2tag(&pf_oqids, qname));
}
void
-pf_qid2qname(u_int32_t qid, char *p)
+pf_oqid2qname(u_int32_t qid, char *p)
{
- tag2tagname(&pf_qids, (u_int16_t)qid, p);
+ tag2tagname(&pf_oqids, (u_int16_t)qid, p);
}
void
-pf_qid_unref(u_int32_t qid)
+pf_oqid_unref(u_int32_t qid)
{
- tag_unref(&pf_qids, (u_int16_t)qid);
+ tag_unref(&pf_oqids, (u_int16_t)qid);
}
int
@@ -503,7 +506,7 @@ pf_begin_altq(u_int32_t *ticket)
/* detach and destroy the discipline */
error = altq_remove(altq);
} else
- pf_qid_unref(altq->qid);
+ pf_oqid_unref(altq->qid);
pool_put(&pf_altq_pl, altq);
}
if (error)
@@ -528,7 +531,7 @@ pf_rollback_altq(u_int32_t ticket)
/* detach and destroy the discipline */
error = altq_remove(altq);
} else
- pf_qid_unref(altq->qid);
+ pf_oqid_unref(altq->qid);
pool_put(&pf_altq_pl, altq);
}
altqs_inactive_open = 0;
@@ -580,7 +583,7 @@ pf_commit_altq(u_int32_t ticket)
if (err != 0 && error == 0)
error = err;
} else
- pf_qid_unref(altq->qid);
+ pf_oqid_unref(altq->qid);
pool_put(&pf_altq_pl, altq);
}
splx(s);
@@ -593,7 +596,7 @@ int
pf_enable_altq(struct pf_altq *altq)
{
struct ifnet *ifp;
- struct tb_profile tb;
+ struct oldtb_profile tb;
int s, error = 0;
if ((ifp = ifunit(altq->ifname)) == NULL)
@@ -607,7 +610,7 @@ pf_enable_altq(struct pf_altq *altq)
tb.rate = altq->ifbandwidth;
tb.depth = altq->tbrsize;
s = splnet();
- error = tbr_set(&ifp->if_snd, &tb);
+ error = oldtbr_set(&ifp->if_snd, &tb);
splx(s);
}
@@ -618,7 +621,7 @@ int
pf_disable_altq(struct pf_altq *altq)
{
struct ifnet *ifp;
- struct tb_profile tb;
+ struct oldtb_profile tb;
int s, error;
if ((ifp = ifunit(altq->ifname)) == NULL)
@@ -637,7 +640,7 @@ pf_disable_altq(struct pf_altq *altq)
/* clear tokenbucket regulator */
tb.rate = 0;
s = splnet();
- error = tbr_set(&ifp->if_snd, &tb);
+ error = oldtbr_set(&ifp->if_snd, &tb);
splx(s);
}
@@ -1673,7 +1676,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
* copy the necessary fields
*/
if (altq->qname[0] != 0) {
- if ((altq->qid = pf_qname2qid(altq->qname)) == 0) {
+ if ((altq->qid = pf_oqname2qid(altq->qname)) == 0) {
error = EBUSY;
pool_put(&pf_altq_pl, altq);
break;
@@ -2560,10 +2563,10 @@ pf_rule_copyin(struct pf_rule *from, struct pf_rule *to,
#ifdef ALTQ
/* set queue IDs */
if (to->qname[0] != 0) {
- if ((to->qid = pf_qname2qid(to->qname)) == 0)
+ if ((to->qid = pf_oqname2qid(to->qname)) == 0)
return (EBUSY);
else if (to->pqname[0] != 0) {
- if ((to->pqid = pf_qname2qid(to->pqname)) == 0)
+ if ((to->pqid = pf_oqname2qid(to->pqname)) == 0)
return (EBUSY);
} else
to->pqid = to->qid;
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 14ae05af482..fe1ec5f0e4f 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfvar.h,v 1.352 2011/10/07 14:02:48 henning Exp $ */
+/* $OpenBSD: pfvar.h,v 1.353 2011/10/07 17:10:08 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1898,9 +1898,6 @@ void pf_tag2tagname(u_int16_t, char *);
void pf_tag_ref(u_int16_t);
void pf_tag_unref(u_int16_t);
void pf_tag_packet(struct mbuf *, int, int);
-u_int32_t pf_qname2qid(char *);
-void pf_qid2qname(u_int32_t, char *);
-void pf_qid_unref(u_int32_t);
int pf_addr_compare(struct pf_addr *, struct pf_addr *,
sa_family_t);