svn commit: r403864 - in head/emulators/qemu: . files

Muhammad Moinur Rahman bofh at FreeBSD.org
Wed Dec 16 14:15:22 UTC 2015


Author: bofh
Date: Wed Dec 16 14:15:19 2015
New Revision: 403864
URL: https://svnweb.freebsd.org/changeset/ports/403864

Log:
  emulators/qemu: Update version 0.11.1=>2.4.1
  
  - MASTER_SITES has been changed from SAVANNAH and local repo of nox@
    to new wiki.qemu.org
  - Take MAINTAINERSHIP
  - Updated to maintain version release with UPSTREAM. qemu-devel will be
  updated to maintain with SNAPSHOTS
  - Some of the patches has been converted to OPTIONSNG with post-patch
  - Most of the patches are now makepatch compatible
  - Converted most of the LEGACY OPTIONS to OPTIONSNG

Added:
  head/emulators/qemu/files/patch-disas_libvixl_a64_disasm-a64.cc   (contents, props changed)
  head/emulators/qemu/files/patch-include_net_net.h   (contents, props changed)
  head/emulators/qemu/files/patch-include_qemu-common.h   (contents, props changed)
  head/emulators/qemu/files/patch-net_tap-bsd.c   (contents, props changed)
  head/emulators/qemu/files/patch-qemu-char.c   (contents, props changed)
  head/emulators/qemu/files/patch-slirp_slirp__config.h   (contents, props changed)
  head/emulators/qemu/files/patch-ui_x__keymap.c   (contents, props changed)
Deleted:
  head/emulators/qemu/files/cdrom-dma-patch
  head/emulators/qemu/files/gns3-patch
  head/emulators/qemu/files/patch-0001-qcow2-Bring-synchronous-read-write-back-to-life
  head/emulators/qemu/files/patch-90_security
  head/emulators/qemu/files/patch-CVE-2015-3209
  head/emulators/qemu/files/patch-CVE-2015-3456
  head/emulators/qemu/files/patch-fbsd
  head/emulators/qemu/files/patch-hw-eepro100.c
  head/emulators/qemu/files/patch-hw-vmware_vga.c
  head/emulators/qemu/files/patch-iopl-workaround
  head/emulators/qemu/files/patch-libmath
  head/emulators/qemu/files/patch-libmath2
  head/emulators/qemu/files/patch-libmath_FreeBSD-version
  head/emulators/qemu/files/patch-osdep.c
  head/emulators/qemu/files/patch-pc-bios-optionrom-multiboot.S
  head/emulators/qemu/files/patch-qemu_Makefiles
  head/emulators/qemu/files/patch-qemu_configure_1
  head/emulators/qemu/files/patch-qemu_configure_2
  head/emulators/qemu/files/patch-qemu_net.c
  head/emulators/qemu/files/patch-qemu_slirp_slirp_config.h
  head/emulators/qemu/files/patch-smc-fix
  head/emulators/qemu/files/patch-tapclose
  head/emulators/qemu/files/patch-vl.c
  head/emulators/qemu/files/patch-vl.c-serial
  head/emulators/qemu/files/patch-x_keymap.c
  head/emulators/qemu/files/patch-z-bandaid-usb-current
  head/emulators/qemu/files/rtl8139-re-patch
Modified:
  head/emulators/qemu/Makefile
  head/emulators/qemu/distinfo
  head/emulators/qemu/files/patch-Makefile
  head/emulators/qemu/files/patch-configure
  head/emulators/qemu/files/patch-qemu-doc.texi
  head/emulators/qemu/files/pcap-patch
  head/emulators/qemu/pkg-descr
  head/emulators/qemu/pkg-message
  head/emulators/qemu/pkg-plist

Modified: head/emulators/qemu/Makefile
==============================================================================
--- head/emulators/qemu/Makefile	Wed Dec 16 14:11:42 2015	(r403863)
+++ head/emulators/qemu/Makefile	Wed Dec 16 14:15:19 2015	(r403864)
@@ -2,107 +2,133 @@
 # $FreeBSD$
 
 PORTNAME=	qemu
-PORTVERSION=	0.11.1
-PORTREVISION=	20
+PORTVERSION=	2.4.1
 CATEGORIES=	emulators
-MASTER_SITES=	SAVANNAH \
-		http://bellard.org/qemu/
-DIST_SUBDIR=	qemu
+MASTER_SITES=	http://wiki.qemu.org/download/
+DISTFILES=	${DISTNAME}${EXTRACT_SUFX}
+DIST_SUBDIR=	qemu/${PORTVERSION}
 
-MAINTAINER=	ports at FreeBSD.org
-COMMENT=	QEMU CPU Emulator
+MAINTAINER=	bofh at FreeBSD.org
+COMMENT?=	QEMU CPU Emulator
 
-LICENSE=	GPLv2 # or later
-LICENSE_FILE=	${WRKSRC}/COPYING
+LICENSE=	GPLv2
 
 HAS_CONFIGURE=	yes
-USES=		compiler:features cpe gmake perl5
+USES=		cpe gmake pkgconfig bison perl5 python:2,build tar:bzip2
 USE_PERL5=	build
-PATCH_STRIP=	-p1
+USE_XORG=	pixman
+USE_GNOME+=	glib20
 MAKE_ENV+=	BSD_MAKE="${MAKE}"
-ONLY_FOR_ARCHS=	amd64 i386
-CONFLICTS=	qemu-devel-[0-9]* qemu-sbruno-[0-9]*
+ONLY_FOR_ARCHS=	amd64 i386 powerpc powerpc64 # XXX someone wants to debug sparc64 hosts?
 
-OPTIONS_DEFINE=	KQEMU RTL8139_TIMER SAMBA SDL GNUTLS CURL PCAP GNS3 \
-		CDROM_DMA ADD_AUDIO ALL_TARGETS DOCS
-KQEMU_DESC=		Build with (alpha!) accelerator module
-RTL8139_TIMER_DESC=	allow use of re(4) nic with FreeBSD guests
+OPTIONS_DEFINE=	SAMBA X11 GTK2 OPENGL GNUTLS SASL JPEG PNG CURL \
+		CDROM_DMA PCAP USBREDIR GNS3 X86_TARGETS \
+		STATIC_LINK DOCS BSD_USER
 SAMBA_DESC=		samba dependency (for -smb)
