From nobody@FreeBSD.org  Wed Apr 25 21:03:48 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D1BB0106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 25 Apr 2012 21:03:48 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id BB8B38FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 25 Apr 2012 21:03:48 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q3PL3mrA051865
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 25 Apr 2012 21:03:48 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q3PL3mK9051859;
	Wed, 25 Apr 2012 21:03:48 GMT
	(envelope-from nobody)
Message-Id: <201204252103.q3PL3mK9051859@red.freebsd.org>
Date: Wed, 25 Apr 2012 21:03:48 GMT
From: markham breitbach <markham@ssimicro.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: mfiutil doesn't allow RO access to RO attributes for device
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         167302
>Category:       bin
>Synopsis:       [patch] mfiutil(8) doesn't allow RO access to RO attributes for device
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    eadler
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 25 21:10:10 UTC 2012
>Closed-Date:    Tue Jun 26 03:18:46 UTC 2012
>Last-Modified:  Wed Jun 27 06:54:11 UTC 2012
>Originator:     markham breitbach
>Release:        8.1-RELEASE
>Organization:
SSi Micro
>Environment:
FreeBSD jellybean.ssimicro.com 8.1-RELEASE-p5 FreeBSD 8.1-RELEASE-p5 #0: Tue Sep 27 16:18:26 UTC 2011     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
Currently mfiutil is only really useful to run as root beacuse all access to the device is RDWR.  This patch allows users with RO privilege to the device to read the RO attributes (mostly SHOW commands).  This is useful, for example for a nagios or other monitoring system.
>How-To-Repeat:

>Fix:
created patch for usr.src/mfiutil.

Patch attached with submission follows:

diff -rupN /tmp/mfiutil/mfi_cmd.c ./mfi_cmd.c
--- /tmp/mfiutil/mfi_cmd.c	2012-04-25 20:50:18.000000000 +0000
+++ ./mfi_cmd.c	2012-04-25 20:22:10.000000000 +0000
@@ -301,12 +301,12 @@ mfi_ctrl_get_info(int fd, struct mfi_ctr
 }
 
 int
-mfi_open(int unit)
+mfi_open(int unit,int access)
 {
 	char path[MAXPATHLEN];
 
 	snprintf(path, sizeof(path), "/dev/mfi%d", unit);
-	return (open(path, O_RDWR));
+	return (open(path, access));
 }
 
 void
diff -rupN /tmp/mfiutil/mfi_config.c ./mfi_config.c
--- /tmp/mfiutil/mfi_config.c	2010-06-14 02:09:06.000000000 +0000
+++ ./mfi_config.c	2012-04-25 20:33:15.000000000 +0000
@@ -43,6 +43,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include "mfiutil.h"
 
 #ifdef DEBUG
