Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jul 2017 05:16:07 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320861 - head/sbin/camcontrol
Message-ID:  <201707100516.v6A5G74p000708@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Mon Jul 10 05:16:07 2017
New Revision: 320861
URL: https://svnweb.freebsd.org/changeset/base/320861

Log:
  Fix whitespace bugs
  
  - Delete trailing whitespace.
  - Replace 8 single column spaces with hard tabs.
  - Delete lines with consisting purely of blank space.
  - Add space between `return` and `(`, per style(9).
  
  Special care was taken to not blindly replace 8 single column spaces
  with tabs; doing so could break tools that do strict string comparisons
  with camcontrol output.

Modified:
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Mon Jul 10 05:08:01 2017	(r320860)
+++ head/sbin/camcontrol/camcontrol.c	Mon Jul 10 05:16:07 2017	(r320861)
@@ -380,14 +380,14 @@ getoption(struct camcontrol_opts *table, char *arg, ui
 			*argnum = opts->argnum;
 			*subopt = opts->subopt;
 			if (++num_matches > 1)
-				return(CC_OR_AMBIGUOUS);
+				return (CC_OR_AMBIGUOUS);
 		}
 	}
 
 	if (num_matches > 0)
-		return(CC_OR_FOUND);
+		return (CC_OR_FOUND);
 	else
-		return(CC_OR_NOT_FOUND);
+		return (CC_OR_NOT_FOUND);
 }
 
 #ifndef MINIMALISTIC
@@ -409,7 +409,7 @@ getdevlist(struct cam_device *device)
 		if (cam_send_ccb(device, ccb) < 0) {
 			perror("error getting device list");
 			cam_freeccb(ccb);
-			return(1);
+			return (1);
 		}
 
 		status[0] = '\0';
@@ -447,7 +447,7 @@ getdevlist(struct cam_device *device)
 
 	cam_freeccb(ccb);
 
-	return(error);
+	return (error);
 }
 #endif /* MINIMALISTIC */
 
@@ -476,7 +476,7 @@ getdevtree(int argc, char **argv, char *combinedopt)
 
 	if ((fd = open(XPT_DEVICE, O_RDWR)) == -1) {
 		warn("couldn't open %s", XPT_DEVICE);
-		return(1);
+		return (1);
 	}
 
 	bzero(&ccb, sizeof(union ccb));
@@ -492,7 +492,7 @@ getdevtree(int argc, char **argv, char *combinedopt)
 	if (ccb.cdm.matches == NULL) {
 		warnx("can't malloc memory for matches");
 		close(fd);
-		return(1);
+		return (1);
 	}
 	ccb.cdm.num_matches = 0;
 
@@ -598,12 +598,12 @@ getdevtree(int argc, char **argv, char *combinedopt)
 				    sprintf(tmpstr, "<%s %s>", product,
 					revision);
 				} else if (dev_result->protocol == PROTO_MMCSD) {
-                                        if (strlen(dev_result->mmc_ident_data.model) > 0) {
-                                                sprintf(tmpstr, "<%s>", dev_result->mmc_ident_data.model);
-                                        } else {
-                                                sprintf(tmpstr, "<%s card>",
-                                                        dev_result->mmc_ident_data.card_features & CARD_FEATURE_SDIO ? "SDIO" : "unknown");
-                                        }
+					if (strlen(dev_result->mmc_ident_data.model) > 0) {
+						sprintf(tmpstr, "<%s>", dev_result->mmc_ident_data.model);
+					} else {
+						sprintf(tmpstr, "<%s card>",
+						    dev_result->mmc_ident_data.card_features & CARD_FEATURE_SDIO ? "SDIO" : "unknown");
+					}
 				} else if (dev_result->protocol == PROTO_SEMB) {
 					struct sep_identify_data *sid;
 
@@ -675,7 +675,7 @@ getdevtree(int argc, char **argv, char *combinedopt)
 
 	close(fd);
 
-	return(error);
+	return (error);
 }
 
 #ifndef MINIMALISTIC
@@ -711,7 +711,7 @@ testunitready(struct cam_device *device, int task_attr
 		}
 
 		cam_freeccb(ccb);
-		return(1);
+		return (1);
 	}
 
 	if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
@@ -730,7 +730,7 @@ testunitready(struct cam_device *device, int task_attr
 
 	cam_freeccb(ccb);
 
-	return(error);
+	return (error);
 }
 
 static int
@@ -780,7 +780,7 @@ scsistart(struct cam_device *device, int startstop, in
 		}
 
 		cam_freeccb(ccb);
-		return(1);
+		return (1);
 	}
 
 	if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)