-SDL_DESC=		SDL/X dependency (graphical output)
 GNUTLS_DESC=		gnutls dependency (vnc encryption)
-CURL_DESC=		libcurl dependency (remote images)
-PCAP_DESC=		pcap dependency (networking with bpf)
-GNS3_DESC=		gns3 patches (udp, promiscuous multicast)
+SASL_DESC=		cyrus-sasl dependency (vnc encryption)
+JPEG_DESC=		jpeg dependency (vnc lossy compression)
+PNG_DESC=		png dependency (vnc compression)
 CDROM_DMA_DESC=		IDE CDROM DMA
-ADD_AUDIO_DESC=		Emulate more audio hardware (experimental!)
-ALL_TARGETS_DESC=	Also build non-x86 targets
-OPTIONS_DEFAULT=	SDL GNUTLS CURL PCAP GNS3 CDROM_DMA
-
-.include <bsd.port.pre.mk>
+PCAP_DESC=		pcap dependency (networking with bpf)
+USBREDIR_DESC=		usb device network redirection (experimental!)
+GNS3_DESC=		gns3 patches (promiscuous multicast)
+X86_TARGETS_DESC=	Don't build non-x86 system targets
+BSD_USER_DESC=		Also build bsd-user targets (for testing)
+STATIC_LINK_DESC=	Statically link the executables
+OPTIONS_DEFAULT=X11 GTK2 OPENGL GNUTLS SASL JPEG PNG CDROM_DMA CURL PCAP GNS3
+OPTIONS_SUB=	yes
+X11_USE=	SDL=sdl
+X11_CONFIGURE_ON=	--enable-sdl
+X11_CONFIGURE_OFF=	--disable-sdl
+GTK2_USE=	GNOME=gtk20,vte
+GTK2_USES=	gettext
+GTK2_CONFIGURE_OFF=	--disable-gtk --disable-vte
+GNUTLS_LIB_DEPENDS=	libgnutls.so:${PORTSDIR}/security/gnutls
+GNUTLS_CONFIGURE_OFF=	--disable-vnc-tls
+SASL_LIB_DEPENDS=	libsasl2.so:${PORTSDIR}/security/cyrus-sasl2
+SASL_CONFIGURE_OFF=	--disable-vnc-sasl
+JPEG_USES=		jpeg
+JPEG_CONFIGURE_OFF=	--disable-vnc-jpeg
+PNG_LIB_DEPENDS=	libpng.so:${PORTSDIR}/graphics/png
+PNG_CONFIGURE_OFF=	--disable-vnc-png
+CURL_LIB_DEPENDS=	libcurl.so:${PORTSDIR}/ftp/curl
+CURL_CONFIGURE_OFF=	--disable-curl
+OPENGL_USE=	GL=yes
+OPENGL_CONFIGURE_OFF=	--disable-opengl
+USBREDIR_BUILD_DEPENDS=	usbredir>=0.6:${PORTSDIR}/net/usbredir
+USBREDIR_RUN_DEPENDS=	usbredir>=0.6:${PORTSDIR}/net/usbredir
+USBREDIR_CONFIGURE_OFF=	--disable-usb-redir
+PCAP_CONFIGURE_ON=	--enable-pcap
+STATIC_LINK_CONFIGURE_ON=	--static
+SAMBA_RUN_DEPENDS=	${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba36
+DOCS_BUILD_DEPENDS=	texi2html:${PORTSDIR}/textproc/texi2html
+DOCS_USES=		makeinfo
+DOCS_MAKE_ARGS_OFF=	NOPORTDOCS=1
 
-.if ${ARCH} == "i386" && ${COMPILER_TYPE} == "clang"
-# gcc49 breaks target-i386 on i386, and gcc48 breaks ALL_TARGETS on i386:
-#	https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196855
-USE_GCC=	4.7
-.else
-USE_GCC=	any
+.if !defined(QEMU_USER_STATIC)
+CONFLICTS_INSTALL=	qemu--devel-[0-9]* qemu-sbruno-[0-9]*
 .endif
 
-.if empty(PORT_OPTIONS:MALL_TARGETS)
-CONFIGURE_ARGS+=	--target-list=i386-softmmu,x86_64-softmmu
-PLIST_SUB+=	ALLTARGETS="@comment "
-.else
-PLIST_SUB+=	ALLTARGETS=""
-.endif
+PORTDOCS=	docs qemu-doc.html qemu-tech.html qmp-commands.txt
 
 WITHOUT_CPU_CFLAGS=yes	#to avoid problems with register allocation
 CFLAGS:=	${CFLAGS:C/-fno-tree-vrp//}
-CONFIGURE_ARGS+=	--prefix=${PREFIX} --cc=${CC}
+CONFIGURE_ARGS+=--localstatedir=/var --extra-ldflags=-L\"${LOCALBASE}/lib\" \
+		--disable-smartcard-nss --disable-libssh2 --enable-debug \
+		--prefix=${PREFIX} --cc=${CC} --enable-docs --disable-kvm \
+		--disable-linux-user --disable-linux-aio --disable-xen \
+		--smbd=${LOCALBASE}/sbin/smbd --enable-debug-info --python=${PYTHON_CMD} \
+		--extra-cflags=-I${WRKSRC}\ -I${LOCALBASE}/include\ -DPREFIX=\\\"\"${PREFIX}\\\"\"
+
+.include <bsd.port.options.mk>
 
-.if empty(PORT_OPTIONS:MSDL)
-CONFIGURE_ARGS+=	--disable-sdl
+.if defined(QEMU_USER_STATIC)
+.if ${ARCH} != "amd64"
+CONFIGURE_ARGS+=	--target-list=i386-bsd-user,sparc-bsd-user,arm-bsd-user,mips-bsd-user,mipsel-bsd-user
 .else
-USE_SDL=	sdl
+CONFIGURE_ARGS+=	--target-list=i386-bsd-user,x86_64-bsd-user,sparc-bsd-user,sparc64-bsd-user,arm-bsd-user,mips-bsd-user,mipsel-bsd-user,mips64-bsd-user,mips64el-bsd-user
 .endif
-
-.if empty(PORT_OPTIONS:MGNUTLS)
-CONFIGURE_ARGS+=	--disable-vnc-tls
 .else
-LIB_DEPENDS+=	libgnutls.so:${PORTSDIR}/security/gnutls
+.if ${PORT_OPTIONS:MX86_TARGETS}
+.if ${PORT_OPTIONS:MBSD_USER}
+.if ${ARCH} != "amd64"
+CONFIGURE_ARGS+=	--target-list=i386-softmmu,x86_64-softmmu,i386-bsd-user,sparc-bsd-user,arm-bsd-user,mips-bsd-user,mipsel-bsd-user
+.else
+CONFIGURE_ARGS+=	--target-list=i386-softmmu,x86_64-softmmu,i386-bsd-user,x86_64-bsd-user,sparc-bsd-user,sparc64-bsd-user,arm-bsd-user,mips-bsd-user,mipsel-bsd-user,mips64-bsd-user,mips64el-bsd-user
 .endif
-
-.if empty(PORT_OPTIONS:MCURL)
-CONFIGURE_ARGS+=	--disable-curl
 .else
-LIB_DEPENDS+=	libcurl.so:${PORTSDIR}/ftp/curl
+CONFIGURE_ARGS+=	--target-list=i386-softmmu,x86_64-softmmu
+.endif
+.else
+.if empty(PORT_OPTIONS:MBSD_USER)
+CONFIGURE_ARGS+=	--disable-bsd-user
+.else
+.if ${ARCH} != "amd64"
+CONFIGURE_ARGS+=	--target-list=i386-softmmu,x86_64-softmmu,aarch64-softmmu,alpha-softmmu,arm-softmmu,cris-softmmu,lm32-softmmu,m68k-softmmu,microblaze-softmmu,microblazeel-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu,or32-softmmu,ppc-softmmu,ppcemb-softmmu,ppc64-softmmu,sh4-softmmu,sh4eb-softmmu,sparc-softmmu,sparc64-softmmu,s390x-softmmu,xtensa-softmmu,xtensaeb-softmmu,unicore32-softmmu,moxie-softmmu,i386-bsd-user,sparc-bsd-user,arm-bsd-user,mips-bsd-user,mipsel-bsd-user
+.endif
 .endif
-
-.if ${PORT_OPTIONS:MPCAP}
-CONFIGURE_ARGS+=	--enable-pcap
 .endif
-
-.if ${PORT_OPTIONS:MADD_AUDIO}
-CONFIGURE_ARGS+=	--audio-card-list=ac97,es1370,sb16,cs4231a,adlib,gus
 .endif
 
-# XXX
-CONFIGURE_ARGS+=	--disable-bsd-user
-
-.if ${PORT_OPTIONS:MSAMBA}
-RUN_DEPENDS+=	${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba36
+.if ${PORT_OPTIONS:MBSD_USER} && ${ARCH} == "sparc64"
+IGNORE=	bsd-user targets not tested on sparc64
 .endif
 
-.if ${PORT_OPTIONS:MKQEMU}
-BUILD_DEPENDS+=	kqemu-kmod-devel>=1.4.0pre1:${PORTSDIR}/emulators/kqemu-kmod-devel
-RUN_DEPENDS+=	kqemu-kmod-devel>=1.4.0pre1:${PORTSDIR}/emulators/kqemu-kmod-devel
+.if empty(PORT_OPTIONS:MBSD_USER) || ${ARCH} != "amd64"
+PLIST_SUB+=     BSD_USER64="@comment "
 .else
-CONFIGURE_ARGS+=	--disable-kqemu
+PLIST_SUB+=     BSD_USER64=""
 .endif
 
-.if ${PORT_OPTIONS:MDOCS}
-BUILD_DEPENDS+=	texi2html:${PORTSDIR}/textproc/texi2html
+.if defined(QEMU_USER_STATIC)
+PLIST_SUB+=	SOFTMMU="@comment " STATIC="-static"
 .else
-MAKE_ARGS+=	NOPORTDOCS=1
+PLIST_SUB+=	SOFTMMU="" STATIC=""
+.endif
+
+.if ${PORT_OPTIONS:MSTATIC_LINK} && (${PORT_OPTIONS:MGTK2} || ${PORT_OPTIONS:MX11})
+IGNORE=		X11 ui cannot be built static
 .endif
 
 .if !defined(STRIP) || ${STRIP} == ""
@@ -113,29 +139,24 @@ CONFIGURE_ARGS+=--disable-strip
 MAKE_ARGS+=	ARCH=x86_64
 .endif
 
-post-extract:
-	@${MKDIR} ${WRKSRC}/kqemu
-	@${TOUCH} ${WRKSRC}/kqemu/Makefile
-	@${ECHO} all: > ${WRKSRC}/kqemu/Makefile.freebsd
-
-pre-patch:
-	@for A in ${ONLY_FOR_ARCHS}; do \
-		${MKDIR} ${WRKSRC}/bsd/$$A; \
-	done
-
-post-patch:
-.if ${PORT_OPTIONS:MRTL8139_TIMER}
-	@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/rtl8139-re-patch
-.endif
-.if ${PORT_OPTIONS:MPCAP}
-	@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/pcap-patch
+.if ${ARCH} == "powerpc"
+MAKE_ARGS+=	ARCH=ppc
 .endif
-.if ${PORT_OPTIONS:MGNS3}
-	@cd ${WRKSRC} && ${PATCH} -p1 --quiet < ${FILESDIR}/gns3-patch
+
+.if ${ARCH} == "powerpc64"
+MAKE_ARGS+=	ARCH=ppc64
 .endif
-.if empty(PORT_OPTIONS:MCDROM_DMA)
-	@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/cdrom-dma-patch
+
+.if ${ARCH} == "sparc64"
+CONFIGURE_ARGS+=	--sparc_cpu=v9
 .endif
+
+# -lprocstat actually only _needs_ -lelf after r249666 or r250870 (MFC)
+# but it shouldn't matter much
+post-patch:
+	@${REINPLACE_CMD} -e '/LIBS/s|-lprocstat|-lprocstat -lelf|' \
+		${WRKSRC}/configure
+	@${REINPLACE_CMD} -e '/libs_qga=/s|glib_libs|glib_libs -lintl|' ${WRKSRC}/configure
 	@${REINPLACE_CMD} -E \
 		-e "/^by Tibor .TS. S/s|Sch.*z.$$|Schuetz.|" \
 		${WRKSRC}/qemu-doc.texi
@@ -149,7 +170,17 @@ post-patch:
 		${WRKSRC}/Makefile
 	@${REINPLACE_CMD} -E \
 		-e "1s|^(#! )/usr/bin/perl|\1${PERL}|" \
-		${WRKSRC}/texi2pod.pl
+		${WRKSRC}/scripts/texi2pod.pl
+
+post-patch-CDROM_DMA-off:
+	@${REINPLACE_CMD} -e '/USE_DMA_CDROM/d' ${WRKSRC}/hw/ide/internal.h
+
+post-patch-GNS3-on:
+	@${REINPLACE_CMD} -e 's|(buf\[0\] & 1) && (rctl & E1000_RCTL_MPE)|buf[0] \& 1|' \
+		${WRKSRC}/hw/net/e1000.c
+
+post-patch-PCAP-on:
+	@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/pcap-patch
 
 # XXX need to disable usb host code on head while it's not ported to the
 # new usb stack yet
@@ -158,8 +189,14 @@ post-configure:
 		-e "s|^(HOST_USB=)bsd|\1stub|" \
 		${WRKSRC}/config-host.mak
 
+.if !target(post-install)
 post-install:
 	${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup.sample ${STAGEDIR}${PREFIX}/etc
 	${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown.sample ${STAGEDIR}${PREFIX}/etc
+	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/qemu-*
+
+post-install-DOCS-on:
+	@(cd ${WRKSRC} && ${COPYTREE_SHARE} docs ${STAGEDIR}${DOCSDIR}/)
+.endif
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>

Modified: head/emulators/qemu/distinfo
==============================================================================
--- head/emulators/qemu/distinfo	Wed Dec 16 14:11:42 2015	(r403863)
+++ head/emulators/qemu/distinfo	Wed Dec 16 14:15:19 2015	(r403864)
@@ -1,2 +1,2 @@
-SHA256 (qemu/qemu-0.11.1.tar.gz) = 2ecd2fc0af2ce5d96067ae82cc98a08275c596de53fc929484bedee1d6e7893a
-SIZE (qemu/qemu-0.11.1.tar.gz) = 3830070
+SHA256 (qemu/2.4.1/qemu-2.4.1.tar.bz2) = e3d5cf4c8b1f9129c9c797329a515bfb6b3b1ded0ab8b394c8a316490fe3a177
+SIZE (qemu/2.4.1/qemu-2.4.1.tar.bz2) = 25087522

Modified: head/emulators/qemu/files/patch-Makefile
==============================================================================
--- head/emulators/qemu/files/patch-Makefile	Wed Dec 16 14:11:42 2015	(r403863)
+++ head/emulators/qemu/files/patch-Makefile	Wed Dec 16 14:15:19 2015	(r403864)
@@ -1,47 +1,25 @@
-Index: qemu/Makefile
-@@ -25,7 +25,11 @@
- LDFLAGS += -static
- endif
+--- Makefile.orig	2015-11-03 20:01:30 UTC
++++ Makefile
+@@ -88,7 +88,11 @@ LIBS+=-lz $(LIBS_TOOLS)
+ HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)
+ 
  ifdef BUILD_DOCS
 +ifdef NOPORTDOCS
 +DOCS=qemu.1 qemu-img.1 qemu-nbd.8
 +else
- DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
+ DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 qmp-commands.txt
 +endif
- else
- DOCS=
- endif
-@@ -190,6 +190,8 @@
- obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
- obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
- 
-+QEMU_CFLAGS+=$(CURL_CFLAGS)
-+
- LIBS+=$(CURL_LIBS)
- 
- cocoa.o: cocoa.m
-@@ -260,13 +264,13 @@
+ ifdef CONFIG_LINUX
+ DOCS+=kvm_stat.1
  endif
+@@ -390,8 +394,10 @@ endif
  
  install-doc: $(DOCS)
+ 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
 +ifndef NOPORTDOCS
- 	$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
- 	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
+ 	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(qemu_docdir)"
+ 	$(INSTALL_DATA) qmp-commands.txt "$(DESTDIR)$(qemu_docdir)"
 +endif
- ifndef CONFIG_WIN32
+ ifdef CONFIG_POSIX
  	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
- 	$(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
--	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
--	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
- endif
- 
- install: all $(if $(BUILD_DOCS),install-doc)
-@@ -321,7 +321,7 @@ cscope:
- 
- # documentation
- %.html: %.texi
--	$(call quiet-command,texi2html -I=. -monolithic -number $<,"  GEN   $@")
-+	$(call quiet-command,texi2html -I=. -monolithic --number-sections $<,"  GEN   $@")
- 
- %.info: %.texi
- 	$(call quiet-command,makeinfo -I . $< -o $@,"  GEN   $@")
+ 	$(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"

Modified: head/emulators/qemu/files/patch-configure
==============================================================================
--- head/emulators/qemu/files/patch-configure	Wed Dec 16 14:11:42 2015	(r403863)
+++ head/emulators/qemu/files/patch-configure	Wed Dec 16 14:15:19 2015	(r403864)
@@ -1,33 +1,73 @@
-Index: qemu/configure
-@@ -1154,8 +1154,9 @@
- #include <curl/curl.h>
- int main(void) { return curl_easy_init(); }
- EOF
-+  curl_cflags=`curl-config --cflags 2>/dev/null`
-   curl_libs=`curl-config --libs 2>/dev/null`
-- if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
-+ if $cc $ARCH_CFLAGS $curl_cflags $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
-     curl=yes
-   fi
- fi # test "$curl"
-@@ -1395,9 +1395,9 @@
+--- configure.orig	2015-11-03 20:01:31 UTC
++++ configure
+@@ -273,7 +273,7 @@ DSOSUF=".so"
+ LDFLAGS_SHARED="-shared"
+ modules="no"
+ prefix="/usr/local"
+-mandir="\${prefix}/share/man"
++mandir="\${prefix}/man"
+ datadir="\${prefix}/share"
+ qemu_docdir="\${prefix}/share/doc/qemu"
+ bindir="\${prefix}/bin"
+@@ -2102,7 +2102,7 @@ if test "$gtk" != "no"; then
+             gtk_cflags="$gtk_cflags $x11_cflags"
+             gtk_libs="$gtk_libs $x11_libs"
+         fi
+-        libs_softmmu="$gtk_libs $libs_softmmu"
++        libs_softmmu="$gtk_libs -lintl $libs_softmmu"
+         gtk="yes"
+     elif test "$gtk" = "yes"; then
+         feature_not_found "gtk" "Install gtk2 or gtk3 devel"
+@@ -3643,15 +3643,18 @@ if compile_prog "" "" ; then
  fi
  
  # Check if tools are available to build documentation.
--if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
--  build_docs="no"
--fi
-+#if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
-+#  build_docs="no"
++#if test "$docs" != "no" ; then
++#  if has makeinfo && has pod2man; then
++#    docs=yes
++#  else
++#    if test "$docs" = "yes" ; then
++#      feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
++#    fi
++#    docs=no
++#  fi
 +#fi
+ if test "$docs" != "no" ; then
+-  if has makeinfo && has pod2man; then
+-    docs=yes
+-  else
+-    if test "$docs" = "yes" ; then
+-      feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
+-    fi
+-    docs=no
+-  fi
++  docs=yes
+ fi
+ 
+ # Search for bswap_32 function
+@@ -3793,6 +3796,17 @@ fi
  
- ##########################################
- # Do we need librt
-@@ -1760,6 +1761,7 @@
-   echo "CONFIG_CURL=y" >> $config_host_mak
-   echo "CURL_LIBS=$curl_libs" >> $config_host_mak
-   echo "#define CONFIG_CURL 1" >> $config_host_h
-+  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
+ # check for libusb
+ if test "$libusb" != "no" ; then
++    cat > $TMPC << EOF
++#include <libusb.h>
++
++int main(void) { return libusb_get_port_path(NULL, NULL, NULL, 0); }
++EOF
++    if compile_prog "-Werror" "-lusb -pthread" ; then
++        libusb="yes"
++        libusb_cflags=""
++        libusb_libs=-lusb
++        libs_softmmu="$libs_softmmu $libusb_libs"
++    else
+     if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
+         libusb="yes"
+         libusb_cflags=$($pkg_config --cflags libusb-1.0)
+@@ -3805,6 +3819,7 @@ if test "$libusb" != "no" ; then
+         fi
+         libusb="no"
+     fi
++    fi
  fi
- if test "$brlapi" = "yes" ; then
-   echo "CONFIG_BRLAPI=y" >> $config_host_mak
+ 
+ # check for usbredirparser for usb network redirection support

Added: head/emulators/qemu/files/patch-disas_libvixl_a64_disasm-a64.cc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu/files/patch-disas_libvixl_a64_disasm-a64.cc	Wed Dec 16 14:15:19 2015	(r403864)
@@ -0,0 +1,11 @@
+--- disas/libvixl/a64/disasm-a64.cc.orig	2015-11-03 20:01:31 UTC
++++ disas/libvixl/a64/disasm-a64.cc
+@@ -1362,7 +1362,7 @@ void Disassembler::AppendPCRelativeOffse
+                                                   int64_t offset) {
+   USE(instr);
+   char sign = (offset < 0) ? '-' : '+';
+-  AppendToOutput("#%c0x%" PRIx64, sign, std::abs(offset));
++  AppendToOutput("#%c0x%" PRIx64, sign, offset < 0 ? -offset : offset);
+ }
+ 
+ 

Added: head/emulators/qemu/files/patch-include_net_net.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu/files/patch-include_net_net.h	Wed Dec 16 14:15:19 2015	(r403864)
@@ -0,0 +1,13 @@
+--- include/net/net.h.orig	2015-11-03 20:01:34 UTC
++++ include/net/net.h
+@@ -202,8 +202,8 @@ void qmp_netdev_add(QDict *qdict, QObjec
+ int net_hub_id_for_client(NetClientState *nc, int *id);
+ NetClientState *net_hub_port_find(int hub_id);
+ 
+-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
+-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
++#define DEFAULT_NETWORK_SCRIPT PREFIX "/etc/qemu-ifup"
++#define DEFAULT_NETWORK_DOWN_SCRIPT PREFIX "/etc/qemu-ifdown"
+ #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
+ #define DEFAULT_BRIDGE_INTERFACE "br0"
+ 

Added: head/emulators/qemu/files/patch-include_qemu-common.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu/files/patch-include_qemu-common.h	Wed Dec 16 14:15:19 2015	(r403864)
@@ -0,0 +1,12 @@
+--- include/qemu-common.h.orig	2015-11-03 20:01:34 UTC
++++ include/qemu-common.h
+@@ -568,7 +568,9 @@ void qemu_hexdump(const char *buf, FILE 
+ #define VEC_OR(v1, v2) ((v1) | (v2))
+ /* altivec.h may redefine the bool macro as vector type.
+  * Reset it to POSIX semantics. */
++#ifndef __cplusplus
+ #define bool _Bool
++#endif
+ #elif defined __SSE2__
+ #include <emmintrin.h>
+ #define VECTYPE        __m128i

Added: head/emulators/qemu/files/patch-net_tap-bsd.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu/files/patch-net_tap-bsd.c	Wed Dec 16 14:15:19 2015	(r403864)
@@ -0,0 +1,10 @@
+--- net/tap-bsd.c.orig	2015-11-03 20:01:34 UTC
++++ net/tap-bsd.c
+@@ -29,6 +29,7 @@
+ 
+ #if defined(__NetBSD__) || defined(__FreeBSD__)
+ #include <sys/ioctl.h>
++#include <sys/socket.h>
+ #include <net/if.h>
+ #include <net/if_tap.h>
+ #endif

Added: head/emulators/qemu/files/patch-qemu-char.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu/files/patch-qemu-char.c	Wed Dec 16 14:15:19 2015	(r403864)
@@ -0,0 +1,19 @@
+--- qemu-char.c.orig	2015-12-16 00:54:18 UTC
++++ qemu-char.c
+@@ -1507,10 +1507,14 @@ static void tty_serial_init(int fd, int 
+     cfsetospeed(&tty, spd);
+ 
+     tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
+-                          |INLCR|IGNCR|ICRNL|IXON);
+-    tty.c_oflag |= OPOST;
++                          |INLCR|IGNCR|ICRNL|IXON|IMAXBEL);
++    tty.c_oflag &= ~OPOST; /* Don't do any output processing! */
+     tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
+     tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB);
++#ifdef __FreeBSD__
++    cfmakeraw(&tty);
++#endif
++	      
+     switch(data_bits) {
+     default:
+     case 8:

Modified: head/emulators/qemu/files/patch-qemu-doc.texi
==============================================================================
--- head/emulators/qemu/files/patch-qemu-doc.texi	Wed Dec 16 14:11:42 2015	(r403863)
+++ head/emulators/qemu/files/patch-qemu-doc.texi	Wed Dec 16 14:15:19 2015	(r403864)
@@ -1,5 +1,6 @@
-Index: qemu/qemu-doc.texi
-@@ -985,7 +985,8 @@
+--- qemu-doc.texi.orig	2015-11-03 20:01:35 UTC
++++ qemu-doc.texi
+@@ -355,7 +355,8 @@ Send Ctrl-a
  
  @c man begin SEEALSO
  The HTML documentation of QEMU for more precise information and Linux

Added: head/emulators/qemu/files/patch-slirp_slirp__config.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu/files/patch-slirp_slirp__config.h	Wed Dec 16 14:15:19 2015	(r403864)
@@ -0,0 +1,38 @@
+--- slirp/slirp_config.h.orig	2015-11-03 20:01:35 UTC
++++ slirp/slirp_config.h
+@@ -83,7 +83,7 @@
+ //#undef HOST_WORDS_BIGENDIAN
+ 
+ /* Define if you have readv */
+-#undef HAVE_READV
++#define HAVE_READV
+ 
+ /* Define if iovec needs to be declared */
+ #undef DECLARE_IOVEC
+@@ -92,7 +92,7 @@
+ #endif
+ 
+ /* Define if you have a POSIX.1 sys/wait.h */
+-#undef HAVE_SYS_WAIT_H
++#define HAVE_SYS_WAIT_H
+ 
+ /* Define if you have sys/select.h */
+ #undef HAVE_SYS_SELECT_H
+@@ -110,7 +110,7 @@
+ #endif
+ 
+ /* Define if you have sys/signal.h */
+-#undef HAVE_SYS_SIGNAL_H
++#define HAVE_SYS_SIGNAL_H
+ 
+ /* Define if you have sys/stropts.h */
+ #undef HAVE_SYS_STROPTS_H
+@@ -179,7 +179,7 @@
+ #undef HAVE_GRANTPT
+ 
+ /* Define if you have fchmod */
+-#undef HAVE_FCHMOD
++#define HAVE_FCHMOD
+ 
+ /* Define if you have <sys/type32.h> */
+ #undef HAVE_SYS_TYPES32_H

Added: head/emulators/qemu/files/patch-ui_x__keymap.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu/files/patch-ui_x__keymap.c	Wed Dec 16 14:15:19 2015	(r403864)
@@ -0,0 +1,15 @@
+--- ui/x_keymap.c.orig	2015-12-16 00:59:05 UTC
++++ ui/x_keymap.c
+@@ -43,9 +43,9 @@ static const uint8_t x_keycode_to_pc_key
+    0xb5,      /* 112  Divide */
+    0xb8,      /* 113  Alt-R  */
+    0xc6,      /* 114  Break  */
+-   0x0,         /* 115 */
+-   0x0,         /* 116 */
+-   0x0,         /* 117 */
++   0xdb,      /* 115 left windows key */
++   0xdc,      /* 116 right windows key */
++   0xdd,      /* 117 right menu key */
+    0x0,         /* 118 */
+    0x0,         /* 119 */
+    0x0,         /* 120 */

Modified: head/emulators/qemu/files/pcap-patch
==============================================================================
--- head/emulators/qemu/files/pcap-patch	Wed Dec 16 14:11:42 2015	(r403863)
+++ head/emulators/qemu/files/pcap-patch	Wed Dec 16 14:15:19 2015	(r403864)
@@ -1,47 +1,33 @@
---- Makefile.target.orig	2010-01-29 14:39:26.000000000 -0500
-+++ Makefile.target	2010-01-29 14:39:28.000000000 -0500
-@@ -616,6 +616,13 @@ ifdef CONFIG_COREAUDIO
- COCOA_LIBS+=-framework CoreAudio
- endif
- endif
-+ifdef CONFIG_PCAP
-+ifdef CONFIG_WIN32
-+LIBS+=-lwpcap
-+else
-+LIBS+=-lpcap
-+endif
-+endif
- ifdef CONFIG_SLIRP
- CPPFLAGS+=-I$(SRC_PATH)/slirp
- endif
---- configure.orig	2010-01-29 14:39:26.000000000 -0500
-+++ configure	2010-01-29 14:39:27.000000000 -0500
-@@ -203,6 +203,9 @@ sdl="yes"
- sdl_x11="no"
- xen="yes"
- pkgversion=""
+--- configure.orig	2015-08-11 19:11:05 UTC
++++ configure
+@@ -338,6 +338,9 @@ libssh2=""
+ vhdx=""
+ numa=""
+ tcmalloc="no"
 +pcap="no"
 +pcap_create="no"
 +bpf="no"
  
- # OS specific
- if check_define __linux__ ; then
-@@ -428,6 +431,8 @@ for opt do
+ # parse CC options first
+ for opt do
+@@ -896,6 +899,10 @@ for opt do
    ;;
-   --disable-vnc-sasl) vnc_sasl="no"
+   --enable-vnc-png) vnc_png="yes"
    ;;
 +  --enable-pcap) pcap="yes"
 +  ;;
++  --disable-pcap) pcap="no"
++  ;;
    --disable-slirp) slirp="no"
    ;;
-   --disable-vde) vde="no"
-@@ -925,6 +930,48 @@ EOF
+   --disable-uuid) uuid="no"
+@@ -2354,6 +2361,51 @@ EOF
  fi
  
  ##########################################
 +# pcap probe
 +