@@ -154,7 +155,7 @@ clear_config(int ac, char **av)
 	int ch, fd;
 	u_int i;
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -546,7 +547,7 @@ create_volume(int ac, char **av)
 	}
 
 	
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -797,7 +798,7 @@ delete_volume(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -856,7 +857,7 @@ add_spare(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -962,7 +963,7 @@ remove_spare(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -1100,7 +1101,7 @@ debug_config(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -1134,7 +1135,7 @@ dump(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
diff -rupN /tmp/mfiutil/mfi_drive.c ./mfi_drive.c
--- /tmp/mfiutil/mfi_drive.c	2010-06-14 02:09:06.000000000 +0000
+++ ./mfi_drive.c	2012-04-25 20:33:38.000000000 +0000
@@ -40,6 +40,7 @@
 #include <string.h>
 #include <strings.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include <cam/scsi/scsi_all.h>
 #include "mfiutil.h"
 
@@ -296,7 +297,7 @@ drive_set_state(char *drive, uint16_t ne
 	uint8_t mbox[6];
 	int error, fd;
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -389,7 +390,7 @@ start_rebuild(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -438,7 +439,7 @@ abort_rebuild(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -486,7 +487,7 @@ drive_progress(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -545,7 +546,7 @@ drive_clear(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -598,7 +599,7 @@ drive_locate(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
diff -rupN /tmp/mfiutil/mfi_evt.c ./mfi_evt.c
--- /tmp/mfiutil/mfi_evt.c	2010-06-14 02:09:06.000000000 +0000
+++ ./mfi_evt.c	2012-04-25 20:34:08.000000000 +0000
@@ -38,6 +38,7 @@
 #include <strings.h>
 #include <time.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include "mfiutil.h"
 
 static int
@@ -74,7 +75,7 @@ show_logstate(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -539,7 +540,7 @@ show_events(int ac, char **av)
 	int ch, fd, num_events, verbose;
 	u_int i;
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
diff -rupN /tmp/mfiutil/mfi_flash.c ./mfi_flash.c
--- /tmp/mfiutil/mfi_flash.c	2010-06-14 02:09:06.000000000 +0000
+++ ./mfi_flash.c	2012-04-25 20:34:53.000000000 +0000
@@ -38,6 +38,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include "mfiutil.h"
 
 #define	FLASH_BUF_SIZE	(64 * 1024)
@@ -140,7 +141,7 @@ flash_adapter(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
diff -rupN /tmp/mfiutil/mfi_patrol.c ./mfi_patrol.c
--- /tmp/mfiutil/mfi_patrol.c	2010-06-14 02:09:06.000000000 +0000
+++ ./mfi_patrol.c	2012-04-25 20:35:16.000000000 +0000
@@ -37,6 +37,7 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include "mfiutil.h"
 
 static char *
@@ -84,7 +85,7 @@ show_patrol(int ac, char **av)
 	int fd;
 	u_int i;
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -180,7 +181,7 @@ start_patrol(int ac, char **av)
 {
 	int fd;
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -203,7 +204,7 @@ stop_patrol(int ac, char **av)
 {
 	int fd;
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -270,7 +271,7 @@ patrol_config(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
diff -rupN /tmp/mfiutil/mfi_show.c ./mfi_show.c
--- /tmp/mfiutil/mfi_show.c	2010-06-14 02:09:06.000000000 +0000
+++ ./mfi_show.c	2012-04-25 20:30:29.000000000 +0000
@@ -37,6 +37,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
 #include "mfiutil.h"
 
 MFI_TABLE(top, show);
@@ -61,7 +64,7 @@ show_adapter(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDONLY);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -144,7 +147,7 @@ show_battery(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDONLY);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -249,7 +252,7 @@ show_config(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDONLY);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -345,7 +348,7 @@ show_volumes(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDONLY);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -423,7 +426,7 @@ show_drives(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDONLY);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -519,7 +522,7 @@ show_firmware(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDONLY);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
diff -rupN /tmp/mfiutil/mfi_volume.c ./mfi_volume.c
--- /tmp/mfiutil/mfi_volume.c	2010-06-14 02:09:06.000000000 +0000
+++ ./mfi_volume.c	2012-04-25 20:39:28.000000000 +0000
@@ -37,6 +37,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include "mfiutil.h"
 
 MFI_TABLE(top, volume);
@@ -158,7 +159,7 @@ volume_cache(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -330,7 +331,7 @@ volume_name(int ac, char **av)
 		return (ENOSPC);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDWR);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
@@ -374,7 +375,7 @@ volume_progress(int ac, char **av)
 		return (EINVAL);
 	}
 
-	fd = mfi_open(mfi_unit);
+	fd = mfi_open(mfi_unit,O_RDONLY);
 	if (fd < 0) {
 		warn("mfi_open");
 		return (errno);
diff -rupN /tmp/mfiutil/mfiutil.c ./mfiutil.c
--- /tmp/mfiutil/mfiutil.c	2010-06-14 02:09:06.000000000 +0000
+++ ./mfiutil.c	2012-04-25 20:41:16.000000000 +0000
@@ -91,7 +91,7 @@ static int
 version(int ac, char **av)
 {
 
-	printf("mfiutil version 1.0.13");
+	printf("mfiutil version 1.0.13b");
 #ifdef DEBUG
 	printf(" (DEBUG)");
 #endif
diff -rupN /tmp/mfiutil/mfiutil.h ./mfiutil.h
--- /tmp/mfiutil/mfiutil.h	2010-06-14 02:09:06.000000000 +0000
+++ ./mfiutil.h	2012-04-25 20:21:30.000000000 +0000
@@ -133,7 +133,7 @@ int	mfi_lookup_drive(int fd, char *drive
 int	mfi_lookup_volume(int fd, const char *name, uint8_t *target_id);
 int	mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize,
     uint8_t *mbox, size_t mboxlen, uint8_t *statusp);
-int	mfi_open(int unit);
+int	mfi_open(int unit,int access);
 int	mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp);
 int	mfi_ld_get_info(int fd, uint8_t target_id, struct mfi_ld_info *info,
     uint8_t *statusp);


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->eadler 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Sun May 6 14:49:06 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=167302 
State-Changed-From-To: open->analyzed 
State-Changed-By: eadler 
State-Changed-When: Mon Jun 18 04:30:31 UTC 2012 
State-Changed-Why:  
awaiting approval 

http://www.freebsd.org/cgi/query-pr.cgi?pr=167302 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/167302: commit references a PR
Date: Tue, 19 Jun 2012 06:18:50 +0000 (UTC)

 Author: eadler
 Date: Tue Jun 19 06:18:37 2012
 New Revision: 237259
 URL: http://svn.freebsd.org/changeset/base/237259
 
 Log:
   Allow users with RO privilege to the device to read the RO attributes.
   
   PR:		bin/167302
   Submitted by:	markham breitbach <markham@ssimicro.com>
   Discussed with:	pjd (briefly)
   Approved by:	cperciva
   MFC after:	1 week
 
 Modified:
   head/usr.sbin/mfiutil/mfi_cmd.c
   head/usr.sbin/mfiutil/mfi_config.c
   head/usr.sbin/mfiutil/mfi_drive.c
   head/usr.sbin/mfiutil/mfi_evt.c
   head/usr.sbin/mfiutil/mfi_flash.c
   head/usr.sbin/mfiutil/mfi_patrol.c
   head/usr.sbin/mfiutil/mfi_show.c
   head/usr.sbin/mfiutil/mfi_volume.c
   head/usr.sbin/mfiutil/mfiutil.c
   head/usr.sbin/mfiutil/mfiutil.h
 
 Modified: head/usr.sbin/mfiutil/mfi_cmd.c
 ==============================================================================
 --- head/usr.sbin/mfiutil/mfi_cmd.c	Tue Jun 19 06:10:34 2012	(r237258)
 +++ head/usr.sbin/mfiutil/mfi_cmd.c	Tue Jun 19 06:18:37 2012	(r237259)
 @@ -301,12 +301,12 @@ mfi_ctrl_get_info(int fd, struct mfi_ctr
  }
  
  int
 -mfi_open(int unit)
 +mfi_open(int unit, int acs)
  {
  	char path[MAXPATHLEN];
  
  	snprintf(path, sizeof(path), "/dev/mfi%d", unit);
 -	return (open(path, O_RDWR));
 +	return (open(path, acs));
  }
  
  void
 
 Modified: head/usr.sbin/mfiutil/mfi_config.c
 ==============================================================================
 --- head/usr.sbin/mfiutil/mfi_config.c	Tue Jun 19 06:10:34 2012	(r237258)
 +++ head/usr.sbin/mfiutil/mfi_config.c	Tue Jun 19 06:18:37 2012	(r237259)
 @@ -35,6 +35,7 @@
  #endif
  #include <err.h>
  #include <errno.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #ifdef DEBUG
  #include <stdint.h>
 @@ -157,7 +158,7 @@ clear_config(int ac, char **av)
  	int ch, error, fd;
  	u_int i;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -575,7 +576,7 @@ create_volume(int ac, char **av)
  	narrays = 0;
  	error = 0;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -857,7 +858,7 @@ delete_volume(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -925,7 +926,7 @@ add_spare(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -1050,7 +1051,7 @@ remove_spare(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -1196,7 +1197,7 @@ debug_config(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -1233,7 +1234,7 @@ dump(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: head/usr.sbin/mfiutil/mfi_drive.c
 ==============================================================================
 --- head/usr.sbin/mfiutil/mfi_drive.c	Tue Jun 19 06:10:34 2012	(r237258)
 +++ head/usr.sbin/mfiutil/mfi_drive.c	Tue Jun 19 06:18:37 2012	(r237259)
 @@ -33,6 +33,7 @@
  #include <sys/errno.h>
  #include <ctype.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #include <limits.h>
  #include <stdio.h>
 @@ -71,7 +72,7 @@ mfi_drive_name(struct mfi_pd_info *pinfo
  		else
  			snprintf(buf, sizeof(buf), "%2u", device_id);
  
 -		fd = mfi_open(mfi_unit);
 +		fd = mfi_open(mfi_unit, O_RDWR);
  		if (fd < 0) {
  			warn("mfi_open");
  			return (buf);
 @@ -383,7 +384,7 @@ drive_set_state(char *drive, uint16_t ne
  	uint8_t mbox[6];
  	int error, fd;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -484,7 +485,7 @@ start_rebuild(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -541,7 +542,7 @@ abort_rebuild(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -597,7 +598,7 @@ drive_progress(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -663,7 +664,7 @@ drive_clear(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -723,7 +724,7 @@ drive_locate(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: head/usr.sbin/mfiutil/mfi_evt.c
 ==============================================================================
 --- head/usr.sbin/mfiutil/mfi_evt.c	Tue Jun 19 06:10:34 2012	(r237258)
 +++ head/usr.sbin/mfiutil/mfi_evt.c	Tue Jun 19 06:18:37 2012	(r237259)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <strings.h>
 @@ -73,7 +74,7 @@ show_logstate(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -541,7 +542,7 @@ show_events(int ac, char **av)
  	int ch, error, fd, num_events, verbose;
  	u_int i;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: head/usr.sbin/mfiutil/mfi_flash.c
 ==============================================================================
 --- head/usr.sbin/mfiutil/mfi_flash.c	Tue Jun 19 06:10:34 2012	(r237258)
 +++ head/usr.sbin/mfiutil/mfi_flash.c	Tue Jun 19 06:18:37 2012	(r237259)
 @@ -150,7 +150,7 @@ flash_adapter(int ac, char **av)
  		goto error;
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: head/usr.sbin/mfiutil/mfi_patrol.c
 ==============================================================================
 --- head/usr.sbin/mfiutil/mfi_patrol.c	Tue Jun 19 06:10:34 2012	(r237258)
 +++ head/usr.sbin/mfiutil/mfi_patrol.c	Tue Jun 19 06:18:37 2012	(r237259)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
 @@ -86,7 +87,7 @@ show_patrol(int ac, char **av)
  	int error, fd;
  	u_int i;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -196,7 +197,7 @@ start_patrol(int ac, char **av)
  {
  	int error, fd;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -222,7 +223,7 @@ stop_patrol(int ac, char **av)
  {
  	int error, fd;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -292,7 +293,7 @@ patrol_config(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: head/usr.sbin/mfiutil/mfi_show.c
 ==============================================================================
 --- head/usr.sbin/mfiutil/mfi_show.c	Tue Jun 19 06:10:34 2012	(r237258)
 +++ head/usr.sbin/mfiutil/mfi_show.c	Tue Jun 19 06:18:37 2012	(r237259)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #include <stdio.h>
  #include <stdlib.h>
 @@ -61,7 +62,7 @@ show_adapter(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -148,7 +149,7 @@ show_battery(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -320,7 +321,7 @@ show_config(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -421,7 +422,7 @@ show_volumes(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -504,7 +505,7 @@ show_drives(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -612,7 +613,7 @@ show_firmware(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -672,7 +673,7 @@ show_progress(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: head/usr.sbin/mfiutil/mfi_volume.c
 ==============================================================================
 --- head/usr.sbin/mfiutil/mfi_volume.c	Tue Jun 19 06:10:34 2012	(r237258)
 +++ head/usr.sbin/mfiutil/mfi_volume.c	Tue Jun 19 06:18:37 2012	(r237259)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #include <stdio.h>
  #include <stdlib.h>
 @@ -294,7 +295,7 @@ volume_cache(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -402,7 +403,7 @@ volume_name(int ac, char **av)
  		return (ENOSPC);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -453,7 +454,7 @@ volume_progress(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: head/usr.sbin/mfiutil/mfiutil.c
 ==============================================================================
 --- head/usr.sbin/mfiutil/mfiutil.c	Tue Jun 19 06:10:34 2012	(r237258)
 +++ head/usr.sbin/mfiutil/mfiutil.c	Tue Jun 19 06:18:37 2012	(r237259)
 @@ -95,7 +95,7 @@ static int
  version(int ac, char **av)
  {
  
 -	printf("mfiutil version 1.0.13");
 +	printf("mfiutil version 1.0.14");
  #ifdef DEBUG
  	printf(" (DEBUG)");
  #endif
 
 Modified: head/usr.sbin/mfiutil/mfiutil.h
 ==============================================================================
 --- head/usr.sbin/mfiutil/mfiutil.h	Tue Jun 19 06:10:34 2012	(r237258)
 +++ head/usr.sbin/mfiutil/mfiutil.h	Tue Jun 19 06:18:37 2012	(r237259)
 @@ -139,7 +139,7 @@ int	mfi_lookup_drive(int fd, char *drive
  int	mfi_lookup_volume(int fd, const char *name, uint8_t *target_id);
  int	mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize,
      uint8_t *mbox, size_t mboxlen, uint8_t *statusp);
 -int	mfi_open(int unit);
 +int	mfi_open(int unit, int acs);
  int	mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp);
  int	mfi_ld_get_info(int fd, uint8_t target_id, struct mfi_ld_info *info,
      uint8_t *statusp);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: analyzed->patched 
State-Changed-By: eadler 
State-Changed-When: Tue Jun 19 06:25:57 UTC 2012 
State-Changed-Why:  
committed in r237259 

http://www.freebsd.org/cgi/query-pr.cgi?pr=167302 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/167302: commit references a PR
Date: Tue, 26 Jun 2012 03:05:30 +0000 (UTC)

 Author: eadler
 Date: Tue Jun 26 03:05:17 2012
 New Revision: 237589
 URL: http://svn.freebsd.org/changeset/base/237589
 
 Log:
   MFC r237259 r237260 r237329:
   	Allow users with RO privilege to the device to read the RO attributes. [0]
   	Add __unused macros to appropriate places in order to allow building
   	with WARNS=6 on base gcc, gcc46, and clang
   
   PR:		bin/167302 [0]
   Approved by:	cperciva (implicit)
 
 Modified:
   stable/9/usr.sbin/mfiutil/Makefile
   stable/9/usr.sbin/mfiutil/mfi_cmd.c
   stable/9/usr.sbin/mfiutil/mfi_config.c
   stable/9/usr.sbin/mfiutil/mfi_drive.c
   stable/9/usr.sbin/mfiutil/mfi_evt.c
   stable/9/usr.sbin/mfiutil/mfi_flash.c
   stable/9/usr.sbin/mfiutil/mfi_patrol.c
   stable/9/usr.sbin/mfiutil/mfi_show.c
   stable/9/usr.sbin/mfiutil/mfi_volume.c
   stable/9/usr.sbin/mfiutil/mfiutil.c
   stable/9/usr.sbin/mfiutil/mfiutil.h
 Directory Properties:
   stable/9/usr.sbin/mfiutil/   (props changed)
 
 Modified: stable/9/usr.sbin/mfiutil/Makefile
 ==============================================================================
 --- stable/9/usr.sbin/mfiutil/Makefile	Tue Jun 26 01:32:58 2012	(r237588)
 +++ stable/9/usr.sbin/mfiutil/Makefile	Tue Jun 26 03:05:17 2012	(r237589)
 @@ -6,7 +6,6 @@ SRCS=	mfiutil.c mfi_cmd.c mfi_config.c m
  MAN8=	mfiutil.8
  
  CFLAGS+= -fno-builtin-strftime
 -WARNS?=3
  
  DPADD=	${LIBUTIL}
  LDADD=	-lutil
 
 Modified: stable/9/usr.sbin/mfiutil/mfi_cmd.c
 ==============================================================================
 --- stable/9/usr.sbin/mfiutil/mfi_cmd.c	Tue Jun 26 01:32:58 2012	(r237588)
 +++ stable/9/usr.sbin/mfiutil/mfi_cmd.c	Tue Jun 26 03:05:17 2012	(r237589)
 @@ -301,12 +301,12 @@ mfi_ctrl_get_info(int fd, struct mfi_ctr
  }
  
  int
 -mfi_open(int unit)
 +mfi_open(int unit, int acs)
  {
  	char path[MAXPATHLEN];
  
  	snprintf(path, sizeof(path), "/dev/mfi%d", unit);
 -	return (open(path, O_RDWR));
 +	return (open(path, acs));
  }
  
  void
 
 Modified: stable/9/usr.sbin/mfiutil/mfi_config.c
 ==============================================================================
 --- stable/9/usr.sbin/mfiutil/mfi_config.c	Tue Jun 26 01:32:58 2012	(r237588)
 +++ stable/9/usr.sbin/mfiutil/mfi_config.c	Tue Jun 26 03:05:17 2012	(r237589)
 @@ -35,6 +35,7 @@
  #endif
  #include <err.h>
  #include <errno.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #ifdef DEBUG
  #include <stdint.h>
 @@ -151,13 +152,13 @@ mfi_config_lookup_volume(struct mfi_conf
  }
  
  static int
 -clear_config(int ac, char **av)
 +clear_config(int ac __unused, char **av __unused)
  {
  	struct mfi_ld_list list;
  	int ch, error, fd;
  	u_int i;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -410,7 +411,7 @@ find_next_volume(struct config_id_state 
  
  /* Populate an array with drives. */
  static void
 -build_array(int fd, char *arrayp, struct array_info *array_info,
 +build_array(int fd __unused, char *arrayp, struct array_info *array_info,
      struct config_id_state *state, int verbose)
  {
  	struct mfi_array *ar = (struct mfi_array *)arrayp;
 @@ -575,7 +576,7 @@ create_volume(int ac, char **av)
  	narrays = 0;
  	error = 0;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -857,7 +858,7 @@ delete_volume(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -925,7 +926,7 @@ add_spare(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -1050,7 +1051,7 @@ remove_spare(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -1196,7 +1197,7 @@ debug_config(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -1233,7 +1234,7 @@ dump(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/9/usr.sbin/mfiutil/mfi_drive.c
 ==============================================================================
 --- stable/9/usr.sbin/mfiutil/mfi_drive.c	Tue Jun 26 01:32:58 2012	(r237588)
 +++ stable/9/usr.sbin/mfiutil/mfi_drive.c	Tue Jun 26 03:05:17 2012	(r237589)
 @@ -33,6 +33,7 @@
  #include <sys/errno.h>
  #include <ctype.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #include <limits.h>
  #include <stdio.h>
 @@ -71,7 +72,7 @@ mfi_drive_name(struct mfi_pd_info *pinfo
  		else
  			snprintf(buf, sizeof(buf), "%2u", device_id);
  
 -		fd = mfi_open(mfi_unit);
 +		fd = mfi_open(mfi_unit, O_RDWR);
  		if (fd < 0) {
  			warn("mfi_open");
  			return (buf);
 @@ -329,11 +330,13 @@ cam_strvis(char *dst, const char *src, i
  const char *
  mfi_pd_inq_string(struct mfi_pd_info *info)
  {
 -	struct scsi_inquiry_data *inq_data;
 +	struct scsi_inquiry_data iqd, *inq_data = &iqd;
  	char vendor[16], product[48], revision[16], rstr[12], serial[SID_VENDOR_SPECIFIC_0_SIZE];
  	static char inq_string[64];
  
 -	inq_data = (struct scsi_inquiry_data *)info->inquiry_data;
 +	memcpy(inq_data, info->inquiry_data,
 +	    (sizeof (iqd) <  sizeof (info->inquiry_data))?
 +	    sizeof (iqd) : sizeof (info->inquiry_data));
  	if (SID_QUAL_IS_VENDOR_UNIQUE(inq_data))
  		return (NULL);
  	if (SID_TYPE(inq_data) != T_DIRECT)
 @@ -383,7 +386,7 @@ drive_set_state(char *drive, uint16_t ne
  	uint8_t mbox[6];
  	int error, fd;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -484,7 +487,7 @@ start_rebuild(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -541,7 +544,7 @@ abort_rebuild(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -597,7 +600,7 @@ drive_progress(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -663,7 +666,7 @@ drive_clear(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -723,7 +726,7 @@ drive_locate(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/9/usr.sbin/mfiutil/mfi_evt.c
 ==============================================================================
 --- stable/9/usr.sbin/mfiutil/mfi_evt.c	Tue Jun 26 01:32:58 2012	(r237588)
 +++ stable/9/usr.sbin/mfiutil/mfi_evt.c	Tue Jun 26 03:05:17 2012	(r237589)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <strings.h>
 @@ -63,7 +64,7 @@ mfi_get_events(int fd, struct mfi_evt_li
  }
  
  static int
 -show_logstate(int ac, char **av)
 +show_logstate(int ac, char **av __unused)
  {
  	struct mfi_evt_log_state info;
  	int error, fd;
 @@ -73,7 +74,7 @@ show_logstate(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -541,7 +542,7 @@ show_events(int ac, char **av)
  	int ch, error, fd, num_events, verbose;
  	u_int i;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/9/usr.sbin/mfiutil/mfi_flash.c
 ==============================================================================
 --- stable/9/usr.sbin/mfiutil/mfi_flash.c	Tue Jun 26 01:32:58 2012	(r237588)
 +++ stable/9/usr.sbin/mfiutil/mfi_flash.c	Tue Jun 26 03:05:17 2012	(r237589)
 @@ -150,7 +150,7 @@ flash_adapter(int ac, char **av)
  		goto error;
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/9/usr.sbin/mfiutil/mfi_patrol.c
 ==============================================================================
 --- stable/9/usr.sbin/mfiutil/mfi_patrol.c	Tue Jun 26 01:32:58 2012	(r237588)
 +++ stable/9/usr.sbin/mfiutil/mfi_patrol.c	Tue Jun 26 03:05:17 2012	(r237589)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
 @@ -74,7 +75,7 @@ patrol_get_props(int fd, struct mfi_pr_p
  }
  
  static int
 -show_patrol(int ac, char **av)
 +show_patrol(int ac __unused, char **av __unused)
  {
  	struct mfi_pr_properties prop;
  	struct mfi_pr_status status;
 @@ -86,7 +87,7 @@ show_patrol(int ac, char **av)
  	int error, fd;
  	u_int i;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -192,11 +193,11 @@ show_patrol(int ac, char **av)
  MFI_COMMAND(show, patrol, show_patrol);
  
  static int
 -start_patrol(int ac, char **av)
 +start_patrol(int ac __unused, char **av __unused)
  {
  	int error, fd;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -218,11 +219,11 @@ start_patrol(int ac, char **av)
  MFI_COMMAND(start, patrol, start_patrol);
  
  static int
 -stop_patrol(int ac, char **av)
 +stop_patrol(int ac __unused, char **av __unused)
  {
  	int error, fd;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -292,7 +293,7 @@ patrol_config(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/9/usr.sbin/mfiutil/mfi_show.c
 ==============================================================================
 --- stable/9/usr.sbin/mfiutil/mfi_show.c	Tue Jun 26 01:32:58 2012	(r237588)
 +++ stable/9/usr.sbin/mfiutil/mfi_show.c	Tue Jun 26 03:05:17 2012	(r237589)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #include <stdio.h>
  #include <stdlib.h>
 @@ -50,7 +51,7 @@ format_stripe(char *buf, size_t buflen, 
  }
  
  static int
 -show_adapter(int ac, char **av)
 +show_adapter(int ac, char **av __unused)
  {
  	struct mfi_ctrl_info info;
  	char stripe[5];
 @@ -61,7 +62,7 @@ show_adapter(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -135,7 +136,7 @@ show_adapter(int ac, char **av)
  MFI_COMMAND(show, adapter, show_adapter);
  
  static int
 -show_battery(int ac, char **av)
 +show_battery(int ac, char **av __unused)
  {
  	struct mfi_bbu_capacity_info cap;
  	struct mfi_bbu_design_info design;
 @@ -148,7 +149,7 @@ show_battery(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -303,7 +304,7 @@ print_pd(struct mfi_pd_info *info, int s
  }
  
  static int
 -show_config(int ac, char **av)
 +show_config(int ac, char **av __unused)
  {
  	struct mfi_config_data *config;
  	struct mfi_array *ar;
 @@ -320,7 +321,7 @@ show_config(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -409,7 +410,7 @@ show_config(int ac, char **av)
  MFI_COMMAND(show, config, show_config);
  
  static int
 -show_volumes(int ac, char **av)
 +show_volumes(int ac, char **av __unused)
  {
  	struct mfi_ld_list list;
  	struct mfi_ld_info info;
 @@ -421,7 +422,7 @@ show_volumes(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -492,7 +493,7 @@ show_volumes(int ac, char **av)
  MFI_COMMAND(show, volumes, show_volumes);
  
  static int
 -show_drives(int ac, char **av)
 +show_drives(int ac, char **av __unused)
  {
  	struct mfi_pd_list *list;
  	struct mfi_pd_info info;
 @@ -504,7 +505,7 @@ show_drives(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -600,7 +601,7 @@ display_firmware(struct mfi_info_compone
  }
  
  static int
 -show_firmware(int ac, char **av)
 +show_firmware(int ac, char **av __unused)
  {
  	struct mfi_ctrl_info info;
  	struct mfi_info_component header;
 @@ -612,7 +613,7 @@ show_firmware(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -656,7 +657,7 @@ show_firmware(int ac, char **av)
  MFI_COMMAND(show, firmware, show_firmware);
  
  static int
 -show_progress(int ac, char **av)
 +show_progress(int ac, char **av __unused)
  {
  	struct mfi_ld_list llist;
  	struct mfi_pd_list *plist;
 @@ -672,7 +673,7 @@ show_progress(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/9/usr.sbin/mfiutil/mfi_volume.c
 ==============================================================================
 --- stable/9/usr.sbin/mfiutil/mfi_volume.c	Tue Jun 26 01:32:58 2012	(r237588)
 +++ stable/9/usr.sbin/mfiutil/mfi_volume.c	Tue Jun 26 03:05:17 2012	(r237589)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #include <stdio.h>
  #include <stdlib.h>
 @@ -294,7 +295,7 @@ volume_cache(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -402,7 +403,7 @@ volume_name(int ac, char **av)
  		return (ENOSPC);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -453,7 +454,7 @@ volume_progress(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/9/usr.sbin/mfiutil/mfiutil.c
 ==============================================================================
 --- stable/9/usr.sbin/mfiutil/mfiutil.c	Tue Jun 26 01:32:58 2012	(r237588)
 +++ stable/9/usr.sbin/mfiutil/mfiutil.c	Tue Jun 26 03:05:17 2012	(r237589)
 @@ -92,10 +92,10 @@ usage(void)
  }
  
  static int
 -version(int ac, char **av)
 +version(int ac __unused, char **av __unused)
  {
  
 -	printf("mfiutil version 1.0.13");
 +	printf("mfiutil version 1.0.14");
  #ifdef DEBUG
  	printf(" (DEBUG)");
  #endif
 
 Modified: stable/9/usr.sbin/mfiutil/mfiutil.h
 ==============================================================================
 --- stable/9/usr.sbin/mfiutil/mfiutil.h	Tue Jun 26 01:32:58 2012	(r237588)
 +++ stable/9/usr.sbin/mfiutil/mfiutil.h	Tue Jun 26 03:05:17 2012	(r237589)
 @@ -139,7 +139,7 @@ int	mfi_lookup_drive(int fd, char *drive
  int	mfi_lookup_volume(int fd, const char *name, uint8_t *target_id);
  int	mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize,
      uint8_t *mbox, size_t mboxlen, uint8_t *statusp);
 -int	mfi_open(int unit);
 +int	mfi_open(int unit, int acs);
  int	mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp);
  int	mfi_ld_get_info(int fd, uint8_t target_id, struct mfi_ld_info *info,
      uint8_t *statusp);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/167302: commit references a PR
Date: Tue, 26 Jun 2012 03:05:52 +0000 (UTC)

 Author: eadler
 Date: Tue Jun 26 03:05:42 2012
 New Revision: 237590
 URL: http://svn.freebsd.org/changeset/base/237590
 
 Log:
   MFC r237259 r237260 r237329:
   	Allow users with RO privilege to the device to read the RO attributes. [0]
   	Add __unused macros to appropriate places in order to allow building
   	with WARNS=6 on base gcc, gcc46, and clang
   
   PR:		bin/167302 [0]
   Approved by:	cperciva (implicit)
 
 Modified:
   stable/8/usr.sbin/mfiutil/Makefile
   stable/8/usr.sbin/mfiutil/mfi_cmd.c
   stable/8/usr.sbin/mfiutil/mfi_config.c
   stable/8/usr.sbin/mfiutil/mfi_drive.c
   stable/8/usr.sbin/mfiutil/mfi_evt.c
   stable/8/usr.sbin/mfiutil/mfi_flash.c
   stable/8/usr.sbin/mfiutil/mfi_patrol.c
   stable/8/usr.sbin/mfiutil/mfi_show.c
   stable/8/usr.sbin/mfiutil/mfi_volume.c
   stable/8/usr.sbin/mfiutil/mfiutil.c
   stable/8/usr.sbin/mfiutil/mfiutil.h
 Directory Properties:
   stable/8/usr.sbin/mfiutil/   (props changed)
 
 Modified: stable/8/usr.sbin/mfiutil/Makefile
 ==============================================================================
 --- stable/8/usr.sbin/mfiutil/Makefile	Tue Jun 26 03:05:17 2012	(r237589)
 +++ stable/8/usr.sbin/mfiutil/Makefile	Tue Jun 26 03:05:42 2012	(r237590)
 @@ -6,7 +6,6 @@ SRCS=	mfiutil.c mfi_cmd.c mfi_config.c m
  MAN8=	mfiutil.8
  
  CFLAGS+= -fno-builtin-strftime
 -WARNS?=3
  
  DPADD=	${LIBUTIL}
  LDADD=	-lutil
 
 Modified: stable/8/usr.sbin/mfiutil/mfi_cmd.c
 ==============================================================================
 --- stable/8/usr.sbin/mfiutil/mfi_cmd.c	Tue Jun 26 03:05:17 2012	(r237589)
 +++ stable/8/usr.sbin/mfiutil/mfi_cmd.c	Tue Jun 26 03:05:42 2012	(r237590)
 @@ -301,12 +301,12 @@ mfi_ctrl_get_info(int fd, struct mfi_ctr
  }
  
  int
 -mfi_open(int unit)
 +mfi_open(int unit, int acs)
  {
  	char path[MAXPATHLEN];
  
  	snprintf(path, sizeof(path), "/dev/mfi%d", unit);
 -	return (open(path, O_RDWR));
 +	return (open(path, acs));
  }
  
  void
 
 Modified: stable/8/usr.sbin/mfiutil/mfi_config.c
 ==============================================================================
 --- stable/8/usr.sbin/mfiutil/mfi_config.c	Tue Jun 26 03:05:17 2012	(r237589)
 +++ stable/8/usr.sbin/mfiutil/mfi_config.c	Tue Jun 26 03:05:42 2012	(r237590)
 @@ -35,6 +35,7 @@
  #endif
  #include <err.h>
  #include <errno.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #ifdef DEBUG
  #include <stdint.h>
 @@ -151,13 +152,13 @@ mfi_config_lookup_volume(struct mfi_conf
  }
  
  static int
 -clear_config(int ac, char **av)
 +clear_config(int ac __unused, char **av __unused)
  {
  	struct mfi_ld_list list;
  	int ch, error, fd;
  	u_int i;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -410,7 +411,7 @@ find_next_volume(struct config_id_state 
  
  /* Populate an array with drives. */
  static void
 -build_array(int fd, char *arrayp, struct array_info *array_info,
 +build_array(int fd __unused, char *arrayp, struct array_info *array_info,
      struct config_id_state *state, int verbose)
  {
  	struct mfi_array *ar = (struct mfi_array *)arrayp;
 @@ -575,7 +576,7 @@ create_volume(int ac, char **av)
  	narrays = 0;
  	error = 0;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -857,7 +858,7 @@ delete_volume(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -925,7 +926,7 @@ add_spare(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -1050,7 +1051,7 @@ remove_spare(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -1196,7 +1197,7 @@ debug_config(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -1233,7 +1234,7 @@ dump(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/8/usr.sbin/mfiutil/mfi_drive.c
 ==============================================================================
 --- stable/8/usr.sbin/mfiutil/mfi_drive.c	Tue Jun 26 03:05:17 2012	(r237589)
 +++ stable/8/usr.sbin/mfiutil/mfi_drive.c	Tue Jun 26 03:05:42 2012	(r237590)
 @@ -33,6 +33,7 @@
  #include <sys/errno.h>
  #include <ctype.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #include <limits.h>
  #include <stdio.h>
 @@ -71,7 +72,7 @@ mfi_drive_name(struct mfi_pd_info *pinfo
  		else
  			snprintf(buf, sizeof(buf), "%2u", device_id);
  
 -		fd = mfi_open(mfi_unit);
 +		fd = mfi_open(mfi_unit, O_RDWR);
  		if (fd < 0) {
  			warn("mfi_open");
  			return (buf);
 @@ -329,11 +330,13 @@ cam_strvis(char *dst, const char *src, i
  const char *
  mfi_pd_inq_string(struct mfi_pd_info *info)
  {
 -	struct scsi_inquiry_data *inq_data;
 +	struct scsi_inquiry_data iqd, *inq_data = &iqd;
  	char vendor[16], product[48], revision[16], rstr[12], serial[SID_VENDOR_SPECIFIC_0_SIZE];
  	static char inq_string[64];
  
 -	inq_data = (struct scsi_inquiry_data *)info->inquiry_data;
 +	memcpy(inq_data, info->inquiry_data,
 +	    (sizeof (iqd) <  sizeof (info->inquiry_data))?
 +	    sizeof (iqd) : sizeof (info->inquiry_data));
  	if (SID_QUAL_IS_VENDOR_UNIQUE(inq_data))
  		return (NULL);
  	if (SID_TYPE(inq_data) != T_DIRECT)
 @@ -383,7 +386,7 @@ drive_set_state(char *drive, uint16_t ne
  	uint8_t mbox[6];
  	int error, fd;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -484,7 +487,7 @@ start_rebuild(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -541,7 +544,7 @@ abort_rebuild(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -597,7 +600,7 @@ drive_progress(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -663,7 +666,7 @@ drive_clear(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -723,7 +726,7 @@ drive_locate(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/8/usr.sbin/mfiutil/mfi_evt.c
 ==============================================================================
 --- stable/8/usr.sbin/mfiutil/mfi_evt.c	Tue Jun 26 03:05:17 2012	(r237589)
 +++ stable/8/usr.sbin/mfiutil/mfi_evt.c	Tue Jun 26 03:05:42 2012	(r237590)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <strings.h>
 @@ -63,7 +64,7 @@ mfi_get_events(int fd, struct mfi_evt_li
  }
  
  static int
 -show_logstate(int ac, char **av)
 +show_logstate(int ac, char **av __unused)
  {
  	struct mfi_evt_log_state info;
  	int error, fd;
 @@ -73,7 +74,7 @@ show_logstate(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -541,7 +542,7 @@ show_events(int ac, char **av)
  	int ch, error, fd, num_events, verbose;
  	u_int i;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/8/usr.sbin/mfiutil/mfi_flash.c
 ==============================================================================
 --- stable/8/usr.sbin/mfiutil/mfi_flash.c	Tue Jun 26 03:05:17 2012	(r237589)
 +++ stable/8/usr.sbin/mfiutil/mfi_flash.c	Tue Jun 26 03:05:42 2012	(r237590)
 @@ -150,7 +150,7 @@ flash_adapter(int ac, char **av)
  		goto error;
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/8/usr.sbin/mfiutil/mfi_patrol.c
 ==============================================================================
 --- stable/8/usr.sbin/mfiutil/mfi_patrol.c	Tue Jun 26 03:05:17 2012	(r237589)
 +++ stable/8/usr.sbin/mfiutil/mfi_patrol.c	Tue Jun 26 03:05:42 2012	(r237590)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
 @@ -74,7 +75,7 @@ patrol_get_props(int fd, struct mfi_pr_p
  }
  
  static int
 -show_patrol(int ac, char **av)
 +show_patrol(int ac __unused, char **av __unused)
  {
  	struct mfi_pr_properties prop;
  	struct mfi_pr_status status;
 @@ -86,7 +87,7 @@ show_patrol(int ac, char **av)
  	int error, fd;
  	u_int i;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -192,11 +193,11 @@ show_patrol(int ac, char **av)
  MFI_COMMAND(show, patrol, show_patrol);
  
  static int
 -start_patrol(int ac, char **av)
 +start_patrol(int ac __unused, char **av __unused)
  {
  	int error, fd;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -218,11 +219,11 @@ start_patrol(int ac, char **av)
  MFI_COMMAND(start, patrol, start_patrol);
  
  static int
 -stop_patrol(int ac, char **av)
 +stop_patrol(int ac __unused, char **av __unused)
  {
  	int error, fd;
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -293,7 +294,7 @@ patrol_config(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/8/usr.sbin/mfiutil/mfi_show.c
 ==============================================================================
 --- stable/8/usr.sbin/mfiutil/mfi_show.c	Tue Jun 26 03:05:17 2012	(r237589)
 +++ stable/8/usr.sbin/mfiutil/mfi_show.c	Tue Jun 26 03:05:42 2012	(r237590)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #include <stdio.h>
  #include <stdlib.h>
 @@ -50,7 +51,7 @@ format_stripe(char *buf, size_t buflen, 
  }
  
  static int
 -show_adapter(int ac, char **av)
 +show_adapter(int ac, char **av __unused)
  {
  	struct mfi_ctrl_info info;
  	char stripe[5];
 @@ -61,7 +62,7 @@ show_adapter(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -135,7 +136,7 @@ show_adapter(int ac, char **av)
  MFI_COMMAND(show, adapter, show_adapter);
  
  static int
 -show_battery(int ac, char **av)
 +show_battery(int ac, char **av __unused)
  {
  	struct mfi_bbu_capacity_info cap;
  	struct mfi_bbu_design_info design;
 @@ -148,7 +149,7 @@ show_battery(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -303,7 +304,7 @@ print_pd(struct mfi_pd_info *info, int s
  }
  
  static int
 -show_config(int ac, char **av)
 +show_config(int ac, char **av __unused)
  {
  	struct mfi_config_data *config;
  	struct mfi_array *ar;
 @@ -320,7 +321,7 @@ show_config(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -409,7 +410,7 @@ show_config(int ac, char **av)
  MFI_COMMAND(show, config, show_config);
  
  static int
 -show_volumes(int ac, char **av)
 +show_volumes(int ac, char **av __unused)
  {
  	struct mfi_ld_list list;
  	struct mfi_ld_info info;
 @@ -421,7 +422,7 @@ show_volumes(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -492,7 +493,7 @@ show_volumes(int ac, char **av)
  MFI_COMMAND(show, volumes, show_volumes);
  
  static int
 -show_drives(int ac, char **av)
 +show_drives(int ac, char **av __unused)
  {
  	struct mfi_pd_list *list;
  	struct mfi_pd_info info;
 @@ -504,7 +505,7 @@ show_drives(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -600,7 +601,7 @@ display_firmware(struct mfi_info_compone
  }
  
  static int
 -show_firmware(int ac, char **av)
 +show_firmware(int ac, char **av __unused)
  {
  	struct mfi_ctrl_info info;
  	struct mfi_info_component header;
 @@ -612,7 +613,7 @@ show_firmware(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -656,7 +657,7 @@ show_firmware(int ac, char **av)
  MFI_COMMAND(show, firmware, show_firmware);
  
  static int
 -show_progress(int ac, char **av)
 +show_progress(int ac, char **av __unused)
  {
  	struct mfi_ld_list llist;
  	struct mfi_pd_list *plist;
 @@ -672,7 +673,7 @@ show_progress(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/8/usr.sbin/mfiutil/mfi_volume.c
 ==============================================================================
 --- stable/8/usr.sbin/mfiutil/mfi_volume.c	Tue Jun 26 03:05:17 2012	(r237589)
 +++ stable/8/usr.sbin/mfiutil/mfi_volume.c	Tue Jun 26 03:05:42 2012	(r237590)
 @@ -32,6 +32,7 @@
  #include <sys/types.h>
  #include <sys/errno.h>
  #include <err.h>
 +#include <fcntl.h>
  #include <libutil.h>
  #include <stdio.h>
  #include <stdlib.h>
 @@ -294,7 +295,7 @@ volume_cache(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -402,7 +403,7 @@ volume_name(int ac, char **av)
  		return (ENOSPC);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDWR);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 @@ -453,7 +454,7 @@ volume_progress(int ac, char **av)
  		return (EINVAL);
  	}
  
 -	fd = mfi_open(mfi_unit);
 +	fd = mfi_open(mfi_unit, O_RDONLY);
  	if (fd < 0) {
  		error = errno;
  		warn("mfi_open");
 
 Modified: stable/8/usr.sbin/mfiutil/mfiutil.c
 ==============================================================================
 --- stable/8/usr.sbin/mfiutil/mfiutil.c	Tue Jun 26 03:05:17 2012	(r237589)
 +++ stable/8/usr.sbin/mfiutil/mfiutil.c	Tue Jun 26 03:05:42 2012	(r237590)
 @@ -92,10 +92,10 @@ usage(void)
  }
  
  static int
 -version(int ac, char **av)
 +version(int ac __unused, char **av __unused)
  {
  
 -	printf("mfiutil version 1.0.13");
 +	printf("mfiutil version 1.0.14");
  #ifdef DEBUG
  	printf(" (DEBUG)");
  #endif
 
 Modified: stable/8/usr.sbin/mfiutil/mfiutil.h
 ==============================================================================
 --- stable/8/usr.sbin/mfiutil/mfiutil.h	Tue Jun 26 03:05:17 2012	(r237589)
 +++ stable/8/usr.sbin/mfiutil/mfiutil.h	Tue Jun 26 03:05:42 2012	(r237590)
 @@ -139,7 +139,7 @@ int	mfi_lookup_drive(int fd, char *drive
  int	mfi_lookup_volume(int fd, const char *name, uint8_t *target_id);
  int	mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize,
      uint8_t *mbox, size_t mboxlen, uint8_t *statusp);
 -int	mfi_open(int unit);
 +int	mfi_open(int unit, int acs);
  int	mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp);
  int	mfi_ld_get_info(int fd, uint8_t target_id, struct mfi_ld_info *info,
      uint8_t *statusp);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: eadler 
State-Changed-When: Tue Jun 26 03:18:44 UTC 2012 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=167302 
>Unformatted:
