svn commit: r243294 - stable/9/sbin/camcontrol

Ed Maste emaste at FreeBSD.org
Mon Nov 19 18:20:28 UTC 2012


Author: emaste
Date: Mon Nov 19 18:20:27 2012
New Revision: 243294
URL: http://svnweb.freebsd.org/changeset/base/243294

Log:
  MFC (part of) r241737 (ed):
  
    More -Wmissing-variable-declarations fixes.
  
    In addition to adding `static' where possible:
  
    ...
    - sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings.
    ...

Modified:
  stable/9/sbin/camcontrol/camcontrol.c
  stable/9/sbin/camcontrol/camcontrol.h
  stable/9/sbin/camcontrol/fwdownload.c
  stable/9/sbin/camcontrol/modeedit.c
Directory Properties:
  stable/9/sbin/camcontrol/   (props changed)

Modified: stable/9/sbin/camcontrol/camcontrol.c
==============================================================================
--- stable/9/sbin/camcontrol/camcontrol.c	Mon Nov 19 18:18:24 2012	(r243293)
+++ stable/9/sbin/camcontrol/camcontrol.c	Mon Nov 19 18:20:27 2012	(r243294)
@@ -5782,9 +5782,10 @@ bailout:
 #endif /* MINIMALISTIC */
 
 void
-usage(int verbose)
+usage(int printlong)
 {
-	fprintf(verbose ? stdout : stderr,
+
+	fprintf(printlong ? stdout : stderr,
 "usage:  camcontrol <command>  [device id][generic args][command args]\n"
 "        camcontrol devlist    [-v]\n"
 #ifndef MINIMALISTIC
@@ -5833,7 +5834,7 @@ usage(int verbose)
 "        camcontrol fwdownload [dev_id][generic args] <-f fw_image> [-y][-s]\n"
 #endif /* MINIMALISTIC */
 "        camcontrol help\n");
-	if (!verbose)
+	if (!printlong)
 		return;
 #ifndef MINIMALISTIC
 	fprintf(stdout,

Modified: stable/9/sbin/camcontrol/camcontrol.h
==============================================================================
--- stable/9/sbin/camcontrol/camcontrol.h	Mon Nov 19 18:18:24 2012	(r243293)
+++ stable/9/sbin/camcontrol/camcontrol.h	Mon Nov 19 18:20:27 2012	(r243294)
@@ -40,8 +40,10 @@ struct get_hook
 	int got;
 };
 
+extern int verbose;
+
 int fwdownload(struct cam_device *device, int argc, char **argv,
-	       char *combinedopt, int verbose, int retry_count, int timeout,
+	       char *combinedopt, int printerrors, int retry_count, int timeout,
 	       const char */*type*/);
 void mode_sense(struct cam_device *device, int mode_page, int page_control,
 		int dbd, int retry_count, int timeout, u_int8_t *data,
@@ -58,5 +60,5 @@ char *cget(void *hook, char *name);
 int iget(void *hook, char *name);
 void arg_put(void *hook, int letter, void *arg, int count, char *name);
 int get_confirmation(void);
-void usage(int verbose);
+void usage(int printlong);
 #endif /* _CAMCONTROL_H */

Modified: stable/9/sbin/camcontrol/fwdownload.c
==============================================================================
--- stable/9/sbin/camcontrol/fwdownload.c	Mon Nov 19 18:18:24 2012	(r243293)
+++ stable/9/sbin/camcontrol/fwdownload.c	Mon Nov 19 18:20:27 2012	(r243294)
@@ -131,7 +131,7 @@ static char	*fw_read_img(const char *fw_
 		    const struct fw_vendor *vp, int *num_bytes);
 static int	 fw_download_img(struct cam_device *cam_dev,
 		    const struct fw_vendor *vp, char *buf, int img_size,
-		    int sim_mode, int verbose, int retry_count, int timeout,
+		    int sim_mode, int printerrors, int retry_count, int timeout,
 		    const char */*name*/, const char */*type*/);
 
 /*
@@ -238,7 +238,7 @@ bailout1:
  */
 static int
 fw_download_img(struct cam_device *cam_dev, const struct fw_vendor *vp,
-    char *buf, int img_size, int sim_mode, int verbose, int retry_count,
+    char *buf, int img_size, int sim_mode, int printerrors, int retry_count,
     int timeout, const char *imgname, const char *type)
 {
 	struct scsi_write_buffer cdb;
@@ -290,7 +290,7 @@ fw_download_img(struct cam_device *cam_d
 	ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
 	if (cam_send_ccb(cam_dev, ccb) < 0) {
 		warnx("Error sending identify/test unit ready");
-		if (verbose)
+		if (printerrors)
 			cam_error_print(cam_dev, ccb, CAM_ESF_ALL,
 			    CAM_EPF_ALL, stderr);
 		cam_freeccb(ccb);
@@ -298,7 +298,7 @@ fw_download_img(struct cam_device *cam_d
 	}
 	if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
 		warnx("Device is not ready");
-		if (verbose)
+		if (printerrors)
 			cam_error_print(cam_dev, ccb, CAM_ESF_ALL,
 			    CAM_EPF_ALL, stderr);
 		cam_freeccb(ccb);
@@ -372,7 +372,7 @@ fw_download_img(struct cam_device *cam_d
 			/* Execute the command. */
 			if (cam_send_ccb(cam_dev, ccb) < 0) {
 				warnx("Error writing image to device");
-				if (verbose)
+				if (printerrors)
 					cam_error_print(cam_dev, ccb, CAM_ESF_ALL,
 						   CAM_EPF_ALL, stderr);
 				goto bailout;
@@ -398,7 +398,7 @@ bailout:
 
 int
 fwdownload(struct cam_device *device, int argc, char **argv,
-    char *combinedopt, int verbose, int retry_count, int timeout,
+    char *combinedopt, int printerrors, int retry_count, int timeout,
     const char *type)
 {
 	const struct fw_vendor *vp;
@@ -450,7 +450,7 @@ fwdownload(struct cam_device *device, in
 	if (sim_mode)
 		fprintf(stdout, "Running in simulation mode\n");
 
-	if (fw_download_img(device, vp, buf, img_size, sim_mode, verbose,
+	if (fw_download_img(device, vp, buf, img_size, sim_mode, printerrors,
 	    retry_count, timeout, fw_img_path, type) != 0) {
 		fprintf(stderr, "Firmware download failed\n");
 		goto fail;

Modified: stable/9/sbin/camcontrol/modeedit.c
==============================================================================
--- stable/9/sbin/camcontrol/modeedit.c	Mon Nov 19 18:18:24 2012	(r243293)
+++ stable/9/sbin/camcontrol/modeedit.c	Mon Nov 19 18:20:27 2012	(r243294)
@@ -48,8 +48,6 @@ __FBSDID("$FreeBSD$");
 #include <camlib.h>
 #include "camcontrol.h"
 
-int verbose = 0;
-
 #define	DEFAULT_SCSI_MODE_DB	"/usr/share/misc/scsi_modes"
 #define	DEFAULT_EDITOR		"vi"
 #define	MAX_FORMAT_SPEC		4096	/* Max CDB format specifier. */


More information about the svn-src-stable-9 mailing list