-+if test "$pcap" = "yes" ; then
++if test "$pcap" = "yes" -a "$pcap" != "no"; then
 +  cat > $TMPC << EOF
 +#include <pcap.h>
 +int main(void) { return (pcap_lib_version() == (char *)0 ? 1 : 0); }
@@ -51,7 +37,9 @@
 +  else
 +    libpcap=-lwpcap
 +  fi
-+  if ! $cc $ARCH_CFLAGS -o $TMPE $libpcap $TMPC 2> /dev/null ; then
++  if compile_prog "" "$libpcap" ; then
++    :
++  else
 +    echo
 +    echo "Error: Could not find pcap"
 +    echo "Make sure to have the pcap libs and headers installed."
@@ -66,7 +54,7 @@
 +  return (pcap_create("foo", errbuf) == (pcap_t *)0 ? 1 : 0);
 +}
 +EOF
-+  if $cc $ARCH_CFLAGS -o $TMPE $libpcap $TMPC 2> /dev/null ; then
++  if compile_prog "" "$libpcap" ; then
 +    pcap_create="yes"
 +  fi
 +  cat > $TMPC << EOF
@@ -75,72 +63,111 @@
 +#include <net/bpf.h>
 +int main(void) { return (BPF_MAJOR_VERSION); }
 +EOF
