WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 16/17] Add some userspace tools for managing the crea

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 16/17] Add some userspace tools for managing the creation and destruction of bypass rings.
From: <steven.smith@xxxxxxxxxx>
Date: Sun, 4 Oct 2009 16:04:32 +0100
Cc: Steven Smith <steven.smith@xxxxxxxxxx>, keir.frasier@xxxxxxxxxx, jeremy@xxxxxxxx, joserenato.santos@xxxxxx
Delivery-date: Sun, 04 Oct 2009 08:43:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <cover.1254667618.git.ssmith@xxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <cover.1254667618.git.ssmith@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
These are pretty skanky.  It's not clear where they should live, or
even whether they should live at all, but they're handy for testing.

Signed-off-by: Steven Smith <steven.smith@xxxxxxxxxx>
---
 drivers/net/xen-netchannel2/tools/destroy_bypass.c |   25 ++++++++++++++++
 .../net/xen-netchannel2/tools/establish_bypass.c   |   31 ++++++++++++++++++++
 2 files changed, 56 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/xen-netchannel2/tools/destroy_bypass.c
 create mode 100644 drivers/net/xen-netchannel2/tools/establish_bypass.c

diff --git a/drivers/net/xen-netchannel2/tools/destroy_bypass.c 
b/drivers/net/xen-netchannel2/tools/destroy_bypass.c
new file mode 100644
index 0000000..93b82e0
--- /dev/null
+++ b/drivers/net/xen-netchannel2/tools/destroy_bypass.c
@@ -0,0 +1,25 @@
+#include <sys/ioctl.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "../netchannel2_uspace.h"
+
+int
+main(int argc, char *argv[])
+{
+       int fd;
+       struct netchannel2_ioctl_destroy_bypass ioc;
+       int r;
+
+       fd = open("/dev/netback2", O_RDWR);
+       if (fd < 0)
+               err(1, "openning /dev/netback2");
+       ioc.handle = atoi(argv[1]);
+
+       r = ioctl(fd, NETCHANNEL2_IOCTL_DESTROY_BYPASS, &ioc);
+       if (r < 0)
+               err(1, "destroying bypass");
+       return 0;
+}
diff --git a/drivers/net/xen-netchannel2/tools/establish_bypass.c 
b/drivers/net/xen-netchannel2/tools/establish_bypass.c
new file mode 100644
index 0000000..bdd326c
--- /dev/null
+++ b/drivers/net/xen-netchannel2/tools/establish_bypass.c
@@ -0,0 +1,31 @@
+#include <sys/ioctl.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "../netchannel2_uspace.h"
+
+int
+main(int argc, char *argv[])
+{
+       int fd;
+       unsigned a;
+       unsigned b;
+       struct netchannel2_ioctl_establish_bypass ioc;
+       int r;
+
+       fd = open("/dev/netback2", O_RDWR);
+       if (fd < 0)
+               err(1, "openning /dev/netback2");
+       a = atoi(argv[1]);
+       b = atoi(argv[2]);
+       ioc.handle_a = a;
+       ioc.handle_b = b;
+
+       r = ioctl(fd, NETCHANNEL2_IOCTL_ESTABLISH_BYPASS, &ioc);
+       if (r < 0)
+               err(1, "establishing bypass");
+       printf("%d\n", r);
+       return 0;
+}
-- 
1.6.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>