Sun May 3 22:49:52 2009 UTC ()
Pull up following revision(s) (requested by joerg in ticket #675):
	sbin/drvctl/drvctl.8: revision 1.6
	sbin/drvctl/drvctl.c: revision 1.8 via patch
If drvctl -l is used without argument, print the root device nodes.


(snj)
diff -r1.5 -r1.5.10.1 src/sbin/drvctl/drvctl.8
diff -r1.6 -r1.6.10.1 src/sbin/drvctl/drvctl.c

cvs diff -r1.5 -r1.5.10.1 src/sbin/drvctl/drvctl.8 (expand / switch to context diff)
--- src/sbin/drvctl/drvctl.8 2008/02/16 02:00:37 1.5
+++ src/sbin/drvctl/drvctl.8 2009/05/03 22:49:51 1.5.10.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: drvctl.8,v 1.5 2008/02/16 02:00:37 dyoung Exp $
+.\" $NetBSD: drvctl.8,v 1.5.10.1 2009/05/03 22:49:51 snj Exp $
 .\"
 .\" Copyright (c) 2004
 .\" 	Matthias Drochner.  All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd Feburary 15, 2008
+.Dd April 4, 2009
 .Dt DRVCTL 8
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@
 .Ar device
 .Nm
 .Fl l
-.Ar device
+.Op Ar device
 .Nm
 .Fl p
 .Ar device
@@ -78,6 +78,9 @@
 List the children of the device specified by the
 .Ar device
 argument.
+If
+.Ar device
+is not specified, query for roots of the device tree instead.
 .It Fl p
 Get the properties for the device specified by the
 .Ar device

cvs diff -r1.6 -r1.6.10.1 src/sbin/drvctl/drvctl.c (expand / switch to context diff)
--- src/sbin/drvctl/drvctl.c 2008/01/27 01:38:33 1.6
+++ src/sbin/drvctl/drvctl.c 2009/05/03 22:49:51 1.6.10.1
@@ -1,4 +1,4 @@
-/* $NetBSD: drvctl.c,v 1.6 2008/01/27 01:38:33 dyoung Exp $ */
+/* $NetBSD: drvctl.c,v 1.6.10.1 2009/05/03 22:49:51 snj Exp $ */
 
 /*
  * Copyright (c) 2004
@@ -49,7 +49,7 @@
 
 	fprintf(stderr, "Usage: %s -r [-a attribute] busdevice [locator ...]\n"
 	    "       %s -d device\n"
-	    "       %s -l device\n"
+	    "       %s -l [device]\n"
 	    "       %s -p device\n"
 	    "       %s -Q device\n"
 	    "       %s -R device\n"
@@ -104,7 +104,7 @@
 	argc -= optind;
 	argv += optind;
 
-	if (argc < 1 || mode == 0)
+	if ((argc < 1 && mode != 'l') || mode == 0)
 		usage();
 
 	fd = open(DRVCTLDEV, OPEN_MODE(mode), 0);
@@ -134,7 +134,10 @@
 			err(3, "DRVDETACHDEV");
 		break;
 	case 'l':
-		strlcpy(laa.l_devname, argv[0], sizeof(laa.l_devname));
+		if (argc == 0)
+			*laa.l_devname = '\0';
+		else
+			strlcpy(laa.l_devname, argv[0], sizeof(laa.l_devname));
 
 		if (ioctl(fd, DRVLISTDEV, &laa) == -1)
 			err(3, "DRVLISTDEV");
@@ -149,8 +152,10 @@
 		if (laa.l_children > children)
 			err(6, "DRVLISTDEV: number of children grew");
 
-		for (i = 0; i < laa.l_children; i++)
-			printf("%s %s\n", laa.l_devname, laa.l_childname[i]);
+		for (i = 0; i < laa.l_children; i++) {
+			printf("%s%s%s\n", laa.l_devname, (argc ? " " : ""),
+			    laa.l_childname[i]);
+		}
 		break;
 	case 'r':
 		memset(&raa, 0, sizeof(raa));