Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/usr.sbin/ofctl



The -l flag dumps a partial tree starting with the node specified by 'file'. The format of the output is the same as when you run ofctl with no arguments (this dumps the full tree, equivalent of 'ofctl -l /').

It looks like -r and -w will tell ofctl to read from or write to an externalized proplib file instead of using the openfirm ioctl interface.

On Sat, 26 May 2018, Thomas Klausner wrote:

Thank you!

Do you know what the -l, -r, and -w options do? Those are missing from the man page.

Cheers,
Thomas

On Sat, May 26, 2018 at 10:21:41AM +0000, Jared D. McNeill wrote:
Module Name:	src
Committed By:	jmcneill
Date:		Sat May 26 10:21:41 UTC 2018

Modified Files:
	src/usr.sbin/ofctl: ofctl.8 ofctl.c

Log Message:
Add -v flag which prints the full path of each device node when dumping
the full tree.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/ofctl/ofctl.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/ofctl/ofctl.c

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


Modified files:

Index: src/usr.sbin/ofctl/ofctl.8
diff -u src/usr.sbin/ofctl/ofctl.8:1.4 src/usr.sbin/ofctl/ofctl.8:1.5
--- src/usr.sbin/ofctl/ofctl.8:1.4	Thu Sep 25 22:44:51 2008
+++ src/usr.sbin/ofctl/ofctl.8	Sat May 26 10:21:41 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ofctl.8,v 1.4 2008/09/25 22:44:51 reed Exp $
+.\"	$NetBSD: ofctl.8,v 1.5 2018/05/26 10:21:41 jmcneill Exp $
 .\"
 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 29, 2006
+.Dd May 26, 2018
 .Dt OFCTL 8
 .Os
 .Sh NAME
@@ -36,6 +36,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl p
+.Op Fl v
 .Op Fl f Ar file
 .Op Ar node
 .Sh DESCRIPTION
@@ -66,6 +67,8 @@ instead of the default
 .Pa /dev/openfirm .
 .It Fl p
 Display each node's properties.
+.It Fl v
+Display the full path name for each node.
 .El
 .Sh FILES
 .Bl -tag -width "/dev/openprom "

Index: src/usr.sbin/ofctl/ofctl.c
diff -u src/usr.sbin/ofctl/ofctl.c:1.12 src/usr.sbin/ofctl/ofctl.c:1.13
--- src/usr.sbin/ofctl/ofctl.c:1.12	Wed Dec 23 13:42:24 2015
+++ src/usr.sbin/ofctl/ofctl.c	Sat May 26 10:21:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofctl.c,v 1.12 2015/12/23 13:42:24 jmcneill Exp $	*/
+/*	$NetBSD: ofctl.c,v 1.13 2018/05/26 10:21:41 jmcneill Exp $	*/

 /*-
  * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2006, 2007\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: ofctl.c,v 1.12 2015/12/23 13:42:24 jmcneill Exp $");
+__RCSID("$NetBSD: ofctl.c,v 1.13 2018/05/26 10:21:41 jmcneill Exp $");
 #endif /* not lint */

 #include <stdio.h>
@@ -62,6 +62,7 @@ static int isstrprint(const char *, size

 static int lflag;
 static int pflag;
+static int vflag;

 struct of_node {
 	TAILQ_ENTRY(of_node) of_sibling;
@@ -500,10 +501,11 @@ main(int argc, char **argv)
 	const char *propfilein = NULL;
 	const char *propfileout = NULL;

-	while ((c = getopt(argc, argv, "f:lpr:w:")) != EOF) {
+	while ((c = getopt(argc, argv, "f:lpr:vw:")) != EOF) {
 		switch (c) {
 		case 'l': lflag++; break;
 		case 'p': pflag++; break;
+		case 'v': vflag++; break;
 		case 'f': file = optarg; break;
 		case 'r': propfilein = optarg; break;
 		case 'w': propfileout = optarg; break;
@@ -511,7 +513,7 @@ main(int argc, char **argv)
 		}
 	}
 	if (errflag)
-		errx(1, "usage: ofctl [-pl] [-f file] [-r propfile] [-w propfile] [node...]");
+		errx(1, "usage: ofctl [-plv] [-f file] [-r propfile] [-w propfile] [node...]");

 	if (propfilein != NULL) {
 		of_proplib = prop_dictionary_internalize_from_file(propfilein);
@@ -694,7 +696,7 @@ oflist(int node, const char *parent_devi
 	int len;
 	while (node != 0) {
 		int child;
-		if (pflag == 0) {
+		if (pflag == 0 && vflag == 0) {
 			len = ofname(node, of_buf, of_buflen-1);
 			printf("%08x: %*s%s", node, depth * 2, "",
 			    (char *) of_buf);






Home | Main Index | Thread Index | Old Index