Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net constify
details: https://anonhg.NetBSD.org/src/rev/691b5407d112
branches: trunk
changeset: 759266:691b5407d112
user: christos <christos%NetBSD.org@localhost>
date: Sun Dec 05 00:34:21 2010 +0000
description:
constify
diffstat:
sys/net/bpf.h | 4 ++--
sys/net/bpf_filter.c | 35 ++++++++++++++++++-----------------
2 files changed, 20 insertions(+), 19 deletions(-)
diffs (151 lines):
diff -r 56ab85671bc6 -r 691b5407d112 sys/net/bpf.h
--- a/sys/net/bpf.h Sat Dec 04 23:08:32 2010 +0000
+++ b/sys/net/bpf.h Sun Dec 05 00:34:21 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf.h,v 1.55 2010/04/05 07:22:22 joerg Exp $ */
+/* $NetBSD: bpf.h,v 1.56 2010/12/05 00:34:21 christos Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@@ -361,7 +361,7 @@
int bpf_validate(struct bpf_insn *, int);
#endif
-u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int);
+u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
/*
* Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
diff -r 56ab85671bc6 -r 691b5407d112 sys/net/bpf_filter.c
--- a/sys/net/bpf_filter.c Sat Dec 04 23:08:32 2010 +0000
+++ b/sys/net/bpf_filter.c Sun Dec 05 00:34:21 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf_filter.c,v 1.36 2010/04/21 16:35:09 drochner Exp $ */
+/* $NetBSD: bpf_filter.c,v 1.37 2010/12/05 00:34:21 christos Exp $ */
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.36 2010/04/21 16:35:09 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.37 2010/12/05 00:34:21 christos Exp $");
#if 0
#if !(defined(lint) || defined(KERNEL))
@@ -67,11 +67,11 @@
} \
}
-static int m_xword (struct mbuf *, uint32_t, int *);
-static int m_xhalf (struct mbuf *, uint32_t, int *);
+static int m_xword (const struct mbuf *, uint32_t, int *);
+static int m_xhalf (const struct mbuf *, uint32_t, int *);
static int
-m_xword(struct mbuf *m, uint32_t k, int *err)
+m_xword(const struct mbuf *m, uint32_t k, int *err)
{
int len;
u_char *cp, *np;
@@ -103,7 +103,7 @@
}
static int
-m_xhalf(struct mbuf *m, uint32_t k, int *err)
+m_xhalf(const struct mbuf *m, uint32_t k, int *err)
{
int len;
u_char *cp;
@@ -134,7 +134,8 @@
* buflen is the amount of data present
*/
u_int
-bpf_filter(struct bpf_insn *pc, u_char *p, u_int wirelen, u_int buflen)
+bpf_filter(const struct bpf_insn *pc, const u_char *p, u_int wirelen,
+ u_int buflen)
{
uint32_t A, X, k;
uint32_t mem[BPF_MEMWORDS];
@@ -172,7 +173,7 @@
if (buflen != 0)
return 0;
- A = m_xword((struct mbuf *)p, k, &merr);
+ A = m_xword((const struct mbuf *)p, k, &merr);
if (merr != 0)
return 0;
continue;
@@ -191,7 +192,7 @@
if (buflen != 0)
return 0;
- A = m_xhalf((struct mbuf *)p, k, &merr);
+ A = m_xhalf((const struct mbuf *)p, k, &merr);
if (merr != 0)
return 0;
continue;
@@ -206,12 +207,12 @@
k = pc->k;
if (k >= buflen) {
#ifdef _KERNEL
- struct mbuf *m;
+ const struct mbuf *m;
int len;
if (buflen != 0)
return 0;
- m = (struct mbuf *)p;
+ m = (const struct mbuf *)p;
MINDEX(len, m, k);
A = mtod(m, u_char *)[k];
continue;
@@ -238,7 +239,7 @@
if (buflen != 0)
return 0;
- A = m_xword((struct mbuf *)p, k, &merr);
+ A = m_xword((const struct mbuf *)p, k, &merr);
if (merr != 0)
return 0;
continue;
@@ -257,7 +258,7 @@
if (buflen != 0)
return 0;
- A = m_xhalf((struct mbuf *)p, k, &merr);
+ A = m_xhalf((const struct mbuf *)p, k, &merr);
if (merr != 0)
return 0;
continue;
@@ -272,12 +273,12 @@
k = X + pc->k;
if (k >= buflen) {
#ifdef _KERNEL
- struct mbuf *m;
+ const struct mbuf *m;
int len;
if (buflen != 0)
return 0;
- m = (struct mbuf *)p;
+ m = (const struct mbuf *)p;
MINDEX(len, m, k);
A = mtod(m, u_char *)[k];
continue;
@@ -292,12 +293,12 @@
k = pc->k;
if (k >= buflen) {
#ifdef _KERNEL
- struct mbuf *m;
+ const struct mbuf *m;
int len;
if (buflen != 0)
return 0;
- m = (struct mbuf *)p;
+ m = (const struct mbuf *)p;
MINDEX(len, m, k);
X = (mtod(m, char *)[k] & 0xf) << 2;
continue;
Home |
Main Index |
Thread Index |
Old Index