@@ -814,7 +814,7 @@ scsistart(struct cam_device *device, int startstop, in
 
 	cam_freeccb(ccb);
 
-	return(error);
+	return (error);
 }
 
 int
@@ -851,7 +851,7 @@ scsidoinquiry(struct cam_device *device, int argc, cha
 		error = scsiinquiry(device, task_attr, retry_count, timeout);
 
 	if (error != 0)
-		return(error);
+		return (error);
 
 	if (arglist & CAM_ARG_GET_SERIAL)
 		scsiserial(device, task_attr, retry_count, timeout);
@@ -859,7 +859,7 @@ scsidoinquiry(struct cam_device *device, int argc, cha
 	if (arglist & CAM_ARG_GET_XFERRATE)
 		error = camxferrate(device);
 
-	return(error);
+	return (error);
 }
 
 static int
@@ -874,7 +874,7 @@ scsiinquiry(struct cam_device *device, int task_attr, 
 
 	if (ccb == NULL) {
 		warnx("couldn't allocate CCB");
-		return(1);
+		return (1);
 	}
 
 	/* cam_getccb cleans up the header, caller has to zero the payload */
@@ -886,7 +886,7 @@ scsiinquiry(struct cam_device *device, int task_attr, 
 	if (inq_buf == NULL) {
 		cam_freeccb(ccb);
 		warnx("can't malloc memory for inquiry\n");
-		return(1);
+		return (1);
 	}
 	bzero(inq_buf, sizeof(*inq_buf));
 
@@ -949,7 +949,7 @@ scsiinquiry(struct cam_device *device, int task_attr, 
 		}
 
 		cam_freeccb(ccb);
-		return(1);
+		return (1);
 	}
 
 	if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
@@ -965,7 +965,7 @@ scsiinquiry(struct cam_device *device, int task_attr, 
 
 	if (error != 0) {
 		free(inq_buf);
-		return(error);
+		return (error);
 	}
 
 	fprintf(stdout, "%s%d: ", device->device_name,
@@ -974,7 +974,7 @@ scsiinquiry(struct cam_device *device, int task_attr, 
 
 	free(inq_buf);
 
-	return(0);
+	return (0);
 }
 
 static int
@@ -990,7 +990,7 @@ scsiserial(struct cam_device *device, int task_attr, i
 
 	if (ccb == NULL) {
 		warnx("couldn't allocate CCB");
-		return(1);
+		return (1);
 	}
 
 	/* cam_getccb cleans up the header, caller has to zero the payload */
@@ -1002,7 +1002,7 @@ scsiserial(struct cam_device *device, int task_attr, i
 	if (serial_buf == NULL) {
 		cam_freeccb(ccb);
 		warnx("can't malloc memory for serial number");
-		return(1);
+		return (1);
 	}
 
 	scsi_inquiry(&ccb->csio,
@@ -1032,7 +1032,7 @@ scsiserial(struct cam_device *device, int task_attr, i
 
 		cam_freeccb(ccb);
 		free(serial_buf);
-		return(1);
+		return (1);
 	}
 
 	if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
@@ -1048,7 +1048,7 @@ scsiserial(struct cam_device *device, int task_attr, i
 
 	if (error != 0) {
 		free(serial_buf);
-		return(error);
+		return (error);
 	}
 
 	bcopy(serial_buf->serial_num, serial_num, serial_buf->length);
@@ -1063,7 +1063,7 @@ scsiserial(struct cam_device *device, int task_attr, i
 
 	free(serial_buf);
 
-	return(0);
+	return (0);
 }
 
 int
@@ -1083,7 +1083,7 @@ camxferrate(struct cam_device *device)
 
 	if (ccb == NULL) {
 		warnx("couldn't allocate CCB");
-		return(1);
+		return (1);
 	}
 
 	CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts);
@@ -1222,13 +1222,13 @@ camxferrate(struct cam_device *device)
 		}
 	}
 
-        fprintf(stdout, "\n");
+	fprintf(stdout, "\n");
 
 xferrate_bailout:
 
 	cam_freeccb(ccb);
 
-	return(retval);
+	return (retval);
 }
 
 static void
@@ -1251,7 +1251,7 @@ atahpa_print(struct ata_params *parm, u_int64_t hpasiz
 	if (parm->support.command1 & ATA_SUPPORT_PROTECTED) {
 		u_int64_t lba = lbasize48 ? lbasize48 : lbasize;
 		printf("yes      %s     %ju/%ju\n", (hpasize > lba) ? "yes" : "no ",
-		        lba, hpasize);
+			lba, hpasize);
 
 		printf("HPA - Security                 ");
 		if (parm->support.command1 & ATA_SUPPORT_MAXSECURITY)
@@ -3041,8 +3041,7 @@ atasecurity(struct cam_device *device, int retry_count
 			}
 
 			error = atasecurity_erase(device, ccb, retry_count,
-					          timeout, erase_timeout, &pwd,
-						  quiet);
+			    timeout, erase_timeout, &pwd, quiet);
 		} else {
 			warnx("Can't secure erase (security is disabled)");
 			error = 1;
@@ -3135,7 +3134,7 @@ dorescan_or_reset(int argc, char **argv, int rescan)
 
 	if (argc < 3) {
 		warnx(must, rescan? "rescan" : "reset");
-		return(1);
+		return (1);
 	}
 
 	tstr = argv[optind];
@@ -3147,7 +3146,7 @@ dorescan_or_reset(int argc, char **argv, int rescan)
 		rv = parse_btl(argv[optind], &bus, &target, &lun, &arglist);
 		if (rv != 1 && rv != 3) {
 			warnx(must, rescan? "rescan" : "reset");
-			return(1);
+			return (1);
 		}
 	} else {
 		char name[30];
@@ -3255,7 +3254,7 @@ dorescan_or_reset(int argc, char **argv, int rescan)
 
 bailout:
 
-	return(error);
+	return (error);
 }
 
 static int
@@ -3270,7 +3269,7 @@ rescan_or_reset_bus(path_id_t bus, int rescan)
 	if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) {
 		warnx("error opening transport layer device %s", XPT_DEVICE);
 		warn("%s", XPT_DEVICE);
-		return(1);
+		return (1);
 	}
 
 	ccb = malloc(sizeof(*ccb));
@@ -3435,7 +3434,7 @@ bailout:
 	}
 	free(ccb);
 
-	return(retval);
+	return (retval);
 }
 
 static int
