]> xenbits.xensource.com Git - people/ssmith/netchannel2-pvops.git/commitdiff
Add some userspace tools for managing the creation and destruction of bypass rings.
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Sun, 4 Oct 2009 11:48:07 +0000 (12:48 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Sun, 4 Oct 2009 13:30:57 +0000 (14:30 +0100)
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@citrix.com>
drivers/net/xen-netchannel2/tools/destroy_bypass.c [new file with mode: 0644]
drivers/net/xen-netchannel2/tools/establish_bypass.c [new file with mode: 0644]

diff --git a/drivers/net/xen-netchannel2/tools/destroy_bypass.c b/drivers/net/xen-netchannel2/tools/destroy_bypass.c
new file mode 100644 (file)
index 0000000..93b82e0
--- /dev/null
@@ -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 (file)
index 0000000..bdd326c
--- /dev/null
@@ -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;
+}