Date: Thu, 14 Oct 2010 21:07:09 +0000 (UTC) From: Weongyo Jeong <weongyo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r213854 - user/weongyo/usb/sys/dev/usb Message-ID: <201010142107.o9EL79x5037074@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: weongyo Date: Thu Oct 14 21:07:09 2010 New Revision: 213854 URL: http://svn.freebsd.org/changeset/base/213854 Log: Distinguishes the kernel and userland parts for usb_pf.h. Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c user/weongyo/usb/sys/dev/usb/usb_pf.h Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 20:50:33 2010 (r213853) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 21:07:09 2010 (r213854) @@ -95,63 +95,6 @@ MALLOC_DEFINE(M_USBPF, "USBPktFilter", " #endif /* - * The instruction encodings. - */ - -/* instruction classes */ -#define USBPF_CLASS(code) ((code) & 0x07) -#define USBPF_LD 0x00 -#define USBPF_LDX 0x01 -#define USBPF_ST 0x02 -#define USBPF_STX 0x03 -#define USBPF_ALU 0x04 -#define USBPF_JMP 0x05 -#define USBPF_RET 0x06 -#define USBPF_MISC 0x07 - -/* ld/ldx fields */ -#define USBPF_SIZE(code) ((code) & 0x18) -#define USBPF_W 0x00 -#define USBPF_H 0x08 -#define USBPF_B 0x10 -#define USBPF_MODE(code) ((code) & 0xe0) -#define USBPF_IMM 0x00 -#define USBPF_ABS 0x20 -#define USBPF_IND 0x40 -#define USBPF_MEM 0x60 -#define USBPF_LEN 0x80 -#define USBPF_MSH 0xa0 - -/* alu/jmp fields */ -#define USBPF_OP(code) ((code) & 0xf0) -#define USBPF_ADD 0x00 -#define USBPF_SUB 0x10 -#define USBPF_MUL 0x20 -#define USBPF_DIV 0x30 -#define USBPF_OR 0x40 -#define USBPF_AND 0x50 -#define USBPF_LSH 0x60 -#define USBPF_RSH 0x70 -#define USBPF_NEG 0x80 -#define USBPF_JA 0x00 -#define USBPF_JEQ 0x10 -#define USBPF_JGT 0x20 -#define USBPF_JGE 0x30 -#define USBPF_JSET 0x40 -#define USBPF_SRC(code) ((code) & 0x08) -#define USBPF_K 0x00 -#define USBPF_X 0x08 - -/* ret - USBPF_K and USBPF_X also apply */ -#define USBPF_RVAL(code) ((code) & 0x18) -#define USBPF_A 0x10 - -/* misc */ -#define USBPF_MISCOP(code) ((code) & 0xf8) -#define USBPF_TAX 0x00 -#define USBPF_TXA 0x80 - -/* * Number of scratch memory words (for USBPF_LD|USBPF_MEM and USBPF_ST). */ #define USBPF_MEMWORDS 16 Modified: user/weongyo/usb/sys/dev/usb/usb_pf.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 20:50:33 2010 (r213853) +++ user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 21:07:09 2010 (r213854) @@ -37,10 +37,12 @@ #ifndef _DEV_USB_PF_H #define _DEV_USB_PF_H +#ifdef _KERNEL #include <sys/callout.h> #include <sys/selinfo.h> #include <sys/queue.h> #include <sys/conf.h> +#endif typedef int32_t usbpf_int32; typedef u_int32_t usbpf_u_int32; @@ -50,6 +52,63 @@ typedef u_int64_t usbpf_u_int64; struct usbpf_if; /* + * The instruction encodings. + */ + +/* instruction classes */ +#define USBPF_CLASS(code) ((code) & 0x07) +#define USBPF_LD 0x00 +#define USBPF_LDX 0x01 +#define USBPF_ST 0x02 +#define USBPF_STX 0x03 +#define USBPF_ALU 0x04 +#define USBPF_JMP 0x05 +#define USBPF_RET 0x06 +#define USBPF_MISC 0x07 + +/* ld/ldx fields */ +#define USBPF_SIZE(code) ((code) & 0x18) +#define USBPF_W 0x00 +#define USBPF_H 0x08 +#define USBPF_B 0x10 +#define USBPF_MODE(code) ((code) & 0xe0) +#define USBPF_IMM 0x00 +#define USBPF_ABS 0x20 +#define USBPF_IND 0x40 +#define USBPF_MEM 0x60 +#define USBPF_LEN 0x80 +#define USBPF_MSH 0xa0 + +/* alu/jmp fields */ +#define USBPF_OP(code) ((code) & 0xf0) +#define USBPF_ADD 0x00 +#define USBPF_SUB 0x10 +#define USBPF_MUL 0x20 +#define USBPF_DIV 0x30 +#define USBPF_OR 0x40 +#define USBPF_AND 0x50 +#define USBPF_LSH 0x60 +#define USBPF_RSH 0x70 +#define USBPF_NEG 0x80 +#define USBPF_JA 0x00 +#define USBPF_JEQ 0x10 +#define USBPF_JGT 0x20 +#define USBPF_JGE 0x30 +#define USBPF_JSET 0x40 +#define USBPF_SRC(code) ((code) & 0x08) +#define USBPF_K 0x00 +#define USBPF_X 0x08 + +/* ret - USBPF_K and USBPF_X also apply */ +#define USBPF_RVAL(code) ((code) & 0x18) +#define USBPF_A 0x10 + +/* misc */ +#define USBPF_MISCOP(code) ((code) & 0xf8) +#define USBPF_TAX 0x00 +#define USBPF_TXA 0x80 + +/* * The instruction data structure. */ struct usbpf_insn { @@ -59,6 +118,8 @@ struct usbpf_insn { usbpf_u_int32 k; }; +#ifdef _KERNEL + /* * Descriptor associated with each open uff file. */ @@ -133,6 +194,8 @@ struct usbpf_if { #define USBPFIF_LOCK(uif) mtx_lock(&(uif)->uif_mtx) #define USBPFIF_UNLOCK(uif) mtx_unlock(&(uif)->uif_mtx) +#endif + /* * Structure prepended to each packet. */ @@ -195,10 +258,13 @@ struct usbpf_program { #define UIOCVERSION _IOR('U', 113, struct usbpf_version) #define UIOCSETWF _IOW('B', 123, struct usbpf_program) -void usbpf_attach(struct usb_bus *, struct usbpf_if **); -void usbpf_detach(struct usb_bus *); #define USBPF_XFERTAP_SUBMIT 0 #define USBPF_XFERTAP_DONE 1 + +#ifdef _KERNEL +void usbpf_attach(struct usb_bus *, struct usbpf_if **); +void usbpf_detach(struct usb_bus *); void usbpf_xfertap(struct usb_xfer *, int); +#endif #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010142107.o9EL79x5037074>