Date: Thu, 25 Feb 2021 18:46:34 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 22267215d66d - main - camcontrol(8): remove unnecessary CCB zeroing Message-ID: <202102251846.11PIkY1Q007735@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=22267215d66d9bd490ad1a12221472028e3174f4 commit 22267215d66d9bd490ad1a12221472028e3174f4 Author: Edward Tomasz Napierala <trasz@FreeBSD.org> AuthorDate: 2021-02-24 23:00:25 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> CommitDate: 2021-02-25 18:45:21 +0000 camcontrol(8): remove unnecessary CCB zeroing After 3e404b8c53d, 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 --- sbin/camcontrol/attrib.c | 2 -- sbin/camcontrol/camcontrol.c | 45 -------------------------------------------- sbin/camcontrol/epc.c | 2 -- sbin/camcontrol/fwdownload.c | 7 ------- sbin/camcontrol/persist.c | 2 -- sbin/camcontrol/zone.c | 2 -- 6 files changed, 60 deletions(-) diff --git a/sbin/camcontrol/attrib.c b/sbin/camcontrol/attrib.c index 52fd4be41060..05cabb1b8145 100644 --- a/sbin/camcontrol/attrib.c +++ b/sbin/camcontrol/attrib.c @@ -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); /* diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 748f54c9ce55..69939715898e 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -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) { diff --git a/sbin/camcontrol/epc.c b/sbin/camcontrol/epc.c index 8b42f63c7523..f96ca6e68ba9 100644 --- a/sbin/camcontrol/epc.c +++ b/sbin/camcontrol/epc.c @@ -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': { diff --git a/sbin/camcontrol/fwdownload.c b/sbin/camcontrol/fwdownload.c index 87aef6d3c240..dc97b3a221db 100644 --- a/sbin/camcontrol/fwdownload.c +++ b/sbin/camcontrol/fwdownload.c @@ -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; diff --git a/sbin/camcontrol/persist.c b/sbin/camcontrol/persist.c index ce4de9f8feb1..f7ef30e06ede 100644 --- a/sbin/camcontrol/persist.c +++ b/sbin/camcontrol/persist.c @@ -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': diff --git a/sbin/camcontrol/zone.c b/sbin/camcontrol/zone.c index 130f53226f57..3f7dfcec4f35 100644 --- a/sbin/camcontrol/zone.c +++ b/sbin/camcontrol/zone.c @@ -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':
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102251846.11PIkY1Q007735>