Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,61 @@
# -*- 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' ]
#----------------------------------------------------------------------------
# exported PCI devices
# these devices have to be attched to the pciback driver; use
# pciback.hide=(bus:dev1.fun1)(bus:dev2.fun2)(...)
# on the dom0's kernel command line to force attach of PCI devices to
# pciback. bus and dev are 2-digit hex number, fun is a single digit
# the domU needs to be built with
# xpci* at xenbus ?
# pci* at xpci ?
# and the pci drivers to be used by the domU
#
# pci = [ 'bus:dev1.fun1', 'bus:dev2.fun2' ]
#----------------------------------------------------------------------------
# Boot parameters (e.g. -s, -a, ...)
extra = ""
#============================================================================

View File

@@ -0,0 +1,38 @@
#!/bin/sh -e
# $NetBSD: vif-bridge-nbsd,v 1.2 2011/01/12 00:11:19 jym Exp $
# Called by xenbackendd
# Usage: vif-bridge xsdir_backend_path state
dir=$(dirname $0)
. "$dir/xen-subr"
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=$(xenstore_read_default "$xpath/vifname" "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

View File

@@ -0,0 +1,36 @@
#!/bin/sh -e
# $NetBSD: vif-ip-nbsd,v 1.2 2011/01/12 00:11:19 jym Exp $
# Called by xenbackendd
# Usage: vif-ip xsdir_backend_path state
dir=$(dirname $0)
. "$dir/xen-subr"
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=$(xenstore_read_default "$xpath/vifname" "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

View File

@@ -0,0 +1,11 @@
# $NetBSD: xen-subr-nbsd,v 1.1 2011/01/12 00:11:19 jym Exp $
#
# Contains commonly used functions which are used by Xen scripts
# xenstore_read_default path default
#
# Read the given path in XenStore. Return default if path does not exist
#
xenstore_read_default() {
xenstore-read "$1" 2>/dev/null || echo "$2"
}

View File

@@ -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);
}

View File

@@ -0,0 +1,17 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: xenbackendd.sh,v 1.2 2011/10/07 22:37:06 shattered 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"

View File

@@ -0,0 +1,30 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: xend.sh,v 1.3 2009/01/17 12:31:10 bouyer Exp $
#
# PROVIDE: xend
# REQUIRE: DAEMON
. /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/xend/boot || exit 1
mkdir -p /var/run/xenstored || exit 1
}
load_rc_config $name
run_rc_command "$1"

View File

@@ -0,0 +1,136 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: xendomains.sh,v 1.2 2012/07/16 22:55:25 jym 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
if ! $cmdline; then
echo "Pre-hook \`\`$cmdline'' failed... skipping $domain."
continue
fi
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"

View File

@@ -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 __PKGSRC_PRIVCMD_H__
#define __PKGSRC_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 /* __PKGSRC_PRIVCMD_H__ */

View File

@@ -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__ */