@@ -3449,17 +3448,17 @@ scanlun_or_reset_dev(path_id_t bus, target_id_t target
 
 	if (bus == CAM_BUS_WILDCARD) {
 		warnx("invalid bus number %d", bus);
-		return(1);
+		return (1);
 	}
 
 	if (target == CAM_TARGET_WILDCARD) {
 		warnx("invalid target number %d", target);
-		return(1);
+		return (1);
 	}
 
 	if (lun == CAM_LUN_WILDCARD) {
 		warnx("invalid lun number %jx", (uintmax_t)lun);
-		return(1);
+		return (1);
 	}
 
 	fd = -1;
@@ -3471,13 +3470,13 @@ scanlun_or_reset_dev(path_id_t bus, target_id_t target
 			warnx("error opening transport layer device %s\n",
 			    XPT_DEVICE);
 			warn("%s", XPT_DEVICE);
-			return(1);
+			return (1);
 		}
 	} else {
 		device = cam_open_btl(bus, target, lun, O_RDWR, NULL);
 		if (device == NULL) {
 			warnx("%s", cam_errbuf);
-			return(1);
+			return (1);
 		}
 	}
 
@@ -3495,13 +3494,13 @@ scanlun_or_reset_dev(path_id_t bus, target_id_t target
 		if (ioctl(fd, CAMIOCOMMAND, &ccb) < 0) {
 			warn("CAMIOCOMMAND ioctl failed");
 			close(fd);
-			return(1);
+			return (1);
 		}
 	} else {
 		if (cam_send_ccb(device, &ccb) < 0) {
 			warn("error sending XPT_RESET_DEV CCB");
 			cam_close_device(device);
-			return(1);
+			return (1);
 		}
 	}
 
@@ -3518,12 +3517,12 @@ scanlun_or_reset_dev(path_id_t bus, target_id_t target
 	  && ((ccb.ccb_h.status & CAM_STATUS_MASK) == CAM_BDR_SENT))) {
 		fprintf(stdout, "%s of %d:%d:%jx was successful\n",
 		    scan? "Re-scan" : "Reset", bus, target, (uintmax_t)lun);
-		return(0);
+		return (0);
 	} else {
 		fprintf(stdout, "%s of %d:%d:%jx returned error %#x\n",
 		    scan? "Re-scan" : "Reset", bus, target, (uintmax_t)lun,
 		    ccb.ccb_h.status & CAM_STATUS_MASK);
-		return(1);
+		return (1);
 	}
 }
 
@@ -3755,7 +3754,7 @@ next_batch:
 		error = 1;
 		goto defect_bailout;
 		break;
-	} 
+	}
 
 	max_possible_size = (hdr_max / entry_size) * entry_size;
 	num_returned = returned_length / entry_size;
@@ -4101,7 +4100,7 @@ defect_bailout:
 	if (ccb != NULL)
 		cam_freeccb(ccb);
 
-	return(error);
+	return (error);
 }
 #endif /* MINIMALISTIC */
 
@@ -4302,7 +4301,7 @@ scsicmd(struct cam_device *device, int argc, char **ar
 
 	if (ccb == NULL) {
 		warnx("scsicmd: error allocating ccb");
-		return(1);
+		return (1);
 	}
 
 	CCB_CLEAR_ALL_EXCEPT_HDR(ccb);
@@ -4502,7 +4501,7 @@ scsicmd(struct cam_device *device, int argc, char **ar
 			case 3:
 			case 6:
 			case 7:
-			        /* computed by buff_encode_visit */
+				/* computed by buff_encode_visit */
 				break;
 			case 4:
 				cdb_len = 16;
@@ -4631,7 +4630,7 @@ scsicmd_bailout:
 
 	cam_freeccb(ccb);
 
-	return(error);
+	return (error);
 }
 
 static int
@@ -4685,7 +4684,7 @@ camdebug(int argc, char **argv, char *combinedopt)
 	if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) {
 		warnx("error opening transport layer device %s", XPT_DEVICE);
 		warn("%s", XPT_DEVICE);
-		return(1);
+		return (1);
 	}
 	argc -= optind;
 	argv += optind;
@@ -4694,7 +4693,7 @@ camdebug(int argc, char **argv, char *combinedopt)
 		warnx("you must specify \"off\", \"all\" or a bus,");
 		warnx("bus:target, or bus:target:lun");
 		close(fd);
-		return(1);
+		return (1);
 	}
 
 	tstr = *argv;
@@ -4768,7 +4767,7 @@ camdebug(int argc, char **argv, char *combinedopt)
 		close(fd);
 	}
 
-	return(error);
+	return (error);
 }
 
 static int
@@ -4786,7 +4785,7 @@ tagcontrol(struct cam_device *device, int argc, char *
 
 	if (ccb == NULL) {
 		warnx("tagcontrol: error allocating ccb");
-		return(1);
+		return (1);
 	}
 
 	while ((c = getopt(argc, argv, combinedopt)) != -1) {
@@ -4882,7 +4881,7 @@ tagcontrol(struct cam_device *device, int argc, char *
 tagcontrol_bailout:
 
 	cam_freeccb(ccb);
-	return(retval);
+	return (retval);
 }
 
 static void
@@ -5035,7 +5034,7 @@ get_cpi(struct cam_device *device, struct ccb_pathinq 
 	ccb = cam_getccb(device);
 	if (ccb == NULL) {
 		warnx("get_cpi: couldn't allocate CCB");
-		return(1);
+		return (1);
 	}
 	CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cpi);
 	ccb->ccb_h.func_code = XPT_PATH_INQ;
@@ -5058,7 +5057,7 @@ get_cpi(struct cam_device *device, struct ccb_pathinq 
 
 get_cpi_bailout:
 	cam_freeccb(ccb);
-	return(retval);
+	return (retval);
 }
 
 /*
@@ -5073,7 +5072,7 @@ get_cgd(struct cam_device *device, struct ccb_getdev *
 	ccb = cam_getccb(device);
 	if (ccb == NULL) {
 		warnx("get_cgd: couldn't allocate CCB");
-		return(1);
+		return (1);
 	}
 	CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cgd);
 	ccb->ccb_h.func_code = XPT_GDEV_TYPE;
@@ -5096,7 +5095,7 @@ get_cgd(struct cam_device *device, struct ccb_getdev *
 
 get_cgd_bailout:
 	cam_freeccb(ccb);
-	return(retval);
+	return (retval);
 }
 
 /*
@@ -5118,7 +5117,7 @@ dev_has_vpd_page(struct cam_device *dev, uint8_t page_
 		retval = -1;
 		goto bailout;
 	}
-	
+
 	/* cam_getccb cleans up the header, caller has to zero the payload */
 	CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
 
@@ -5165,7 +5164,7 @@ dev_has_vpd_page(struct cam_device *dev, uint8_t page_
 bailout:
 	if (ccb != NULL)
 		cam_freeccb(ccb);
-	
+
 	return (retval);
 }
 
@@ -5195,7 +5194,7 @@ get_device_type(struct cam_device *dev, int retry_coun
 		break; /*NOTREACHED*/
 	default:
 		*devtype = CC_DT_UNKNOWN;
-		goto bailout; 
+		goto bailout;
 		break; /*NOTREACHED*/
 	}
 
@@ -5270,7 +5269,7 @@ build_ata_cmd(union ccb *ccb, uint32_t retry_count, ui
 		    /*protocol*/ protocol,
 		    /*ata_flags*/ ata_flags,
 		    /*features*/ features,
-		    /*sector_count*/ sector_count, 
+		    /*sector_count*/ sector_count,
 		    /*lba*/ lba,
 		    /*command*/ command,
 		    /*device*/ 0,
@@ -5302,7 +5301,7 @@ get_ata_status(struct cam_device *dev, union ccb *ccb,
 
 		/*
 		 * In this case, we have SCSI ATA PASS-THROUGH command, 12
-		 * or 16 byte, and need to see what 
+		 * or 16 byte, and need to see what
 		 */
 		if (ccb->ccb_h.flags & CAM_CDB_POINTER)
 			opcode = ccb->csio.cdb_io.cdb_ptr[0];
@@ -5352,7 +5351,7 @@ get_ata_status(struct cam_device *dev, union ccb *ccb,
 			       ((uint64_t)desc->lba_31_24 << 24) |
 			       (desc->lba_23_16 << 16) |
 			       (desc->lba_15_8  <<  8) |
-			        desc->lba_7_0;
+				desc->lba_7_0;
 			*device = desc->device;
 			*status = desc->status;
 
@@ -5403,7 +5402,7 @@ get_ata_status(struct cam_device *dev, union ccb *ccb,
 		res = &ccb->ataio.res;
 		*error = res->error;
 		*status = res->status;
-		*device = res->device; 
+		*device = res->device;
 		*count = res->sector_count;
 		*lba = (res->lba_high << 16) |
 		       (res->lba_mid << 8) |
@@ -5603,7 +5602,7 @@ get_print_cts(struct cam_device *device, int user_sett
 
 	if (ccb == NULL) {
 		warnx("get_print_cts: error allocating ccb");
-		return(1);
+		return (1);
 	}
 
 	CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts);
@@ -5643,7 +5642,7 @@ get_print_cts_bailout:
 
 	cam_freeccb(ccb);
 
-	return(retval);
+	return (retval);
 }
 
 static int
@@ -5666,7 +5665,7 @@ ratecontrol(struct cam_device *device, int task_attr, 
 	ccb = cam_getccb(device);
 	if (ccb == NULL) {
 		warnx("ratecontrol: error allocating ccb");
-		return(1);
+		return (1);
 	}
 	while ((c = getopt(argc, argv, combinedopt)) != -1) {
 		switch(c){
@@ -5998,7 +5997,7 @@ ratecontrol(struct cam_device *device, int task_attr, 
 
 ratecontrol_bailout:
 	cam_freeccb(ccb);
-	return(retval);
+	return (retval);
 }
 
 static int
@@ -6022,7 +6021,7 @@ scsiformat(struct cam_device *device, int argc, char *
 
 	if (ccb == NULL) {
 		warnx("scsiformat: error allocating ccb");
-		return(1);
+		return (1);
 	}
 
 	CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
@@ -6288,7 +6287,7 @@ scsiformat_bailout:
 
 	cam_freeccb(ccb);
 
-	return(error);
+	return (error);
 }
 
 static int
@@ -6317,7 +6316,7 @@ scsisanitize(struct cam_device *device, int argc, char
 
 	if (ccb == NULL) {
 		warnx("scsisanitize: error allocating ccb");
-		return(1);
+		return (1);
 	}
 
 	CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
@@ -6698,7 +6697,7 @@ scsisanitize_bailout:
 		free(data_ptr);
 	cam_freeccb(ccb);
 
-	return(error);
+	return (error);
 }
 
 static int
@@ -7328,7 +7327,7 @@ smpcmd(struct cam_device *device, int argc, char **arg
 			} else if ((amt_written == 0)
 				&& (amt_to_write > 0)) {
 				warnx("only wrote %u bytes out of %u",
-				      response_size - amt_to_write, 
+				      response_size - amt_to_write,
 				      response_size);
 			}
 		}
@@ -7352,19 +7351,19 @@ mmcsdcmd(struct cam_device *device, int argc, char **a
 {
 	int c, error = 0;
 	union ccb *ccb;
-        int32_t mmc_opcode = 0, mmc_arg = 0;
-        int32_t mmc_flags = -1;
+	int32_t mmc_opcode = 0, mmc_arg = 0;
+	int32_t mmc_flags = -1;
 	int retval;
-        int is_write = 0;
-        int is_bw_4 = 0, is_bw_1 = 0;
-        int is_highspeed = 0, is_stdspeed = 0;
+	int is_write = 0;
+	int is_bw_4 = 0, is_bw_1 = 0;
+	int is_highspeed = 0, is_stdspeed = 0;
 	int is_info_request = 0;
 	int flags = 0;
-        uint8_t mmc_data_byte = 0;
+	uint8_t mmc_data_byte = 0;
 
-        /* For IO_RW_EXTENDED command */
+	/* For IO_RW_EXTENDED command */
 	uint8_t *mmc_data = NULL;
-        struct mmc_data mmc_d;
+	struct mmc_data mmc_d;
 	int mmc_data_len = 0;
 
 	/*
@@ -7382,143 +7381,143 @@ mmcsdcmd(struct cam_device *device, int argc, char **a
 
 	while ((c = getopt(argc, argv, combinedopt)) != -1) {
 		switch (c) {
-                case '4':
-                        is_bw_4 = 1;
-                        break;
-                case '1':
-                        is_bw_1 = 1;
-                        break;
-                case 'S':
-                        if (!strcmp(optarg, "high"))
-                                is_highspeed = 1;
-                        else
-                                is_stdspeed = 1;
-                        break;
+		case '4':
+			is_bw_4 = 1;
+			break;
+		case '1':
+			is_bw_1 = 1;
+			break;
+		case 'S':
+			if (!strcmp(optarg, "high"))
+				is_highspeed = 1;
+			else
+				is_stdspeed = 1;
+			break;
 		case 'I':
 			is_info_request = 1;
 			break;
-                case 'c':
-                        mmc_opcode = strtol(optarg, NULL, 0);
+		case 'c':
+			mmc_opcode = strtol(optarg, NULL, 0);
 			if (mmc_opcode < 0) {
 				warnx("invalid MMC opcode %d",
 				      mmc_opcode);
 				error = 1;
 				goto mmccmd_bailout;
 			}
-                        break;
-                case 'a':
-                        mmc_arg = strtol(optarg, NULL, 0);
+			break;
+		case 'a':
+			mmc_arg = strtol(optarg, NULL, 0);
 			if (mmc_arg < 0) {
 				warnx("invalid MMC arg %d",
 				      mmc_arg);
 				error = 1;
 				goto mmccmd_bailout;
 			}
-                        break;
-                case 'f':
-                        mmc_flags = strtol(optarg, NULL, 0);
+			break;
+		case 'f':
+			mmc_flags = strtol(optarg, NULL, 0);
 			if (mmc_flags < 0) {
 				warnx("invalid MMC flags %d",
 				      mmc_flags);
 				error = 1;
 				goto mmccmd_bailout;
 			}
-                        break;
-                case 'l':
-                        mmc_data_len = strtol(optarg, NULL, 0);
+			break;
+		case 'l':
+			mmc_data_len = strtol(optarg, NULL, 0);
 			if (mmc_data_len <= 0) {
 				warnx("invalid MMC data len %d",
 				      mmc_data_len);
 				error = 1;
 				goto mmccmd_bailout;
 			}
-                        break;
-                case 'W':
-                        is_write = 1;
-                        break;
-                case 'b':
-                        mmc_data_byte = strtol(optarg, NULL, 0);
-                        break;
+			break;
+		case 'W':
+			is_write = 1;
+			break;
+		case 'b':
+			mmc_data_byte = strtol(optarg, NULL, 0);
+			break;
 		default:
 			break;
 		}
 	}
 	flags |= CAM_DEV_QFRZDIS; /* masks are broken?! */
 
-        /* If flags are left default, supply the right flags */
-        if (mmc_flags < 0)
-                switch (mmc_opcode) {
-                case MMC_GO_IDLE_STATE:
-                        mmc_flags = MMC_RSP_NONE | MMC_CMD_BC;
-                        break;
-                case IO_SEND_OP_COND:
-                        mmc_flags = MMC_RSP_R4;
-                        break;
-                case SD_SEND_RELATIVE_ADDR:
-                        mmc_flags = MMC_RSP_R6 | MMC_CMD_BCR;
-                        break;
-                case MMC_SELECT_CARD:
-                        mmc_flags = MMC_RSP_R1B | MMC_CMD_AC;
-                        mmc_arg = mmc_arg << 16;
-                        break;
-                case SD_IO_RW_DIRECT:
-                        mmc_flags = MMC_RSP_R5 | MMC_CMD_AC;
-                        mmc_arg = SD_IO_RW_ADR(mmc_arg);
-                        if (is_write)
-                                mmc_arg |= SD_IO_RW_WR | SD_IO_RW_RAW | SD_IO_RW_DAT(mmc_data_byte);
-                        break;
-                case SD_IO_RW_EXTENDED:
-                        mmc_flags = MMC_RSP_R5 | MMC_CMD_ADTC;
-                        mmc_arg = SD_IO_RW_ADR(mmc_arg);
-                        int len_arg = mmc_data_len;
-                        if (mmc_data_len == 512)
-                                len_arg = 0;
+	/* If flags are left default, supply the right flags */
+	if (mmc_flags < 0)
+		switch (mmc_opcode) {
+		case MMC_GO_IDLE_STATE:
+			mmc_flags = MMC_RSP_NONE | MMC_CMD_BC;
+			break;
+		case IO_SEND_OP_COND:
+			mmc_flags = MMC_RSP_R4;
+			break;
+		case SD_SEND_RELATIVE_ADDR:
+			mmc_flags = MMC_RSP_R6 | MMC_CMD_BCR;
+			break;
+		case MMC_SELECT_CARD:
+			mmc_flags = MMC_RSP_R1B | MMC_CMD_AC;
+			mmc_arg = mmc_arg << 16;
+			break;
+		case SD_IO_RW_DIRECT:
+			mmc_flags = MMC_RSP_R5 | MMC_CMD_AC;
+			mmc_arg = SD_IO_RW_ADR(mmc_arg);
+			if (is_write)
+				mmc_arg |= SD_IO_RW_WR | SD_IO_RW_RAW | SD_IO_RW_DAT(mmc_data_byte);
+			break;
+		case SD_IO_RW_EXTENDED:
+			mmc_flags = MMC_RSP_R5 | MMC_CMD_ADTC;
+			mmc_arg = SD_IO_RW_ADR(mmc_arg);
+			int len_arg = mmc_data_len;
+			if (mmc_data_len == 512)
+				len_arg = 0;
 
-                        // Byte mode
-                        mmc_arg |= SD_IOE_RW_LEN(len_arg) | SD_IO_RW_INCR;
-                        // Block mode
+			// Byte mode
+			mmc_arg |= SD_IOE_RW_LEN(len_arg) | SD_IO_RW_INCR;
+			// Block mode
 //                        mmc_arg |= SD_IOE_RW_BLK | SD_IOE_RW_LEN(len_arg) | SD_IO_RW_INCR;
-                        break;
-                default:
-                        mmc_flags = MMC_RSP_R1;
-                        break;
-                }
+			break;
+		default:
+			mmc_flags = MMC_RSP_R1;
+			break;
+		}
 
-        // Switch bus width instead of sending IO command
-        if (is_bw_4 || is_bw_1) {
-                struct ccb_trans_settings_mmc *cts;
-                ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
-                ccb->ccb_h.flags = 0;
-                cts = &ccb->cts.proto_specific.mmc;
-                cts->ios.bus_width = is_bw_4 == 1 ? bus_width_4 : bus_width_1;
-                cts->ios_valid = MMC_BW;
-                if (((retval = cam_send_ccb(device, ccb)) < 0)
-                    || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
-                        warn("Error sending command");
-                } else {
-                        printf("Parameters set OK\n");
-                }
-                cam_freeccb(ccb);
-                return (retval);
-        }
+	// Switch bus width instead of sending IO command
+	if (is_bw_4 || is_bw_1) {
+		struct ccb_trans_settings_mmc *cts;
+		ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
+		ccb->ccb_h.flags = 0;
+		cts = &ccb->cts.proto_specific.mmc;
+		cts->ios.bus_width = is_bw_4 == 1 ? bus_width_4 : bus_width_1;
+		cts->ios_valid = MMC_BW;
+		if (((retval = cam_send_ccb(device, ccb)) < 0)
+		    || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
+			warn("Error sending command");
+		} else {
+			printf("Parameters set OK\n");
+		}
+		cam_freeccb(ccb);
+		return (retval);
+	}
 
-        // Switch bus speed instead of sending IO command
-        if (is_stdspeed || is_highspeed) {
-                struct ccb_trans_settings_mmc *cts;
-                ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
-                ccb->ccb_h.flags = 0;
-                cts = &ccb->cts.proto_specific.mmc;
-                cts->ios.timing = is_highspeed == 1 ? bus_timing_hs : bus_timing_normal;
-                cts->ios_valid = MMC_BT;
-                if (((retval = cam_send_ccb(device, ccb)) < 0)
-                    || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
-                        warn("Error sending command");
-                } else {
-                        printf("Speed set OK (HS: %d)\n", is_highspeed);
-                }
-                cam_freeccb(ccb);
-                return (retval);
-        }
+	// Switch bus speed instead of sending IO command
+	if (is_stdspeed || is_highspeed) {
+		struct ccb_trans_settings_mmc *cts;
+		ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
+		ccb->ccb_h.flags = 0;
+		cts = &ccb->cts.proto_specific.mmc;
+		cts->ios.timing = is_highspeed == 1 ? bus_timing_hs : bus_timing_normal;
+		cts->ios_valid = MMC_BT;
+		if (((retval = cam_send_ccb(device, ccb)) < 0)
+		    || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
+			warn("Error sending command");
+		} else {
+			printf("Speed set OK (HS: %d)\n", is_highspeed);
+		}
+		cam_freeccb(ccb);
+		return (retval);
+	}
 
 	// Get information about controller and its settings
 	if (is_info_request) {
@@ -7560,16 +7559,16 @@ mmcsdcmd(struct cam_device *device, int argc, char **a
 		return (0);
 	}
 
-        printf("CMD %d arg %d flags %02x\n", mmc_opcode, mmc_arg, mmc_flags);
+	printf("CMD %d arg %d flags %02x\n", mmc_opcode, mmc_arg, mmc_flags);
 
-        if (mmc_data_len > 0) {
-                flags |= CAM_DIR_IN;
-                mmc_data = malloc(mmc_data_len);
-                memset(mmc_data, 0, mmc_data_len);
-                mmc_d.len = mmc_data_len;
-                mmc_d.data = mmc_data;
-                mmc_d.flags = MMC_DATA_READ;
-        } else flags |= CAM_DIR_NONE;
+	if (mmc_data_len > 0) {
+		flags |= CAM_DIR_IN;
+		mmc_data = malloc(mmc_data_len);
+		memset(mmc_data, 0, mmc_data_len);
+		mmc_d.len = mmc_data_len;
+		mmc_d.data = mmc_data;
+		mmc_d.flags = MMC_DATA_READ;
+	} else flags |= CAM_DIR_NONE;
 
 	cam_fill_mmcio(&ccb->mmcio,
 		       /*retries*/ retry_count,
@@ -7597,36 +7596,35 @@ mmcsdcmd(struct cam_device *device, int argc, char **a
 	}
 
 	if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)) {
-                printf("MMCIO: error %d, %08x %08x %08x %08x\n",
-                       ccb->mmcio.cmd.error, ccb->mmcio.cmd.resp[0],
-                       ccb->mmcio.cmd.resp[1],
-                       ccb->mmcio.cmd.resp[2],
-                       ccb->mmcio.cmd.resp[3]);
+		printf("MMCIO: error %d, %08x %08x %08x %08x\n",
+		       ccb->mmcio.cmd.error, ccb->mmcio.cmd.resp[0],
+		       ccb->mmcio.cmd.resp[1],
+		       ccb->mmcio.cmd.resp[2],
+		       ccb->mmcio.cmd.resp[3]);
 
-                switch (mmc_opcode) {
-                case SD_IO_RW_DIRECT:
-                        printf("IO_RW_DIRECT: resp byte %02x, cur state %d\n",
-                               SD_R5_DATA(ccb->mmcio.cmd.resp),
-                               (ccb->mmcio.cmd.resp[0] >> 12) & 0x3
-                                );
-                        break;
-                case SD_IO_RW_EXTENDED:
-                        printf("IO_RW_EXTENDED: read %d bytes w/o error:\n", mmc_data_len);
-                        hexdump(mmc_data, mmc_data_len, NULL, 0);
-                        break;
-                case SD_SEND_RELATIVE_ADDR:
-                        printf("SEND_RELATIVE_ADDR: published RCA %02x\n", ccb->mmcio.cmd.resp[0] >> 16);
-                        break;
-                default:
-                        printf("No command-specific decoder for CMD %d\n", mmc_opcode);
-                }
+		switch (mmc_opcode) {
+		case SD_IO_RW_DIRECT:
+			printf("IO_RW_DIRECT: resp byte %02x, cur state %d\n",
+			       SD_R5_DATA(ccb->mmcio.cmd.resp),
+			       (ccb->mmcio.cmd.resp[0] >> 12) & 0x3);
+			break;
+		case SD_IO_RW_EXTENDED:
+			printf("IO_RW_EXTENDED: read %d bytes w/o error:\n", mmc_data_len);
+			hexdump(mmc_data, mmc_data_len, NULL, 0);
+			break;
+		case SD_SEND_RELATIVE_ADDR:
+			printf("SEND_RELATIVE_ADDR: published RCA %02x\n", ccb->mmcio.cmd.resp[0] >> 16);
+			break;
+		default:
+			printf("No command-specific decoder for CMD %d\n", mmc_opcode);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



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