-+  if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
++  if compile_prog ; then
 +    bpf="yes"
 +  fi
++  libs_softmmu="$libpcap $libs_softmmu"
 +fi # test "$pcap"
 +
 +##########################################
- # VNC TLS detection
- if test "$vnc_tls" = "yes" ; then
- cat > $TMPC <<EOF
-@@ -1436,6 +1483,7 @@ if test "$vnc_sasl" = "yes" ; then
-     echo "    SASL CFLAGS    $vnc_sasl_cflags"
-     echo "    SASL LIBS      $vnc_sasl_libs"
- fi
+ # VNC TLS/WS detection
+ if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
+   cat > $TMPC <<EOF
+@@ -4515,6 +4567,7 @@ echo "Audio drivers     $audio_drv_list"
+ echo "Block whitelist (rw) $block_drv_rw_whitelist"
+ echo "Block whitelist (ro) $block_drv_ro_whitelist"
+ echo "VirtFS support    $virtfs"
 +echo "pcap support      $pcap"
- if test -n "$sparc_cpu"; then
-     echo "Target Sparc Arch $sparc_cpu"
- fi
-@@ -1589,6 +1637,16 @@ fi
- if test $profiler = "yes" ; then
-   echo "#define CONFIG_PROFILER 1" >> $config_host_h
+ echo "VNC support       $vnc"
+ if test "$vnc" = "yes" ; then
+     echo "VNC TLS support   $vnc_tls"
+@@ -4692,6 +4745,15 @@ fi
+ if test "$profiler" = "yes" ; then
+   echo "CONFIG_PROFILER=y" >> $config_host_mak
  fi
 +if test "$pcap" = "yes" ; then
