camcontrol(8): remove unnecessary CCB zeroing

After 3e404b8c53, cam_getccb(3) clears the returned CCB, making
a number of calls to CCB_CLEAR_ALL_EXCEPT_HDR(3) unnecessary.

Reviewed By:	imp
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D27812
This commit is contained in:
Edward Tomasz Napierala 2021-02-24 23:00:25 +00:00
parent f848d08e45
commit 22267215d6
6 changed files with 0 additions and 60 deletions

View File

@ -138,8 +138,6 @@ scsiattrib(struct cam_device *device, int argc, char **argv, char *combinedopt,
goto bailout;
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
STAILQ_INIT(&write_attr_list);
/*

View File

@ -1021,9 +1021,6 @@ scsiinquiry(struct cam_device *device, int task_attr, int retry_count,
return (1);
}
/* cam_getccb cleans up the header, caller has to zero the payload */
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
inq_buf = (struct scsi_inquiry_data *)malloc(
sizeof(struct scsi_inquiry_data));
@ -1131,9 +1128,6 @@ scsiserial(struct cam_device *device, int task_attr, int retry_count,
return (1);
}
/* cam_getccb cleans up the header, caller has to zero the payload */
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
serial_buf = (struct scsi_vpd_unit_serial_number *)
malloc(sizeof(*serial_buf));
@ -1218,8 +1212,6 @@ camxferrate(struct cam_device *device)
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts);
ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
ccb->cts.type = CTS_TYPE_CURRENT_SETTINGS;
@ -4480,8 +4472,6 @@ mode_select(struct cam_device *device, int cdb_len, int save_pages,
if (ccb == NULL)
errx(1, "mode_select: couldn't allocate CCB");
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
scsi_mode_select_len(&ccb->csio,
/* retries */ retry_count,
/* cbfcnp */ NULL,
@ -4620,8 +4610,6 @@ scsicmd(struct cam_device *device, int argc, char **argv, char *combinedopt,
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(ccb);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch(c) {
case 'a':
@ -5106,7 +5094,6 @@ tagcontrol(struct cam_device *device, int argc, char **argv,
cam_path_string(device, pathstr, sizeof(pathstr));
if (numtags >= 0) {
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->crs);
ccb->ccb_h.func_code = XPT_REL_SIMQ;
ccb->ccb_h.flags = CAM_DEV_QFREEZE;
ccb->crs.release_flags = RELSIM_ADJUST_OPENINGS;
@ -5350,7 +5337,6 @@ get_cpi(struct cam_device *device, struct ccb_pathinq *cpi)
warnx("get_cpi: couldn't allocate CCB");
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cpi);
ccb->ccb_h.func_code = XPT_PATH_INQ;
if (cam_send_ccb(device, ccb) < 0) {
warn("get_cpi: error sending Path Inquiry CCB");
@ -5385,7 +5371,6 @@ get_cgd(struct cam_device *device, struct ccb_getdev *cgd)
warnx("get_cgd: couldn't allocate CCB");
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cgd);
ccb->ccb_h.func_code = XPT_GDEV_TYPE;
if (cam_send_ccb(device, ccb) < 0) {
warn("get_cgd: error sending Get type information CCB");
@ -5426,9 +5411,6 @@ dev_has_vpd_page(struct cam_device *dev, uint8_t page_id, int retry_count,
goto bailout;
}
/* cam_getccb cleans up the header, caller has to zero the payload */
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
bzero(&sup_pages, sizeof(sup_pages));
scsi_inquiry(&ccb->csio,
@ -5963,8 +5945,6 @@ get_print_cts(struct cam_device *device, int user_settings, int quiet,
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts);
ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
if (user_settings == 0)
@ -6107,7 +6087,6 @@ ratecontrol(struct cam_device *device, int task_attr, int retry_count,
*/
if ((retval = get_cpi(device, &cpi)) != 0)
goto ratecontrol_bailout;
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts);
if (quiet == 0) {
fprintf(stdout, "%s parameters:\n",
user_settings ? "User" : "Current");
@ -6356,8 +6335,6 @@ scsiformat(struct cam_device *device, int argc, char **argv,
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch(c) {
case 'q':
@ -6851,8 +6828,6 @@ sanitize(struct cam_device *device, int argc, char **argv,
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch(c) {
case 'a':
@ -7209,8 +7184,6 @@ scsireportluns(struct cam_device *device, int argc, char **argv,
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
countonly = 0;
lunsonly = 0;
@ -7453,8 +7426,6 @@ scsireadcapacity(struct cam_device *device, int argc, char **argv,
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch (c) {
case 'b':
@ -7654,8 +7625,6 @@ smpcmd(struct cam_device *device, int argc, char **argv, char *combinedopt,
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch (c) {
case 'R':
@ -8203,8 +8172,6 @@ smpreportgeneral(struct cam_device *device, int argc, char **argv,
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch (c) {
case 'l':
@ -8347,8 +8314,6 @@ smpphycontrol(struct cam_device *device, int argc, char **argv,
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch (c) {
case 'a':
@ -8604,8 +8569,6 @@ smpmaninfo(struct cam_device *device, int argc, char **argv,
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch (c) {
case 'l':
@ -8698,8 +8661,6 @@ getdevid(struct cam_devitem *item)
goto bailout;
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cdai);
/*
* On the first try, we just probe for the size of the data, and
* then allocate that much memory and try again.
@ -8983,7 +8944,6 @@ smpphylist(struct cam_device *device, int argc, char **argv,
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio);
STAILQ_INIT(&devlist.dev_queue);
rgrequest = malloc(sizeof(*rgrequest));
@ -9448,9 +9408,6 @@ scsigetopcodes(struct cam_device *device, int opcode_set, int opcode,
goto bailout;
}
/* cam_getccb cleans up the header, caller has to zero the payload */
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
if (opcode_set != 0) {
options |= RSO_OPTIONS_OC;
num_opcodes = 1;
@ -9888,8 +9845,6 @@ reprobe(struct cam_device *device)
return (1);
}
CCB_CLEAR_ALL_EXCEPT_HDR(ccb);
ccb->ccb_h.func_code = XPT_REPROBE_LUN;
if (cam_send_ccb(device, ccb) < 0) {

View File

@ -633,8 +633,6 @@ epc(struct cam_device *device, int argc, char **argv, char *combinedopt,
goto bailout;
}
CCB_CLEAR_ALL_EXCEPT_HDR(ccb);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch (c) {
case 'c': {

View File

@ -465,9 +465,6 @@ fw_validate_ibm(struct cam_device *dev, int retry_count, int timeout, int fd,
goto bailout;
}
/* cam_getccb cleans up the header, caller has to zero the payload */
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
bzero(&vpd_page, sizeof(vpd_page));
scsi_inquiry(&ccb->csio,
@ -671,8 +668,6 @@ fw_check_device_ready(struct cam_device *dev, camcontrol_devtype devtype,
goto bailout;
}
CCB_CLEAR_ALL_EXCEPT_HDR(ccb);
if (devtype != CC_DT_SCSI) {
dxfer_len = sizeof(struct ata_params);
@ -802,8 +797,6 @@ fw_download_img(struct cam_device *cam_dev, struct fw_vendor *vp,
goto bailout;
}
CCB_CLEAR_ALL_EXCEPT_HDR(ccb);
max_pkt_size = vp->max_pkt_size;
if (max_pkt_size == 0)
max_pkt_size = UNKNOWN_MAX_PKT_SIZE;

View File

@ -453,8 +453,6 @@ scsipersist(struct cam_device *device, int argc, char **argv, char *combinedopt,
goto bailout;
}
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch (c) {
case 'a':

View File

@ -347,8 +347,6 @@ zone(struct cam_device *device, int argc, char **argv, char *combinedopt,
goto bailout;
}
CCB_CLEAR_ALL_EXCEPT_HDR(ccb);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch (c) {
case 'a':