Re: CVS commit: src/share/examples/rump/virtual_ip_router

2010-03-29 Thread Antti Kantee
On Mon Mar 29 2010 at 17:40:15 +, Christos Zoulas wrote:
> >Added Files:
> > src/share/examples/rump/virtual_ip_router: startrouters.sh
> 
> Style:
> 
> - errors to stderr and prefixed by the script name.
> - I would have set LIF='10.0.${ip}.1', and used eval to set lif to avoid
>   echo/sed/pipe...
> - `` -> $(), if you really dislike eval.

Yea, it's a script i wrote over a year ago probably at 2000am when I
wanted to measure IP routing instead of write pretty scripts.  As the
README says, this is only an example hack of what you can do instead of
a commercial grade network testing/simulation product.  ... Not that it
couldn't be turned into one and if someone does want to work on producing
one, your suggestions are an excellent place to start tinkering.


Re: CVS commit: src/share/examples/rump/virtual_ip_router

2010-03-29 Thread Christos Zoulas
In article <20100329021115.3a28f17...@cvs.netbsd.org>,
Antti Kantee   wrote:
>-=-=-=-=-=-
>
>Module Name:   src
>Committed By:  pooka
>Date:  Mon Mar 29 02:11:15 UTC 2010
>
>Modified Files:
>   src/share/examples/rump/virtual_ip_router: README.txt
>Added Files:
>   src/share/examples/rump/virtual_ip_router: startrouters.sh
>
>Log Message:
>amazing grep, how sweet the find
>that saved a hack like me
>script once was lost but now it's found
>was -x, but now I sh

Style:

- errors to stderr and prefixed by the script name.
- I would have set LIF='10.0.${ip}.1', and used eval to set lif to avoid
  echo/sed/pipe...
- `` -> $(), if you really dislike eval.

christos



CVS commit: src/share/examples/rump

2010-03-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Mar  7 23:28:14 UTC 2010

Modified Files:
src/share/examples/rump: Makefile
Added Files:
src/share/examples/rump/ttyserv: Makefile ttyserv.c

Log Message:
Add a simple tty server which attaches to /dev/ttyU in the rump
kernel and provides the same device on the host with pud(4).  I
can succesfully talk to my u3g device using tip(1) against the
server's devices.  Some characters are lost here and there, though
(probably a problem with interrupt pipes in ugenhc).  Once that
issues is solved, there is no reason why e.g. pppd (chat) could
not be used against the server.

Now, why would anyone want to do this instead of using the kernel
driver directly?  Well, for one, on my laptop I run netbsd-5 which
doesn't have a u3g driver which supports the u3g hardware I have.

As anyone with half an eye can see, this is quite copypasted from
umserv and there is plenty of opportunity for uncopypasting for
the eager vi-wielder.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/examples/rump/Makefile
cvs rdiff -u -r0 -r1.1 src/share/examples/rump/ttyserv/Makefile \
src/share/examples/rump/ttyserv/ttyserv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/examples/rump/Makefile
diff -u src/share/examples/rump/Makefile:1.2 src/share/examples/rump/Makefile:1.3
--- src/share/examples/rump/Makefile:1.2	Mon Jan 11 02:20:06 2010
+++ src/share/examples/rump/Makefile	Sun Mar  7 23:28:14 2010
@@ -1,6 +1,7 @@
-#	$NetBSD: Makefile,v 1.2 2010/01/11 02:20:06 pooka Exp $
+#	$NetBSD: Makefile,v 1.3 2010/03/07 23:28:14 pooka Exp $
 #
 
-SUBDIR=	img2cgd sdread tipsy ulptprint umserv ukbd_read ums_draw wirelessconf
+SUBDIR=	img2cgd sdread swwdog_arm tipsy ttyserv ulptprint umserv	\
+	ukbd_read ums_draw wirelessconf
 
 .include 

Added files:

