Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Dec 2012 00:13:58 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r243921 - projects/bpfjit/sys/net
Message-ID:  <201212060013.qB60Dw4i016526@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Thu Dec  6 00:13:57 2012
New Revision: 243921
URL: http://svnweb.freebsd.org/changeset/base/243921

Log:
  Add m_xbyte() and make m_xhalf(), m_xword(), and m_xbyte() global.  These
  functions are used by bpfjit.c later.  While I am here, make it compilable
  again in userland (broken in r224044).

Modified:
  projects/bpfjit/sys/net/bpf_filter.c

Modified: projects/bpfjit/sys/net/bpf_filter.c
==============================================================================
--- projects/bpfjit/sys/net/bpf_filter.c	Thu Dec  6 00:06:15 2012	(r243920)
+++ projects/bpfjit/sys/net/bpf_filter.c	Thu Dec  6 00:13:57 2012	(r243921)
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/mbuf.h>
 #else
 #include <stdlib.h>
+#include <strings.h>
 #endif
 #include <net/bpf.h>
 #ifdef _KERNEL
@@ -82,11 +83,12 @@ __FBSDID("$FreeBSD$");
 	} \
 }
 
-static u_int16_t	m_xhalf(struct mbuf *m, bpf_u_int32 k, int *err);
-static u_int32_t	m_xword(struct mbuf *m, bpf_u_int32 k, int *err);
+uint32_t	m_xhalf(const struct mbuf *, uint32_t, int *);
+uint32_t	m_xword(const struct mbuf *, uint32_t, int *);
+uint32_t	m_xbyte(const struct mbuf *, uint32_t, int *);
 
-static u_int32_t
-m_xword(struct mbuf *m, bpf_u_int32 k, int *err)
+uint32_t
+m_xword(const struct mbuf *m, uint32_t k, int *err)
 {
 	size_t len;
 	u_char *cp, *np;
@@ -134,8 +136,8 @@ m_xword(struct mbuf *m, bpf_u_int32 k, i
 	return (0);
 }
 
-static u_int16_t
-m_xhalf(struct mbuf *m, bpf_u_int32 k, int *err)
+uint32_t
+m_xhalf(const struct mbuf *m, uint32_t k, int *err)
 {
 	size_t len;
 	u_char *cp;
@@ -163,6 +165,15 @@ m_xhalf(struct mbuf *m, bpf_u_int32 k, i
 	*err = 1;
 	return (0);
 }
+
+uint32_t
+m_xbyte(const struct mbuf *m, uint32_t k, int *err)
+{
+
+	*err = 0;
+	MINDEX(m, k);
+	return (mtod(m, u_char *)[k]);
+}
 #endif
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212060013.qB60Dw4i016526>