Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Use kmem instead of malloc. Requested by rmind.
details: https://anonhg.NetBSD.org/src/rev/f78984db7ca8
branches: trunk
changeset: 762310:f78984db7ca8
user: christos <christos%NetBSD.org@localhost>
date: Sat Feb 19 04:10:47 2011 +0000
description:
Use kmem instead of malloc. Requested by rmind.
diffstat:
sys/net/bpf_filter.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (53 lines):
diff -r 03427edb127f -r f78984db7ca8 sys/net/bpf_filter.c
--- a/sys/net/bpf_filter.c Sat Feb 19 02:22:27 2011 +0000
+++ b/sys/net/bpf_filter.c Sat Feb 19 04:10:47 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf_filter.c,v 1.43 2011/02/19 02:22:27 matt Exp $ */
+/* $NetBSD: bpf_filter.c,v 1.44 2011/02/19 04:10:47 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.43 2011/02/19 02:22:27 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.44 2011/02/19 04:10:47 christos Exp $");
#if 0
#if !(defined(lint) || defined(KERNEL))
@@ -48,6 +48,7 @@
#include <sys/param.h>
#include <sys/time.h>
+#include <sys/kmem.h>
#include <sys/endian.h>
#define EXTRACT_SHORT(p) be16dec(p)
@@ -466,7 +467,7 @@
int
bpf_validate(const struct bpf_insn *f, int signed_len)
{
- u_int i, from, len, ok = 0;
+ u_int i, from, len, ok = 0, size;
const struct bpf_insn *p;
#if defined(KERNEL) || defined(_KERNEL)
uint16_t *mem, invalid;
@@ -483,7 +484,7 @@
return 0;
#if defined(KERNEL) || defined(_KERNEL)
- mem = malloc(sizeof(*mem) * len, M_TEMP, M_WAITOK|M_ZERO);
+ mem = kmem_zalloc(size = sizeof(*mem) * len, KM_SLEEP);
invalid = ~0; /* All is invalid on startup */
#endif
@@ -633,7 +634,7 @@
ok = 1;
out:
#if defined(KERNEL) || defined(_KERNEL)
- free(mem, M_TEMP);
+ kmem_free(mem, size);
#endif
return ok;
}
Home |
Main Index |
Thread Index |
Old Index