-+  echo "CONFIG_PCAP=yes" >> $config_host_mak
-+  echo "#define CONFIG_PCAP 1" >> $config_host_h
++  echo "CONFIG_PCAP=y" >> $config_host_mak
 +  if test "$pcap_create" = "yes" ; then
-+    echo "#define HAVE_PCAP_CREATE 1" >> $config_host_h
++    echo "CONFIG_PCAP_CREATE=y" >> $config_host_mak
 +  fi
 +  if test "$bpf" = "yes" ; then
-+    echo "#define HAVE_BPF 1" >> $config_host_h
++    echo "CONFIG_BPF=y" >> $config_host_mak
 +  fi
 +fi
  if test "$slirp" = "yes" ; then
    echo "CONFIG_SLIRP=y" >> $config_host_mak
-   echo "#define CONFIG_SLIRP 1" >> $config_host_h
-Index: net.c
-@@ -688,6 +688,201 @@ static void config_error(Monitor *mon, c
-     va_end(ap);
+   echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
+--- net/clients.h.orig	2015-08-11 19:11:09 UTC
++++ net/clients.h
+@@ -49,6 +49,12 @@ int net_init_bridge(const NetClientOptio
+ 
+ int net_init_l2tpv3(const NetClientOptions *opts, const char *name,
+                     NetClientState *peer, Error **errp);
++
++#ifdef CONFIG_PCAP
++int net_init_pcap(const NetClientOptions *opts, const char *name,
++                  NetClientState *peer);
++#endif
++
+ #ifdef CONFIG_VDE
+ int net_init_vde(const NetClientOptions *opts, const char *name,
+                  NetClientState *peer, Error **errp);
+--- net/hub.c.orig	2015-08-11 19:11:09 UTC
++++ net/hub.c
+@@ -322,6 +322,7 @@ void net_hub_check_clients(void)
+             case NET_CLIENT_OPTIONS_KIND_SOCKET:
+             case NET_CLIENT_OPTIONS_KIND_VDE:
+             case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
++            case NET_CLIENT_OPTIONS_KIND_PCAP:
+                 has_host_dev = 1;
+                 break;
+             default:
+--- net/net.c.orig	2015-08-11 19:11:09 UTC
++++ net/net.c
+@@ -45,6 +45,11 @@
+ #include "qapi/dealloc-visitor.h"
+ #include "sysemu/sysemu.h"
+ 
++#include <sys/ioctl.h>
++#ifdef __FreeBSD__
++#include <net/if.h>
++#endif
++
+ /* Net bridge is currently not supported for W32. */
+ #if !defined(_WIN32)
+ # define CONFIG_NET_BRIDGE
+@@ -880,6 +885,221 @@ static int net_init_nic(const NetClientO
+     return idx;
  }
  
 +#if defined(CONFIG_PCAP)
-+#if defined(HAVE_BPF)
++#if defined(CONFIG_BPF)
 +#define PCAP_DONT_INCLUDE_PCAP_BPF_H
 +#include <net/bpf.h>
 +#endif
 +#include <pcap.h>
 +
-+typedef struct PCAPState {
-+    VLANClientState *vc;
-+    pcap_t *handle;
-+    int max_eth_frame_size;
-+} PCAPState;
++struct PCAPState {
++    NetClientState     nc;
++    pcap_t            *handle;
++    int                max_eth_frame_size;
++};
 +
-+static ssize_t pcap_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
++static ssize_t pcap_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 +{
-+    PCAPState *s = (PCAPState *)vc->opaque;
++    struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
 +
 +    return pcap_inject(s->handle, (u_char*)buf, size);
 +}
 +
-+static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata)
++static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata
++		)
 +{
-+    VLANClientState *vc = (VLANClientState *)user;
++    NetClientState *nc = (NetClientState *)user;
 +
 +    int len = phdr->len;
 +#ifdef __FreeBSD__
-+    PCAPState *s = vc->opaque;
++    struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
 +    int max_eth_frame_size = s->max_eth_frame_size;
 +
 +    if (len > max_eth_frame_size) {
@@ -150,42 +177,63 @@ Index: net.c
 +        len = max_eth_frame_size;
 +    }
 +#endif
-+    qemu_send_packet(vc, pdata, len);
++    qemu_send_packet(nc, pdata, len);
 +}
 +
 +static void pcap_send(void *opaque)
 +{
-+    PCAPState *s = (PCAPState *)opaque;
++    struct PCAPState *s = (struct PCAPState *)opaque;
 +
 +    for (;;) {
-+        if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)s->vc) >= 0)
++        if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)&s->nc) >= 0)
 +            break;
 +    }
 +}
 +