Index: src/share/examples/rump/ttyserv/Makefile
diff -u /dev/null src/share/examples/rump/ttyserv/Makefile:1.1
--- /dev/null	Sun Mar  7 23:28:14 2010
+++ src/share/examples/rump/ttyserv/Makefile	Sun Mar  7 23:28:14 2010
@@ -0,0 +1,10 @@
+PROG=ttyserv
+NOMAN=
+LDADD+=-lrumpdev_ucom -lrumpdev_ugenhc -lrumpdev_usb -lrumpdev
+LDADD+=-lrumpvfs
+LDADD+=-lrump -lrumpuser -lpthread
+
+WARNS=4
+DBG=-g
+
+.include 
Index: src/share/examples/rump/ttyserv/ttyserv.c
diff -u /dev/null src/share/examples/rump/ttyserv/ttyserv.c:1.1
--- /dev/null	Sun Mar  7 23:28:14 2010
+++ src/share/examples/rump/ttyserv/ttyserv.c	Sun Mar  7 23:28:14 2010
@@ -0,0 +1,223 @@
+/*	$NetBSD: ttyserv.c,v 1.1 2010/03/07 23:28:14 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This is a [quick, simple & dirty] userspace tty/ucom server.
+ * We probe USB devices using rump and attach them to the host kernel
+ * using pud(4).
+ */
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * No devfs?  No problem.  We just hack a bit & wait for the dust to settle.
+ */
+#define MYMAJOR 412
+static int
+makenodes(void)
+{
+	struct stat sb;
+	int rv;
+
+	if (stat("rumpttyU0", &sb) != 0)
+		rv = mknod("rumpttyU0", S_IFCHR | 0666, makedev(MYMAJOR, 0));
+	if (rv != 0 && !(rv == -1 && errno == EEXIST))
+		return rv;
+
+	if (stat("rumpttyU1", &sb) != 0)
+		rv = mknod("rumpttyU1", S_IFCHR | 0666, makedev(MYMAJOR, 1));
+	if (rv != 0 && !(rv == -1 && errno == EEXIST))
+		return rv;
+
+	return 0;
+}
+
+static struct vnode *devvps[2];
+static kauth_cred_t rootcred;
+static int fd;
+
+static void *
+handlereq(void *arg)
+{
+	struct vno

CVS commit: src/share/examples/rump

2010-03-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Mar  7 23:28:14 UTC 2010

Modified Files:
src/share/examples/rump: Makefile
Added Files:
src/share/examples/rump/ttyserv: Makefile ttyserv.c

Log Message:
Add a simple tty server which attaches to /dev/ttyU in the rump
kernel and provides the same device on the host with pud(4).  I
can succesfully talk to my u3g device using tip(1) against the
server's devices.  Some characters are lost here and there, though
(probably a problem with interrupt pipes in ugenhc).  Once that
issues is solved, there is no reason why e.g. pppd (chat) could
not be used against the server.

Now, why would anyone want to do this instead of using the kernel
driver directly?  Well, for one, on my laptop I run netbsd-5 which
doesn't have a u3g driver which supports the u3g hardware I have.

As anyone with half an eye can see, this is quite copypasted from
umserv and there is plenty of opportunity for uncopypasting for
the eager vi-wielder.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/examples/rump/Makefile
cvs rdiff -u -r0 -r1.1 src/share/examples/rump/ttyserv/Makefile \
src/share/examples/rump/ttyserv/ttyserv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/rump/sdread

2010-03-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Mar  7 23:18:17 UTC 2010

Modified Files:
src/share/examples/rump/sdread: sdread.c

Log Message:
Pause after probe here too, so that you can amuse yourself by
unplugging and replugging devices and looking at the detach/attach
feedback messages.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/examples/rump/sdread/sdread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/rump/sdread

2010-03-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Mar  7 23:18:17 UTC 2010

Modified Files:
src/share/examples/rump/sdread: sdread.c

Log Message:
Pause after probe here too, so that you can amuse yourself by
unplugging and replugging devices and looking at the detach/attach
feedback messages.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/examples/rump/sdread/sdread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/examples/rump/sdread/sdread.c
diff -u src/share/examples/rump/sdread/sdread.c:1.3 src/share/examples/rump/sdread/sdread.c:1.4
--- src/share/examples/rump/sdread/sdread.c:1.3	Wed Feb 17 20:43:35 2010
+++ src/share/examples/rump/sdread/sdread.c	Sun Mar  7 23:18:17 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdread.c,v 1.3 2010/02/17 20:43:35 pooka Exp $	*/
+/*	$NetBSD: sdread.c,v 1.4 2010/03/07 23:18:17 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -86,6 +86,7 @@
 		rump_boot_sethowto(RUMP_AB_VERBOSE);
 	rump_init();
 	if (probeonly) {
+		pause();
 		exit(0);
 	}
 



CVS commit: src/share/examples/rump/tipsy

2010-02-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb 18 16:14:55 UTC 2010

Modified Files:
src/share/examples/rump/tipsy: tipsy.c

Log Message:
In "probeonly", pause after bootstrap to make "monkey plug and
unplug device, monkey see fancy dmesg info" possible.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/examples/rump/tipsy/tipsy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/rump/sdread

2010-02-17 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Feb 17 20:43:35 UTC 2010

Modified Files:
src/share/examples/rump/sdread: Makefile sdread.c

Log Message:
* support cd devices (@scsibus & @atapibus, per libumass)
* support cd9660
* add "probe" keyword, which just prints the dmesg in verbose form


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/examples/rump/sdread/Makefile
cvs rdiff -u -r1.2 -r1.3 src/share/examples/rump/sdread/sdread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/rump

2010-02-09 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Feb 10 02:31:01 UTC 2010

Modified Files:
src/share/examples/rump/sdread: Makefile
src/share/examples/rump/tipsy: Makefile
src/share/examples/rump/ukbd_read: Makefile
src/share/examples/rump/ulptprint: Makefile
src/share/examples/rump/ums_draw: Makefile
src/share/examples/rump/umserv: Makefile
src/share/examples/rump/wirelessconf: Makefile

Log Message:
rumpusbhc is now ugenhc


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/examples/rump/sdread/Makefile
cvs rdiff -u -r1.1 -r1.2 src/share/examples/rump/tipsy/Makefile
cvs rdiff -u -r1.1 -r1.2 src/share/examples/rump/ukbd_read/Makefile
cvs rdiff -u -r1.1 -r1.2 src/share/examples/rump/ulptprint/Makefile
cvs rdiff -u -r1.1 -r1.2 src/share/examples/rump/ums_draw/Makefile
cvs rdiff -u -r1.1 -r1.2 src/share/examples/rump/umserv/Makefile
cvs rdiff -u -r1.3 -r1.4 src/share/examples/rump/wirelessconf/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/rump/wirelessconf

2010-02-05 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Feb  5 22:07:51 UTC 2010

Modified Files:
src/share/examples/rump/wirelessconf: Makefile

Log Message:
The rumpdev_net80211 until-recently-wip component is now rumpnet_net80211.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/examples/rump/wirelessconf/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/rump/swwdog_arm

2010-01-30 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Jan 31 03:11:55 UTC 2010

Added Files:
src/share/examples/rump/swwdog_arm: Makefile swwdog_arm.c

Log Message:
Add an example on how to use sysmon watchdogs in rump.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/examples/rump/swwdog_arm/Makefile \
src/share/examples/rump/swwdog_arm/swwdog_arm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/rump

2010-01-10 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan 11 02:20:06 UTC 2010

Modified Files:
src/share/examples/rump: Makefile

Log Message:
descend into new subdirs


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/examples/rump/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/rump/ums_draw

2010-01-10 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan 11 02:18:45 UTC 2010

Added Files:
src/share/examples/rump/ums_draw: Makefile ms.c

Log Message:
Read mouse events from wsmouse and move a silly curses cursor around
the screen (quite poorly, i might add ;).


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/examples/rump/ums_draw/Makefile \
src/share/examples/rump/ums_draw/ms.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/rump/ukbd_read

2010-01-10 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan 11 02:16:51 UTC 2010

Added Files:
src/share/examples/rump/ukbd_read: Makefile kbd.c

Log Message:
Add an example program which reads keypresses from the ukbd driver
(via wscons) and simply prints them on screen.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/examples/rump/ukbd_read/Makefile \
src/share/examples/rump/ukbd_read/kbd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/rump

2010-01-09 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Jan  9 16:19:17 UTC 2010

Added Files:
src/share/examples/rump: Makefile

Log Message:
Stick a top-level subdir-makefile here for easy build-testing.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/examples/rump/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.