summaryrefslogtreecommitdiff
path: root/sysutils/xentools3
diff options
context:
space:
mode:
authorbouyer <bouyer>2007-06-14 19:39:45 +0000
committerbouyer <bouyer>2007-06-14 19:39:45 +0000
commit972d9a832974048c594742d45dffb3554da53bf6 (patch)
tree5e16cbb00d89ea3ae27a2180407bdab0e1aa74f6 /sysutils/xentools3
parent46888318f15621ff8e013b63c8e6e4232e01dee3 (diff)
downloadpkgsrc-972d9a832974048c594742d45dffb3554da53bf6.tar.gz
Rename xentools30 to xentools3 to acknowledge that Xen dropped one digit
in version numbers, and upgrade to 3.1.0. Changes since 3.0.4: * XenAPI 1.0 support o XML configuration files for virtual machines; o VM life-cycle management operations; and o Secure on- or off-box XML-RPC with bindings for many languages * Basic save/restore/migrate support for HVM (e.g. Windows) VMs; * Dynamic memory control for HVM guests; * 32-on-64 PV guest support (run PAE PV VMs on a 64-bit Xen!); and * Blktap copy-on-write disk support. It also fixes some HVM bugs.
Diffstat (limited to 'sysutils/xentools3')
-rw-r--r--sysutils/xentools3/DESCR5
-rw-r--r--sysutils/xentools3/MESSAGE.NetBSD17
-rw-r--r--sysutils/xentools3/Makefile189
-rw-r--r--sysutils/xentools3/PLIST369
-rw-r--r--sysutils/xentools3/buildlink3.mk19
-rw-r--r--sysutils/xentools3/distinfo46
-rw-r--r--sysutils/xentools3/files/NetBSD.mk2
-rw-r--r--sysutils/xentools3/files/block-nbsd88
-rw-r--r--sysutils/xentools3/files/netbsd1-nbsd48
-rw-r--r--sysutils/xentools3/files/vif-bridge-nbsd35
-rwxr-xr-xsysutils/xentools3/files/vif-ip-nbsd33
-rw-r--r--sysutils/xentools3/files/xenbackendd.c319
-rw-r--r--sysutils/xentools3/files/xenbackendd.sh17
-rw-r--r--sysutils/xentools3/files/xend.sh29
-rw-r--r--sysutils/xentools3/files/xendomains.sh134
-rw-r--r--sysutils/xentools3/files/xenio.h105
-rw-r--r--sysutils/xentools3/files/xenio3.h89
-rw-r--r--sysutils/xentools3/patches/patch-aa67
-rw-r--r--sysutils/xentools3/patches/patch-ab273
-rw-r--r--sysutils/xentools3/patches/patch-ac13
-rw-r--r--sysutils/xentools3/patches/patch-ad161
-rw-r--r--sysutils/xentools3/patches/patch-al28
-rw-r--r--sysutils/xentools3/patches/patch-as45
-rw-r--r--sysutils/xentools3/patches/patch-au16
-rw-r--r--sysutils/xentools3/patches/patch-av12
-rw-r--r--sysutils/xentools3/patches/patch-aw42
-rw-r--r--sysutils/xentools3/patches/patch-ax14
-rw-r--r--sysutils/xentools3/patches/patch-ba47
-rw-r--r--sysutils/xentools3/patches/patch-bb13
-rw-r--r--sysutils/xentools3/patches/patch-bc22
-rw-r--r--sysutils/xentools3/patches/patch-be16
-rw-r--r--sysutils/xentools3/patches/patch-bf13
-rw-r--r--sysutils/xentools3/patches/patch-bg13
-rw-r--r--sysutils/xentools3/patches/patch-bh13
-rw-r--r--sysutils/xentools3/patches/patch-bo25
-rw-r--r--sysutils/xentools3/patches/patch-br16
-rw-r--r--sysutils/xentools3/patches/patch-bs49
-rw-r--r--sysutils/xentools3/patches/patch-bt78
-rw-r--r--sysutils/xentools3/patches/patch-bw15
-rw-r--r--sysutils/xentools3/patches/patch-cb12
-rw-r--r--sysutils/xentools3/patches/patch-cc24
-rw-r--r--sysutils/xentools3/patches/patch-cd16
-rw-r--r--sysutils/xentools3/patches/patch-cf21
-rw-r--r--sysutils/xentools3/patches/patch-cg42
-rw-r--r--sysutils/xentools3/patches/patch-ch102
-rw-r--r--sysutils/xentools3/patches/patch-ci16
-rw-r--r--sysutils/xentools3/patches/patch-cj23
-rw-r--r--sysutils/xentools3/patches/patch-ck16
-rw-r--r--sysutils/xentools3/patches/patch-cm47
-rw-r--r--sysutils/xentools3/patches/patch-cn36
-rw-r--r--sysutils/xentools3/patches/patch-co40
-rw-r--r--sysutils/xentools3/patches/patch-cp14
-rw-r--r--sysutils/xentools3/patches/patch-cq16
-rw-r--r--sysutils/xentools3/patches/patch-cr22
-rw-r--r--sysutils/xentools3/patches/patch-cs21
-rw-r--r--sysutils/xentools3/patches/patch-ct56
-rw-r--r--sysutils/xentools3/patches/patch-cu13
-rw-r--r--sysutils/xentools3/patches/patch-cv13
58 files changed, 3085 insertions, 0 deletions
diff --git a/sysutils/xentools3/DESCR b/sysutils/xentools3/DESCR
new file mode 100644
index 00000000000..43c6815d681
--- /dev/null
+++ b/sysutils/xentools3/DESCR
@@ -0,0 +1,5 @@
+The Xen virtual machine monitor allows running several virtual machines
+on a single physical machine. The xentools3 package contains the
+tools to create, destroy and control the virtual machines.
+
+The xentools3 package contains the tools for Xen 3
diff --git a/sysutils/xentools3/MESSAGE.NetBSD b/sysutils/xentools3/MESSAGE.NetBSD
new file mode 100644
index 00000000000..627de52deb5
--- /dev/null
+++ b/sysutils/xentools3/MESSAGE.NetBSD
@@ -0,0 +1,17 @@
+===========================================================================
+$NetBSD: MESSAGE.NetBSD,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+
+Please ensure that the Xen-specific devices needed by xend(8) exist:
+
+ cd /dev && sh MAKEDEV xen
+
+There are example configuration files for setting up a guest domain in:
+
+ ${EGDIR}/
+
+Please also refer to the the "NetBSD/xen How-To" for more information on
+creating a Xen setup:
+
+ http://www.NetBSD.org/Ports/xen/howto.html
+
+===========================================================================
diff --git a/sysutils/xentools3/Makefile b/sysutils/xentools3/Makefile
new file mode 100644
index 00000000000..9b6b3b9218e
--- /dev/null
+++ b/sysutils/xentools3/Makefile
@@ -0,0 +1,189 @@
+# $NetBSD: Makefile,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+#
+
+VERSION= 3.1.0
+DISTNAME= xen-${VERSION}-src
+PKGNAME= xentools3-${VERSION}
+CATEGORIES= sysutils
+MASTER_SITES= http://www.cl.cam.ac.uk/research/srg/netos/xen/downloads/ \
+ http://bits.xensource.com/oss-xen/release/${VERSION}/src.tgz/
+EXTRACT_SUFX= .tgz
+
+MAINTAINER= bouyer@NetBSD.org
+HOMEPAGE= http://www.cl.cam.ac.uk/research/srg/netos/xen/
+COMMENT= Userland Tools for Xen
+
+#DEPENDS+= ${PYPKGPREFIX}-twisted-[0-9]*:../../net/py-twisted
+DEPENDS+= ${PYPKGPREFIX}-readline-[0-9]*:../../devel/py-readline
+
+PKG_SYSCONFSUBDIR= xen
+
+ONLY_FOR_PLATFORM= Linux-2.[46]*-i386 NetBSD-*-i386
+
+CONFLICTS+= libxen-[0-9]*
+CONFLICTS+= xentools20-[0-9]*
+CONFLICTS= xentools30-*
+
+WRKSRC= ${WRKDIR}/xen-${VERSION}-src/tools
+CHECK_PORTABILITY_SKIP= examples/* xm-test/ramdisk/make-release.sh
+
+EGDIR= ${PREFIX}/share/examples/xen
+MESSAGE_SUBST= EGDIR=${EGDIR}
+
+USE_TOOLS+= perl #for pod2man
+USE_TOOLS+= gmake
+MAKE_ENV+= CONFIG_NetBSD=yes
+MAKE_ENV+= CONFIG_MBOOTPACK=no
+MAKE_ENV+= EGDIR=${EGDIR:Q}
+MAKE_ENV+= MV=${MV:Q} PYTHON=${PYTHONBIN:Q} SED=${SED:Q}
+MAKE_ENV+= XEN_TARGET_ARCH="x86_32"
+PYTHON_VERSIONS_ACCEPTED= 24 23
+PY_PATCHPLIST= yes
+PYTHON_PATCH_SCRIPTS+= misc/xm
+PYTHON_PATCH_SCRIPTS+= misc/netfix
+PYTHON_PATCH_SCRIPTS+= misc/xen-bugtool
+PYTHON_PATCH_SCRIPTS+= misc/xencons
+PYTHON_PATCH_SCRIPTS+= misc/xend
+PYTHON_PATCH_SCRIPTS+= misc/xensymoops
+PYTHON_PATCH_SCRIPTS+= misc/xen-python-path
+PYTHON_PATCH_SCRIPTS+= pygrub/src/pygrub
+PYTHON_PATCH_SCRIPTS+= python/xen/util/bugtool.py
+PYTHON_PATCH_SCRIPTS+= python/xen/xend/sxp.py
+PYTHON_PATCH_SCRIPTS+= python/xen/util/pci.py
+PYTHON_PATCH_SCRIPTS+= python/xen/xend/XendClient.py
+PYTHON_PATCH_SCRIPTS+= python/xen/xend/arch.py
+PYTHON_PATCH_SCRIPTS+= python/test.py
+PYTHON_PATCH_SCRIPTS+= security/python/xensec_gen/cgi-bin/policy.cgi
+PYTHON_PATCH_SCRIPTS+= security/python/xensec_gen/main.py
+PYTHON_PATCH_SCRIPTS+= security/python/setup.py
+PYTHON_PATCH_SCRIPTS+= security/xensec_gen.py
+PYTHON_PATCH_SCRIPTS+= xenmon/xenmon.py
+PYTHON_PATCH_SCRIPTS+= xentrace/xentrace_format
+
+SUBST_CLASSES+= paths
+SUBST_STAGE.paths= pre-configure
+SUBST_FILES.paths= ioemu/vl.c
+SUBST_SED.paths= -e "s|/usr/sbin|${PREFIX}/sbin|g"
+SUBST_MESSAGE.paths= Fixing hardcoded paths.
+
+SUBST_CLASSES+= pathsvar
+SUBST_STAGE.pathsvar= pre-configure
+SUBST_FILES.pathsvar= examples/init.d/sysconfig.xendomains \
+ examples/xend-config.sxp \
+ python/xen/xend/server/relocate.py \
+ python/xen/xend/XendOptions.py \
+ security/Makefile security/python/xensec_gen/main.py \
+ xenstore/xs_lib.c
+SUBST_SED.pathsvar= -e "s|/var/lib|${VARBASE}/run|g"
+
+SUBST_CLASSES+= py
+SUBST_STAGE.py= pre-configure
+SUBST_FILES.py= pygrub/Makefile
+SUBST_FILES.py+= python/Makefile
+SUBST_FILES.py+= security/Makefile
+SUBST_FILES.py+= ../xen/include/public/foreign/Makefile
+SUBST_SED.py= -e "s,python,${PYTHONBIN},g"
+
+SUBST_CLASSES+= conf
+SUBST_STAGE.conf= pre-configure
+SUBST_FILES.conf= python/xen/xend/XendOptions.py
+SUBST_FILES.conf+= python/xen/xend/osdep.py
+SUBST_FILES.conf+= python/xen/xm/create.py
+SUBST_FILES.conf+= python/xen/xm/addlabel.py
+SUBST_FILES.conf+= python/xen/xm/getlabel.py
+SUBST_FILES.conf+= python/xen/xm/rmlabel.py
+SUBST_SED.conf= -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g"
+
+SUBST_CLASSES+= prefix
+SUBST_STAGE.prefix= pre-configure
+SUBST_FILES.prefix= python/xen/util/auxbin.py
+SUBST_FILES.prefix+= misc/xen-python-path
+SUBST_SED.prefix= -e "s,@PREFIX@,${PREFIX},g"
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS} == "NetBSD"
+SUBST_CLASSES+= proc
+SUBST_STAGE.proc= pre-configure
+SUBST_FILES.proc= python/xen/xend/XendVnet.py
+SUBST_FILES.proc+= xenstore/xs_lib.c
+SUBST_SED.proc= -e "s|/proc|/kern|g"
+PROCPATH= /kern
+.else
+PROCPATH= /proc
+.endif
+
+RCD_SCRIPTS= xend xenbackendd xendomains
+FILES_SUBST+= RCD_INTERPRETER=${PYTHONBIN:Q}
+FILES_SUBST+= PROCPATH=${PROCPATH:Q}
+FILES_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR:Q}
+
+XEND_SCRIPTS= block vif-bridge vif-ip
+
+CONF_FILES= ${EGDIR}/xend-config.sxp \
+ ${PKG_SYSCONFDIR}/xend-config.sxp
+.for s in ${XEND_SCRIPTS}
+CONF_FILES_PERMS+= ${EGDIR}/${s} ${PKG_SYSCONFDIR}/scripts/${s} \
+ ${ROOT_USER} ${ROOT_GROUP} 0755
+.endfor
+
+OWN_DIRS= ${PKG_SYSCONFDIR}/scripts /var/log/xen
+
+pre-build:
+ ${MKDIR} ${WRKSRC}/libxc/xen/NetBSD
+ ${TEST} -f ${WRKSRC}/libxc/xen/NetBSD/xenio.h || \
+ ${CP} ${FILESDIR}/xenio.h ${WRKSRC}/libxc/xen/NetBSD
+ ${TEST} -f ${WRKSRC}/libxc/xen/NetBSD/xenio3.h || \
+ ${CP} ${FILESDIR}/xenio3.h ${WRKSRC}/libxc/xen/NetBSD
+ ${CP} ${FILESDIR}/NetBSD.mk ${WRKSRC}/../config/
+ pod2man ${WRKSRC}/../docs/man/xend-config.sxp.pod.5 |\
+ sed -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ >${WRKDIR}/xend-config.sxp.5
+ pod2man ${WRKSRC}/../docs/man/xmdomain.cfg.pod.5 |\
+ sed -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ >${WRKDIR}/xmdomain.cfg.5
+ pod2man ${WRKSRC}/../docs/man/xm.pod.1 |\
+ sed -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ >${WRKDIR}/xm.1
+
+.if ${OPSYS} == "NetBSD"
+post-build:
+ cd ${FILESDIR}; for src in *-nbsd; do \
+ dst="$${src%-nbsd}"; \
+ ${SED} -e "s|@PKG_SYSCONFDIR@|${PKG_SYSCONFDIR}|g" \
+ -e "s|@PREFIX@|${PREFIX}|g" \
+ $$src > ${WRKSRC}/examples/$$dst; \
+ done
+ ${CC} ${CFLAGS} ${LDFLAGS} \
+ -DVBD_SCRIPT=\"${PKG_SYSCONFDIR}/scripts/block\" \
+ -DLOG_FILE=\"${VARBASE}/log/xenbackendd.log\" \
+ -DPID_FILE=\"${VARBASE}/run/xenbackendd.pid\" \
+ -o ${WRKDIR}/xenbackendd.bin ${FILESDIR}/xenbackendd.c \
+ -I${WRKSRC}/libxc -L${WRKSRC}/libxc \
+ -I${WRKSRC}/xenstore -L${WRKSRC}/xenstore \
+ -lxenctrl -lxenstore
+
+.endif
+
+post-install:
+ ${INSTALL_PROGRAM} ${WRKDIR}/xenbackendd.bin ${PREFIX}/sbin/xenbackendd
+ ${INSTALL_DATA_DIR} ${EGDIR}
+ for f in xend-config.sxp xmexample1 xmexample2 xmexample3 netbsd1; do \
+ ${INSTALL_DATA} ${WRKSRC}/examples/$$f ${EGDIR}/$$f; \
+ done
+.for s in ${XEND_SCRIPTS}
+ ${INSTALL_SCRIPT} ${WRKSRC}/examples/${s} ${EGDIR}/${s}
+.endfor
+ ${RM} -rf ${PREFIX}/lib/xen
+ ${INSTALL_DATA} ${WRKDIR}/xend-config.sxp.5 ${PREFIX}/man/man5
+ ${INSTALL_DATA} ${WRKDIR}/xmdomain.cfg.5 ${PREFIX}/man/man5
+ ${INSTALL_DATA} ${WRKDIR}/xm.1 ${PREFIX}/man/man1
+
+.include "../../lang/python/application.mk"
+.include "../../lang/python/extension.mk"
+.include "../../textproc/py-xml/buildlink3.mk"
+#.include "../../devel/zlib/buildlink3.mk"
+#.include "../../www/curl/buildlink3.mk"
+.include "../../devel/ncurses/buildlink3.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/sysutils/xentools3/PLIST b/sysutils/xentools3/PLIST
new file mode 100644
index 00000000000..b40312ecabd
--- /dev/null
+++ b/sysutils/xentools3/PLIST
@@ -0,0 +1,369 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+bin/readnotes
+bin/xc_restore
+bin/xc_save
+bin/xencons
+bin/xenconsole
+bin/xenperf
+bin/xenstore-chmod
+bin/xenstore-control
+bin/xenstore-exists
+bin/xenstore-list
+bin/xenstore-ls
+bin/xenstore-read
+bin/xenstore-rm
+bin/xenstore-write
+bin/xen-detect
+include/xenctrl.h
+include/xenguest.h
+include/xs.h
+include/xs_lib.h
+lib/libxenctrl.a
+lib/libxenctrl.so
+lib/libxenctrl.so.3.0
+lib/libxenctrl.so.3.0.0
+lib/libxenguest.a
+lib/libxenguest.so
+lib/libxenguest.so.3.0
+lib/libxenguest.so.3.0.0
+lib/libxenstore.a
+lib/libxenstore.so
+lib/libxenstore.so.3.0
+lib/libxenstore.so.3.0.0
+man/man1/xentop.1
+man/man1/xm.1
+man/man5/xend-config.sxp.5
+man/man5/xmdomain.cfg.5
+${PYSITELIB}/xen/__init__.py
+${PYSITELIB}/xen/__init__.pyc
+${PYSITELIB}/xen/lowlevel/__init__.py
+${PYSITELIB}/xen/lowlevel/__init__.pyc
+${PYSITELIB}/xen/lowlevel/acm.so
+${PYSITELIB}/xen/lowlevel/ptsname.so
+${PYSITELIB}/xen/lowlevel/xc.so
+${PYSITELIB}/xen/lowlevel/xs.so
+${PYSITELIB}/xen/sv/CreateDomain.py
+${PYSITELIB}/xen/sv/CreateDomain.pyc
+${PYSITELIB}/xen/sv/DomInfo.py
+${PYSITELIB}/xen/sv/DomInfo.pyc
+${PYSITELIB}/xen/sv/GenTabbed.py
+${PYSITELIB}/xen/sv/GenTabbed.pyc
+${PYSITELIB}/xen/sv/HTMLBase.py
+${PYSITELIB}/xen/sv/HTMLBase.pyc
+${PYSITELIB}/xen/sv/Main.py
+${PYSITELIB}/xen/sv/Main.pyc
+${PYSITELIB}/xen/sv/NodeInfo.py
+${PYSITELIB}/xen/sv/NodeInfo.pyc
+${PYSITELIB}/xen/sv/RestoreDomain.py
+${PYSITELIB}/xen/sv/RestoreDomain.pyc
+${PYSITELIB}/xen/sv/Wizard.py
+${PYSITELIB}/xen/sv/Wizard.pyc
+${PYSITELIB}/xen/sv/__init__.py
+${PYSITELIB}/xen/sv/__init__.pyc
+${PYSITELIB}/xen/sv/util.py
+${PYSITELIB}/xen/sv/util.pyc
+${PYSITELIB}/xen/util/Brctl.py
+${PYSITELIB}/xen/util/Brctl.pyc
+${PYSITELIB}/xen/util/SSHTransport.py
+${PYSITELIB}/xen/util/SSHTransport.pyc
+${PYSITELIB}/xen/util/__init__.py
+${PYSITELIB}/xen/util/__init__.pyc
+${PYSITELIB}/xen/util/asserts.py
+${PYSITELIB}/xen/util/asserts.pyc
+${PYSITELIB}/xen/util/auxbin.py
+${PYSITELIB}/xen/util/auxbin.pyc
+${PYSITELIB}/xen/util/blkif.py
+${PYSITELIB}/xen/util/blkif.pyc
+${PYSITELIB}/xen/util/bugtool.py
+${PYSITELIB}/xen/util/bugtool.pyc
+${PYSITELIB}/xen/util/diagnose.py
+${PYSITELIB}/xen/util/diagnose.pyc
+${PYSITELIB}/xen/util/dictio.py
+${PYSITELIB}/xen/util/dictio.pyc
+${PYSITELIB}/xen/util/ip.py
+${PYSITELIB}/xen/util/ip.pyc
+${PYSITELIB}/xen/util/mac.py
+${PYSITELIB}/xen/util/mac.pyc
+${PYSITELIB}/xen/util/mkdir.py
+${PYSITELIB}/xen/util/mkdir.pyc
+${PYSITELIB}/xen/util/pci.py
+${PYSITELIB}/xen/util/pci.pyc
+${PYSITELIB}/xen/util/security.py
+${PYSITELIB}/xen/util/security.pyc
+${PYSITELIB}/xen/util/xmlrpcclient.py
+${PYSITELIB}/xen/util/xmlrpcclient.pyc
+${PYSITELIB}/xen/util/xmlrpclib2.py
+${PYSITELIB}/xen/util/xmlrpclib2.pyc
+${PYSITELIB}/xen/util/xpopen.py
+${PYSITELIB}/xen/util/xpopen.pyc
+${PYSITELIB}/xen/web/SrvBase.py
+${PYSITELIB}/xen/web/SrvBase.pyc
+${PYSITELIB}/xen/web/SrvDir.py
+${PYSITELIB}/xen/web/SrvDir.pyc
+${PYSITELIB}/xen/web/__init__.py
+${PYSITELIB}/xen/web/__init__.pyc
+${PYSITELIB}/xen/web/connection.py
+${PYSITELIB}/xen/web/connection.pyc
+${PYSITELIB}/xen/web/http.py
+${PYSITELIB}/xen/web/http.pyc
+${PYSITELIB}/xen/web/httpserver.py
+${PYSITELIB}/xen/web/httpserver.pyc
+${PYSITELIB}/xen/web/protocol.py
+${PYSITELIB}/xen/web/protocol.pyc
+${PYSITELIB}/xen/web/resource.py
+${PYSITELIB}/xen/web/resource.pyc
+${PYSITELIB}/xen/web/static.py
+${PYSITELIB}/xen/web/static.pyc
+${PYSITELIB}/xen/web/tcp.py
+${PYSITELIB}/xen/web/tcp.pyc
+${PYSITELIB}/xen/web/unix.py
+${PYSITELIB}/xen/web/unix.pyc
+${PYSITELIB}/xen/xend/Args.py
+${PYSITELIB}/xen/xend/Args.pyc
+${PYSITELIB}/xen/xend/PrettyPrint.py
+${PYSITELIB}/xen/xend/PrettyPrint.pyc
+${PYSITELIB}/xen/xend/Vifctl.py
+${PYSITELIB}/xen/xend/Vifctl.pyc
+${PYSITELIB}/xen/xend/XendAPI.py
+${PYSITELIB}/xen/xend/XendAPI.pyc
+${PYSITELIB}/xen/xend/XendAPIConstants.py
+${PYSITELIB}/xen/xend/XendAPIConstants.pyc
+${PYSITELIB}/xen/xend/XendAPIStore.py
+${PYSITELIB}/xen/xend/XendAPIStore.pyc
+${PYSITELIB}/xen/xend/XendAPIVersion.py
+${PYSITELIB}/xen/xend/XendAPIVersion.pyc
+${PYSITELIB}/xen/xend/XendAuthSessions.py
+${PYSITELIB}/xen/xend/XendAuthSessions.pyc
+${PYSITELIB}/xen/xend/XendBase.py
+${PYSITELIB}/xen/xend/XendBase.pyc
+${PYSITELIB}/xen/xend/XendBootloader.py
+${PYSITELIB}/xen/xend/XendBootloader.pyc
+${PYSITELIB}/xen/xend/XendCheckpoint.py
+${PYSITELIB}/xen/xend/XendCheckpoint.pyc
+${PYSITELIB}/xen/xend/XendClient.py
+${PYSITELIB}/xen/xend/XendClient.pyc
+${PYSITELIB}/xen/xend/XendConfig.py
+${PYSITELIB}/xen/xend/XendConfig.pyc
+${PYSITELIB}/xen/xend/XendConstants.py
+${PYSITELIB}/xen/xend/XendConstants.pyc
+${PYSITELIB}/xen/xend/XendDevices.py
+${PYSITELIB}/xen/xend/XendDevices.pyc
+${PYSITELIB}/xen/xend/XendDmesg.py
+${PYSITELIB}/xen/xend/XendDmesg.pyc
+${PYSITELIB}/xen/xend/XendDomain.py
+${PYSITELIB}/xen/xend/XendDomain.pyc
+${PYSITELIB}/xen/xend/XendDomainInfo.py
+${PYSITELIB}/xen/xend/XendDomainInfo.pyc
+${PYSITELIB}/xen/xend/XendError.py
+${PYSITELIB}/xen/xend/XendError.pyc
+${PYSITELIB}/xen/xend/XendLocalStorageRepo.py
+${PYSITELIB}/xen/xend/XendLocalStorageRepo.pyc
+${PYSITELIB}/xen/xend/XendLogging.py
+${PYSITELIB}/xen/xend/XendLogging.pyc
+${PYSITELIB}/xen/xend/XendMonitor.py
+${PYSITELIB}/xen/xend/XendMonitor.pyc
+${PYSITELIB}/xen/xend/XendNetwork.py
+${PYSITELIB}/xen/xend/XendNetwork.pyc
+${PYSITELIB}/xen/xend/XendNode.py
+${PYSITELIB}/xen/xend/XendNode.pyc
+${PYSITELIB}/xen/xend/XendOptions.py
+${PYSITELIB}/xen/xend/XendOptions.pyc
+${PYSITELIB}/xen/xend/XendPBD.py
+${PYSITELIB}/xen/xend/XendPBD.pyc
+${PYSITELIB}/xen/xend/XendPIF.py
+${PYSITELIB}/xen/xend/XendPIF.pyc
+${PYSITELIB}/xen/xend/XendPIFMetrics.py
+${PYSITELIB}/xen/xend/XendPIFMetrics.pyc
+${PYSITELIB}/xen/xend/XendProtocol.py
+${PYSITELIB}/xen/xend/XendProtocol.pyc
+${PYSITELIB}/xen/xend/XendQCoWStorageRepo.py
+${PYSITELIB}/xen/xend/XendQCoWStorageRepo.pyc
+${PYSITELIB}/xen/xend/XendStateStore.py
+${PYSITELIB}/xen/xend/XendStateStore.pyc
+${PYSITELIB}/xen/xend/XendStorageRepository.py
+${PYSITELIB}/xen/xend/XendStorageRepository.pyc
+${PYSITELIB}/xen/xend/XendTask.py
+${PYSITELIB}/xen/xend/XendTask.pyc
+${PYSITELIB}/xen/xend/XendTaskManager.py
+${PYSITELIB}/xen/xend/XendTaskManager.pyc
+${PYSITELIB}/xen/xend/XendVDI.py
+${PYSITELIB}/xen/xend/XendVDI.pyc
+${PYSITELIB}/xen/xend/XendVMMetrics.py
+${PYSITELIB}/xen/xend/XendVMMetrics.pyc
+${PYSITELIB}/xen/xend/XendVnet.py
+${PYSITELIB}/xen/xend/XendVnet.pyc
+${PYSITELIB}/xen/xend/__init__.py
+${PYSITELIB}/xen/xend/__init__.pyc
+${PYSITELIB}/xen/xend/arch.py
+${PYSITELIB}/xen/xend/arch.pyc
+${PYSITELIB}/xen/xend/balloon.py
+${PYSITELIB}/xen/xend/balloon.pyc
+${PYSITELIB}/xen/xend/encode.py
+${PYSITELIB}/xen/xend/encode.pyc
+${PYSITELIB}/xen/xend/image.py
+${PYSITELIB}/xen/xend/image.pyc
+${PYSITELIB}/xen/xend/osdep.py
+${PYSITELIB}/xen/xend/osdep.pyc
+${PYSITELIB}/xen/xend/server/BlktapController.py
+${PYSITELIB}/xen/xend/server/BlktapController.pyc
+${PYSITELIB}/xen/xend/server/ConsoleController.py
+${PYSITELIB}/xen/xend/server/ConsoleController.pyc
+${PYSITELIB}/xen/xend/server/DevController.py
+${PYSITELIB}/xen/xend/server/DevController.pyc
+${PYSITELIB}/xen/xend/server/SSLXMLRPCServer.py
+${PYSITELIB}/xen/xend/server/SSLXMLRPCServer.pyc
+${PYSITELIB}/xen/xend/server/SrvDaemon.py
+${PYSITELIB}/xen/xend/server/SrvDaemon.pyc
+${PYSITELIB}/xen/xend/server/SrvDmesg.py
+${PYSITELIB}/xen/xend/server/SrvDmesg.pyc
+${PYSITELIB}/xen/xend/server/SrvDomain.py
+${PYSITELIB}/xen/xend/server/SrvDomain.pyc
+${PYSITELIB}/xen/xend/server/SrvDomainDir.py
+${PYSITELIB}/xen/xend/server/SrvDomainDir.pyc
+${PYSITELIB}/xen/xend/server/SrvNode.py
+${PYSITELIB}/xen/xend/server/SrvNode.pyc
+${PYSITELIB}/xen/xend/server/SrvRoot.py
+${PYSITELIB}/xen/xend/server/SrvRoot.pyc
+${PYSITELIB}/xen/xend/server/SrvServer.py
+${PYSITELIB}/xen/xend/server/SrvServer.pyc
+${PYSITELIB}/xen/xend/server/SrvVnetDir.py
+${PYSITELIB}/xen/xend/server/SrvVnetDir.pyc
+${PYSITELIB}/xen/xend/server/SrvXendLog.py
+${PYSITELIB}/xen/xend/server/SrvXendLog.pyc
+${PYSITELIB}/xen/xend/server/XMLRPCServer.py
+${PYSITELIB}/xen/xend/server/XMLRPCServer.pyc
+${PYSITELIB}/xen/xend/server/__init__.py
+${PYSITELIB}/xen/xend/server/__init__.pyc
+${PYSITELIB}/xen/xend/server/blkif.py
+${PYSITELIB}/xen/xend/server/blkif.pyc
+${PYSITELIB}/xen/xend/server/iopif.py
+${PYSITELIB}/xen/xend/server/iopif.pyc
+${PYSITELIB}/xen/xend/server/irqif.py
+${PYSITELIB}/xen/xend/server/irqif.pyc
+${PYSITELIB}/xen/xend/server/netif.py
+${PYSITELIB}/xen/xend/server/netif.pyc
+${PYSITELIB}/xen/xend/server/params.py
+${PYSITELIB}/xen/xend/server/params.pyc
+${PYSITELIB}/xen/xend/server/pciif.py
+${PYSITELIB}/xen/xend/server/pciif.pyc
+${PYSITELIB}/xen/xend/server/pciquirk.py
+${PYSITELIB}/xen/xend/server/pciquirk.pyc
+${PYSITELIB}/xen/xend/server/relocate.py
+${PYSITELIB}/xen/xend/server/relocate.pyc
+${PYSITELIB}/xen/xend/server/tests/__init__.py
+${PYSITELIB}/xen/xend/server/tests/__init__.pyc
+${PYSITELIB}/xen/xend/server/tests/test_controllers.py
+${PYSITELIB}/xen/xend/server/tests/test_controllers.pyc
+${PYSITELIB}/xen/xend/server/tpmif.py
+${PYSITELIB}/xen/xend/server/tpmif.pyc
+${PYSITELIB}/xen/xend/server/usbif.py
+${PYSITELIB}/xen/xend/server/usbif.pyc
+${PYSITELIB}/xen/xend/server/vfbif.py
+${PYSITELIB}/xen/xend/server/vfbif.pyc
+${PYSITELIB}/xen/xend/sxp.py
+${PYSITELIB}/xen/xend/sxp.pyc
+${PYSITELIB}/xen/xend/tests/__init__.py
+${PYSITELIB}/xen/xend/tests/__init__.pyc
+${PYSITELIB}/xen/xend/tests/test_XendConfig.py
+${PYSITELIB}/xen/xend/tests/test_XendConfig.pyc
+${PYSITELIB}/xen/xend/tests/test_sxp.py
+${PYSITELIB}/xen/xend/tests/test_sxp.pyc
+${PYSITELIB}/xen/xend/tests/test_uuid.py
+${PYSITELIB}/xen/xend/tests/test_uuid.pyc
+${PYSITELIB}/xen/xend/uuid.py
+${PYSITELIB}/xen/xend/uuid.pyc
+${PYSITELIB}/xen/xend/xenstore/__init__.py
+${PYSITELIB}/xen/xend/xenstore/__init__.pyc
+${PYSITELIB}/xen/xend/xenstore/tests/__init__.py
+${PYSITELIB}/xen/xend/xenstore/tests/__init__.pyc
+${PYSITELIB}/xen/xend/xenstore/tests/stress_xs.py
+${PYSITELIB}/xen/xend/xenstore/tests/stress_xs.pyc
+${PYSITELIB}/xen/xend/xenstore/xstransact.py
+${PYSITELIB}/xen/xend/xenstore/xstransact.pyc
+${PYSITELIB}/xen/xend/xenstore/xsutil.py
+${PYSITELIB}/xen/xend/xenstore/xsutil.pyc
+${PYSITELIB}/xen/xend/xenstore/xswatch.py
+${PYSITELIB}/xen/xend/xenstore/xswatch.pyc
+${PYSITELIB}/xen/xm/XenAPI.py
+${PYSITELIB}/xen/xm/XenAPI.pyc
+${PYSITELIB}/xen/xm/__init__.py
+${PYSITELIB}/xen/xm/__init__.pyc
+${PYSITELIB}/xen/xm/addlabel.py
+${PYSITELIB}/xen/xm/addlabel.pyc
+${PYSITELIB}/xen/xm/cfgbootpolicy.py
+${PYSITELIB}/xen/xm/cfgbootpolicy.pyc
+${PYSITELIB}/xen/xm/console.py
+${PYSITELIB}/xen/xm/console.pyc
+${PYSITELIB}/xen/xm/create.py
+${PYSITELIB}/xen/xm/create.pyc
+${PYSITELIB}/xen/xm/dry-run.py
+${PYSITELIB}/xen/xm/dry-run.pyc
+${PYSITELIB}/xen/xm/dumppolicy.py
+${PYSITELIB}/xen/xm/dumppolicy.pyc
+${PYSITELIB}/xen/xm/getlabel.py
+${PYSITELIB}/xen/xm/getlabel.pyc
+${PYSITELIB}/xen/xm/help.py
+${PYSITELIB}/xen/xm/help.pyc
+${PYSITELIB}/xen/xm/labels.py
+${PYSITELIB}/xen/xm/labels.pyc
+${PYSITELIB}/xen/xm/loadpolicy.py
+${PYSITELIB}/xen/xm/loadpolicy.pyc
+${PYSITELIB}/xen/xm/main.py
+${PYSITELIB}/xen/xm/main.pyc
+${PYSITELIB}/xen/xm/makepolicy.py
+${PYSITELIB}/xen/xm/makepolicy.pyc
+${PYSITELIB}/xen/xm/migrate.py
+${PYSITELIB}/xen/xm/migrate.pyc
+${PYSITELIB}/xen/xm/new.py
+${PYSITELIB}/xen/xm/new.pyc
+${PYSITELIB}/xen/xm/opts.py
+${PYSITELIB}/xen/xm/opts.pyc
+${PYSITELIB}/xen/xm/resources.py
+${PYSITELIB}/xen/xm/resources.pyc
+${PYSITELIB}/xen/xm/rmlabel.py
+${PYSITELIB}/xen/xm/rmlabel.pyc
+${PYSITELIB}/xen/xm/shutdown.py
+${PYSITELIB}/xen/xm/shutdown.pyc
+${PYSITELIB}/xen/xm/tests/__init__.py
+${PYSITELIB}/xen/xm/tests/__init__.pyc
+${PYSITELIB}/xen/xm/tests/test_create.py
+${PYSITELIB}/xen/xm/tests/test_create.pyc
+${PYSITELIB}/xen/xm/xenapi_create.py
+${PYSITELIB}/xen/xm/xenapi_create.pyc
+sbin/netfix
+sbin/xen-bugtool
+sbin/xenbackendd
+sbin/xenconsoled
+sbin/xend
+sbin/xenperf
+sbin/xenstored
+sbin/xentop
+sbin/xen-python-path
+sbin/xm
+share/examples/rc.d/xenbackendd
+share/examples/rc.d/xend
+share/examples/rc.d/xendomains
+share/examples/xen/block
+share/examples/xen/netbsd1
+share/examples/xen/vif-bridge
+share/examples/xen/vif-ip
+share/examples/xen/xend-config.sxp
+share/examples/xen/xmexample1
+share/examples/xen/xmexample2
+share/examples/xen/xmexample3
+share/xen/create.dtd
+@dirrm share/xen
+@dirrm share/examples/xen
+@dirrm ${PYSITELIB}/xen/xm/tests
+@dirrm ${PYSITELIB}/xen/xm
+@dirrm ${PYSITELIB}/xen/xend/xenstore/tests
+@dirrm ${PYSITELIB}/xen/xend/xenstore
+@dirrm ${PYSITELIB}/xen/xend/tests
+@dirrm ${PYSITELIB}/xen/xend/server/tests
+@dirrm ${PYSITELIB}/xen/xend/server
+@dirrm ${PYSITELIB}/xen/xend
+@dirrm ${PYSITELIB}/xen/web
+@dirrm ${PYSITELIB}/xen/util
+@dirrm ${PYSITELIB}/xen/sv
+@dirrm ${PYSITELIB}/xen/lowlevel
+@dirrm ${PYSITELIB}/xen
diff --git a/sysutils/xentools3/buildlink3.mk b/sysutils/xentools3/buildlink3.mk
new file mode 100644
index 00000000000..414fa2d7561
--- /dev/null
+++ b/sysutils/xentools3/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+XENTOOLS3_BUILDLINK3_MK:= ${XENTOOLS3_BUILDLINK3_MK}+
+
+.if ${BUILDLINK_DEPTH} == "+"
+BUILDLINK_DEPENDS+= xentools3
+.endif
+
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Nxentools3}
+BUILDLINK_PACKAGES+= xentools3
+BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}xentools3
+
+.if ${XENTOOLS3_BUILDLINK3_MK} == "+"
+BUILDLINK_API_DEPENDS.xentools3+= xentools3>=3.1.0
+BUILDLINK_PKGSRCDIR.xentools3?= ../../sysutils/xentools3
+.endif # XENTOOLS3_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff --git a/sysutils/xentools3/distinfo b/sysutils/xentools3/distinfo
new file mode 100644
index 00000000000..8dbdcc4df8a
--- /dev/null
+++ b/sysutils/xentools3/distinfo
@@ -0,0 +1,46 @@
+$NetBSD: distinfo,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+
+SHA1 (xen-3.1.0-src.tgz) = fa4b54c36626f2cce9b15dc99cafda0b42c54777
+RMD160 (xen-3.1.0-src.tgz) = 2fd65a3b81e522d0ed2d62fd11e5977167f1ceb3
+Size (xen-3.1.0-src.tgz) = 6831094 bytes
+SHA1 (patch-aa) = 86a6c9c2a43da76a5746835e13646b24e6992070
+SHA1 (patch-ab) = dda7b5fefec4136f9d4b39a9598bc7a965ba3937
+SHA1 (patch-ac) = 4eb0f474d4e3a685788c1ce92c0b407dc3d7a855
+SHA1 (patch-ad) = ec36d712925ddf06aac7d6393ad818a51c4363f3
+SHA1 (patch-al) = da759ccbb2c4b48f42178cff47ace7ef42466814
+SHA1 (patch-as) = 6f05feeb9dd63f2071d48b0d8aa8c6a0952e60c7
+SHA1 (patch-au) = beb2eaa8bf832e179e69b1758cfe0fafafdc496b
+SHA1 (patch-av) = be2a1440126908996410f92a04ad479f8a2ca373
+SHA1 (patch-aw) = 8039fa7bd7799efc48da9550f861e2212cb3361b
+SHA1 (patch-ax) = c2fd0f25ed00498039eececcfb467a236f608efa
+SHA1 (patch-ba) = 464405094eb798cce37302bdbc935561248ebd4e
+SHA1 (patch-bb) = d6705871ab5655719cac1df2daf03845a8d50fba
+SHA1 (patch-bc) = c143c3c587f254af1552667a70e2fac1f0f9665e
+SHA1 (patch-be) = dc8e2a96f39cb540eece35468e2e055201c80220
+SHA1 (patch-bf) = 8b4ecb5cc6c92e3b52574f725f577df062c4f147
+SHA1 (patch-bg) = 3d390a3155db6a1f9c910868b7f615c2f270dc4d
+SHA1 (patch-bh) = c9719a85d84268fab81da989b06c7eca341bb6f9
+SHA1 (patch-bo) = 473f6615d275d7a9d65ba6abfc7b809cb5e334fb
+SHA1 (patch-br) = 906ac9598808f7e9677a04bbe159d174ea6f8b9a
+SHA1 (patch-bs) = e6542ccdad7b48536d2d1b0ad533da4b1a784022
+SHA1 (patch-bt) = d1cfab2ccf14d3df0fdda4c4699258997d2eb5d2
+SHA1 (patch-bw) = d4bdb0dcc48cabefb568042d3b58822f8251b1bd
+SHA1 (patch-cb) = 0bf2513749e28ff955caabd76bf79dd8280b61ed
+SHA1 (patch-cc) = 3e618c7da953115e7b3c7fe07f17b75ef2c2bb34
+SHA1 (patch-cd) = 8fc057e9dc98e356ba46cdf183a8891c59c005b8
+SHA1 (patch-cf) = 05c5e86d33d31a2216c2751a2bf684c8d5d06746
+SHA1 (patch-cg) = 26aa623c34b8b0aebffd93451291264ad7d99c94
+SHA1 (patch-ch) = ebe2aedf1ecd1dce66f4a8a25ef5e83ee1d4c60d
+SHA1 (patch-ci) = 1338452d7994b3de40e80fb395175ddbe325b577
+SHA1 (patch-cj) = 166e2190a31bba842da1111310ba7b1ad35a5d81
+SHA1 (patch-ck) = 3783d9b4b9344670bae2f35e2ac7f11e2ec9ce7b
+SHA1 (patch-cm) = 802d395f1dc391a827487bbc9fcfe2bbd6af07de
+SHA1 (patch-cn) = 40ae04194cca94b112133e962d4cf7487412925a
+SHA1 (patch-co) = 470535c84115dc3d96ec7e30d1e5c2380af27133
+SHA1 (patch-cp) = 1f774a6636ce6646fc83bab304e84ce2d8886db5
+SHA1 (patch-cq) = 9d45b395050b47d3d2b98487673d37feb35df80c
+SHA1 (patch-cr) = d5ccaddebdbe266ca2136b82a8e6968f636a2799
+SHA1 (patch-cs) = f3932e1b49870078532316ccb1dfa64378c3e8e4
+SHA1 (patch-ct) = 14259d4c223b12218a07f2a2860e2706d40157b8
+SHA1 (patch-cu) = 90b4a39a037c6f2aeb694e1df8e7a7165b51cdbc
+SHA1 (patch-cv) = 1fea2a1cd139e2e46655622ad5f02b37e1501e0b
diff --git a/sysutils/xentools3/files/NetBSD.mk b/sysutils/xentools3/files/NetBSD.mk
new file mode 100644
index 00000000000..7d57dd437e3
--- /dev/null
+++ b/sysutils/xentools3/files/NetBSD.mk
@@ -0,0 +1,2 @@
+# $NetBSD: NetBSD.mk,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+include $(XEN_ROOT)/config/StdGNU.mk
diff --git a/sysutils/xentools3/files/block-nbsd b/sysutils/xentools3/files/block-nbsd
new file mode 100644
index 00000000000..0530c45b806
--- /dev/null
+++ b/sysutils/xentools3/files/block-nbsd
@@ -0,0 +1,88 @@
+#!/bin/sh -e
+
+# $NetBSD: block-nbsd,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+# Called by xenbackendd
+# Usage: block xsdir_backend_path state
+
+PATH=/bin:/usr/bin:@PREFIX@/bin:/sbin:/usr/sbin:@PREFIX@/sbin
+export PATH
+
+error() {
+ echo "$@" >&2
+ xenstore_write $xpath/hotplug-status error
+ exit 1
+}
+
+
+xpath=$1
+xstatus=$2
+xtype=$(xenstore-read "$xpath/type")
+xparams=$(xenstore-read "$xpath/params")
+
+case $xstatus in
+6)
+ # device removed
+ case $xtype in
+ file)
+ vnd=$(xenstore-read "$xpath/vnd" || echo none)
+ if [ $vnd != none ]; then
+ vnconfig -u $vnd
+ fi
+ ;;
+ phy)
+ ;;
+ *)
+ echo "unknown type $xtype" >&2
+ ;;
+ esac
+ xenstore-rm $xpath
+ exit 0
+ ;;
+2)
+ case $xtype in
+ file)
+ # Store the list of available vnd(4) devices in
+ #``available_disks'', and mark them as ``free''.
+ list=`ls -1 /dev/vnd[0-9]*d | sed "s,/dev/vnd,,;s,d,," | sort -n`
+ for i in $list; do
+ disk="vnd$i"
+ available_disks="$available_disks $disk"
+ eval $disk=free
+ done
+ # Mark the used vnd(4) devices as ``used''.
+ for disk in `sysctl hw.disknames`; do
+ case $disk in
+ vnd[0-9]*) eval $disk=used ;;
+ esac
+ done
+ # Configure the first free vnd(4) device.
+ for disk in $available_disks; do
+ eval status=\$$disk
+ if [ "$status" = "free" ] && \
+ vnconfig /dev/${disk}d $xparams >/dev/null; then
+ device=/dev/${disk}d
+ echo vnconfig /dev/${disk}d $xparams
+ break
+ fi
+ done
+ if [ x$device = x ] ; then
+ error "no available vnd device"
+ fi
+ echo xenstore-write $xpath/vnd $device
+ xenstore-write $xpath/vnd $device
+ ;;
+ phy)
+ device=$xparams
+ ;;
+ esac
+ physical_device=$(stat -f '%r' "$device")
+ echo xenstore-write $xpath/physical-device $physical_device
+ xenstore-write $xpath/physical-device $physical_device
+ echo xenstore-write $xpath/hotplug-status connected
+ xenstore-write $xpath/hotplug-status connected
+ exit 0
+ ;;
+*)
+ exit 0
+ ;;
+esac
diff --git a/sysutils/xentools3/files/netbsd1-nbsd b/sysutils/xentools3/files/netbsd1-nbsd
new file mode 100644
index 00000000000..90883c018d1
--- /dev/null
+++ b/sysutils/xentools3/files/netbsd1-nbsd
@@ -0,0 +1,48 @@
+# -*- mode: python; -*-
+#============================================================================
+# Python configuration setup for 'xm create'.
+# This script sets the parameters used when a domain is created using 'xm create'.
+# You use a separate script for each domain you want to create, or
+# you can set the parameters for the domain on the xm command line.
+#============================================================================
+
+#----------------------------------------------------------------------------
+# Kernel image file.
+kernel = "/usr/pkg/etc/xen/kernels/netbsd-XEN3_DOMU.gz"
+#kernel = "/usr/pkg/etc/xen/kernels/netbsd-INSTALL_XEN3_DOMU.gz"
+
+# Initial memory allocation (in megabytes) for the new domain.
+memory = 256
+
+# A name for your domain. All domains must have different names.
+name = "netbsd1"
+
+#----------------------------------------------------------------------------
+# network configuration.
+# The mac address is optionnal, it will use a random one if not specified.
+# By default we create a bridged configuration; when a vif is created
+# the script @PKG_SYSCONFDIR@/scripts/vif-bridge is called to connect
+# the bridge to the designated bridge (the bridge should already be up)
+vif = [ 'mac=00:16:3e:00:00:11, bridge=bridge0' ]
+
+#it's possible to use a different script when the vif is created;
+# for example to use a routed setup instead of bridged:
+# vif = [ 'mac=00:16:3e:00:00:11, ip=10.0.0.1 netmask 255.255.255.0, script=vif-ip' ]
+
+#----------------------------------------------------------------------------
+# Define the disk devices you want the domain to have access to, and
+# what you want them accessible as.
+# Each disk entry is of the form phy:UNAME,DEV,MODE
+# where UNAME is the device, DEV is the device name the domain will see,
+# and MODE is r for read-only, w for read-write.
+# For NetBSD guest DEV doesn't matter, so we can just use increasing numbers
+# here. For linux guests you have to use a linux device name (e.g. hda1)
+# or the corresponding device number (e.g 0x301 for hda1)
+
+disk = [ 'file:/home/domains/netbsd1,0x1,w' ]
+
+#----------------------------------------------------------------------------
+# Boot parameters (e.g. -s, -a, ...)
+extra = ""
+
+#============================================================================
diff --git a/sysutils/xentools3/files/vif-bridge-nbsd b/sysutils/xentools3/files/vif-bridge-nbsd
new file mode 100644
index 00000000000..a872085f186
--- /dev/null
+++ b/sysutils/xentools3/files/vif-bridge-nbsd
@@ -0,0 +1,35 @@
+#!/bin/sh -e
+
+# $NetBSD: vif-bridge-nbsd,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+# Called by xenbackendd
+# Usage: vif-bridge xsdir_backend_path state
+
+PATH=/bin:/usr/bin:@PREFIX@/bin:/sbin:/usr/sbin:@PREFIX@/sbin
+export PATH
+
+xpath=$1
+xstatus=$2
+
+case $xstatus in
+6)
+ # device removed
+ xenstore-rm $xpath
+ exit 0
+ ;;
+2)
+ xbridge=$(xenstore-read "$xpath/bridge")
+ xfid=$(xenstore-read "$xpath/frontend-id")
+ xhandle=$(xenstore-read "$xpath/handle")
+ iface=xvif$xfid.$xhandle
+ echo ifconfig $iface up
+ ifconfig $iface up
+ brconfig $xbridge add $iface
+ echo brconfig $xbridge add $iface
+ xenstore-write $xpath/hotplug-status connected
+ echo xenstore-write $xpath/hotplug-status connected
+ exit 0
+ ;;
+*)
+ exit 0
+ ;;
+esac
diff --git a/sysutils/xentools3/files/vif-ip-nbsd b/sysutils/xentools3/files/vif-ip-nbsd
new file mode 100755
index 00000000000..a1a5f867f1d
--- /dev/null
+++ b/sysutils/xentools3/files/vif-ip-nbsd
@@ -0,0 +1,33 @@
+#!/bin/sh -e
+
+# $NetBSD: vif-ip-nbsd,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+# Called by xenbackendd
+# Usage: vif-ip xsdir_backend_path state
+
+PATH=/bin:/usr/bin:@PREFIX@/bin:/sbin:/usr/sbin:@PREFIX@/sbin
+export PATH
+
+xpath=$1
+xstatus=$2
+
+case $xstatus in
+6)
+ # device removed
+ xenstore-rm $xpath
+ exit 0
+ ;;
+2)
+ xip=$(xenstore-read "$xpath/ip")
+ xfid=$(xenstore-read "$xpath/frontend-id")
+ xhandle=$(xenstore-read "$xpath/handle")
+ iface=xvif$xfid.$xhandle
+ echo ifconfig $iface $xip up
+ ifconfig $iface $xip up
+ xenstore-write $xpath/hotplug-status connected
+ echo xenstore-write $xpath/hotplug-status connected
+ exit 0
+ ;;
+*)
+ exit 0
+ ;;
+esac
diff --git a/sysutils/xentools3/files/xenbackendd.c b/sysutils/xentools3/files/xenbackendd.c
new file mode 100644
index 00000000000..18e43313ff1
--- /dev/null
+++ b/sysutils/xentools3/files/xenbackendd.c
@@ -0,0 +1,319 @@
+/* $NetBSD: xenbackendd.c,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $ */
+/*
+ * Copyright (C) 2006 Manuel bouyer
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; under version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <getopt.h>
+#include <stdbool.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <string.h>
+#include <syslog.h>
+#include <stdarg.h>
+
+#include <xenctrl.h>
+#include <xs.h>
+
+#define DEVTYPE_UNKNOWN 0
+#define DEVTYPE_VIF 1
+#define DEVTYPE_VBD 2
+
+#define DOMAIN_PATH "/local/domain/0"
+
+#ifndef VBD_SCRIPT
+#define VBD_SCRIPT "/usr/pkg/etc/xen/scripts/block"
+#endif
+#ifndef LOG_FILE
+#define LOG_FILE "/var/log/xenbackendd.log"
+#endif
+#ifndef PID_FILE
+#define PID_FILE "/var/run/xenbackendd.pid"
+#endif
+
+
+struct xs_handle *xs;
+int xc;
+
+int xen_setup(void);
+void dolog(int, const char *, ...);
+void dodebug(const char *, ...);
+void doexec(const char *, const char *, const char *);
+void usage(void);
+
+int fflag = 0;
+int dflag = 0;
+
+const char *vbd_script = NULL;
+const char *log_file = NULL;
+const char *pidfile = NULL;
+int
+main(int argc, char * const argv[])
+{
+ char **vec;
+ unsigned int num;
+ int i;
+ char *s;
+ int state;
+ char *sstate;
+ char *p;
+ char buf[80];
+ int type = DEVTYPE_UNKNOWN;
+ extern char *optarg;
+ extern int optind;
+ int ch;
+ int debug_fd;
+ FILE *pidfile_f;
+
+ while ((ch = getopt(argc, argv, "dfl:p:s:")) != -1) {
+ switch (ch) {
+ case 'd':
+ dflag = 1;
+ break;
+ case 'f':
+ fflag = 1;
+ break;
+ case 'l':
+ log_file = optarg;
+ break;
+ case 'p':
+ pidfile = pidfile;
+ case 's':
+ vbd_script = optarg;
+ break;
+ default:
+ usage();
+ }
+ }
+
+ if (vbd_script == NULL)
+ vbd_script = VBD_SCRIPT;
+ if (pidfile == NULL)
+ pidfile = PID_FILE;
+ if (log_file == NULL)
+ log_file = LOG_FILE;
+
+ openlog("xenbackendd", LOG_PID | LOG_NDELAY, LOG_DAEMON);
+
+ if (fflag == 0) {
+ /* open log file */
+ debug_fd = open(log_file, O_RDWR | O_CREAT | O_TRUNC, 0644);
+ if (debug_fd == -1) {
+ dolog(LOG_ERR, "can't open %s: %s",
+ log_file, strerror(errno));
+ exit(1);
+ }
+ }
+
+ if (fflag == 0) {
+ /* daemonize */
+ pidfile_f = fopen(pidfile, "w");
+ if (pidfile_f == NULL) {
+ dolog(LOG_ERR, "can't open %s: %s",
+ pidfile, strerror(errno));
+ exit(1);
+ }
+ if (daemon(0, 0) < 0) {
+ dolog(LOG_ERR, "can't daemonize: %s",
+ strerror(errno));
+ exit(1);
+ }
+ fprintf(pidfile_f, "%d\n", (int)getpid());
+ fclose(pidfile_f);
+ /* retirect stderr to log file */
+ if (dup2(debug_fd, STDERR_FILENO) < 0) {
+ dolog(LOG_ERR, "can't redirect stderr to %s: %s\n",
+ log_file, strerror(errno));
+ exit(1);
+ }
+ /* also redirect stdout if we're in debug mode */
+ if (dflag) {
+ if (dup2(debug_fd, STDOUT_FILENO) < 0) {
+ dolog(LOG_ERR,
+ "can't redirect stdout to %s: %s\n",
+ log_file, strerror(errno));
+ exit(1);
+ }
+ }
+ close(debug_fd);
+ debug_fd = -1;
+ }
+
+ if (xen_setup() < 0) {
+ exit(1);
+ }
+
+ while (1) {
+ vec = xs_read_watch(xs, &num);
+ if (!vec) {
+ dolog(LOG_ERR, "xs_read_watch: NULL\n");
+ continue;
+ }
+ if (strlen(vec[XS_WATCH_PATH]) < sizeof("state"))
+ goto next1;
+ /* find last component of path, check if it's "state" */
+ p = &vec[XS_WATCH_PATH][
+ strlen(vec[XS_WATCH_PATH]) - sizeof("state")];
+ if (p[0] != '/')
+ goto next1;
+ p[0] = '\0';
+ p++;
+ if (strcmp(p, "state") != 0)
+ goto next1;
+ snprintf(buf, sizeof(buf), "%s/state", vec[XS_WATCH_PATH]);
+ sstate = xs_read(xs, XBT_NULL, buf, 0);
+ if (sstate == NULL) {
+ dolog(LOG_ERR,
+ "Failed to read %s (%s)", buf, strerror(errno));
+ goto next1;
+ }
+ state = atoi(sstate);
+ snprintf(buf, sizeof(buf), "%s/hotplug-status",
+ vec[XS_WATCH_PATH]);
+ s = xs_read(xs, XBT_NULL, buf, 0);
+ if (s != NULL && state != 6 /* XenbusStateClosed */)
+ goto next2;
+ if (strncmp(vec[XS_WATCH_PATH],
+ DOMAIN_PATH "/backend/vif",
+ strlen(DOMAIN_PATH "/backend/vif")) == 0)
+ type = DEVTYPE_VIF;
+ if (strncmp(vec[XS_WATCH_PATH],
+ DOMAIN_PATH "/backend/vbd",
+ strlen(DOMAIN_PATH "/backend/vbd")) == 0)
+ type = DEVTYPE_VBD;
+ switch(type) {
+ case DEVTYPE_VIF:
+ if (s)
+ free(s);
+ snprintf(buf, sizeof(buf), "%s/script",
+ vec[XS_WATCH_PATH]);
+ s = xs_read(xs, XBT_NULL, buf, 0);
+ if (s == NULL) {
+ dolog(LOG_ERR,
+ "Failed to read %s (%s)", buf,
+ strerror(errno));
+ goto next2;
+ }
+ doexec(s, vec[XS_WATCH_PATH], sstate);
+ break;
+ case DEVTYPE_VBD:
+ doexec(vbd_script, vec[XS_WATCH_PATH], sstate);
+ break;
+ default:
+ break;
+ }
+next2:
+ if (s)
+ free(s);
+ free(sstate);
+next1:
+ free(vec);
+ }
+}
+
+void
+dolog(int pri, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, "\n");
+ fflush(stderr);
+ va_start(ap, fmt);
+ vsyslog(pri, fmt, ap);
+ va_end(ap);
+}
+
+void
+dodebug(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (dflag == 0)
+ return;
+ va_start(ap, fmt);
+ vfprintf(stdout, fmt, ap);
+ va_end(ap);
+ printf("\n");
+ fflush(stdout);
+}
+
+int
+xen_setup(void)
+{
+
+ xs = xs_daemon_open();
+ if (xs == NULL) {
+ dolog(LOG_ERR,
+ "Failed to contact xenstore (%s). Is it running?",
+ strerror(errno));
+ goto out;
+ }
+
+ xc = xc_interface_open();
+ if (xc == -1) {
+ dolog(LOG_ERR, "Failed to contact hypervisor (%s)",
+ strerror(errno));
+ goto out;
+ }
+ if (!xs_watch(xs, DOMAIN_PATH, "backend")) {
+ dolog(LOG_ERR, "xenstore watch on backend fails.");
+ goto out;
+ }
+ return 0;
+ out:
+ if (xs)
+ xs_daemon_close(xs);
+ if (xc != -1)
+ xc_interface_close(xc);
+ return -1;
+}
+
+void
+doexec(const char *cmd, const char *arg1, const char *arg2)
+{
+ dodebug("exec %s %s %s", cmd, arg1, arg2);
+ switch(vfork()) {
+ case -1:
+ dolog(LOG_ERR, "can't vfork: %s", strerror(errno));
+ break;
+ case 0:
+ execl(cmd, cmd, arg1, arg2, NULL);
+ dolog(LOG_ERR, "can't exec %s: %s", cmd, strerror(errno));
+ exit(1);
+ break;
+ default:
+ wait(NULL);
+ break;
+ }
+}
+
+void
+usage()
+{
+ fprintf(stderr, "usage: %s [-d] [-f] [-l log_file] [-p pif_file] [-s vbd_script]\n",
+ getprogname());
+ exit(1);
+}
diff --git a/sysutils/xentools3/files/xenbackendd.sh b/sysutils/xentools3/files/xenbackendd.sh
new file mode 100644
index 00000000000..0e7feb6c496
--- /dev/null
+++ b/sysutils/xentools3/files/xenbackendd.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# $NetBSD: xenbackendd.sh,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+#
+
+# PROVIDE: xenbackendd
+# REQUIRE: xend
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="xenbackendd"
+rcvar=$name
+command="@PREFIX@/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/sysutils/xentools3/files/xend.sh b/sysutils/xentools3/files/xend.sh
new file mode 100644
index 00000000000..24ee4b2b869
--- /dev/null
+++ b/sysutils/xentools3/files/xend.sh
@@ -0,0 +1,29 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: xend.sh,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+#
+# PROVIDE: xend
+# REQUIRE: disks network
+
+. /etc/rc.subr
+
+name="xend"
+rcvar=$name
+command="@PREFIX@/sbin/xend"
+command_interpreter="@RCD_INTERPRETER@"
+start_cmd="@ECHO@ Starting ${name}. && PATH=${PATH}:@PREFIX@/sbin ${command} start"
+start_precmd="xen_precmd"
+privcmd_path="@PROCPATH@/xen/privcmd"
+
+xen_precmd()
+{
+ if [ ! -f ${privcmd_path} ]; then
+ @ECHO@ "${name}: Cannot find ${privcmd_path}!"
+ exit 1
+ fi
+ mkdir -p /var/run/xend || exit 1
+ mkdir -p /var/run/xenstored || exit 1
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/sysutils/xentools3/files/xendomains.sh b/sysutils/xentools3/files/xendomains.sh
new file mode 100644
index 00000000000..7af5aa72c3b
--- /dev/null
+++ b/sysutils/xentools3/files/xendomains.sh
@@ -0,0 +1,134 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: xendomains.sh,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+#
+# PROVIDE: xendomains
+# REQUIRE: xenbackendd
+# KEYWORD: shutdown
+#
+# xendomains This required variable is a whitespace-separated
+# list of domains, e.g., xendomains="dom1 dom2 dom3".
+#
+# xendomains_config This optional variable is a format string that
+# represents the path to the configuration file for
+# each domain. "%s" is substituted with the name of
+# the domain. The default is "@PKG_SYSCONFDIR@/%s".
+#
+# xendomains_prehook This optional variable is a format string that
+# represents the command to run, if it exists, before
+# starting each domain. "%s" is substituted with the
+# name of the domain. The default is
+# "@PKG_SYSCONFDIR@/%s-pre".
+#
+# xendomains_posthook This optional variable is a format string that
+# represents the command to run, if it exists, after
+# stopping each domain. "%s" is substituted with the
+# name of the domain. The default is
+# "@PKG_SYSCONFDIR@/%s-post".
+#
+
+. /etc/rc.subr
+
+name="xendomains"
+ctl_command="@PREFIX@/sbin/xm"
+start_cmd="xendomains_start"
+stop_cmd="xendomains_stop"
+list_cmd="xendomains_list"
+extra_commands="list"
+privcmd_path="@PROCPATH@/xen/privcmd"
+
+xendomains_start()
+{
+ [ -n "$xendomains" ] || return
+
+ if [ ! -f ${privcmd_path} ]; then
+ echo "${name}: Cannot find ${privcmd_path}!"
+ exit 1
+ fi
+
+ echo "Starting xen domains."
+ for domain in $xendomains; do
+ case "$domain" in
+ "") continue ;;
+ esac
+
+ # Start off by running the pre-hook script if it's present.
+ if [ -n "${xendomains_prehook}" ]; then
+ cmdline=`printf "${xendomains_prehook}" $domain`
+ cmd="${cmdline%% *}"
+ if [ -x "$cmd" ]; then
+ $cmdline || echo "Pre-hook \`\`$cmdline'' failed... skipping $domain."
+ continue
+ fi
+ fi
+
+ # Ask xend to create the domain.
+ if [ -n "${xendomains_config}" ]; then
+ file=`printf "${xendomains_config}" $domain`
+ if [ -f "$file" ]; then
+ ${ctl_command} create "$file"
+ fi
+ fi
+ done
+}
+
+xendomains_list() {
+ # Output a whitespace-separated list of live guest domains.
+ ${ctl_command} list | awk '
+ (FNR <= 2) { next }
+ ($5 !~ /s/) { s = s " " $1 }
+ END { sub(" *", "", s); print s }'
+}
+
+xendomains_stop()
+{
+ # Determine an appropriate timeout waiting for all domains to
+ # stop -- always wait at least 60s, and add 5s per active domain.
+ #
+ numdomains=$(xendomains_list | awk '{ print NF }')
+ [ $numdomains -gt 0 ] || return
+ timeout=$((60 + numdomains * 5))
+
+ # Ask xend to stop every domain, and poll xend every 10s up to the
+ # timeout period to check if all the domains are stopped. We
+ # consider a domain in the "s" (shutdown) state to be stopped.
+ #
+ echo "Stopping xen domains."
+ for domain in $(xendomains_list); do
+ ${ctl_command} shutdown --halt $domain
+ done
+ while [ $timeout -gt 0 ]; do
+ livedomains=$(xendomains_list)
+ [ -n "$livedomains" ] || break
+ timeout=$((timeout - 10))
+ sleep 10
+ done
+ livedomains=$(xendomains_list)
+ if [ -n "$livedomains" ]; then
+ echo "Failed to stop: $livedomains"
+ else
+ echo "All domains stopped."
+ fi
+
+ # Finish off by running the post-hook script if it's present.
+ for domain in $xendomains; do
+ case "$domain" in
+ "") continue ;;
+ esac
+ if [ -n "${xendomains_posthook}" ]; then
+ cmdline=`printf "${xendomains_posthook}" $domain`
+ cmd="${cmdline%% *}"
+ if [ -x "$cmd" ]; then
+ $cmdline || echo "Post-hook \`\`$cmdline'' failed."
+ fi
+ fi
+ done
+}
+
+load_rc_config $name
+
+: ${xendomains_config="@PKG_SYSCONFDIR@/%s"}
+: ${xendomains_prehook="@PKG_SYSCONFDIR@/%s-pre"}
+: ${xendomains_posthook="@PKG_SYSCONFDIR@/%s-post"}
+
+run_rc_command "$1"
diff --git a/sysutils/xentools3/files/xenio.h b/sysutils/xentools3/files/xenio.h
new file mode 100644
index 00000000000..d670b414759
--- /dev/null
+++ b/sysutils/xentools3/files/xenio.h
@@ -0,0 +1,105 @@
+/* NetBSD: xenio.h,v 1.3 2005/05/24 12:07:12 yamt Exp $ */
+
+/******************************************************************************
+ * privcmd.h
+ *
+ * Copyright (c) 2003-2004, K A Fraser
+ *
+ * This file may be distributed separately from the Linux kernel, or
+ * incorporated into other software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __NetBSD_PRIVCMD_H__
+#define __NetBSD_PRIVCMD_H__
+
+/* Interface to /proc/xen/privcmd */
+
+typedef struct privcmd_hypercall
+{
+ unsigned long op;
+ unsigned long arg[5];
+} privcmd_hypercall_t;
+
+typedef struct privcmd_mmap_entry {
+ unsigned long va;
+ unsigned long mfn;
+ unsigned long npages;
+} privcmd_mmap_entry_t;
+
+typedef struct privcmd_mmap {
+ int num;
+ domid_t dom; /* target domain */
+ privcmd_mmap_entry_t *entry;
+} privcmd_mmap_t;
+
+typedef struct privcmd_mmapbatch {
+ int num; /* number of pages to populate */
+ domid_t dom; /* target domain */
+ unsigned long addr; /* virtual address */
+ unsigned long *arr; /* array of mfns - top nibble set on err */
+} privcmd_mmapbatch_t;
+
+typedef struct privcmd_blkmsg
+{
+ unsigned long op;
+ void *buf;
+ int buf_size;
+} privcmd_blkmsg_t;
+
+/*
+ * @cmd: IOCTL_PRIVCMD_HYPERCALL
+ * @arg: &privcmd_hypercall_t
+ * Return: Value returned from execution of the specified hypercall.
+ */
+#define IOCTL_PRIVCMD_HYPERCALL \
+ _IOWR('P', 0, privcmd_hypercall_t)
+
+#if defined(_KERNEL)
+/* compat */
+#define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN_OLD \
+ _IO('P', 1)
+#endif /* defined(_KERNEL) */
+
+#define IOCTL_PRIVCMD_MMAP \
+ _IOW('P', 2, privcmd_mmap_t)
+#define IOCTL_PRIVCMD_MMAPBATCH \
+ _IOW('P', 3, privcmd_mmapbatch_t)
+#define IOCTL_PRIVCMD_GET_MACH2PHYS_START_MFN \
+ _IOR('P', 4, unsigned long)
+
+/*
+ * @cmd: IOCTL_PRIVCMD_INITDOMAIN_EVTCHN
+ * @arg: n/a
+ * Return: Port associated with domain-controller end of control event channel
+ * for the initial domain.
+ */
+#define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN \
+ _IOR('P', 5, int)
+
+/* Interface to /dev/xenevt */
+/* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */
+#define EVTCHN_RESET _IO('E', 1)
+/* EVTCHN_BIND: Bind to the specified event-channel port. */
+#define EVTCHN_BIND _IOW('E', 2, unsigned long)
+/* EVTCHN_UNBIND: Unbind from the specified event-channel port. */
+#define EVTCHN_UNBIND _IOW('E', 3, unsigned long)
+
+#endif /* __NetBSD_PRIVCMD_H__ */
diff --git a/sysutils/xentools3/files/xenio3.h b/sysutils/xentools3/files/xenio3.h
new file mode 100644
index 00000000000..7f1cc503af3
--- /dev/null
+++ b/sysutils/xentools3/files/xenio3.h
@@ -0,0 +1,89 @@
+/* $NetBSD: xenio3.h,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $ */
+/******************************************************************************
+ * evtchn.h
+ *
+ * Interface to /dev/xen/evtchn.
+ *
+ * Copyright (c) 2003-2005, K A Fraser
+ *
+ * This file may be distributed separately from the Linux kernel, or
+ * incorporated into other software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __NetBSD_XENIO3_H__
+#define __NetBSD_XENIO3_H__
+
+/*
+ * Bind a fresh port to VIRQ @virq.
+ * Return allocated port.
+ */
+#define IOCTL_EVTCHN_BIND_VIRQ \
+ _IOWR('E', 4, struct ioctl_evtchn_bind_virq)
+struct ioctl_evtchn_bind_virq {
+ unsigned int virq;
+ unsigned int port;
+};
+
+/*
+ * Bind a fresh port to remote <@remote_domain, @remote_port>.
+ * Return allocated port.
+ */
+#define IOCTL_EVTCHN_BIND_INTERDOMAIN \
+ _IOWR('E', 5, struct ioctl_evtchn_bind_interdomain)
+struct ioctl_evtchn_bind_interdomain {
+ unsigned int remote_domain, remote_port;
+ unsigned int port;
+};
+
+/*
+ * Allocate a fresh port for binding to @remote_domain.
+ * Return allocated port.
+ */
+#define IOCTL_EVTCHN_BIND_UNBOUND_PORT \
+ _IOWR('E', 6, struct ioctl_evtchn_bind_unbound_port)
+struct ioctl_evtchn_bind_unbound_port {
+ unsigned int remote_domain;
+ unsigned int port;
+};
+
+/*
+ * Unbind previously allocated @port.
+ */
+#define IOCTL_EVTCHN_UNBIND \
+ _IOW('E', 7, struct ioctl_evtchn_unbind)
+struct ioctl_evtchn_unbind {
+ unsigned int port;
+};
+
+/*
+ * Send event to previously allocated @port.
+ */
+#define IOCTL_EVTCHN_NOTIFY \
+ _IOW('E', 8, struct ioctl_evtchn_notify)
+struct ioctl_evtchn_notify {
+ unsigned int port;
+};
+
+/* Clear and reinitialise the event buffer. Clear error condition. */
+#define IOCTL_EVTCHN_RESET \
+ _IO('E', 9)
+
+#endif /* __NetBSD_XENIO3_H__ */
diff --git a/sysutils/xentools3/patches/patch-aa b/sysutils/xentools3/patches/patch-aa
new file mode 100644
index 00000000000..f02fc3b55d3
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-aa
@@ -0,0 +1,67 @@
+$NetBSD: patch-aa,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+
+--- Makefile.orig 2007-05-18 16:45:21.000000000 +0200
++++ Makefile 2007-05-27 13:32:39.000000000 +0200
+@@ -5,27 +5,18 @@
+ SUBDIRS-y += libxc
+ SUBDIRS-y += xenstore
+ SUBDIRS-y += misc
+-SUBDIRS-y += examples
+-SUBDIRS-y += xentrace
+ SUBDIRS-$(CONFIG_XCUTILS) += xcutils
+-SUBDIRS-$(CONFIG_X86) += firmware
+ SUBDIRS-y += security
+ SUBDIRS-y += console
+-SUBDIRS-y += xenmon
+-SUBDIRS-y += guest-headers
+ SUBDIRS-$(VTPM_TOOLS) += vtpm_manager
+ SUBDIRS-$(VTPM_TOOLS) += vtpm
+ SUBDIRS-y += xenstat
+-SUBDIRS-y += libaio
+-SUBDIRS-y += blktap
+-SUBDIRS-y += libfsimage
+ SUBDIRS-$(XENFB_TOOLS) += xenfb
+ SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
+
+ # These don't cross-compile
+ ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
+ SUBDIRS-$(PYTHON_TOOLS) += python
+-SUBDIRS-$(PYTHON_TOOLS) += pygrub
+ endif
+
+ .PHONY: all
+@@ -33,34 +24,27 @@
+ @set -e; for subdir in $(SUBDIRS-y); do \
+ $(MAKE) -C $$subdir $@; \
+ done
+- $(MAKE) ioemu
+
+ .PHONY: install
+ install: check
+ @set -e; for subdir in $(SUBDIRS-y); do \
+ $(MAKE) -C $$subdir $@; \
+ done
+- $(MAKE) ioemuinstall
+- $(INSTALL_DIR) $(DESTDIR)/var/xen/dump
+- $(INSTALL_DIR) $(DESTDIR)/var/log/xen
+
+ .PHONY: clean
+ clean: check_clean
+ @set -e; for subdir in $(SUBDIRS-y); do \
+ $(MAKE) -C $$subdir $@; \
+ done
+- $(MAKE) ioemuclean
+
+ .PHONY: distclean
+ distclean: clean
+
+ .PHONY: check
+ check:
+- $(MAKE) -C check
+
+ .PHONY: check_clean
+ check_clean:
+- $(MAKE) -C check clean
+
+ .PHONY: ioemu ioemuinstall ioemuclean
+ ifeq ($(CONFIG_IOEMU),y)
diff --git a/sysutils/xentools3/patches/patch-ab b/sysutils/xentools3/patches/patch-ab
new file mode 100644
index 00000000000..9dd4bc16bd7
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-ab
@@ -0,0 +1,273 @@
+$NetBSD: patch-ab,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+
+--- /dev/null 2007-05-27 15:18:39.000000000 +0200
++++ libxc/xc_netbsd.c 2007-05-27 16:01:23.000000000 +0200
+@@ -0,0 +1,268 @@
++/******************************************************************************
++ *
++ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
++ * Use is subject to license terms.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation, version 2 of the
++ * License.
++ */
++
++#include "xc_private.h"
++
++#include <xen/memory.h>
++#include <xen/NetBSD/xenio3.h>
++#include <unistd.h>
++#include <fcntl.h>
++
++int xc_interface_open(void)
++{
++ int flags, saved_errno;
++ int fd = open("/kern/xen/privcmd", O_RDWR);
++
++ if ( fd == -1 )
++ {
++ PERROR("Could not obtain handle on privileged command interface");
++ return -1;
++ }
++
++ /* Although we return the file handle as the 'xc handle' the API
++ does not specify / guarentee that this integer is in fact
++ a file handle. Thus we must take responsiblity to ensure
++ it doesn't propagate (ie leak) outside the process */
++ if ( (flags = fcntl(fd, F_GETFD)) < 0 )
++ {
++ PERROR("Could not get file handle flags");
++ goto error;
++ }
++ flags |= FD_CLOEXEC;
++ if ( fcntl(fd, F_SETFD, flags) < 0 )
++ {
++ PERROR("Could not set file handle flags");
++ goto error;
++ }
++
++ return fd;
++
++ error:
++ saved_errno = errno;
++ close(fd);
++ errno = saved_errno;
++ return -1;
++}
++
++int xc_interface_close(int xc_handle)
++{
++ return close(xc_handle);
++}
++
++void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot,
++ xen_pfn_t *arr, int num)
++{
++ privcmd_mmapbatch_t ioctlx;
++ void *addr;
++ addr = mmap(NULL, num*PAGE_SIZE, prot, MAP_ANON | MAP_SHARED, -1, 0);
++ if ( addr == MAP_FAILED )
++ return NULL;
++
++ ioctlx.num=num;
++ ioctlx.dom=dom;
++ ioctlx.addr=(unsigned long)addr;
++ ioctlx.arr=arr;
++ if ( ioctl(xc_handle, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx) < 0 )
++ {
++ int saved_errno = errno;
++ perror("XXXXXXXX");
++ (void)munmap(addr, num*PAGE_SIZE);
++ errno = saved_errno;
++ return NULL;
++ }
++ return addr;
++
++}
++
++void *xc_map_foreign_range(int xc_handle, uint32_t dom,
++ int size, int prot,
++ unsigned long mfn)
++{
++ privcmd_mmap_t ioctlx;
++ privcmd_mmap_entry_t entry;
++ void *addr;
++ addr = mmap(NULL, size, prot, MAP_ANON | MAP_SHARED, -1, 0);
++ if ( addr == MAP_FAILED )
++ return NULL;
++
++ ioctlx.num=1;
++ ioctlx.dom=dom;
++ ioctlx.entry=&entry;
++ entry.va=(unsigned long) addr;
++ entry.mfn=mfn;
++ entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT;
++ if ( ioctl(xc_handle, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 )
++ {
++ int saved_errno = errno;
++ (void)munmap(addr, size);
++ errno = saved_errno;
++ return NULL;
++ }
++ return addr;
++}
++
++int xc_map_foreign_ranges(int xc_handle, uint32_t dom,
++ privcmd_mmap_entry_t *entries, int nr)
++{
++ privcmd_mmap_t ioctlx;
++ int err;
++
++ ioctlx.num = nr;
++ ioctlx.dom = dom;
++ ioctlx.entry = entries;
++
++ err = ioctl(xc_handle, IOCTL_PRIVCMD_MMAP, &ioctlx);
++ if (err == 0)
++ return 0;
++ else
++ return -errno;
++}
++
++static int do_privcmd(int xc_handle, unsigned int cmd, unsigned long data)
++{
++ int err = ioctl(xc_handle, cmd, data);
++ if (err == 0)
++ return 0;
++ else
++ return -errno;
++}
++
++int do_xen_hypercall(int xc_handle, privcmd_hypercall_t *hypercall)
++{
++ return do_privcmd(xc_handle,
++ IOCTL_PRIVCMD_HYPERCALL,
++ (unsigned long)hypercall);
++}
++
++#define EVTCHN_DEV_NAME "/dev/xenevt"
++
++int xc_evtchn_open(void)
++{
++ return open(EVTCHN_DEV_NAME, O_NONBLOCK|O_RDWR);
++}
++
++int xc_evtchn_close(int xce_handle)
++{
++ return close(xce_handle);
++}
++
++int xc_evtchn_fd(int xce_handle)
++{
++ return xce_handle;
++}
++
++int xc_evtchn_notify(int xce_handle, evtchn_port_t port)
++{
++ struct ioctl_evtchn_notify notify;
++
++ notify.port = port;
++
++ return ioctl(xce_handle, IOCTL_EVTCHN_NOTIFY, &notify);
++}
++
++evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
++ evtchn_port_t remote_port)
++{
++ struct ioctl_evtchn_bind_interdomain bind;
++ int ret;
++
++ bind.remote_domain = domid;
++ bind.remote_port = remote_port;
++
++ ret = ioctl(xce_handle, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
++ if (ret == 0)
++ return bind.port;
++ else
++ return -1;
++}
++
++int xc_evtchn_unbind(int xce_handle, evtchn_port_t port)
++{
++ struct ioctl_evtchn_unbind unbind;
++
++ unbind.port = port;
++
++ return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind);
++}
++
++evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
++{
++ struct ioctl_evtchn_bind_virq bind;
++ int err;
++
++ bind.virq = virq;
++
++ err = ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
++ if (err)
++ return -1;
++ else
++ return bind.port;
++}
++
++static int dorw(int fd, char *data, size_t size, int do_write)
++{
++ size_t offset = 0;
++ ssize_t len;
++
++ while ( offset < size )
++ {
++ if (do_write)
++ len = write(fd, data + offset, size - offset);
++ else
++ len = read(fd, data + offset, size - offset);
++
++ if ( len == -1 )
++ {
++ if ( errno == EINTR )
++ continue;
++ return -1;
++ }
++
++ offset += len;
++ }
++
++ return 0;
++}
++
++evtchn_port_t xc_evtchn_pending(int xce_handle)
++{
++ evtchn_port_t port;
++
++ if ( dorw(xce_handle, (char *)&port, sizeof(port), 0) == -1 )
++ return -1;
++
++ return port;
++}
++
++int xc_evtchn_unmask(int xce_handle, evtchn_port_t port)
++{
++ return dorw(xce_handle, (char *)&port, sizeof(port), 1);
++}
++
++/* Optionally flush file to disk and discard page cache */
++void discard_file_cache(int fd, int flush)
++{
++
++ if ( flush && (fsync(fd) < 0) )
++ {
++ /*PERROR("Failed to flush file: %s", strerror(errno));*/
++ }
++}
++
++/*
++ * Local variables:
++ * mode: C
++ * c-set-style: "BSD"
++ * c-basic-offset: 4
++ * tab-width: 4
++ * indent-tabs-mode: nil
++ * End:
++ */
diff --git a/sysutils/xentools3/patches/patch-ac b/sysutils/xentools3/patches/patch-ac
new file mode 100644
index 00000000000..8b595c5756d
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-ac
@@ -0,0 +1,13 @@
+$NetBSD: patch-ac,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+
+--- libxc/xc_domain_save.c.orig 2007-05-27 13:35:43.000000000 +0200
++++ libxc/xc_domain_save.c 2007-05-27 13:35:53.000000000 +0200
+@@ -620,7 +620,7 @@
+ }
+
+ if ( (m2p = mmap(NULL, m2p_size, prot,
+- MAP_SHARED, xc_handle, 0)) == MAP_FAILED )
++ MAP_ANON | MAP_SHARED, xc_handle, 0)) == MAP_FAILED )
+ {
+ ERROR("failed to mmap m2p");
+ return NULL;
diff --git a/sysutils/xentools3/patches/patch-ad b/sysutils/xentools3/patches/patch-ad
new file mode 100644
index 00000000000..194b691f765
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-ad
@@ -0,0 +1,161 @@
+$NetBSD: patch-ad,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- libxc/xc_private.c.orig 2007-05-18 16:45:21.000000000 +0200
++++ libxc/xc_private.c 2007-05-27 13:43:06.000000000 +0200
+@@ -10,7 +10,12 @@
+ #include <stdarg.h>
+ #include <pthread.h>
+
+-static __thread xc_error last_error = { XC_ERROR_NONE, ""};
++static pthread_key_t last_error_pkey;
++static pthread_once_t last_error_pkey_once = PTHREAD_ONCE_INIT;
++
++static pthread_key_t errbuf_pkey;
++static pthread_once_t errbuf_pkey_once = PTHREAD_ONCE_INIT;
++
+ #if DEBUG
+ static xc_error_handler error_handler = xc_default_error_handler;
+ #else
+@@ -23,15 +28,44 @@
+ fprintf(stderr, "ERROR %s: %s\n", desc, err->message);
+ }
+
++static void
++_xc_clean_last_error(void *m)
++{
++ if (m)
++ free(m);
++ pthread_setspecific(last_error_pkey, NULL);
++}
++
++static void
++_xc_init_last_error(void)
++{
++ pthread_key_create(&last_error_pkey, _xc_clean_last_error);
++}
++static xc_error *
++_xc_get_last_error(void) {
++ xc_error *last_error;
++
++ pthread_once(&last_error_pkey_once, _xc_init_last_error);
++
++ last_error = pthread_getspecific(last_error_pkey);
++ if (last_error == NULL) {
++ last_error = malloc(sizeof(xc_error));
++ pthread_setspecific(last_error_pkey, last_error);
++ }
++ return last_error;
++}
++
++
+ const xc_error *xc_get_last_error(void)
+ {
+- return &last_error;
++ return _xc_get_last_error();
+ }
+
+ void xc_clear_last_error(void)
+ {
+- last_error.code = XC_ERROR_NONE;
+- last_error.message[0] = '\0';
++ xc_error *last_error = _xc_get_last_error();
++ last_error->code = XC_ERROR_NONE;
++ last_error->message[0] = '\0';
+ }
+
+ const char *xc_error_code_to_desc(int code)
+@@ -64,9 +98,10 @@
+
+ static void _xc_set_error(int code, const char *msg)
+ {
+- last_error.code = code;
+- strncpy(last_error.message, msg, XC_MAX_ERROR_MSG_LEN - 1);
+- last_error.message[XC_MAX_ERROR_MSG_LEN-1] = '\0';
++ xc_error *last_error = _xc_get_last_error();
++ last_error->code = code;
++ strncpy(last_error->message, msg, XC_MAX_ERROR_MSG_LEN - 1);
++ last_error->message[XC_MAX_ERROR_MSG_LEN-1] = '\0';
+ }
+
+ void xc_set_error(int code, const char *fmt, ...)
+@@ -84,23 +119,29 @@
+
+ errno = saved_errno;
+
+- if ( error_handler != NULL )
+- error_handler(&last_error);
++ if ( error_handler != NULL ) {
++ xc_error *last_error = _xc_get_last_error();
++ error_handler(last_error);
++ }
+ }
+
+ int lock_pages(void *addr, size_t len)
+ {
+ int e = 0;
++ void *laddr = (void *)((u_long)addr & ~0xfffUL);
++ size_t llen = (len + 0xfffUL) & ~0xfffUL;
+ #ifndef __sun__
+- e = mlock(addr, len);
++ e = mlock(laddr, llen);
+ #endif
+ return (e);
+ }
+
+ void unlock_pages(void *addr, size_t len)
+ {
++ void *laddr = (void *)((u_long)addr & ~0xfffUL);
++ size_t llen = (len + 0xfffUL) & ~0xfffUL;
+ #ifndef __sun__
+- safe_munlock(addr, len);
++ safe_munlock(laddr, llen);
+ #endif
+ }
+
+@@ -466,20 +507,43 @@
+ return new_mfn;
+ }
+
++static void
++_xc_clean_errbuf(void * m)
++{
++ if (m)
++ free(m);
++ pthread_setspecific(errbuf_pkey, NULL);
++}
++
++static void
++_xc_init_errbuf(void)
++{
++ pthread_key_create(&errbuf_pkey, _xc_clean_errbuf);
++}
++
+ char *safe_strerror(int errcode)
+ {
+- static __thread char errbuf[32];
++#define XS_BUFSIZE 32
++ char *errbuf;
+ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+ char *strerror_str;
+
++ pthread_once(&errbuf_pkey_once, _xc_init_errbuf);
++
++ errbuf = pthread_getspecific(errbuf_pkey);
++ if (errbuf == NULL) {
++ errbuf = malloc(XS_BUFSIZE);
++ pthread_setspecific(errbuf_pkey, errbuf);
++ }
++
+ /*
+ * Thread-unsafe strerror() is protected by a local mutex. We copy
+ * the string to a thread-private buffer before releasing the mutex.
+ */
+ pthread_mutex_lock(&mutex);
+ strerror_str = strerror(errcode);
+- strncpy(errbuf, strerror_str, sizeof(errbuf));
+- errbuf[sizeof(errbuf)-1] = '\0';
++ strncpy(errbuf, strerror_str, XS_BUFSIZE);
++ errbuf[XS_BUFSIZE-1] = '\0';
+ pthread_mutex_unlock(&mutex);
+
+ return errbuf;
diff --git a/sysutils/xentools3/patches/patch-al b/sysutils/xentools3/patches/patch-al
new file mode 100644
index 00000000000..9be852cd208
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-al
@@ -0,0 +1,28 @@
+$NetBSD: patch-al,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- console/Makefile.orig 2007-05-18 16:45:21.000000000 +0200
++++ console/Makefile 2007-05-27 13:45:20.000000000 +0200
+@@ -21,16 +21,17 @@
+ $(RM) client/*.o daemon/*.o
+
+ xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
+- $(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
++ $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
+ $(SOCKET_LIBS) -lxenctrl -lxenstore
+
+ xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
+- $(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
++ $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
+ $(SOCKET_LIBS) -lxenctrl -lxenstore
+
+ .PHONY: install
+ install: $(BIN)
+- $(INSTALL_DIR) $(DESTDIR)/$(DAEMON_INSTALL_DIR)
+- $(INSTALL_PROG) xenconsoled $(DESTDIR)/$(DAEMON_INSTALL_DIR)
+- $(INSTALL_DIR) $(DESTDIR)/$(CLIENT_INSTALL_DIR)
+- $(INSTALL_PROG) xenconsole $(DESTDIR)/$(CLIENT_INSTALL_DIR)
++ $(BSD_INSTALL_PROGRAM_DIR) $(PREFIX)/sbin
++ $(BSD_INSTALL_PROGRAM) xenconsoled $(PREFIX)/sbin
++ $(BSD_INSTALL_PROGRAM_DIR) $(PREFIX)/bin
++ $(BSD_INSTALL_PROGRAM) xenconsole $(PREFIX)/bin
++
diff --git a/sysutils/xentools3/patches/patch-as b/sysutils/xentools3/patches/patch-as
new file mode 100644
index 00000000000..9e99adba529
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-as
@@ -0,0 +1,45 @@
+$NetBSD: patch-as,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- libxc/Makefile.orig 2007-05-18 16:45:21.000000000 +0200
++++ libxc/Makefile 2007-05-27 13:46:42.000000000 +0200
+@@ -23,6 +23,7 @@
+ CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c
+ CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
+ CTRL_SRCS-$(CONFIG_X86_Linux) += xc_ptrace.c xc_ptrace_core.c
++CTRL_SRCS-$(CONFIG_NetBSD) += xc_netbsd.c
+
+ GUEST_SRCS-y :=
+ GUEST_SRCS-y += xg_private.c
+@@ -102,19 +103,19 @@
+
+ .PHONY: install
+ install: build
+- [ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
+- [ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
+- $(INSTALL_PROG) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
+- $(INSTALL_DATA) libxenctrl.a $(DESTDIR)/usr/$(LIBDIR)
+- ln -sf libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so.$(MAJOR)
+- ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so
+- $(INSTALL_DATA) xenctrl.h $(DESTDIR)/usr/include
+-
+- $(INSTALL_PROG) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
+- $(INSTALL_DATA) libxenguest.a $(DESTDIR)/usr/$(LIBDIR)
+- ln -sf libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so.$(MAJOR)
+- ln -sf libxenguest.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so
+- $(INSTALL_DATA) xenguest.h $(DESTDIR)/usr/include
++ $(BSD_INSTALL_LIB_DIR) $(PREFIX)/lib
++ $(BSD_INSTALL_DATA_DIR) $(PREFIX)/include
++ $(BSD_INSTALL_LIB) libxenctrl.so.$(MAJOR).$(MINOR) $(PREFIX)/lib
++ $(BSD_INSTALL_LIB) libxenctrl.a $(PREFIX)/lib
++ ln -sf libxenctrl.so.$(MAJOR).$(MINOR) $(PREFIX)/lib/libxenctrl.so.$(MAJOR)
++ ln -sf libxenctrl.so.$(MAJOR) $(PREFIX)/lib/libxenctrl.so
++ $(BSD_INSTALL_DATA) xenctrl.h $(PREFIX)/include
++
++ $(BSD_INSTALL_LIB) libxenguest.so.$(MAJOR).$(MINOR) $(PREFIX)/lib
++ $(BSD_INSTALL_LIB) libxenguest.a $(PREFIX)/lib
++ ln -sf libxenguest.so.$(MAJOR).$(MINOR) $(PREFIX)/lib/libxenguest.so.$(MAJOR)
++ ln -sf libxenguest.so.$(MAJOR) $(PREFIX)/lib/libxenguest.so
++ $(BSD_INSTALL_DATA) xenguest.h $(PREFIX)/include
+
+ .PHONY: TAGS
+ TAGS:
diff --git a/sysutils/xentools3/patches/patch-au b/sysutils/xentools3/patches/patch-au
new file mode 100644
index 00000000000..605a32b9d06
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-au
@@ -0,0 +1,16 @@
+$NetBSD: patch-au,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- libxc/xc_private.h.orig 2006-10-16 22:15:35.000000000 +0200
++++ libxc/xc_private.h 2006-10-16 22:16:09.000000000 +0200
+@@ -15,7 +15,11 @@
+
+ #include "xenctrl.h"
+
++#ifdef __NetBSD__
++#include <xen/NetBSD/xenio.h>
++#else
+ #include <xen/sys/privcmd.h>
++#endif
+
+ /* valgrind cannot see when a hypercall has filled in some values. For this
+ reason, we must zero the privcmd_hypercall_t or domctl/sysctl instance
diff --git a/sysutils/xentools3/patches/patch-av b/sysutils/xentools3/patches/patch-av
new file mode 100644
index 00000000000..e6eb39e5b28
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-av
@@ -0,0 +1,12 @@
+$NetBSD: patch-av,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- libxc/xg_private.h.orig 2006-10-16 22:15:35.000000000 +0200
++++ libxc/xg_private.h 2006-10-16 22:16:19.000000000 +0200
+@@ -15,7 +15,6 @@
+ #include "xenguest.h"
+ #include "xc_private.h"
+
+-#include <xen/sys/privcmd.h>
+ #include <xen/memory.h>
+ #include <xen/elfnote.h>
+
diff --git a/sysutils/xentools3/patches/patch-aw b/sysutils/xentools3/patches/patch-aw
new file mode 100644
index 00000000000..5efbab957c3
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-aw
@@ -0,0 +1,42 @@
+$NetBSD: patch-aw,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- misc/Makefile.orig 2007-05-18 16:45:21.000000000 +0200
++++ misc/Makefile 2007-05-27 13:48:51.000000000 +0200
+@@ -13,8 +13,10 @@
+ TARGETS-$(CONFIG_X86) += xen-detect
+ TARGETS := $(TARGETS-y)
+
+-INSTALL_BIN = $(TARGETS) xencons
+-INSTALL_SBIN = netfix xm xen-bugtool xen-python-path xend xenperf
++INSTALL_BIN = $(TARGETS)
++INSTALL_BIN_SCRIPT = xencons
++INSTALL_SBIN = xenperf
++INSTALL_SBIN_SCRIPT = netfix xm xen-bugtool xend xen-python-path
+
+ .PHONY: all
+ all: build
+@@ -26,11 +28,13 @@
+
+ .PHONY: install
+ install: build
+- [ -d $(DESTDIR)/usr/bin ] || $(INSTALL_DIR) $(DESTDIR)/usr/bin
+- [ -d $(DESTDIR)/usr/sbin ] || $(INSTALL_DIR) $(DESTDIR)/usr/sbin
+- $(INSTALL_PROG) $(INSTALL_BIN) $(DESTDIR)/usr/bin
+- $(INSTALL_PROG) $(INSTALL_SBIN) $(DESTDIR)/usr/sbin
+- $(MAKE) -C lomount install
++ $(BSD_INSTALL_PROGRAM_DIR) $(PREFIX)/bin
++ $(BSD_INSTALL_PROGRAM_DIR) $(PREFIX)/sbin
++ $(BSD_INSTALL_PROGRAM) $(INSTALL_BIN) $(PREFIX)/bin
++ $(BSD_INSTALL_SCRIPT) $(INSTALL_BIN_SCRIPT) $(PREFIX)/bin
++ $(BSD_INSTALL_PROGRAM) $(INSTALL_SBIN) $(PREFIX)/sbin
++ $(BSD_INSTALL_SCRIPT) $(INSTALL_SBIN_SCRIPT) $(PREFIX)/sbin
++# $(MAKE) -C lomount install
+ # No sense in installing miniterm on the Xen box.
+ # $(MAKE) -C miniterm install
+
+@@ -44,4 +48,4 @@
+ $(CC) -c $(CFLAGS) -o $@ $<
+
+ xenperf: %: %.o Makefile
+- $(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxenctrl
++ $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) -L$(XEN_LIBXC) -lxenctrl
diff --git a/sysutils/xentools3/patches/patch-ax b/sysutils/xentools3/patches/patch-ax
new file mode 100644
index 00000000000..430e3652a20
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-ax
@@ -0,0 +1,14 @@
+$NetBSD: patch-ax,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- misc/xend.orig 2006-10-17 15:33:55.000000000 +0200
++++ misc/xend 2006-10-17 15:38:47.000000000 +0200
+@@ -94,8 +94,7 @@
+ os.execvp('xenconsoled', ['xenconsoled'])
+
+ def start_blktapctrl():
+- if os.fork() == 0:
+- os.execvp('blktapctrl', ['blktapctrl'])
++ ''
+
+ def main():
+ try:
diff --git a/sysutils/xentools3/patches/patch-ba b/sysutils/xentools3/patches/patch-ba
new file mode 100644
index 00000000000..56bc5a593d1
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-ba
@@ -0,0 +1,47 @@
+$NetBSD: patch-ba,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- python/Makefile.orig 2007-05-18 16:45:21.000000000 +0200
++++ python/Makefile 2007-05-27 14:33:00.000000000 +0200
+@@ -12,7 +12,7 @@
+ POTFILE := $(PODIR)/xen-xm.pot
+ I18NSRCFILES = $(shell find xen/xm/ -name '*.py')
+ CATALOGS = $(patsubst %,xen/xm/messages/%.mo,$(LINGUAS))
+-NLSDIR = /usr/share/locale
++NLSDIR = $(PREFIX)/share/locale
+
+ .PHONY: build buildpy
+ buildpy:
+@@ -57,24 +57,24 @@
+ ifndef XEN_PYTHON_NATIVE_INSTALL
+ install: LIBPATH=$(shell PYTHONPATH=xen/util python -c "import auxbin; print auxbin.libpath()")
+ install: install-messages install-dtd
+- CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix="" --force --install-lib="$(DESTDIR)$(LIBPATH)/python"
++ python setup.py install
+ else
+ install: install-messages install-dtd
+- CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)" --force
++ python setup.py install
+ endif
+
+ install-dtd: all
+- $(INSTALL_DIR) $(DESTDIR)/usr/share/xen
+- $(INSTALL_DATA) xen/xm/create.dtd $(DESTDIR)/usr/share/xen
++ $(BSD_INSTALL_DATA_DIR) $(PREFIX)/share/xen
++ $(BSD_INSTALL_DATA) xen/xm/create.dtd $(PREFIX)/share/xen
+
+ install-messages: all
+ if which $(MSGFMT) >/dev/null ; then \
+- mkdir -p $(DESTDIR)$(NLSDIR); \
++ $(BSD_INSTALL_DATA_DIR) $(NLSDIR); \
+ for l in $(LINGUAS); do \
+- $(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l; \
+- $(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l/LC_MESSAGES; \
+- $(INSTALL_DATA) $(PODIR)/$$l.mo \
+- $(DESTDIR)$(NLSDIR)/$$l/LC_MESSAGES/$(POPACKAGE).mo; \
++ $(BSD_INSTALL_DATA_DIR) $(NLSDIR)/$$l; \
++ $(BSD_INSTALL_DATA_DIR) $(NLSDIR)/$$l/LC_MESSAGES; \
++ $(BSD_INSTALL_DATA) $(PODIR)/$$l.mo \
++ $(NLSDIR)/$$l/LC_MESSAGES/$(POPACKAGE).mo; \
+ done ; \
+ fi
+
diff --git a/sysutils/xentools3/patches/patch-bb b/sysutils/xentools3/patches/patch-bb
new file mode 100644
index 00000000000..9ec0463cd78
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-bb
@@ -0,0 +1,13 @@
+$NetBSD: patch-bb,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- python/xen/xend/XendOptions.py.orig 2007-05-27 14:34:33.000000000 +0200
++++ python/xen/xend/XendOptions.py 2007-05-27 14:35:35.000000000 +0200
+@@ -281,7 +281,7 @@
+ class XendOptionsFile(XendOptions):
+
+ """Default path to the config file."""
+- config_default = "/etc/xen/xend-config.sxp"
++ config_default = "@XENDCONFDIR@/xend-config.sxp"
+
+ """Environment variable used to override config_default."""
+ config_var = "XEND_CONFIG"
diff --git a/sysutils/xentools3/patches/patch-bc b/sysutils/xentools3/patches/patch-bc
new file mode 100644
index 00000000000..7f9fbb37986
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-bc
@@ -0,0 +1,22 @@
+$NetBSD: patch-bc,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- python/xen/xm/create.py.orig 2007-04-25 22:19:55.000000000 +0200
++++ python/xen/xm/create.py 2007-04-25 22:20:12.000000000 +0200
+@@ -64,7 +64,7 @@
+ use="Quiet.")
+
+ gopts.opt('path', val='PATH',
+- fn=set_value, default='.:/etc/xen',
++ fn=set_value, default='.:@XENDCONFDIR@',
+ use="Search path for configuration scripts. "
+ "The value of PATH is a colon-separated directory list.")
+
+@@ -318,7 +318,7 @@
+ preferred instance number. The hotplug script will determine
+ which instance number will actually be assigned to the domain.
+ The associtation between virtual machine and the TPM instance
+- number can be found in /etc/xen/vtpm.db. Use the backend in the
++ number can be found in @XENDCONFDIR@/vtpm.db. Use the backend in the
+ given domain.
+ The type parameter can be used to select a specific driver type
+ that the VM can use. To prevent a fully virtualized domain (HVM)
diff --git a/sysutils/xentools3/patches/patch-be b/sysutils/xentools3/patches/patch-be
new file mode 100644
index 00000000000..0a58135b7bb
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-be
@@ -0,0 +1,16 @@
+$NetBSD: patch-be,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- python/xen/lowlevel/acm/acm.c.orig 2006-10-17 00:18:15.000000000 +0200
++++ python/xen/lowlevel/acm/acm.c 2006-10-17 00:18:25.000000000 +0200
+@@ -26,10 +26,10 @@
+ #include <stdlib.h>
+ #include <sys/ioctl.h>
+ #include <netinet/in.h>
++#include <xenctrl.h>
+ #include <xen/acm.h>
+ #include <xen/acm_ops.h>
+
+-#include <xenctrl.h>
+
+ #define PERROR(_m, _a...) \
+ fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a , \
diff --git a/sysutils/xentools3/patches/patch-bf b/sysutils/xentools3/patches/patch-bf
new file mode 100644
index 00000000000..06522cbec4a
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-bf
@@ -0,0 +1,13 @@
+$NetBSD: patch-bf,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- python/xen/xm/addlabel.py.orig 2006-10-15 14:22:03.000000000 +0200
++++ python/xen/xm/addlabel.py 2006-10-19 21:51:26.000000000 +0200
+@@ -133,7 +133,7 @@
+ if argv[2].lower() == "dom":
+ configfile = argv[3]
+ if configfile[0] != '/':
+- for prefix in [".", "/etc/xen"]:
++ for prefix in [".", "@XENDCONFDIR@"]:
+ configfile = prefix + "/" + configfile
+ if os.path.isfile(configfile):
+ break
diff --git a/sysutils/xentools3/patches/patch-bg b/sysutils/xentools3/patches/patch-bg
new file mode 100644
index 00000000000..4f0f5c0a7c1
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-bg
@@ -0,0 +1,13 @@
+$NetBSD: patch-bg,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- python/xen/xm/getlabel.py.orig 2006-10-15 14:22:03.000000000 +0200
++++ python/xen/xm/getlabel.py 2006-10-19 21:52:18.000000000 +0200
+@@ -55,7 +55,7 @@
+ if configfile[0] == '/':
+ fd = open(configfile, "rb")
+ else:
+- for prefix in [".", "/etc/xen"]:
++ for prefix in [".", "@XENDCONFDIR@"]:
+ abs_file = prefix + "/" + configfile
+ if os.path.isfile(abs_file):
+ fd = open(abs_file, "rb")
diff --git a/sysutils/xentools3/patches/patch-bh b/sysutils/xentools3/patches/patch-bh
new file mode 100644
index 00000000000..b85696e7353
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-bh
@@ -0,0 +1,13 @@
+$NetBSD: patch-bh,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- python/xen/xm/rmlabel.py.orig 2006-10-15 14:22:03.000000000 +0200
++++ python/xen/xm/rmlabel.py 2006-10-19 21:52:58.000000000 +0200
+@@ -60,7 +60,7 @@
+ file = configfile
+ fd = open(file, "rb")
+ else:
+- for prefix in [".", "/etc/xen"]:
++ for prefix in [".", "@XENDCONFDIR@"]:
+ file = prefix + "/" + configfile
+ if os.path.isfile(file):
+ fd = open(file, "rb")
diff --git a/sysutils/xentools3/patches/patch-bo b/sysutils/xentools3/patches/patch-bo
new file mode 100644
index 00000000000..468033bd56e
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-bo
@@ -0,0 +1,25 @@
+$NetBSD: patch-bo,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- xcutils/Makefile.orig 2007-05-18 16:45:21.000000000 +0200
++++ xcutils/Makefile 2007-05-27 14:37:57.000000000 +0200
+@@ -24,7 +24,7 @@
+
+ PROGRAMS = xc_restore xc_save readnotes
+
+-LDLIBS = -L$(XEN_LIBXC) -L$(XEN_XENSTORE) -lxenguest -lxenctrl -lxenstore
++LDLIBS = $(LDFLAGS) -L$(XEN_LIBXC) -L$(XEN_XENSTORE) -lxenguest -lxenctrl -lxenstore
+
+ .PHONY: all
+ all: build
+@@ -37,9 +37,8 @@
+
+ .PHONY: install
+ install: build
+- [ -d $(DESTDIR)$(PROGRAMS_INSTALL_DIR) ] || \
+- $(INSTALL_DIR) $(DESTDIR)$(PROGRAMS_INSTALL_DIR)
+- $(INSTALL_PROG) $(PROGRAMS) $(DESTDIR)$(PROGRAMS_INSTALL_DIR)
++ $(BSD_INSTALL_PROGRAM_DIR) $(PREFIX)/bin
++ $(BSD_INSTALL_PROGRAM) $(PROGRAMS) $(PREFIX)/bin
+
+
+ .PHONY: clean
diff --git a/sysutils/xentools3/patches/patch-br b/sysutils/xentools3/patches/patch-br
new file mode 100644
index 00000000000..49d8a248b5d
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-br
@@ -0,0 +1,16 @@
+$NetBSD: patch-br,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- xenstat/xentop/Makefile.orig 2007-01-08 16:00:52.000000000 +0100
++++ xenstat/xentop/Makefile 2007-04-25 18:43:18.000000000 +0200
+@@ -33,9 +33,8 @@
+
+ .PHONY: install
+ install: xentop xentop.1
+- $(INSTALL_PROG) xentop $(DESTDIR)$(sbindir)/xentop
+- $(INSTALL_DIR) $(DESTDIR)$(man1dir)
+- $(INSTALL_DATA) xentop.1 $(DESTDIR)$(man1dir)/xentop.1
++ $(BSD_INSTALL_PROGRAM) xentop $(PREFIX)/sbin
++ $(BSD_INSTALL_DATA) xentop.1 $(PREFIX)/$(PKGMANDIR)/man1
+
+ endif
+
diff --git a/sysutils/xentools3/patches/patch-bs b/sysutils/xentools3/patches/patch-bs
new file mode 100644
index 00000000000..6e4d95c774f
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-bs
@@ -0,0 +1,49 @@
+$NetBSD: patch-bs,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- xenstore/Makefile.orig 2007-05-18 16:45:21.000000000 +0200
++++ xenstore/Makefile 2007-05-27 14:41:40.000000000 +0200
+@@ -29,6 +29,7 @@
+
+ XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_linux.o
+ XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o
++XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_netbsd.o
+
+ XENSTORED_OBJS += $(XENSTORED_OBJS_y)
+
+@@ -168,22 +169,20 @@
+
+ .PHONY: install
+ install: all
+- $(INSTALL_DIR) $(DESTDIR)/var/run/xenstored
+- $(INSTALL_DIR) $(DESTDIR)/var/lib/xenstored
+- $(INSTALL_DIR) $(DESTDIR)/usr/bin
+- $(INSTALL_DIR) $(DESTDIR)/usr/sbin
+- $(INSTALL_DIR) $(DESTDIR)/usr/include
+- $(INSTALL_PROG) xenstored $(DESTDIR)/usr/sbin
+- $(INSTALL_PROG) $(CLIENTS) $(DESTDIR)/usr/bin
+- $(INSTALL_PROG) xenstore-control $(DESTDIR)/usr/bin
+- $(INSTALL_PROG) xenstore-ls $(DESTDIR)/usr/bin
+- $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
+- $(INSTALL_PROG) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
+- ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenstore.so.$(MAJOR)
+- ln -sf libxenstore.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenstore.so
+- $(INSTALL_DATA) libxenstore.a $(DESTDIR)/usr/$(LIBDIR)
+- $(INSTALL_DATA) xs.h $(DESTDIR)/usr/include
+- $(INSTALL_DATA) xs_lib.h $(DESTDIR)/usr/include
++ $(BSD_INSTALL_PROGRAM_DIR) $(PREFIX)/bin
++ $(BSD_INSTALL_PROGRAM_DIR) $(PREFIX)/sbin
++ $(BSD_INSTALL_DATA_DIR) -p $(PREFIX)/include
++ $(BSD_INSTALL_PROGRAM) xenstored $(PREFIX)/sbin
++ $(BSD_INSTALL_PROGRAM) $(CLIENTS) $(PREFIX)/bin
++ $(BSD_INSTALL_PROGRAM) xenstore-control $(PREFIX)/bin
++ $(BSD_INSTALL_PROGRAM) xenstore-ls $(PREFIX)/bin
++ $(BSD_INSTALL_LIB_DIR) $(PREFIX)/lib
++ $(BSD_INSTALL_LIB) libxenstore.so.$(MAJOR).$(MINOR) $(PREFIX)/lib
++ ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(PREFIX)/lib/libxenstore.so.$(MAJOR)
++ ln -sf libxenstore.so.$(MAJOR) $(PREFIX)/lib/libxenstore.so
++ $(BSD_INSTALL_LIB) libxenstore.a $(PREFIX)/lib
++ $(BSD_INSTALL_DATA) xs.h $(PREFIX)/include
++ $(BSD_INSTALL_DATA) xs_lib.h $(PREFIX)/include
+
+ -include $(PROG_DEP)
+
diff --git a/sysutils/xentools3/patches/patch-bt b/sysutils/xentools3/patches/patch-bt
new file mode 100644
index 00000000000..8e6a535c84d
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-bt
@@ -0,0 +1,78 @@
+$NetBSD: patch-bt,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- /dev/null 2007-04-25 19:26:24.000000000 +0200
++++ xenstore/xenstored_netbsd.c 2007-04-25 19:28:19.000000000 +0200
+@@ -0,0 +1,73 @@
++/******************************************************************************
++ *
++ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
++ * Use is subject to license terms.
++ *
++ * Copyright (C) 2005 Rusty Russell IBM Corporation
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation, version 2 of the
++ * License.
++ */
++
++#include <fcntl.h>
++#include <unistd.h>
++#include <stdlib.h>
++#include <sys/mman.h>
++
++#include "xenstored_core.h"
++
++#define XENSTORED_PROC_KVA "/dev/xsd_kva"
++#define XENSTORED_PROC_PORT "/kern/xen/xsd_port"
++
++evtchn_port_t xenbus_evtchn(void)
++{
++ int fd;
++ int rc;
++ evtchn_port_t port;
++ char str[20];
++
++ fd = open(XENSTORED_PROC_PORT, O_RDONLY);
++ if (fd == -1)
++ return -1;
++
++ rc = read(fd, str, sizeof(str));
++ if (rc == -1)
++ {
++ int err = errno;
++ close(fd);
++ errno = err;
++ return -1;
++ }
++
++ str[rc] = '\0';
++ port = strtoul(str, NULL, 0);
++
++ close(fd);
++ return port;
++}
++
++void *xenbus_map(void)
++{
++ int fd;
++ void *addr;
++
++ fd = open(XENSTORED_PROC_KVA, O_RDWR);
++ if (fd == -1)
++ return NULL;
++
++ addr = mmap(NULL, getpagesize(), PROT_READ|PROT_WRITE,
++ MAP_SHARED, fd, 0);
++
++ if (addr == MAP_FAILED)
++ addr = NULL;
++
++ close(fd);
++
++ return addr;
++}
++
++void xenbus_notify_running(void)
++{
++}
diff --git a/sysutils/xentools3/patches/patch-bw b/sysutils/xentools3/patches/patch-bw
new file mode 100644
index 00000000000..9790c19c1ce
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-bw
@@ -0,0 +1,15 @@
+$NetBSD: patch-bw,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- xenstore/list.h.orig 2006-10-16 22:51:42.000000000 +0200
++++ xenstore/list.h 2006-10-16 22:51:57.000000000 +0200
+@@ -3,6 +3,10 @@
+ /* Taken from Linux kernel code, but de-kernelized for userspace. */
+ #include <stddef.h>
+
++#undef LIST_HEAD_INIT
++#undef LIST_HEAD
++#undef INIT_LIST_HEAD
++
+ /*
+ * These are non-NULL pointers that will result in page faults
+ * under normal circumstances, used to verify that nobody uses
diff --git a/sysutils/xentools3/patches/patch-cb b/sysutils/xentools3/patches/patch-cb
new file mode 100644
index 00000000000..4eb7ced90bb
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cb
@@ -0,0 +1,12 @@
+$NetBSD: patch-cb,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- console/daemon/utils.c.orig 2006-10-16 22:55:37.000000000 +0200
++++ console/daemon/utils.c 2006-10-16 22:55:48.000000000 +0200
+@@ -32,6 +32,7 @@
+ #include <sys/socket.h>
+ #include <sys/un.h>
+ #include <string.h>
++#include <signal.h>
+
+ #include "xenctrl.h"
+ #include "utils.h"
diff --git a/sysutils/xentools3/patches/patch-cc b/sysutils/xentools3/patches/patch-cc
new file mode 100644
index 00000000000..5032dca341d
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cc
@@ -0,0 +1,24 @@
+$NetBSD: patch-cc,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- console/client/main.c.orig 2007-05-18 16:45:21.000000000 +0200
++++ console/client/main.c 2007-05-27 14:43:14.000000000 +0200
+@@ -34,7 +34,11 @@
+ #include <sys/select.h>
+ #include <err.h>
+ #include <errno.h>
++#ifndef __NetBSD__
+ #include <pty.h>
++#endif
++#include <string.h>
++
+
+ #include "xs.h"
+
+@@ -289,6 +293,7 @@
+ err(errno, "Could not read tty from store");
+ }
+
++ init_term(spty, &attr);
+ init_term(STDIN_FILENO, &attr);
+ console_loop(spty, xs, path);
+ restore_term(STDIN_FILENO, &attr);
diff --git a/sysutils/xentools3/patches/patch-cd b/sysutils/xentools3/patches/patch-cd
new file mode 100644
index 00000000000..8b6e8e45866
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cd
@@ -0,0 +1,16 @@
+$NetBSD: patch-cd,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- python/xen/util/auxbin.py.orig 2006-10-16 22:57:51.000000000 +0200
++++ python/xen/util/auxbin.py 2006-10-16 22:58:05.000000000 +0200
+@@ -16,8 +16,8 @@
+ #============================================================================
+
+
+-LIB_32 = "/usr/lib"
+-LIB_64 = "/usr/lib64"
+-LIB_BIN_SUFFIX = "xen/bin"
++LIB_32 = "@PREFIX@/bin"
++LIB_64 = "@PREFIX@/bin"
++LIB_BIN_SUFFIX = ""
+
+ ## The architectures on which the LIB_64 directory is used. This
diff --git a/sysutils/xentools3/patches/patch-cf b/sysutils/xentools3/patches/patch-cf
new file mode 100644
index 00000000000..923cde27e6e
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cf
@@ -0,0 +1,21 @@
+$NetBSD: patch-cf,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- xenstat/libxenstat/Makefile.orig 2007-05-18 16:45:21.000000000 +0200
++++ xenstat/libxenstat/Makefile 2007-05-27 14:45:56.000000000 +0200
+@@ -31,6 +31,7 @@
+ OBJECTS-y=src/xenstat.o
+ OBJECTS-$(CONFIG_Linux) += src/xenstat_linux.o
+ OBJECTS-$(CONFIG_SunOS) += src/xenstat_solaris.o
++OBJECTS-$(CONFIG_NetBSD) += src/xenstat_netbsd.o
+ SONAME_FLAGS=-Wl,$(SONAME_LDFLAG) -Wl,libxenstat.so.$(MAJOR)
+
+ WARN_FLAGS=-Wall -Werror
+@@ -97,7 +98,7 @@
+ all-bindings: perl-bindings python-bindings
+
+ # The install-bindings target installs all the language bindings
+-install-bindings: install-perl-bindings install-python-bindings
++install-bindings: install-python-bindings
+
+ $(BINDINGS): $(SHLIB) $(SHLIB_LINKS) src/xenstat.h
+
diff --git a/sysutils/xentools3/patches/patch-cg b/sysutils/xentools3/patches/patch-cg
new file mode 100644
index 00000000000..d3070124567
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cg
@@ -0,0 +1,42 @@
+$NetBSD: patch-cg,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- xenstat/xentop/xentop.c.orig 2006-10-04 04:28:30.000000000 +0200
++++ xenstat/xentop/xentop.c 2006-10-17 00:16:10.000000000 +0200
+@@ -18,7 +18,8 @@
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+-#include <curses.h>
++#include <ncurses.h>
++#define vw_printw vwprintw
+ #include <ctype.h>
+ #include <errno.h>
+ #include <stdio.h>
+@@ -27,7 +28,11 @@
+ #include <sys/time.h>
+ #include <time.h>
+ #include <unistd.h>
++#ifndef __NetBSD__
+ #include <linux/kdev_t.h>
++#else
++#include <stdarg.h>
++#endif
+
+ #include <xenstat.h>
+
+@@ -895,6 +900,7 @@
+ /* Output all VBD information */
+ void do_vbd(xenstat_domain *domain)
+ {
++#ifdef notyet
+ int i = 0;
+ xenstat_vbd *vbd;
+ unsigned num_vbds = 0;
+@@ -911,6 +917,7 @@
+ xenstat_vbd_rd_reqs(vbd),
+ xenstat_vbd_wr_reqs(vbd));
+ }
++#endif
+ }
+
+ static void top(void)
diff --git a/sysutils/xentools3/patches/patch-ch b/sysutils/xentools3/patches/patch-ch
new file mode 100644
index 00000000000..b9190e2617e
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-ch
@@ -0,0 +1,102 @@
+$NetBSD: patch-ch,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- /dev/null 2007-05-27 19:36:35.000000000 +0200
++++ xenstat/libxenstat/src/xenstat_netbsd.c 2007-05-27 19:36:00.000000000 +0200
+@@ -0,0 +1,97 @@
++/* libxenstat: statistics-collection library for Xen
++ * Copyright (C) International Business Machines Corp., 2005
++ * Authors: Josh Triplett <josht@us.ibm.com>
++ * Judy Fischbach <jfisch@us.ibm.com>
++ * David Hendricks <dhendrix@us.ibm.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2.1 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ */
++
++/*
++ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
++ * Use is subject to license terms.
++ */
++
++#include <fcntl.h>
++#include <dirent.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
++
++#include "xenstat_priv.h"
++
++#define SYSFS_VBD_PATH "/sys/devices/xen-backend/"
++
++struct priv_data {
++ FILE *procnetdev;
++ DIR *sysfsvbd;
++};
++
++static struct priv_data *
++get_priv_data(xenstat_handle *handle)
++{
++ if (handle->priv != NULL)
++ return handle->priv;
++
++ handle->priv = malloc(sizeof(struct priv_data));
++ if (handle->priv == NULL)
++ return (NULL);
++
++ ((struct priv_data *)handle->priv)->procnetdev = NULL;
++ ((struct priv_data *)handle->priv)->sysfsvbd = NULL;
++
++ return handle->priv;
++}
++
++/* Expected format of /proc/net/dev */
++static const char PROCNETDEV_HEADER[] =
++ "Inter-| Receive |"
++ " Transmit\n"
++ " face |bytes packets errs drop fifo frame compressed multicast|"
++ "bytes packets errs drop fifo colls carrier compressed\n";
++
++/* Collect information about networks */
++int xenstat_collect_networks(xenstat_node * node)
++{
++ /* XXX fixme: implement code to get stats from libkvm ! */
++ return 1;
++}
++
++/* Free network information in handle */
++void xenstat_uninit_networks(xenstat_handle * handle)
++{
++ struct priv_data *priv = get_priv_data(handle);
++ if (priv != NULL && priv->procnetdev != NULL)
++ fclose(priv->procnetdev);
++}
++
++static int read_attributes_vbd(const char *vbd_directory, const char *what, char *ret, int cap)
++{
++ /* XXX implement */
++ return 0;
++}
++
++/* Collect information about VBDs */
++int xenstat_collect_vbds(xenstat_node * node)
++{
++ return 1;
++}
++
++/* Free VBD information in handle */
++void xenstat_uninit_vbds(xenstat_handle * handle)
++{
++ struct priv_data *priv = get_priv_data(handle);
++ if (priv != NULL && priv->sysfsvbd != NULL)
++ closedir(priv->sysfsvbd);
++}
diff --git a/sysutils/xentools3/patches/patch-ci b/sysutils/xentools3/patches/patch-ci
new file mode 100644
index 00000000000..d51add40ba5
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-ci
@@ -0,0 +1,16 @@
+$NetBSD: patch-ci,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- ../xen/include/public/arch-x86/xen.h.orig 2007-04-25 19:25:41.000000000 +0200
++++ ../xen/include/public/arch-x86/xen.h 2007-04-25 19:25:43.000000000 +0200
+@@ -35,9 +35,10 @@
+ #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
+ typedef type * __guest_handle_ ## name
+ #endif
++#define __XEN_GUEST_HANDLE(name) __guest_handle_ ## name
+
+ #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
+-#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
++#define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name)
+ #define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0)
+ #ifdef __XEN_TOOLS__
+ #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
diff --git a/sysutils/xentools3/patches/patch-cj b/sysutils/xentools3/patches/patch-cj
new file mode 100644
index 00000000000..1380b4af831
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cj
@@ -0,0 +1,23 @@
+$NetBSD: patch-cj,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- python/xen/xend/osdep.py.orig 2007-04-25 22:22:18.000000000 +0200
++++ python/xen/xend/osdep.py 2007-04-25 22:23:03.000000000 +0200
+@@ -22,9 +22,11 @@
+ _scripts_dir = {
+ "Linux": "/etc/xen/scripts",
+ "SunOS": "/usr/lib/xen/scripts",
++ "NetBSD": "@XENDCONFDIR@/scripts",
+ }
+
+ _xend_autorestart = {
++ "NetBSD": True,
+ "Linux": True,
+ "SunOS": False,
+ }
+@@ -32,5 +34,5 @@
+ def _get(var, default=None):
+ return var.get(os.uname()[0], default)
+
+-scripts_dir = _get(_scripts_dir, "/etc/xen/scripts")
++scripts_dir = _get(_scripts_dir, "@XENDCONFDIR@/scripts")
+ xend_autorestart = _get(_xend_autorestart)
diff --git a/sysutils/xentools3/patches/patch-ck b/sysutils/xentools3/patches/patch-ck
new file mode 100644
index 00000000000..398b5a1495c
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-ck
@@ -0,0 +1,16 @@
+$NetBSD: patch-ck,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- xenstore/xs_lib.c.orig 2007-01-08 16:00:53.000000000 +0100
++++ xenstore/xs_lib.c 2007-04-26 13:16:40.000000000 +0200
+@@ -79,8 +79,10 @@
+ if (s)
+ return s;
+
+-#ifdef __linux__
++#if defined(__linux__)
+ return "/proc/xen/xenbus";
++#elif defined(__NetBSD__)
++ return "/kern/xen/xenbus";
+ #else
+ return "/dev/xen/xenbus";
+ #endif
diff --git a/sysutils/xentools3/patches/patch-cm b/sysutils/xentools3/patches/patch-cm
new file mode 100644
index 00000000000..eef001c56ad
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cm
@@ -0,0 +1,47 @@
+$NetBSD: patch-cm,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- ../docs/man/xend-config.sxp.pod.5.orig 2007-01-08 16:00:44.000000000 +0100
++++ ../docs/man/xend-config.sxp.pod.5 2007-04-28 19:21:52.000000000 +0200
+@@ -4,7 +4,7 @@
+
+ =head1 SYNOPSIS
+
+-/etc/xen/xend-config.sxp
++@XENDCONFDIR@/xend-config.sxp
+
+ =head1 DESCRIPTION
+
+@@ -12,7 +12,7 @@
+ parameters which determine the behavior of the daemon at runtime.
+
+ The parameters are specified in S-expression format. See the example
+-configuration file in I</etc/xen/xend-config.sxp> for details.
++configuration file in I<@XENDCONFDIR@/xend-config.sxp> for details.
+
+ =head1 OPTIONS
+
+@@ -82,13 +82,13 @@
+
+ =item I<network-script>
+
+-The name of the script in I</etc/xen/scripts> that will be run to
++The name of the script in I<@XENDCONFDIR@/scripts> that will be run to
+ setup the networking environment. This can be any name, but in
+ general is either I<network-bridge> or I<network-route>.
+
+ =item I<vif-script>
+
+-The name of the script in I</etc/xen/scripts> that will be run to
++The name of the script in I<@XENDCONFDIR@/scripts> that will be run to
+ setup a virtual interface when it is created or destroyed. This needs
+ to (in general) work in unison with the I<network-script>.
+
+@@ -113,7 +113,7 @@
+
+ The name of an application or script that can handle external device
+ migration, such as for example virtual TPM migration. An example
+-script is I</etc/xen/scripts/external-device-migrate>.
++script is I<@XENDCONFDIR@/scripts/external-device-migrate>.
+
+ =back
+
diff --git a/sysutils/xentools3/patches/patch-cn b/sysutils/xentools3/patches/patch-cn
new file mode 100644
index 00000000000..4c11028bdea
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cn
@@ -0,0 +1,36 @@
+$NetBSD: patch-cn,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- ../docs/man/xmdomain.cfg.pod.5.orig 2007-01-08 16:00:44.000000000 +0100
++++ ../docs/man/xmdomain.cfg.pod.5 2007-04-28 19:21:52.000000000 +0200
+@@ -4,9 +4,9 @@
+
+ =head1 SYNOPSIS
+
+- /etc/xen/myxendomain
+- /etc/xen/myxendomain2
+- /etc/xen/auto/myxenautostarted
++ @XENDCONFDIR@/myxendomain
++ @XENDCONFDIR@/myxendomain2
++ @XENDCONFDIR@/auto/myxenautostarted
+
+ =head1 DESCRIPTION
+
+@@ -14,14 +14,14 @@
+ domains to create from scratch. Each of these config files needs to
+ contain a number of required options, and may specify many more.
+
+-Domain configuration files live in /etc/xen by default, if you store
++Domain configuration files live in @XENDCONFDIR@ by default, if you store
+ config files anywhere else the full path to the config file must be
+ specified in the I<xm create> command.
+
+-/etc/xen/auto is a special case. Domain config files in that
++@XENDCONFDIR@/auto is a special case. Domain config files in that
+ directory will be started automatically at system boot if the
+-xendomain init script is enabled. The contents of /etc/xen/auto
+-should be symlinks to files in /etc/xen to allow I<xm create> to be
++xendomain init script is enabled. The contents of @XENDCONFDIR@/auto
++should be symlinks to files in @XENDCONFDIR@ to allow I<xm create> to be
+ used without full paths.
+
+ Options are specified by I<name = value> statements in the
diff --git a/sysutils/xentools3/patches/patch-co b/sysutils/xentools3/patches/patch-co
new file mode 100644
index 00000000000..a8386e29419
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-co
@@ -0,0 +1,40 @@
+$NetBSD: patch-co,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- ../docs/man/xm.pod.1.orig 2007-01-08 16:00:44.000000000 +0100
++++ ../docs/man/xm.pod.1 2007-04-28 19:21:52.000000000 +0200
+@@ -72,7 +72,7 @@
+ Name=Value combinations.
+
+ Configfile can either be an absolute path to a file, or a relative
+-path to a file located in /etc/xen.
++path to a file located in @XENDCONFDIR@.
+
+ Create will return B<as soon> as the domain is started. This B<does
+ not> mean the guest OS in the domain has actually booted, or is
+@@ -97,7 +97,7 @@
+
+ xm create Fedora4
+
+-This creates a domain with the file /etc/xen/Fedora4, and returns as
++This creates a domain with the file @XENDCONFDIR@/Fedora4, and returns as
+ soon as it is run.
+
+ =item I<without config file>
+@@ -798,7 +798,7 @@
+ name pre-fix for the policy xml file. The preceding name parts are
+ translated into the local path pointing to the policy xml file
+ relative to the global policy root directory
+-(/etc/xen/acm-security/policies). For example,
++(@XENDCONFDIR@/acm-security/policies). For example,
+ example.chwall_ste.client_v1 denotes the policy file
+ example/chwall_ste/client_v1-security_policy.xml relative to the
+ global policy root directory.
+@@ -889,7 +889,7 @@
+ =over 4
+
+ This step creates client_v1.map and client_v1.bin files in
+-/etc/xen/acm-security/policies/example/chwall_ste.
++@XENDCONFDIR@/acm-security/policies/example/chwall_ste.
+
+ xm makepolicy example.chwall_ste.client_v1
+
diff --git a/sysutils/xentools3/patches/patch-cp b/sysutils/xentools3/patches/patch-cp
new file mode 100644
index 00000000000..c7ee2c0bcca
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cp
@@ -0,0 +1,14 @@
+$NetBSD: patch-cp,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+
+--- ../xen/include/public/arch-x86/xen-x86_32.h.orig 2007-05-27 15:08:03.000000000 +0200
++++ ../xen/include/public/arch-x86/xen-x86_32.h 2007-05-27 15:08:44.000000000 +0200
+@@ -103,7 +103,8 @@
+ (hnd).p = val; \
+ } while ( 0 )
+ #define uint64_aligned_t uint64_t __attribute__((aligned(8)))
+-#define XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name
++#define __XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name
++#define XEN_GUEST_HANDLE_64(name) __XEN_GUEST_HANDLE_64(name)
+ #endif
+
+ #ifndef __ASSEMBLY__
diff --git a/sysutils/xentools3/patches/patch-cq b/sysutils/xentools3/patches/patch-cq
new file mode 100644
index 00000000000..9a32ada5ac8
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cq
@@ -0,0 +1,16 @@
+$NetBSD: patch-cq,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- ../xen/common/libelf/libelf-private.h.orig 2007-05-27 15:13:03.000000000 +0200
++++ ../xen/common/libelf/libelf-private.h 2007-05-27 15:14:20.000000000 +0200
+@@ -33,6 +33,11 @@
+ #define bswap_16(x) BSWAP_16(x)
+ #define bswap_32(x) BSWAP_32(x)
+ #define bswap_64(x) BSWAP_64(x)
++#elif defined(__NetBSD__)
++#include <sys/bswap.h>
++#define bswap_16(x) bswap16(x)
++#define bswap_32(x) bswap32(x)
++#define bswap_64(x) bswap64(x)
+ #else
+ #include <byteswap.h>
+ #endif
diff --git a/sysutils/xentools3/patches/patch-cr b/sysutils/xentools3/patches/patch-cr
new file mode 100644
index 00000000000..6d0390bb5c7
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cr
@@ -0,0 +1,22 @@
+$NetBSD: patch-cr,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- libxc/xc_dom_core.c.orig 2007-05-27 15:17:22.000000000 +0200
++++ libxc/xc_dom_core.c 2007-05-27 15:17:39.000000000 +0200
+@@ -122,7 +122,7 @@
+ memset(block, 0, sizeof(*block));
+ block->mmap_len = size;
+ block->mmap_ptr = mmap(NULL, block->mmap_len,
+- PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
++ PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,
+ -1, 0);
+ if ( block->mmap_ptr == MAP_FAILED )
+ {
+@@ -354,7 +354,7 @@
+ {
+ mode = "anonymous memory";
+ phys->ptr = mmap(NULL, phys->count << page_shift,
+- PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
++ PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,
+ -1, 0);
+ if ( phys->ptr == MAP_FAILED )
+ {
diff --git a/sysutils/xentools3/patches/patch-cs b/sysutils/xentools3/patches/patch-cs
new file mode 100644
index 00000000000..6e1d453fb0d
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cs
@@ -0,0 +1,21 @@
+$NetBSD: patch-cs,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- misc/xen-python-path.orig 2007-05-18 16:45:21.000000000 +0200
++++ misc/xen-python-path 2007-05-27 17:07:21.000000000 +0200
+@@ -22,14 +22,14 @@
+ # take the first installed instance of auxbin that we find, and then run it
+ # to determine the correct path, appending that to sys.path.
+
+-AUXBIN = 'xen/util/auxbin.py'
++AUXBIN = 'site-packages/xen/util/auxbin.py'
+
+ import os
+ import os.path
+ import sys
+
+ for p in ['python%s' % sys.version[:3], 'python']:
+- for l in ['/usr/lib64', '/usr/lib']:
++ for l in ['@PREFIX@/lib']:
+ d = os.path.join(l, p)
+ if os.path.exists(os.path.join(d, AUXBIN)):
+ sys.path.append(d)
diff --git a/sysutils/xentools3/patches/patch-ct b/sysutils/xentools3/patches/patch-ct
new file mode 100644
index 00000000000..c970a13b854
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-ct
@@ -0,0 +1,56 @@
+$NetBSD: patch-ct,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- python/xen/xend/XendNode.py.orig 2007-05-18 16:45:21.000000000 +0200
++++ python/xen/xend/XendNode.py 2007-05-27 17:30:50.000000000 +0200
+@@ -106,17 +106,15 @@
+ # We can run off the end of the cpuinfo list if domain0 does not
+ # have #vcpus == #pcpus. In that case we just replicate one that's
+ # in the hash table.
+- if not cpuinfo.has_key(number):
+- number = cpuinfo.keys()[0]
+ if arch.type == "x86":
+ self.cpus[u].update(
+ { 'host' : self.uuid,
+ 'features' : cpu_features,
+- 'speed' : int(float(cpuinfo[number]['cpu MHz'])),
+- 'vendor' : cpuinfo[number]['vendor_id'],
+- 'modelname': cpuinfo[number]['model name'],
+- 'stepping' : cpuinfo[number]['stepping'],
+- 'flags' : cpuinfo[number]['flags'],
++ 'speed' : 0,
++ 'vendor' : 'unkown',
++ 'modelname': 'unkown',
++ 'stepping' : 'unkown',
++ 'flags' : 'unkown',
+ })
+ elif arch.type == "ia64":
+ self.cpus[u].update(
+@@ -627,27 +625,7 @@
+
+ def parse_proc_cpuinfo():
+ cpuinfo = {}
+- f = file('/proc/cpuinfo', 'r')
+- try:
+- p = -1
+- d = {}
+- for line in f:
+- keyvalue = line.split(':')
+- if len(keyvalue) != 2:
+- continue
+- key = keyvalue[0].strip()
+- val = keyvalue[1].strip()
+- if key == 'processor':
+- if p != -1:
+- cpuinfo[p] = d
+- p = int(val)
+- d = {}
+- else:
+- d[key] = val
+- cpuinfo[p] = d
+- return cpuinfo
+- finally:
+- f.close()
++ return cpuinfo
+
+
+ def instance():
diff --git a/sysutils/xentools3/patches/patch-cu b/sysutils/xentools3/patches/patch-cu
new file mode 100644
index 00000000000..05fca200784
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cu
@@ -0,0 +1,13 @@
+$NetBSD: patch-cu,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- libxc/xc_dom_boot.c.orig 2007-05-27 17:55:28.000000000 +0200
++++ libxc/xc_dom_boot.c 2007-05-27 17:55:46.000000000 +0200
+@@ -163,7 +163,7 @@
+ }
+
+ ptr = mmap(NULL, count << page_shift, PROT_READ | PROT_WRITE,
+- MAP_SHARED, dom->guest_xc, 0);
++ MAP_SHARED | MAP_ANON, -1, 0);
+ if ( ptr == MAP_FAILED )
+ {
+ xc_dom_panic(XC_INTERNAL_ERROR,
diff --git a/sysutils/xentools3/patches/patch-cv b/sysutils/xentools3/patches/patch-cv
new file mode 100644
index 00000000000..ca86c28ee85
--- /dev/null
+++ b/sysutils/xentools3/patches/patch-cv
@@ -0,0 +1,13 @@
+$NetBSD: patch-cv,v 1.1.1.1 2007/06/14 19:39:46 bouyer Exp $
+
+--- libxc/xc_hvm_build.c 2007-06-12 23:36:11.000000000 +0200
++++ libxc/xc_hvm_build.c.orig 2007-06-12 23:35:55.000000000 +0200
+@@ -120,7 +120,7 @@
+ if ( entries == NULL )
+ goto err;
+ elf->dest = mmap(NULL, pages << PAGE_SHIFT, PROT_READ | PROT_WRITE,
+- MAP_SHARED, xch, 0);
++ MAP_ANON | MAP_SHARED, -1, 0);
+ if ( elf->dest == MAP_FAILED )
+ goto err;
+