-+static void pcap_cleanup(VLANClientState *vc)
++static void pcap_cleanup(NetClientState *nc)
 +{
-+    PCAPState *s = vc->opaque;
++    struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
 +
++    qemu_purge_queued_packets(nc);
 +    pcap_close(s->handle);
-+    qemu_free(s);
 +}
 +
-+static int net_pcap_init(VLANState *vlan, const char *model, const char *name, char *ifname)
++static NetClientInfo net_pcap_info = {
++    .type = NET_CLIENT_OPTIONS_KIND_PCAP,
++    .size = sizeof(struct PCAPState),
++    .receive = pcap_receive,
++//    .receive_raw = pcap_receive_raw,
++//    .receive_iov = pcap_receive_iov,
++//    .poll = pcap_poll,
++    .cleanup = pcap_cleanup,
++};
++/*
++ * ... -net pcap,ifname="..."
++ */
++
++int net_init_pcap(const NetClientOptions *opts, const char *name, NetClientState *peer)
 +{
-+    PCAPState *s = NULL;
++    const NetdevPcapOptions *pcap_opts = opts->pcap;
++    NetClientState *nc;
++    struct PCAPState *s;
++    const char *ifname;
 +    char errbuf[PCAP_ERRBUF_SIZE];
 +#if defined(_WIN32)
 +    HANDLE h;
 +#endif
 +    int i;
 +
-+    s = qemu_mallocz(sizeof(PCAPState));
-+    if (!s)
++    if (!pcap_opts->has_ifname)
 +        return -1;
 +
++    ifname = pcap_opts->ifname;
++
++    /* create the object */
++    nc = qemu_new_net_client(&net_pcap_info, peer, "pcap", ifname);
++    s = DO_UPCAST(struct PCAPState, nc, nc);
++
 +    if (ifname == NULL && (ifname = pcap_lookupdev(errbuf)) == NULL) {
-+        fprintf(stderr, "qemu: pcap_lookupdev: %s\n", errbuf);
++        fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
 +        goto fail;
 +    }
 +
@@ -208,7 +256,8 @@ Index: net.c
 +        close(i);
 +    }
 +#endif
