Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Oct 2010 12:32:51 +0100
From:      Bruce Cran <bruce@cran.org.uk>
To:        freebsd-scsi@freebsd.org
Subject:   camcontrol patch to allow users to specify device node names
Message-ID:  <201010071232.51676.bruce@cran.org.uk>

next in thread | raw e-mail | index | archive | help
--Boundary-00=_j/arMWt9TpdESy5
Content-Type: Text/Plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit

In camcontrol, there's code to check that a device hasn't been specified as 
"/dev/daX" - in this case, an error is printed and it exits. However, a plain 
device name is already allowed and I've checked that passing a device node 
does work.

I've attached a patch which removes this restriction and allows people to use 
"camcontrol tur /dev/da0" if they want to.

Is there a reason for disallowing people to specify the device node, or could 
this patch be committed with an update to the man page to remove the sentence 
about character device node names not being allowed?

-- 
Bruce Cran

--Boundary-00=_j/arMWt9TpdESy5
Content-Type: text/x-patch; charset="ISO-8859-1"; name="camcontrol.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="camcontrol.c.diff"

Index: camcontrol.c
===================================================================
--- camcontrol.c	(revision 213462)
+++ camcontrol.c	(working copy)
@@ -4605,15 +4605,7 @@
 		char name[30];
 		int rv;
 
-		/*
-		 * First catch people who try to do things like:
-		 * camcontrol tur /dev/da0 
-		 * camcontrol doesn't take device nodes as arguments.
-		 */
-		if (argv[2][0] == '/') {
-			warnx("%s is not a valid device identifier", argv[2]);
-			errx(1, "please read the camcontrol(8) man page");
-		} else if (isdigit(argv[2][0])) {
+		if (isdigit(argv[2][0])) {
 			/* device specified as bus:target[:lun] */
 			rv = parse_btl(argv[2], &bus, &target, &lun, &arglist);
 			if (rv < 2)

--Boundary-00=_j/arMWt9TpdESy5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010071232.51676.bruce>