-+#if defined(HAVE_PCAP_CREATE) || defined(_WIN32)
++
++#if defined(CONFIG_PCAP_CREATE) || defined(_WIN32)
 +    /*
 +     * Create pcap handle for the device, set promiscuous mode and activate.
 +     */
@@ -218,11 +267,11 @@ Index: net.c
 +        goto fail;
 +    }
 +    if (pcap_set_promisc(s->handle, 1) != 0) {
-+        pcap_perror(s->handle, "qemu: pcap_set_promisc:");
++        pcap_perror(s->handle, (char *)"qemu: pcap_set_promisc:");
 +        goto fail;
 +    }
 +    if (pcap_activate(s->handle) != 0) {
-+        pcap_perror(s->handle, "qemu: pcap_activate:");
++        pcap_perror(s->handle, (char *)"qemu: pcap_activate:");
 +        goto fail;
 +    }
 +#else
@@ -249,7 +298,7 @@ Index: net.c
 +        goto fail;
 +    }
 +#else /* !_WIN32 */
-+#if defined(HAVE_BPF)
++#if defined(CONFIG_BPF)
 +#if defined(BIOCIMMEDIATE)
 +    /*
 +     * Tell the kernel that the packet has to be seen immediately.
@@ -262,7 +311,6 @@ Index: net.c
 +        }
 +    }
 +#endif /* BIOCIMMEDIATE */
-+
 +#if defined(BIOCFEEDBACK)
 +    /*
 +     * Tell the kernel that the sent packet has to be fed back.
@@ -276,11 +324,10 @@ Index: net.c
 +        }
 +    }
 +#endif /* BIOCFEEDBACK */
-+#endif /* HAVE_BPF */
++#endif /* CONFIG_BPF */
 +#endif /* _WIN32 */
 +
-+    s->vc = qemu_new_vlan_client(vlan, model, name, NULL, pcap_receive, NULL, pcap_cleanup, s);
-+    snprintf(s->vc->info_str, sizeof(s->vc->info_str), "pcap redirector");
++    snprintf(s->nc.info_str, sizeof(s->nc.info_str), "pcap redirector");
 +
 +#if defined(_WIN32)
 +    if ((h = pcap_getevent(s->handle)) == NULL) {
@@ -302,43 +349,43 @@ Index: net.c
 +    if (s) {
 +        if (s->handle)
 +            pcap_close(s->handle);
-+        qemu_free(s);
 +    }
 +
 +    return -1;
 +}
-+#endif /* CONFIG_PCAP */
 +
- #if defined(CONFIG_SLIRP)
- 
- /* slirp network adapter */
-@@ -2596,6 +2791,16 @@ int net_client_init(Monitor *mon, const 
-            are wanted */
-         ret = 0;
-     } else
-+#ifdef CONFIG_PCAP
-+    if (!strcmp(device, "pcap")) {
-+        char ifname[64];
-+        vlan->nb_host_devs++;
-+        if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0)
-+            ret = net_pcap_init(vlan, device, name, NULL);
-+        else
-+            ret = net_pcap_init(vlan, device, name, ifname);
-+    } else
 +#endif
- #ifdef CONFIG_SLIRP
-     if (!strcmp(device, "user")) {
-         static const char * const slirp_params[] = {
---- qemu-options.hx.orig	2009-12-02 15:27:02.000000000 -0500

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-ports-head mailing list