From 27dcd3d90b41d3c89eac3c2b50b9a6f515e5c89d Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Tue, 1 Sep 2020 22:13:48 +0000 Subject: cam: clean up empty lines in .c and .h files --- sys/cam/ata/ata_all.c | 6 ++---- sys/cam/ata/ata_da.c | 8 -------- sys/cam/ata/ata_pmp.c | 2 +- sys/cam/cam.c | 3 --- sys/cam/cam.h | 3 +-- sys/cam/cam_ccb.h | 2 -- sys/cam/cam_compat.c | 3 +-- sys/cam/cam_compat.h | 1 - sys/cam/cam_iosched.c | 5 ----- sys/cam/cam_periph.c | 15 +++------------ sys/cam/cam_queue.c | 6 ++---- sys/cam/cam_queue.h | 4 +--- sys/cam/cam_sim.h | 1 - sys/cam/cam_xpt.c | 25 ------------------------ sys/cam/cam_xpt.h | 1 - sys/cam/cam_xpt_internal.h | 1 - sys/cam/cam_xpt_sim.h | 1 - sys/cam/ctl/README.ctl.txt | 3 +-- sys/cam/ctl/ctl.c | 22 --------------------- sys/cam/ctl/ctl_backend.c | 1 - sys/cam/ctl/ctl_backend.h | 1 - sys/cam/ctl/ctl_backend_block.c | 2 -- sys/cam/ctl/ctl_cmd_table.c | 1 - sys/cam/ctl/ctl_frontend_ioctl.c | 4 +--- sys/cam/ctl/ctl_frontend_iscsi.c | 2 -- sys/cam/ctl/ctl_ha.c | 2 -- sys/cam/ctl/ctl_io.h | 2 -- sys/cam/ctl/ctl_scsi_all.c | 2 -- sys/cam/ctl/ctl_ser_table.c | 1 - sys/cam/ctl/ctl_tpc.c | 1 - sys/cam/ctl/ctl_tpc_local.c | 1 - sys/cam/ctl/scsi_ctl.c | 4 +--- sys/cam/mmc/mmc_da.c | 6 ------ sys/cam/mmc/mmc_xpt.c | 3 --- sys/cam/nvme/nvme_all.c | 1 - sys/cam/nvme/nvme_da.c | 14 ++++++-------- sys/cam/nvme/nvme_xpt.c | 1 - sys/cam/scsi/scsi_all.c | 21 ++++---------------- sys/cam/scsi/scsi_all.h | 17 +++-------------- sys/cam/scsi/scsi_cd.c | 10 ---------- sys/cam/scsi/scsi_cd.h | 1 - sys/cam/scsi/scsi_ch.c | 11 +++-------- sys/cam/scsi/scsi_da.c | 8 -------- sys/cam/scsi/scsi_da.h | 2 -- sys/cam/scsi/scsi_enc.c | 6 ++---- sys/cam/scsi/scsi_enc_safte.c | 3 +-- sys/cam/scsi/scsi_enc_ses.c | 18 +++--------------- sys/cam/scsi/scsi_message.h | 1 - sys/cam/scsi/scsi_pass.c | 10 ++-------- sys/cam/scsi/scsi_pt.c | 7 +++---- sys/cam/scsi/scsi_sa.c | 41 ++++++++++------------------------------ sys/cam/scsi/scsi_sa.h | 2 +- sys/cam/scsi/scsi_ses.h | 3 --- sys/cam/scsi/scsi_sg.c | 2 -- sys/cam/scsi/scsi_targ_bh.c | 6 ++---- sys/cam/scsi/scsi_target.c | 5 +---- sys/cam/scsi/scsi_xpt.c | 9 +-------- sys/cam/scsi/smp_all.c | 1 - 58 files changed, 56 insertions(+), 289 deletions(-) (limited to 'sys/cam') diff --git a/sys/cam/ata/ata_all.c b/sys/cam/ata/ata_all.c index 475cc5ab0d7a..e6da3bff6d11 100644 --- a/sys/cam/ata/ata_all.c +++ b/sys/cam/ata/ata_all.c @@ -920,7 +920,6 @@ ata_string2mode(char *str) return (-1); } - u_int ata_mode2speed(int mode) { @@ -995,7 +994,7 @@ ata_identify_match(caddr_t identbuffer, caddr_t table_entry) { struct scsi_inquiry_pattern *entry; struct ata_params *ident; - + entry = (struct scsi_inquiry_pattern *)table_entry; ident = (struct ata_params *)identbuffer; @@ -1013,7 +1012,7 @@ ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry) { struct scsi_static_inquiry_pattern *entry; struct ata_params *ident; - + entry = (struct scsi_static_inquiry_pattern *)table_entry; ident = (struct ata_params *)identbuffer; @@ -1108,7 +1107,6 @@ semb_write_buffer(struct ccb_ataio *ataio, length > 0 ? data_ptr[0] : 0, 0x80, length / 4); } - void ata_zac_mgmt_out(struct ccb_ataio *ataio, uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c index 6d873d272a15..99335e94bfca 100644 --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -211,7 +211,6 @@ static struct ada_zone_desc { {ADA_ZONE_FLAG_RWP_SUP, "Reset Write Pointer" }, }; - /* Offsets into our private area for storing information */ #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 @@ -1009,7 +1008,6 @@ adaclose(struct disk *dp) (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 && (periph->flags & CAM_PERIPH_INVALID) == 0 && cam_periph_hold(periph, PRIBIO) == 0) { - ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); cam_fill_ataio(&ccb->ataio, 1, @@ -1198,7 +1196,6 @@ adainit(void) printf("ada: Failed to attach master async callback " "due to status 0x%x!\n", status); } else if (ada_send_ordered) { - /* Register our event handlers */ if ((EVENTHANDLER_REGISTER(power_suspend, adasuspend, NULL, EVENTHANDLER_PRI_LAST)) == NULL) @@ -1462,7 +1459,6 @@ adazonesupsysctl(SYSCTL_HANDLER_ARGS) return (error); } - static void adasysctlinit(void *context, int pending) { @@ -2573,7 +2569,6 @@ out: break; } - ata_read_log(ataio, /*retries*/1, /*cbfcnp*/adadone, @@ -2838,7 +2833,6 @@ adazonedone(struct cam_periph *periph, union ccb *ccb) free(ccb->ataio.data_ptr, M_ATADA); } - static void adadone(struct cam_periph *periph, union ccb *done_ccb) { @@ -3082,8 +3076,6 @@ adadone(struct cam_periph *periph, union ccb *done_ccb) /*getcount_only*/0); } } - - } free(ataio->data_ptr, M_ATADA); diff --git a/sys/cam/ata/ata_pmp.c b/sys/cam/ata/ata_pmp.c index e1ff64a3bbaa..153d8e187d7a 100644 --- a/sys/cam/ata/ata_pmp.c +++ b/sys/cam/ata/ata_pmp.c @@ -274,7 +274,7 @@ pmpasync(void *callback_arg, u_int32_t code, { struct ccb_getdev *cgd; cam_status status; - + cgd = (struct ccb_getdev *)arg; if (cgd == NULL) break; diff --git a/sys/cam/cam.c b/sys/cam/cam.c index e9a36c84e86e..5b7e2a7e924f 100644 --- a/sys/cam/cam.c +++ b/sys/cam/cam.c @@ -206,7 +206,6 @@ cam_strvis_sbuf(struct sbuf *sb, const u_int8_t *src, int srclen, } } - /* * Compare string with pattern, returning 0 on match. * Short pattern matches trailing blanks in name, @@ -330,7 +329,6 @@ camstatusentrycomp(const void *key, const void *member) return (status - table_entry->status_code); } - #ifdef _KERNEL char * cam_error_string(union ccb *ccb, char *str, int str_len, @@ -493,7 +491,6 @@ cam_error_string(struct cam_device *device, union ccb *ccb, char *str, if ((proto_flags & CAM_ESF_PRINT_SENSE) && (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND) && (ccb->ccb_h.status & CAM_AUTOSNS_VALID)) { - #ifdef _KERNEL scsi_sense_sbuf(&ccb->csio, &sb, SSS_FLAG_NONE); diff --git a/sys/cam/cam.h b/sys/cam/cam.h index acd57ccd227c..2aaa2e3a5775 100644 --- a/sys/cam/cam.h +++ b/sys/cam/cam.h @@ -278,7 +278,6 @@ typedef enum { /* SCSI Bus Busy */ CAM_SCSI_BUSY = 0x3f, - /* * Flags */ @@ -304,7 +303,7 @@ typedef enum { /* * Target Specific Adjunct Status */ - + /* sent sense with status */ CAM_SENT_SENSE = 0x40000000 } cam_status; diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h index cf5daf653079..3ec0c5fc74ed 100644 --- a/sys/cam/cam_ccb.h +++ b/sys/cam/cam_ccb.h @@ -1111,7 +1111,6 @@ struct ccb_trans_settings { } xport_specific; }; - /* * Calculate the geometry parameters for a device * give the block size and volume size in blocks. @@ -1132,7 +1131,6 @@ struct ccb_calc_geometry { #define KNOB_VALID_ADDRESS 0x1 #define KNOB_VALID_ROLE 0x2 - #define KNOB_ROLE_NONE 0x0 #define KNOB_ROLE_INITIATOR 0x1 #define KNOB_ROLE_TARGET 0x2 diff --git a/sys/cam/cam_compat.c b/sys/cam/cam_compat.c index 5beae62b251e..07aba7d357db 100644 --- a/sys/cam/cam_compat.c +++ b/sys/cam/cam_compat.c @@ -373,7 +373,7 @@ cam_compat_translate_dev_match_0x18(union ccb *ccb) dm = ccb->cdm.matches; /* Translate in-place: old fields are smaller */ dm18 = (struct dev_match_result_0x18 *)(dm); - + for (i = 0; i < ccb->cdm.num_matches; i++) { dm18[i].type = dm[i].type; switch (dm[i].type) { @@ -420,4 +420,3 @@ cam_compat_translate_dev_match_0x18(union ccb *ccb) return (0); } - diff --git a/sys/cam/cam_compat.h b/sys/cam/cam_compat.h index 2c559c3e4d84..dd728d86839e 100644 --- a/sys/cam/cam_compat.h +++ b/sys/cam/cam_compat.h @@ -40,7 +40,6 @@ int cam_compat_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td, int(*cbfnp)(struct cdev *, u_long, caddr_t, int, struct thread *)); - /* Version 0x16 compatibility */ #define CAM_VERSION_0x16 0x16 diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c index c2b36e3d1236..ba1bc4843163 100644 --- a/sys/cam/cam_iosched.c +++ b/sys/cam/cam_iosched.c @@ -241,7 +241,6 @@ struct iop_stats { struct cam_iosched_softc *softc; }; - typedef enum { set_max = 0, /* current = max */ read_latency, /* Steer read latency by throttling writes */ @@ -456,7 +455,6 @@ cam_iosched_iops_tick(struct iop_stats *ios) ios->l_value1 += new_ios; } - return 0; } @@ -542,7 +540,6 @@ cam_iosched_bw_caniop(struct iop_stats *ios, struct bio *bp) if (ios->current > 0 && ios->l_value1 <= 0) return EAGAIN; - return 0; } @@ -615,7 +612,6 @@ cam_iosched_ticker(void *arg) isc->total_ticks++; } - static void cam_iosched_cl_init(struct control_loop *clp, struct cam_iosched_softc *isc) { @@ -791,7 +787,6 @@ cam_iosched_has_more_trim(struct cam_iosched_softc *isc) #define cam_iosched_sort_queue(isc) ((isc)->sort_io_queue >= 0 ? \ (isc)->sort_io_queue : cam_sort_io_queues) - static inline bool cam_iosched_has_work(struct cam_iosched_softc *isc) { diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 358e9901105b..96a83261b199 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -217,7 +217,6 @@ cam_periph_alloc(periph_ctor_t *periph_ctor, * handler. If it looks like a mistaken re-allocation, complain. */ if ((periph = cam_periph_find(path, name)) != NULL) { - if ((periph->flags & CAM_PERIPH_INVALID) != 0 && (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) == 0) { periph->flags |= CAM_PERIPH_NEW_DEV_FOUND; @@ -233,15 +232,14 @@ cam_periph_alloc(periph_ctor_t *periph_ctor, } return (CAM_REQ_INVALID); } - + periph = (struct cam_periph *)malloc(sizeof(*periph), M_CAMPERIPH, M_NOWAIT|M_ZERO); if (periph == NULL) return (CAM_RESRC_UNAVAIL); - - init_level++; + init_level++; sim = xpt_path_sim(path); path_id = xpt_path_path_id(path); @@ -342,7 +340,6 @@ cam_periph_find(struct cam_path *path, char *name) xpt_lock_buses(); for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) { - if (name != NULL && (strcmp((*p_drv)->driver_name, name) != 0)) continue; @@ -380,7 +377,6 @@ retry: count = 0; xpt_lock_buses(); for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) { - TAILQ_FOREACH(periph, &(*p_drv)->units, unit_links) { if (xpt_path_comp(periph->path, path) != 0) continue; @@ -468,7 +464,7 @@ cam_periph_release(struct cam_periph *periph) if (periph == NULL) return; - + cam_periph_assert(periph, MA_NOTOWNED); mtx = cam_periph_mtx(periph); mtx_lock(mtx); @@ -549,7 +545,6 @@ camperiphnextunit(struct periph_driver *p_drv, u_int newunit, int wired, periph_name = p_drv->driver_name; for (;;newunit++) { - for (periph = TAILQ_FIRST(&p_drv->units); periph != NULL && periph->unit_number != newunit; periph = TAILQ_NEXT(periph, unit_links)) @@ -930,7 +925,6 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo, PHOLD(curproc); for (i = 0; i < numbufs; i++) { - /* Save the user's data address. */ mapinfo->orig[i] = *data_ptrs[i]; @@ -1146,7 +1140,6 @@ cam_periph_ioctl(struct cam_periph *periph, u_long cmd, caddr_t addr, ccb->cgdl.index = 0; ccb->cgdl.status = CAM_GDEVLIST_MORE_DEVS; while (ccb->cgdl.status == CAM_GDEVLIST_MORE_DEVS) { - /* we want the next device in the list */ xpt_action(ccb); if (strncmp(ccb->cgdl.periph_name, @@ -2032,7 +2025,6 @@ cam_periph_error(union ccb *ccb, cam_flags camflags, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), lun_id) == CAM_REQ_CMP) { - /* * Let peripheral drivers know that this * device has gone away. @@ -2052,7 +2044,6 @@ cam_periph_error(union ccb *ccb, cam_flags camflags, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), CAM_LUN_WILDCARD) == CAM_REQ_CMP) { - scan_ccb = xpt_alloc_ccb_nowait(); if (scan_ccb != NULL) { scan_ccb->ccb_h.path = newpath; diff --git a/sys/cam/cam_queue.c b/sys/cam/cam_queue.c index 34297030c289..074b0545a1fd 100644 --- a/sys/cam/cam_queue.c +++ b/sys/cam/cam_queue.c @@ -251,7 +251,7 @@ cam_ccbq_alloc(int openings) free(ccbq, M_CAMCCBQ); return (NULL); } - + return (ccbq); } @@ -348,7 +348,6 @@ heap_up(cam_pinfo **queue_array, int new_index) child = new_index; while (child != 1) { - parent = child >> 1; if (queue_cmp(queue_array, parent, child) <= 0) break; @@ -367,11 +366,10 @@ heap_down(cam_pinfo **queue_array, int index, int num_entries) { int child; int parent; - + parent = index; child = parent << 1; for (; child <= num_entries; child = parent << 1) { - if (child < num_entries) { /* child+1 is the right child of parent */ if (queue_cmp(queue_array, child + 1, child) < 0) diff --git a/sys/cam/cam_queue.h b/sys/cam/cam_queue.h index 8393c77972f4..e5928027f030 100644 --- a/sys/cam/cam_queue.h +++ b/sys/cam/cam_queue.h @@ -78,7 +78,6 @@ struct cam_devq { int send_active; }; - struct cam_devq *cam_devq_alloc(int devices, int openings); int cam_devq_init(struct cam_devq *devq, int devices, @@ -87,7 +86,7 @@ int cam_devq_init(struct cam_devq *devq, int devices, void cam_devq_free(struct cam_devq *devq); u_int32_t cam_devq_resize(struct cam_devq *camq, int openings); - + /* * Allocate a cam_ccb_queue structure and initialize it. */ @@ -167,7 +166,6 @@ cam_ccbq_ccb_done(struct cam_ccbq *ccbq, union ccb *done_ccb); static __inline void cam_ccbq_release_opening(struct cam_ccbq *ccbq); - static __inline int cam_ccbq_pending_ccb_count(struct cam_ccbq *ccbq) { diff --git a/sys/cam/cam_sim.h b/sys/cam/cam_sim.h index 86b9787a4bb5..557d3d23cb57 100644 --- a/sys/cam/cam_sim.h +++ b/sys/cam/cam_sim.h @@ -78,7 +78,6 @@ void cam_sim_release(struct cam_sim *sim); /* Optional sim attributes may be set with these. */ void cam_sim_set_path(struct cam_sim *sim, u_int32_t path_id); - /* Generically useful offsets into the sim private area */ #define spriv_ptr0 sim_priv.entries[0].ptr #define spriv_ptr1 sim_priv.entries[1].ptr diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 9f53761c50cc..e5d62b00286c 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -234,7 +234,6 @@ static int xpt_init(void *); DECLARE_MODULE(cam, cam_moduledata, SI_SUB_CONFIGURE, SI_ORDER_SECOND); MODULE_VERSION(cam, 1); - static void xpt_async_bcast(struct async_list *async_head, u_int32_t async_code, struct cam_path *path, @@ -519,7 +518,6 @@ xptdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread * bcopy(&ccb, inccb, sizeof(union ccb)); xpt_free_path(ccb.ccb_h.path); break; - } case XPT_DEV_MATCH: { struct cam_periph_map_info mapinfo; @@ -651,7 +649,6 @@ xptdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread * */ for (periph = TAILQ_FIRST(&(*p_drv)->units); periph != NULL; periph = TAILQ_NEXT(periph, unit_links)) { - if (periph->unit_number == unit) break; } @@ -1036,7 +1033,6 @@ xpt_remove_periph(struct cam_periph *periph) } } - void xpt_announce_periph(struct cam_periph *periph, char *announce_string) { @@ -2675,7 +2671,6 @@ xpt_action_default(union ccb *start_ccb) if (device->protocol_version <= SCSI_REV_2 && start_ccb->ccb_h.target_lun < 8 && (start_ccb->ccb_h.flags & CAM_CDB_POINTER) == 0) { - start_ccb->csio.cdb_io.cdb_bytes[1] |= start_ccb->ccb_h.target_lun << 5; } @@ -2863,7 +2858,6 @@ call_sim: struct cam_ed *device; int found; - found = 0; /* @@ -3041,13 +3035,11 @@ call_sim: crs = &start_ccb->crs; dev = path->device; if (dev == NULL) { - crs->ccb_h.status = CAM_DEV_NOT_THERE; break; } if ((crs->release_flags & RELSIM_ADJUST_OPENINGS) != 0) { - /* Don't ever go below one opening */ if (crs->openings > 0) { xpt_dev_ccbq_resize(path, crs->openings); @@ -3061,9 +3053,7 @@ call_sim: mtx_lock(&dev->sim->devq->send_mtx); if ((crs->release_flags & RELSIM_RELEASE_AFTER_TIMEOUT) != 0) { - if ((dev->flags & CAM_DEV_REL_TIMEOUT_PENDING) != 0) { - /* * Just extend the old timeout and decrement * the freeze count so that a single timeout @@ -3072,7 +3062,6 @@ call_sim: start_ccb->ccb_h.flags &= ~CAM_DEV_QFREEZE; callout_stop(&dev->callout); } else { - start_ccb->ccb_h.flags |= CAM_DEV_QFREEZE; } @@ -3081,11 +3070,9 @@ call_sim: xpt_release_devq_timeout, dev, 0); dev->flags |= CAM_DEV_REL_TIMEOUT_PENDING; - } if ((crs->release_flags & RELSIM_RELEASE_AFTER_CMDCMPLT) != 0) { - if ((dev->flags & CAM_DEV_REL_ON_COMPLETE) != 0) { /* * Decrement the freeze count so that a single @@ -3094,20 +3081,16 @@ call_sim: */ start_ccb->ccb_h.flags &= ~CAM_DEV_QFREEZE; } else { - dev->flags |= CAM_DEV_REL_ON_COMPLETE; start_ccb->ccb_h.flags |= CAM_DEV_QFREEZE; } } if ((crs->release_flags & RELSIM_RELEASE_AFTER_QEMPTY) != 0) { - if ((dev->flags & CAM_DEV_REL_ON_QUEUE_EMPTY) != 0 || (dev->ccbq.dev_active == 0)) { - start_ccb->ccb_h.flags &= ~CAM_DEV_QFREEZE; } else { - dev->flags |= CAM_DEV_REL_ON_QUEUE_EMPTY; start_ccb->ccb_h.flags |= CAM_DEV_QFREEZE; } @@ -3300,7 +3283,6 @@ xpt_schedule(struct cam_periph *periph, u_int32_t new_priority) } } - /* * Schedule a device to run on a given queue. * If the device was inserted as a new entry on the queue, @@ -3318,7 +3300,6 @@ xpt_schedule_dev(struct camq *queue, cam_pinfo *pinfo, CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_schedule_dev\n")); - old_priority = pinfo->priority; /* @@ -3381,7 +3362,6 @@ restart: periph->immediate_priority)) != CAM_PRIORITY_NONE && (periph->periph_allocated - (ccb != NULL ? 1 : 0) < device->ccbq.total_openings || prio <= CAM_PRIORITY_OOB)) { - if (ccb == NULL && (ccb = xpt_get_ccb_nowait(periph)) == NULL) { if (sleep) { @@ -3446,7 +3426,6 @@ xpt_run_devq(struct cam_devq *devq) } if ((work_ccb->ccb_h.flags & CAM_HIGH_POWER) != 0) { - mtx_lock(&xsoftc.xpt_highpower_lock); if (xsoftc.num_highpower <= 0) { /* @@ -4090,7 +4069,6 @@ xpt_bus_register(struct cam_sim *sim, device_t parent, u_int32_t bus) /* Notify interested parties */ if (sim->path_id != CAM_XPT_PATH_ID) { - xpt_async(AC_PATH_REGISTERED, path, &cpi); if ((cpi.hba_misc & PIM_NOSCAN) == 0) { union ccb *scan_ccb; @@ -4692,8 +4670,6 @@ xpt_free_ccb(union ccb *free_ccb) free(free_ccb, M_CAMCCB); } - - /* Private XPT functions */ /* @@ -5399,7 +5375,6 @@ xpt_done_process(struct ccb_hdr *ccb_h) * Any high powered commands queued up? */ if (device != NULL) { - STAILQ_REMOVE_HEAD(hphead, highpowerq_entry); mtx_unlock(&xsoftc.xpt_highpower_lock); diff --git a/sys/cam/cam_xpt.h b/sys/cam/cam_xpt.h index 4fc1d7231918..1d3fd9d315a1 100644 --- a/sys/cam/cam_xpt.h +++ b/sys/cam/cam_xpt.h @@ -39,7 +39,6 @@ #include #endif - /* Forward Declarations */ union ccb; struct cam_periph; diff --git a/sys/cam/cam_xpt_internal.h b/sys/cam/cam_xpt_internal.h index ded1f1d90032..18c8fc85b765 100644 --- a/sys/cam/cam_xpt_internal.h +++ b/sys/cam/cam_xpt_internal.h @@ -92,7 +92,6 @@ SET_DECLARE(cam_xpt_proto_set, struct xpt_proto); #define CAM_XPT_PROTO(data) \ DATA_SET(cam_xpt_proto_set, data) - /* * The CAM EDT (Existing Device Table) contains the device information for * all devices for all buses in the system. The table contains a diff --git a/sys/cam/cam_xpt_sim.h b/sys/cam/cam_xpt_sim.h index 62b581024458..aa9746019981 100644 --- a/sys/cam/cam_xpt_sim.h +++ b/sys/cam/cam_xpt_sim.h @@ -52,4 +52,3 @@ void xpt_done_direct(union ccb *done_ccb); #endif #endif /* _CAM_CAM_XPT_SIM_H */ - diff --git a/sys/cam/ctl/README.ctl.txt b/sys/cam/ctl/README.ctl.txt index 89030e20298a..27ebe49aec56 100644 --- a/sys/cam/ctl/README.ctl.txt +++ b/sys/cam/ctl/README.ctl.txt @@ -162,7 +162,6 @@ LUN Backend Size (Blocks) BS Serial Number Device ID 11 ramdisk 204800000000000 512 MYSERIAL 1 MYDEVID 1 lun_type=0 - Revision 1.4 Changes ==================== - Added in the second HA mode (where CTL does the data transfers instead @@ -172,7 +171,7 @@ Revision 1.4 Changes - Fixed the phantom device problem in the CTL CAM SIM and improved the CAM SIM to automatically trigger a rescan when the port is enabled and disabled. - + - Made the number of threads in the block backend configurable via sysctl, loader tunable and the ctladm command line. (You can now specify -o num_threads=4 when creating a LUN with ctladm create.) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 0a09cc0b2c80..7887009d351c 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -584,7 +584,6 @@ static struct cdevsw ctl_cdevsw = { .d_name = "ctl", }; - MALLOC_DEFINE(M_CTL, "ctlmem", "Memory used for CTL"); static int ctl_module_event_handler(module_t, int /*modeventtype_t*/, void *); @@ -1916,7 +1915,6 @@ ctl_init(void) softc->ctl_ports = malloc(sizeof(struct ctl_port *) * ctl_max_ports, M_DEVBUF, M_WAITOK | M_ZERO); - /* * In Copan's HA scheme, the "master" and "slave" roles are * figured out through the slot the controller is in. Although it @@ -2472,7 +2470,6 @@ ctl_sbuf_printf_esc(struct sbuf *sb, char *str, int size) if (retval != 0) break; - } return (retval); @@ -3985,7 +3982,6 @@ ctl_expand_number(const char *buf, uint64_t *num) return (0); } - /* * This routine could be used in the future to load default and/or saved * mode page parameters for a particuar lun. @@ -4002,7 +3998,6 @@ ctl_init_page_index(struct ctl_lun *lun) sizeof(page_index_template)); for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { - page_index = &lun->mode_pages.index[i]; if (lun->be_lun->lun_type == T_DIRECT && (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) @@ -4415,7 +4410,6 @@ ctl_init_log_page_index(struct ctl_lun *lun) prev = -1; for (i = 0, j = 0, k = 0; i < CTL_NUM_LOG_PAGES; i++) { - page_index = &lun->log_pages.index[i]; if (lun->be_lun->lun_type == T_DIRECT && (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) @@ -5279,7 +5273,6 @@ ctl_start_stop(struct ctl_scsiio *ctsio) residx = ctl_get_initindex(&ctsio->io_hdr.nexus); if (ctl_get_prkey(lun, residx) == 0 || (lun->pr_res_idx != residx && lun->pr_res_type < 4)) { - ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -5996,7 +5989,6 @@ do_next_page: ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } else if (*len_left < sizeof(struct scsi_mode_page_header)) { - free(ctsio->kern_data_ptr, M_CTL); ctl_set_param_len_error(ctsio); ctl_done((union ctl_io *)ctsio); @@ -6004,14 +5996,12 @@ do_next_page: } else if ((page_header->page_code & SMPH_SPF) && (*len_left < sizeof(struct scsi_mode_page_header_sp))) { - free(ctsio->kern_data_ptr, M_CTL); ctl_set_param_len_error(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } - /* * XXX KDM should we do something with the block descriptor? */ @@ -8191,7 +8181,6 @@ ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg) } - int ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) { @@ -8310,7 +8299,6 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) switch (cdb->action & SPRO_ACTION_MASK) { case SPRO_REGISTER: case SPRO_REG_IGNO: { - /* * We don't support any of these options, as we report in * the read capabilities request (see @@ -8397,7 +8385,6 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) ctl_ha_msg_send(CTL_HA_CHAN_CTL, &persis_io, sizeof(persis_io.pr), M_WAITOK); } else /* sa_res_key != 0 */ { - /* * If we aren't registered currently then increment * the key count and set the registered flag. @@ -9497,7 +9484,6 @@ ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len) return (CTL_RETVAL_COMPLETE); } - /* * SCSI VPD page 0x86, the Extended INQUIRY Data page. */ @@ -11586,7 +11572,6 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) } } - if (ctl_scsiio_lun_check(lun, entry, ctsio) != 0) { mtx_unlock(&lun->lun_lock); ctl_done((union ctl_io *)ctsio); @@ -11925,7 +11910,6 @@ ctl_abort_tasks_lun(struct ctl_lun *lun, uint32_t targ_port, uint32_t init_id, */ for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - if ((targ_port == UINT32_MAX || targ_port == xio->io_hdr.nexus.targ_port) && (init_id == UINT32_MAX || @@ -12077,7 +12061,6 @@ ctl_abort_task(union ctl_io *io) */ for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - if ((xio->io_hdr.nexus.targ_port != io->io_hdr.nexus.targ_port) || (xio->io_hdr.nexus.initid != io->io_hdr.nexus.initid) || (xio->io_hdr.flags & CTL_FLAG_ABORT)) @@ -12149,7 +12132,6 @@ ctl_query_task(union ctl_io *io, int task_set) mtx_unlock(&softc->ctl_lock); for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - if ((xio->io_hdr.nexus.targ_port != io->io_hdr.nexus.targ_port) || (xio->io_hdr.nexus.initid != io->io_hdr.nexus.initid) || (xio->io_hdr.flags & CTL_FLAG_ABORT)) @@ -12327,7 +12309,6 @@ ctl_handle_isc(union ctl_io *io) } - /* * Returns the match type in the case of a match, or CTL_LUN_PAT_NONE if * there is no match. @@ -12528,7 +12509,6 @@ ctl_datamove(union ctl_io *io) lun = CTL_LUN(io); if ((lun != NULL) && (lun->delay_info.datamove_delay > 0)) { - callout_init(&io->io_hdr.delay_callout, /*mpsafe*/ 1); io->io_hdr.flags |= CTL_FLAG_DELAY_DONE; callout_reset(&io->io_hdr.delay_callout, @@ -12798,7 +12778,6 @@ ctl_datamove_remote_xfer(union ctl_io *io, unsigned command, if ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE && (io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS) { - if (rq != NULL) ctl_dt_req_free(rq); @@ -13339,7 +13318,6 @@ ctl_done(union ctl_io *io) if ((lun != NULL) && (lun->delay_info.done_delay > 0)) { - callout_init(&io->io_hdr.delay_callout, /*mpsafe*/ 1); io->io_hdr.flags |= CTL_FLAG_DELAY_DONE; callout_reset(&io->io_hdr.delay_callout, diff --git a/sys/cam/ctl/ctl_backend.c b/sys/cam/ctl/ctl_backend.c index 71d4b001e6e6..b7f154f6bfad 100644 --- a/sys/cam/ctl/ctl_backend.c +++ b/sys/cam/ctl/ctl_backend.c @@ -139,4 +139,3 @@ ctl_backend_find(char *backend_name) return (NULL); } - diff --git a/sys/cam/ctl/ctl_backend.h b/sys/cam/ctl/ctl_backend.h index 4d75a20f3559..be8ab4d1706b 100644 --- a/sys/cam/ctl/ctl_backend.h +++ b/sys/cam/ctl/ctl_backend.h @@ -79,7 +79,6 @@ typedef enum { MODULE_DEPEND(name, ctl, 1, 1, 1); \ MODULE_DEPEND(name, cam, 1, 1, 1) - struct ctl_be_lun; typedef void (*be_callback_t)(struct ctl_be_lun *be_lun); diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 643be93d8318..75161bf6ca0c 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -1317,7 +1317,6 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun, pbo = 0; len_left = (uint64_t)lbalen->len * cbe_lun->blocksize; for (i = 0, lba = 0; i < CTLBLK_MAX_SEGS && len_left > 0; i++) { - /* * Setup the S/G entry for this chunk. */ @@ -2783,7 +2782,6 @@ ctl_be_block_init(void) return (0); } - static int ctl_be_block_shutdown(void) { diff --git a/sys/cam/ctl/ctl_cmd_table.c b/sys/cam/ctl/ctl_cmd_table.c index b3780dcf8c67..0e7268389c3b 100644 --- a/sys/cam/ctl/ctl_cmd_table.c +++ b/sys/cam/ctl/ctl_cmd_table.c @@ -738,7 +738,6 @@ const struct ctl_cmd_entry ctl_cmd_table_9b[32] = /* 1d-1f */ }; - /* 9E SERVICE ACTION IN(16) */ const struct ctl_cmd_entry ctl_cmd_table_9e[32] = { diff --git a/sys/cam/ctl/ctl_frontend_ioctl.c b/sys/cam/ctl/ctl_frontend_ioctl.c index 0280391242d2..370e553042c5 100644 --- a/sys/cam/ctl/ctl_frontend_ioctl.c +++ b/sys/cam/ctl/ctl_frontend_ioctl.c @@ -84,10 +84,8 @@ struct cfi_softc { TAILQ_HEAD(, cfi_port) ports; }; - static struct cfi_softc cfi_softc; - static int cfi_init(void); static int cfi_shutdown(void); static void cfi_datamove(union ctl_io *io); @@ -183,7 +181,7 @@ cfi_ioctl_port_create(struct ctl_req *req) val = dnvlist_get_string(req->args_nvl, "pp", NULL); if (val != NULL) pp = strtol(val, NULL, 10); - + val = dnvlist_get_string(req->args_nvl, "vp", NULL); if (val != NULL) vp = strtol(val, NULL, 10); diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 82bb4e162a94..0b91d4fd39c1 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -1183,7 +1183,6 @@ cfiscsi_maintenance_thread(void *arg) CFISCSI_SESSION_UNLOCK(cs); if (cs->cs_terminating && cs->cs_handoff_in_progress == false) { - /* * We used to wait up to 30 seconds to deliver queued * PDUs to the initiator. We also tried hard to deliver @@ -2137,7 +2136,6 @@ cfiscsi_ioctl_port_create(struct ctl_req *req) val = dnvlist_get_string(req->args_nvl, "cfiscsi_portal_group_tag", NULL); - if (target == NULL || val == NULL) { req->status = CTL_LUN_ERROR; snprintf(req->error_str, sizeof(req->error_str), diff --git a/sys/cam/ctl/ctl_ha.c b/sys/cam/ctl/ctl_ha.c index 572bdc40badc..80dfc543303d 100644 --- a/sys/cam/ctl/ctl_ha.c +++ b/sys/cam/ctl/ctl_ha.c @@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$"); #include #include - struct ha_msg_wire { uint32_t channel; uint32_t length; @@ -875,7 +874,6 @@ ctl_dt_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) } } - ctl_ha_status ctl_ha_msg_init(struct ctl_softc *ctl_softc) { diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index 4925c25109bf..6427685f99a8 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -112,7 +112,6 @@ typedef enum { CTL_FLAG_SERSEQ_DONE = 0x20000000 /* All storage I/O started */ } ctl_io_flags; - struct ctl_lba_len { uint64_t lba; uint32_t len; @@ -375,7 +374,6 @@ struct ctl_taskio { uint8_t task_resp[3];/* Response information */ }; - /* * HA link messages. */ diff --git a/sys/cam/ctl/ctl_scsi_all.c b/sys/cam/ctl/ctl_scsi_all.c index 8dc59e0a5262..98dba8cf2d83 100644 --- a/sys/cam/ctl/ctl_scsi_all.c +++ b/sys/cam/ctl/ctl_scsi_all.c @@ -136,7 +136,6 @@ ctl_scsi_sense_sbuf(struct ctl_scsiio *ctsio, ctl_scsi_path_string((union ctl_io *)ctsio, path_str, sizeof(path_str)); if (flags & SSS_FLAG_PRINT_COMMAND) { - sbuf_cat(sb, path_str); ctl_scsi_command_string(ctsio, inq_data, sb); @@ -204,4 +203,3 @@ ctl_scsi_sense_print(struct ctl_scsiio *ctsio, } #endif /* _KERNEL */ - diff --git a/sys/cam/ctl/ctl_ser_table.c b/sys/cam/ctl/ctl_ser_table.c index 2793bfa1e281..5499e63534fa 100644 --- a/sys/cam/ctl/ctl_ser_table.c +++ b/sys/cam/ctl/ctl_ser_table.c @@ -81,4 +81,3 @@ ctl_serialize_table[CTL_SERIDX_COUNT][CTL_SERIDX_COUNT] = { /*FORMAT */{ pS, bK, bK, bK, bK, bK, bK, pS, pS, bK, bK, bK, bK, bK}, /*START */{ bK, bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK}, }; - diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c index 00fb3a52b3d4..456157749c89 100644 --- a/sys/cam/ctl/ctl_tpc.c +++ b/sys/cam/ctl/ctl_tpc.c @@ -2472,4 +2472,3 @@ ctl_report_all_rod_tokens(struct ctl_scsiio *ctsio) ctl_datamove((union ctl_io *)ctsio); return (retval); } - diff --git a/sys/cam/ctl/ctl_tpc_local.c b/sys/cam/ctl/ctl_tpc_local.c index f88565db8355..714240fe8228 100644 --- a/sys/cam/ctl/ctl_tpc_local.c +++ b/sys/cam/ctl/ctl_tpc_local.c @@ -71,7 +71,6 @@ static int tpcl_shutdown(void); static void tpcl_datamove(union ctl_io *io); static void tpcl_done(union ctl_io *io); - static struct ctl_frontend tpcl_frontend = { .name = "tpc", diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index 912c4c49245d..569923f9be70 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -383,7 +383,6 @@ ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) break; } case AC_PATH_DEREGISTERED: { - if (softc != NULL) { /* * XXX KDM are we certain at this point that there @@ -463,7 +462,7 @@ ctlferegister(struct cam_periph *periph, void *arg) softc = (struct ctlfe_lun_softc *)arg; bus_softc = softc->parent_softc; - + STAILQ_INIT(&softc->work_queue); LIST_INIT(&softc->atio_list); LIST_INIT(&softc->inot_list); @@ -1116,7 +1115,6 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) switch (done_ccb->ccb_h.func_code) { case XPT_ACCEPT_TARGET_IO: { - LIST_REMOVE(&done_ccb->ccb_h, periph_links.le); atio = &done_ccb->atio; status = atio->ccb_h.status & CAM_STATUS_MASK; diff --git a/sys/cam/mmc/mmc_da.c b/sys/cam/mmc/mmc_da.c index 7d78685c81df..6bec3b11b9b4 100644 --- a/sys/cam/mmc/mmc_da.c +++ b/sys/cam/mmc/mmc_da.c @@ -75,7 +75,6 @@ __FBSDID("$FreeBSD$"); #include #include - #include #ifdef _KERNEL @@ -268,7 +267,6 @@ mmc_handle_reply(union ccb *ccb) return (0); /* Normal return */ } - static uint32_t mmc_get_bits(uint32_t *bits, int bit_len, int start, int size) { @@ -280,7 +278,6 @@ mmc_get_bits(uint32_t *bits, int bit_len, int start, int size) return (retval & ((1llu << size) - 1)); } - static void mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd) { @@ -752,7 +749,6 @@ sddaasync(void *callback_arg, u_int32_t code, } } - static int sddagetattr(struct bio *bp) { @@ -1021,7 +1017,6 @@ static int mmc_sd_switch(struct cam_periph *periph, union ccb *ccb, uint8_t mode, uint8_t grp, uint8_t value, uint8_t *res) { - struct mmc_data mmc_d; uint32_t arg; int err; @@ -1303,7 +1298,6 @@ sdda_start_init(void *context, union ccb *start_ccb) /* FIXME: there should be a better name for this option...*/ mmcp->card_features |= CARD_FEATURE_SDHC; } - } CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, ("Capacity: %"PRIu64", sectors: %"PRIu64"\n", diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c index ea0426dbc478..d27023e87c69 100644 --- a/sys/cam/mmc/mmc_xpt.c +++ b/sys/cam/mmc/mmc_xpt.c @@ -292,7 +292,6 @@ mmc_action(union ccb *start_ccb) ("mmc_action! func_code=%x, action %s\n", start_ccb->ccb_h.func_code, xpt_action_name(start_ccb->ccb_h.func_code))); switch (start_ccb->ccb_h.func_code) { - case XPT_SCAN_BUS: /* FALLTHROUGH */ case XPT_SCAN_TGT: @@ -601,7 +600,6 @@ mmcprobe_start(struct cam_periph *periph, union ccb *start_ccb) softc->action = PROBE_RESET; else softc->action = PROBE_IDENTIFY; - } /* Here is the place where the identify fun begins */ @@ -852,7 +850,6 @@ mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb) mmcp->card_features |= CARD_FEATURE_SD20; CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("SD 2.0 interface conditions: OK\n")); - } PROBE_SET_ACTION(softc, PROBE_SDIO_RESET); break; diff --git a/sys/cam/nvme/nvme_all.c b/sys/cam/nvme/nvme_all.c index 9ed16df40852..c7cf4ea29dd7 100644 --- a/sys/cam/nvme/nvme_all.c +++ b/sys/cam/nvme/nvme_all.c @@ -85,7 +85,6 @@ nvme_identify_match(caddr_t identbuffer, caddr_t table_entry) return 0; } - void nvme_print_ident(const struct nvme_controller_data *cdata, const struct nvme_namespace_data *data, struct sbuf *sb) diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c index 892dee5a9959..6ff2388a63f8 100644 --- a/sys/cam/nvme/nvme_da.c +++ b/sys/cam/nvme/nvme_da.c @@ -86,7 +86,7 @@ typedef enum { NDA_Q_4K = 0x01, NDA_Q_NONE = 0x00, } nda_quirks; - + #define NDA_Q_BIT_STRING \ "\020" \ "\001Bit 0" @@ -335,7 +335,6 @@ ndaclose(struct disk *dp) if ((softc->flags & NDA_FLAG_DIRTY) != 0 && (periph->flags & CAM_PERIPH_INVALID) == 0 && cam_periph_hold(periph, PRIBIO) == 0) { - ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); nda_nvme_flush(softc, &ccb->nvmeio); error = cam_periph_runccb(ccb, ndaerror, /*cam_flags*/0, @@ -467,7 +466,7 @@ ndastrategy(struct bio *bp) { struct cam_periph *periph; struct nda_softc *softc; - + periph = (struct cam_periph *)bp->bio_disk->d_drv1; softc = (struct nda_softc *)periph->softc; @@ -483,7 +482,7 @@ ndastrategy(struct bio *bp) biofinish(bp, NULL, ENXIO); return; } - + if (bp->bio_cmd == BIO_DELETE) softc->deletes++; @@ -519,7 +518,7 @@ ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len secsize = softc->disk->d_sectorsize; lba = offset / secsize; count = length / secsize; - + if ((periph->flags & CAM_PERIPH_INVALID) != 0) return (ENXIO); @@ -536,7 +535,7 @@ ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len return (error); } - + /* Flush */ xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); @@ -564,7 +563,6 @@ ndainit(void) printf("nda: Failed to attach master async callback " "due to status 0x%x!\n", status); } else if (nda_send_ordered) { - /* Register our event handlers */ if ((EVENTHANDLER_REGISTER(power_suspend, ndasuspend, NULL, EVENTHANDLER_PRI_LAST)) == NULL) @@ -656,7 +654,7 @@ ndaasync(void *callback_arg, u_int32_t code, { struct ccb_getdev *cgd; cam_status status; - + cgd = (struct ccb_getdev *)arg; if (cgd == NULL) break; diff --git a/sys/cam/nvme/nvme_xpt.c b/sys/cam/nvme/nvme_xpt.c index fbb9cf19d839..126b284936bb 100644 --- a/sys/cam/nvme/nvme_xpt.c +++ b/sys/cam/nvme/nvme_xpt.c @@ -849,4 +849,3 @@ nvme_proto_debug_out(union ccb *ccb) ccb->ccb_h.func_code == XPT_NVME_ADMIN), nvme_cmd_string(&ccb->nvmeio.cmd, cdb_str, sizeof(cdb_str)))); } - diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index 79ac6a0a3704..5f076acbe9b2 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -691,7 +691,7 @@ scsi_op_desc(u_int16_t opcode, struct scsi_inquiry_data *inq_data) return(table[j][i].desc); } } - + /* * If we can't find a match for the command in the table, we just * assume it's a vendor specifc command. @@ -710,7 +710,6 @@ scsi_op_desc(u_int16_t opcode, struct scsi_inquiry_data *inq_data) #endif - #if !defined(SCSI_NO_SENSE_STRINGS) #define SST(asc, ascq, action, desc) \ asc, ascq, action, desc @@ -3230,7 +3229,6 @@ ascentrycomp(const void *key, const void *member) table_entry = (const struct asc_table_entry *)member; if (asc >= table_entry->asc) { - if (asc > table_entry->asc) return (1); @@ -4353,7 +4351,6 @@ scsi_command_sbuf(struct sbuf *sb, uint8_t *cdb, int cdb_len, sbuf_printf(sb, "Command Specific Info: %#jx", csi); } - void scsi_progress_sbuf(struct sbuf *sb, uint16_t progress) { @@ -4962,7 +4959,6 @@ scsi_sense_only_sbuf(struct scsi_sense_data *sense, u_int sense_len, scsi_desc_iterate(desc_sense, sense_len, scsi_print_desc_func, &print_info); break; - } case -1: /* @@ -5063,7 +5059,6 @@ scsi_sense_sbuf(struct cam_device *device, struct ccb_scsiio *csio, sense = NULL; if (flags & SSS_FLAG_PRINT_COMMAND) { - sbuf_cat(sb, path_str); #ifdef _KERNEL @@ -5119,8 +5114,6 @@ scsi_sense_sbuf(struct cam_device *device, struct ccb_scsiio *csio, return(0); } - - #ifdef _KERNEL char * scsi_sense_string(struct ccb_scsiio *csio, char *str, int str_len) @@ -5530,7 +5523,6 @@ scsi_calc_syncsrate(u_int period_factor) num_syncrates = nitems(scsi_syncrates); /* See if the period is in the "exception" table */ for (i = 0; i < num_syncrates; i++) { - if (period_factor == scsi_syncrates[i].period_factor) { /* Period in kHz */ return (100000000 / scsi_syncrates[i].period); @@ -5562,7 +5554,6 @@ scsi_calc_syncparam(u_int period) num_syncrates = nitems(scsi_syncrates); /* See if the period is in the "exception" table */ for (i = 0; i < num_syncrates; i++) { - if (period <= scsi_syncrates[i].period) { /* Period in 100ths of ns */ return (scsi_syncrates[i].period_factor); @@ -5713,7 +5704,6 @@ scsi_get_devid_desc(struct scsi_vpd_id_descriptor *desc, uint32_t len, desc->identifier + desc->length <= desc_buf_end; desc = (struct scsi_vpd_id_descriptor *)(desc->identifier + desc->length)) { - if (ck_fn == NULL || ck_fn((uint8_t *)desc) != 0) return (desc); } @@ -7893,7 +7883,6 @@ scsi_read_capacity_16(struct ccb_scsiio *csio, uint32_t retries, { struct scsi_read_capacity_16 *scsi_cmd; - cam_fill_csio(csio, retries, cbfcnp, @@ -8489,7 +8478,6 @@ scsi_ata_pass(struct ccb_scsiio *csio, uint32_t retries, protocol |= AP_EXTEND; } - if ((cmd_size > sizeof(csio->cdb_io.cdb_bytes)) && ((cdb_storage == NULL) || (cdb_storage_len < cmd_size))) { @@ -8867,7 +8855,7 @@ scsi_read_attribute(struct ccb_scsiio *csio, u_int32_t retries, scsi_ulto4b(length, scsi_cmd->length); if (cache != 0) scsi_cmd->cache |= SRA_CACHE; - + cam_fill_csio(csio, retries, cbfcnp, @@ -9076,7 +9064,7 @@ scsi_inquiry_match(caddr_t inqbuffer, caddr_t table_entry) { struct scsi_inquiry_pattern *entry; struct scsi_inquiry_data *inq; - + entry = (struct scsi_inquiry_pattern *)table_entry; inq = (struct scsi_inquiry_data *)inqbuffer; @@ -9103,7 +9091,7 @@ scsi_static_inquiry_match(caddr_t inqbuffer, caddr_t table_entry) { struct scsi_static_inquiry_pattern *entry; struct scsi_inquiry_data *inq; - + entry = (struct scsi_static_inquiry_pattern *)table_entry; inq = (struct scsi_inquiry_data *)inqbuffer; @@ -9166,7 +9154,6 @@ scsi_devid_match(uint8_t *lhs, size_t lhs_len, uint8_t *rhs, size_t rhs_len) rhs_id = (struct scsi_vpd_id_descriptor *)rhs; while (rhs_id <= rhs_last && (rhs_id->identifier + rhs_id->length) <= rhs_end) { - if ((rhs_id->id_type & (SVPD_ID_ASSOC_MASK | SVPD_ID_TYPE_MASK)) == (lhs_id->id_type & diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h index b9ee683f5990..ff27388e446c 100644 --- a/sys/cam/scsi/scsi_all.h +++ b/sys/cam/scsi/scsi_all.h @@ -919,7 +919,6 @@ struct scsi_reserve_10 { uint8_t control; }; - struct scsi_release { u_int8_t opcode; @@ -1099,7 +1098,6 @@ struct scsi_write_attribute u_int8_t control; }; - struct scsi_read_attribute_values { u_int8_t length[4]; @@ -1416,7 +1414,6 @@ struct scsi_write_verify_16 uint8_t control; }; - struct scsi_start_stop_unit { u_int8_t opcode; @@ -2079,7 +2076,6 @@ struct ata_pass_32 { uint8_t auxiliary[4]; }; - #define SC_SCSI_1 0x01 #define SC_SCSI_2 0x03 @@ -2370,7 +2366,6 @@ struct scsi_vpd_supported_pages u_int8_t page_list[0]; }; - struct scsi_vpd_unit_serial_number { u_int8_t device; @@ -2671,7 +2666,6 @@ struct scsi_vpd_scsi_ports */ #define SVPD_ATA_INFORMATION 0x89 - struct scsi_vpd_tpc_descriptor { uint8_t desc_type[2]; @@ -3235,7 +3229,6 @@ typedef enum { SSD_ELEM_MAX } scsi_sense_elem_type; - struct scsi_sense_data { uint8_t error_code; @@ -3411,7 +3404,6 @@ struct scsi_sense_sks_field uint8_t field[2]; }; - /* * This is used for the Hardware Error (0x04), Medium Error (0x03) and * Recovered Error (0x01) sense keys. @@ -3481,7 +3473,7 @@ struct scsi_sense_fru * * Maximum descriptors allowed: 1 (as of SPC-4) */ - + struct scsi_sense_stream { uint8_t desc_type; @@ -3670,7 +3662,6 @@ struct scsi_mode_page_header_sp uint8_t page_length[2]; }; - struct scsi_mode_blk_desc { u_int8_t density; @@ -3682,7 +3673,6 @@ struct scsi_mode_blk_desc #define SCSI_DEFAULT_DENSITY 0x00 /* use 'default' density */ #define SCSI_SAME_DENSITY 0x7f /* use 'same' density- >= SCSI-2 only */ - /* * Status Byte */ @@ -3988,7 +3978,6 @@ int scsi_parse_transportid(char *transportid_str, #endif char *error_str, int error_str_len); - int scsi_attrib_volcoh_sbuf(struct sbuf *sb, struct scsi_mam_attribute_header *hdr, uint32_t valid_len, uint32_t flags, @@ -4417,7 +4406,7 @@ static __inline int32_t scsi_3btol(const uint8_t *bytes) { uint32_t rc = scsi_3btoul(bytes); - + if (rc & 0x00800000) rc |= 0xff000000; @@ -4440,7 +4429,7 @@ static __inline uint64_t scsi_8btou64(const uint8_t *bytes) { uint64_t rv; - + rv = (((uint64_t)bytes[0]) << 56) | (((uint64_t)bytes[1]) << 48) | (((uint64_t)bytes[2]) << 40) | diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 4f8ec3112896..2b4bdc6020fd 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -1091,7 +1091,6 @@ cdstart(struct cam_periph *periph, union ccb *start_ccb) break; } case CD_STATE_MEDIA_TOC_FULL: { - bzero(&softc->toc, sizeof(softc->toc)); scsi_read_toc(&start_ccb->csio, @@ -1339,7 +1338,6 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) announce_buf = NULL; } else { - /* * Invalidate this peripheral. */ @@ -1382,7 +1380,6 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) case CD_CCB_TUR: { if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (cderror(done_ccb, CAM_RETRY_SELTO, SF_RETRY_UA | SF_NO_RECOVERY | SF_NO_PRINT) == ERESTART) @@ -1791,7 +1788,6 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td) cam_periph_unlock(periph); switch (cmd) { - case CDIOCPLAYTRACKS: { struct ioc_play_track *args @@ -1944,7 +1940,6 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td) CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYBLOCKS\n")); - error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { free(params.mode_buf, M_SCSICD); @@ -2818,7 +2813,6 @@ cdcheckmedia(struct cam_periph *periph) */ cdindex = toch->starting_track + num_entries -1; if (cdindex == toch->ending_track + 1) { - error = cdreadtoc(periph, CD_MSF_FORMAT, LEADOUT, (u_int8_t *)&leadout, sizeof(leadout), SF_NO_PRINT); @@ -3219,7 +3213,6 @@ cdreadsubchannel(struct cam_periph *periph, u_int32_t mode, return(error); } - /* * All MODE_SENSE requests in the cd(4) driver MUST go through this * routine. See comments in cd6byteworkaround() for details. @@ -3417,7 +3410,6 @@ cdsetmode(struct cam_periph *periph, struct cd_mode_params *data) return (error); } - static int cdplay(struct cam_periph *periph, u_int32_t blk, u_int32_t len) { @@ -3518,7 +3510,6 @@ cdplaymsf(struct cam_periph *periph, u_int32_t startm, u_int32_t starts, return(error); } - static int cdplaytracks(struct cam_periph *periph, u_int32_t strack, u_int32_t sindex, u_int32_t etrack, u_int32_t eindex) @@ -4188,7 +4179,6 @@ scsi_send_key(struct ccb_scsiio *csio, u_int32_t retries, timeout); } - void scsi_read_dvd_structure(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), diff --git a/sys/cam/scsi/scsi_cd.h b/sys/cam/scsi/scsi_cd.h index 3785c84677dd..0968dafe4d2d 100644 --- a/sys/cam/scsi/scsi_cd.h +++ b/sys/cam/scsi/scsi_cd.h @@ -886,4 +886,3 @@ void scsi_read_toc(struct ccb_scsiio *csio, uint32_t retries, __END_DECLS #endif /*_SCSI_SCSI_CD_H*/ - diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index b84849f2e0de..64b0947eaf8d 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -356,7 +356,6 @@ chasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) "due to status 0x%x\n", status); break; - } default: cam_periph_async(periph, code, path, arg); @@ -426,7 +425,6 @@ chregister(struct cam_periph *periph, void *arg) return (CAM_REQ_CMP_ERR); } - /* Register the device */ make_dev_args_init(&args); args.mda_devsw = &ch_cdevsw; @@ -473,7 +471,7 @@ chopen(struct cdev *dev, int flags, int fmt, struct thread *td) softc = (struct ch_softc *)periph->softc; cam_periph_lock(periph); - + if (softc->flags & CH_FLAG_INVALID) { cam_periph_release_locked(periph); cam_periph_unlock(periph); @@ -612,7 +610,6 @@ chdone(struct cam_periph *periph, union ccb *done_ccb) struct page_element_address_assignment *ea; char announce_buf[80]; - mode_header = (struct scsi_mode_header_6 *)csio->data_ptr; ea = (struct page_element_address_assignment *) @@ -713,7 +710,6 @@ chdone(struct cam_periph *periph, union ccb *done_ccb) "to attach to device\n"); cam_periph_invalidate(periph); - } } softc->state = CH_STATE_NORMAL; @@ -1088,7 +1084,6 @@ copy_element_status(struct ch_softc *softc, ces->ces_flags |= CES_INVERT; if (desc->flags2 & READ_ELEMENT_STATUS_SVALID) { - eaddr = scsi_2btoul(desc->ssea); /* convert source address to logical format */ @@ -1524,7 +1519,7 @@ chsetvoltag(struct cam_periph *periph, /* parameters */ &ssvtp, /* sense_len */ SSD_FULL_SIZE, /* timeout */ CH_TIMEOUT_SEND_VOLTAG); - + error = cam_periph_runccb(ccb, cherror, /*cam_flags*/ CAM_RETRY_SELTO, /*sense_flags*/ SF_RETRY_UA, softc->device_stats); @@ -1652,7 +1647,7 @@ chgetparams(struct cam_periph *periph) /* param_len */ mode_buffer_len, /* sense_len */ SSD_FULL_SIZE, /* timeout */ CH_TIMEOUT_MODE_SENSE); - + error = cam_periph_runccb(ccb, cherror, /*cam_flags*/ CAM_RETRY_SELTO, /* sense_flags */ SF_RETRY_UA | SF_NO_PRINT, softc->device_stats); diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index d648d511b1a2..b5d8585f96eb 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -1799,7 +1799,6 @@ daclose(struct disk *dp) ("daclose\n")); if (da_periph_hold(periph, PRIBIO, DA_REF_CLOSE_HOLD) == 0) { - /* Flush disk cache. */ if ((softc->flags & DA_FLAG_DIRTY) != 0 && (softc->quirks & DA_Q_NO_SYNC_CACHE) == 0 && @@ -1946,7 +1945,6 @@ dadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t leng * Sync the disk cache contents to the physical media. */ if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0) { - xpt_setup_ccb(&csio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); csio.ccb_h.ccb_state = DA_CCB_DUMP; scsi_synchronize_cache(&csio, @@ -1999,7 +1997,6 @@ dainit(void) printf("da: Failed to attach master async callback " "due to status 0x%x!\n", status); } else if (da_send_ordered) { - /* Register our shutdown event handler */ if ((EVENTHANDLER_REGISTER(shutdown_post_sync, dashutdown, NULL, SHUTDOWN_PRI_DEFAULT)) == NULL) @@ -3858,7 +3855,6 @@ out: free(sup_cap, M_SCSIDA); daprobedone(periph, start_ccb); break; - } start_ccb->ccb_h.ccb_bp = NULL; @@ -4873,7 +4869,6 @@ dadone_proberc(struct cam_periph *periph, union ccb *done_ccb) /*timeout*/0, /*getcount_only*/0); - xpt_setup_ccb(&cgd.ccb_h, done_ccb->ccb_h.path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; @@ -5786,7 +5781,6 @@ dadone_probeatazone(struct cam_periph *periph, union ccb *done_ccb) /*getcount_only*/0); } } - } free(csio->data_ptr, M_SCSIDA); @@ -5886,7 +5880,6 @@ dadone_tur(struct cam_periph *periph, union ccb *done_ccb) cam_periph_assert(periph, MA_OWNED); if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (daerror(done_ccb, CAM_RETRY_SELTO, SF_RETRY_UA | SF_NO_RECOVERY | SF_NO_PRINT) == ERESTART) return; /* Will complete again, keep reference */ @@ -6517,7 +6510,6 @@ scsi_ata_zac_mgmt_out(struct ccb_scsiio *csio, uint32_t retries, retval = 1; goto bailout; } - } auxiliary = (zm_action & 0xf) | (zone_flags << 8); diff --git a/sys/cam/scsi/scsi_da.h b/sys/cam/scsi/scsi_da.h index a679114dd88a..2472eda6dc91 100644 --- a/sys/cam/scsi/scsi_da.h +++ b/sys/cam/scsi/scsi_da.h @@ -393,7 +393,6 @@ struct scsi_reassign_blocks_data } defect_descriptor[1]; }; - /* * This is the list header for the READ DEFECT DATA(10) command above. * It may be a bit wrong to append the 10 at the end of the data structure, @@ -609,7 +608,6 @@ struct scsi_rigid_disk_page { uint8_t reserved2[2]; }; - struct scsi_da_rw_recovery_page { u_int8_t page_code; #define SMS_RW_ERROR_RECOVERY_PAGE 0x01 diff --git a/sys/cam/scsi/scsi_enc.c b/sys/cam/scsi/scsi_enc.c index 9d3aadee1740..30cbf108fd44 100644 --- a/sys/cam/scsi/scsi_enc.c +++ b/sys/cam/scsi/scsi_enc.c @@ -429,7 +429,7 @@ enc_ioctl(struct cdev *dev, u_long cmd, caddr_t arg_addr, int flag, return (EBADF); } } - + /* * XXX The values read here are only valid for the current * configuration generation. We need these ioctls @@ -765,7 +765,7 @@ enc_fsm_step(enc_softc_t *enc) struct enc_fsm_state *cur_state; int error; uint32_t xfer_len; - + ENC_DLOG(enc, "%s enter %p\n", __func__, enc); enc->current_action = ffs(enc->pending_actions) - 1; @@ -836,7 +836,6 @@ enc_daemon(void *arg) cam_periph_lock(enc->periph); while ((enc->enc_flags & ENC_FLAG_SHUTDOWN) == 0) { if (enc->pending_actions == 0) { - /* * Reset callout and msleep, or * issue timed task completion @@ -1034,4 +1033,3 @@ out: enc_dtor(periph); return (status); } - diff --git a/sys/cam/scsi/scsi_enc_safte.c b/sys/cam/scsi/scsi_enc_safte.c index 94219cde7a89..200c32073644 100644 --- a/sys/cam/scsi/scsi_enc_safte.c +++ b/sys/cam/scsi/scsi_enc_safte.c @@ -1043,7 +1043,7 @@ safte_set_enc_status(enc_softc_t *enc, uint8_t encstat, int slpflag) req.elm_idx = SES_SETSTATUS_ENC_IDX; req.elm_stat[0] = encstat & 0xf; req.result = 0; - + TAILQ_INSERT_TAIL(&cfg->requests, &req, links); enc_update_request(enc, SAFTE_PROCESS_CONTROL_REQS); cam_periph_sleep(enc->periph, &req, PUSER, "encstat", 0); @@ -1129,4 +1129,3 @@ safte_softc_init(enc_softc_t *enc) TAILQ_INIT(&cfg->requests); return (0); } - diff --git a/sys/cam/scsi/scsi_enc_ses.c b/sys/cam/scsi/scsi_enc_ses.c index c2b2a932a7fd..014fe9fcd525 100644 --- a/sys/cam/scsi/scsi_enc_ses.c +++ b/sys/cam/scsi/scsi_enc_ses.c @@ -439,7 +439,6 @@ ses_iter_next(struct ses_iterator *iter) * configuration has 0 objects. */ if (iter->global_element_index >= (int)iter->cache->nelms - 1) { - /* Elements exhausted. */ iter->type_index = ITERATOR_INDEX_END; iter->type_element_index = ITERATOR_INDEX_END; @@ -463,7 +462,6 @@ ses_iter_next(struct ses_iterator *iter) * count is non-zero. */ if (iter->type_element_index > element_type->hdr->etype_maxelt) { - /* * We've exhausted the elements of this type. * This next element belongs to the next type. @@ -625,7 +623,7 @@ ses_cache_free_status(enc_softc_t *enc, enc_cache_t *cache) ses_cache = cache->private; if (ses_cache->status_page == NULL) return; - + other_ses_cache = enc_other_cache(enc, cache)->private; if (other_ses_cache->status_page != ses_cache->status_page) ENC_FREE(ses_cache->status_page); @@ -647,7 +645,6 @@ ses_cache_free_elm_map(enc_softc_t *enc, enc_cache_t *cache) for (cur_elm = cache->elm_map, last_elm = &cache->elm_map[cache->nelms]; cur_elm != last_elm; cur_elm++) { - ENC_FREE_AND_NULL(cur_elm->elm_private); } ENC_FREE_AND_NULL(cache->elm_map); @@ -721,7 +718,6 @@ ses_cache_clone(enc_softc_t *enc, enc_cache_t *src, enc_cache_t *dst) for (dst_elm = dst->elm_map, src_elm = src->elm_map, last_elm = &src->elm_map[src->nelms]; src_elm != last_elm; src_elm++, dst_elm++) { - dst_elm->elm_private = malloc(sizeof(ses_element_t), M_SCSIENC, M_WAITOK); memcpy(dst_elm->elm_private, src_elm->elm_private, @@ -923,7 +919,6 @@ ses_path_iter_devid_callback(enc_softc_t *enc, enc_element_t *elem, device_match->path_id, device_match->target_id, device_match->target_lun) == CAM_REQ_CMP) { - args->callback(enc, elem, path, args->callback_arg); xpt_free_path(path); @@ -1051,7 +1046,6 @@ ses_setphyspath_callback(enc_softc_t *enc, enc_element_t *elm, cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE); if (strcmp(old_physpath, sbuf_data(args->physpath)) != 0) { - xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.buftype = CDAI_TYPE_PHYS_PATH; @@ -1386,7 +1380,6 @@ ses_process_config(enc_softc_t *enc, struct enc_fsm_state *state, err = 0; if (ses_config_cache_valid(ses_cache, cfg_page->hdr.gen_code)) { - /* Our cache is still valid. Proceed to fetching status. */ goto out; } @@ -1422,7 +1415,6 @@ ses_process_config(enc_softc_t *enc, struct enc_fsm_state *state, last_subenc = &subencs[ses_cache->ses_nsubencs - 1]; ntype = 0; while (cur_subenc <= last_subenc) { - if (!ses_enc_desc_is_complete(buf_subenc, last_valid_byte)) { ENC_VLOG(enc, "Enclosure %d Beyond End of " "Descriptors\n", cur_subenc - subencs); @@ -1612,7 +1604,6 @@ ses_process_status(enc_softc_t *enc, struct enc_fsm_state *state, __func__, length, xfer_len); while (cur_stat <= last_stat && (element = ses_iter_next(&iter)) != NULL) { - ENC_DLOG(enc, "%s: obj %d(%d,%d) off=0x%tx status=%jx\n", __func__, iter.global_element_index, iter.type_index, iter.type_element_index, (uint8_t *)cur_stat - buf, @@ -2077,7 +2068,6 @@ ses_process_elm_descs(enc_softc_t *enc, struct enc_fsm_state *state, ses_iter_init(enc, enc_cache, &iter); while (offset < plength && (element = ses_iter_next(&iter)) != NULL) { - if ((offset + sizeof(struct ses_elm_desc_hdr)) > plength) { ENC_VLOG(enc, "Element %d Descriptor Header Past " "End of Buffer\n", iter.global_element_index); @@ -2210,7 +2200,7 @@ ses_fill_control_request(enc_softc_t *enc, struct enc_fsm_state *state, enc_cache = &enc->enc_daemon_cache; ses_cache = enc_cache->private; hdr = (struct ses_control_page_hdr *)buf; - + if (ses_cache->status_page == NULL) { ses_terminate_control_requests(&ses->ses_requests, EIO); return (EIO); @@ -2231,7 +2221,6 @@ ses_fill_control_request(enc_softc_t *enc, struct enc_fsm_state *state, /* Apply incoming requests. */ while ((req = TAILQ_FIRST(&ses->ses_requests)) != NULL) { - TAILQ_REMOVE(&ses->ses_requests, req, links); req->result = ses_encode(enc, buf, plength, req); if (req->result != 0) { @@ -2769,7 +2758,7 @@ ses_set_enc_status(enc_softc_t *enc, uint8_t encstat, int slpflag) ses = enc->enc_private; req.elm_idx = SES_SETSTATUS_ENC_IDX; req.elm_stat.comstatus = encstat & 0xf; - + TAILQ_INSERT_TAIL(&ses->ses_requests, &req, links); enc_update_request(enc, SES_PROCESS_CONTROL_REQS); cam_periph_sleep(enc->periph, &req, PUSER, "encstat", 0); @@ -3055,4 +3044,3 @@ ses_softc_init(enc_softc_t *enc) return (0); } - diff --git a/sys/cam/scsi/scsi_message.h b/sys/cam/scsi/scsi_message.h index ddac571e6b43..c6fb7fca4c2e 100644 --- a/sys/cam/scsi/scsi_message.h +++ b/sys/cam/scsi/scsi_message.h @@ -73,4 +73,3 @@ #define MSG_QUERY_TASK 0x100 #define MSG_QUERY_TASK_SET 0x101 #define MSG_QUERY_ASYNC_EVENT 0x102 - diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index c6d6a5da4035..79e86ccaf267 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -445,7 +445,6 @@ pass_add_physpath(void *context, int pending) if (xpt_getattr(physpath, MAXPATHLEN, "GEOM::physpath", periph->path) == 0 && strlen(physpath) != 0) { - mtx_unlock(mtx); make_dev_physpath_alias(MAKEDEV_WAITOK, &softc->alias_dev, softc->dev, softc->alias_dev, physpath); @@ -484,7 +483,7 @@ passasync(void *callback_arg, u_int32_t code, { struct ccb_getdev *cgd; cam_status status; - + cgd = (struct ccb_getdev *)arg; if (cgd == NULL) break; @@ -833,7 +832,6 @@ passclose(struct cdev *dev, int flag, int fmt, struct thread *td) return (0); } - static void passstart(struct cam_periph *periph, union ccb *start_ccb) { @@ -1039,7 +1037,6 @@ passcreatezone(struct cam_periph *periph) ("%s called when the pass(4) zone is allocated!\n", __func__)); if ((softc->flags & PASS_FLAG_ZONE_INPROG) == 0) { - /* * We're the first context through, so we need to create * the pass(4) UMA zone for I/O requests. @@ -1694,7 +1691,6 @@ passmemdone(struct cam_periph *periph, struct pass_io_req *io_req) io_req->user_bufs[i]); goto bailout; } - } break; case CAM_DATA_PADDR: @@ -1756,7 +1752,6 @@ passdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread error = 0; switch (cmd) { - case CAMIOCOMMAND: { union ccb *inccb; @@ -2200,7 +2195,6 @@ passsendccb(struct cam_periph *periph, union ccb *ccb, union ccb *inccb) if ((fc == XPT_SCSI_IO) || (fc == XPT_ATA_IO) || (fc == XPT_SMP_IO) || (fc == XPT_DEV_MATCH) || (fc == XPT_DEV_ADVINFO) || (fc == XPT_MMC_IO) || (fc == XPT_NVME_ADMIN) || (fc == XPT_NVME_IO)) { - bzero(&mapinfo, sizeof(mapinfo)); /* @@ -2251,6 +2245,6 @@ passerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags) periph = xpt_path_periph(ccb->ccb_h.path); softc = (struct pass_softc *)periph->softc; - + return(cam_periph_error(ccb, cam_flags, sense_flags)); } diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index 39784b04a3f4..50ac160db6e9 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -117,7 +117,6 @@ static struct periph_driver ptdriver = PERIPHDRIVER_DECLARE(pt, ptdriver); - static struct cdevsw pt_cdevsw = { .d_version = D_VERSION, .d_flags = 0, @@ -195,7 +194,7 @@ ptstrategy(struct bio *bp) { struct cam_periph *periph; struct pt_softc *softc; - + periph = (struct cam_periph *)bp->bio_dev->si_drv1; bp->bio_resid = bp->bio_bcount; if (periph == NULL) { @@ -213,7 +212,7 @@ ptstrategy(struct bio *bp) biofinish(bp, NULL, ENXIO); return; } - + /* * Place it in the queue of disk activities for this disk */ @@ -368,7 +367,7 @@ ptasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) { struct ccb_getdev *cgd; cam_status status; - + cgd = (struct ccb_getdev *)arg; if (cgd == NULL) break; diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index ea0d61165174..fe2912c8b52c 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -124,7 +124,6 @@ typedef enum { /* bits in ccb_pflags */ #define SA_POSITION_UPDATED 0x1 - typedef enum { SA_FLAG_OPEN = 0x0001, SA_FLAG_FIXED = 0x0002, @@ -605,7 +604,6 @@ static void safilldenstypesb(struct sbuf *sb, int *indent, static void safilldensitysb(struct sa_softc *softc, int *indent, struct sbuf *sb); - #ifndef SA_DEFAULT_IO_SPLIT #define SA_DEFAULT_IO_SPLIT 0 #endif @@ -636,7 +634,6 @@ PERIPHDRIVER_DECLARE(sa, sadriver); #define D_TAPE 0 #endif - static struct cdevsw sa_cdevsw = { .d_version = D_VERSION, .d_open = saopen, @@ -742,7 +739,6 @@ saclose(struct cdev *dev, int flag, int fmt, struct thread *td) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE|CAM_DEBUG_INFO, ("saclose(%s): softc=0x%x\n", devtoname(dev), softc->flags)); - softc->open_rdonly = 0; if (SA_IS_CTRL(dev)) { softc->ctrl_mode = 0; @@ -878,7 +874,7 @@ saclose(struct cdev *dev, int flag, int fmt, struct thread *td) xpt_print(periph->path, "tape is now frozen- use an OFFLINE, " "REWIND or MTEOM command to clear this state.\n"); } - + /* release the device if it is no longer mounted */ if ((softc->flags & SA_FLAG_TAPE_MOUNTED) == 0) sareservereleaseunit(periph, FALSE); @@ -900,7 +896,7 @@ sastrategy(struct bio *bp) { struct cam_periph *periph; struct sa_softc *softc; - + bp->bio_resid = bp->bio_bcount; if (SA_IS_CTRL(bp->bio_dev)) { biofinish(bp, NULL, EINVAL); @@ -945,7 +941,6 @@ sastrategy(struct bio *bp) softc->open_pending_mount = 0; } - /* * If it's a null transfer, return immediately */ @@ -975,7 +970,6 @@ sastrategy(struct bio *bp) } else if ((bp->bio_bcount > softc->max_blk) || (bp->bio_bcount < softc->min_blk) || (bp->bio_bcount & softc->blk_mask) != 0) { - xpt_print_path(periph->path); printf("Invalid request. Variable block " "device requests must be "); @@ -988,7 +982,7 @@ sastrategy(struct bio *bp) biofinish(bp, NULL, EINVAL); return; } - + /* * Place it at the end of the queue. */ @@ -1004,7 +998,7 @@ sastrategy(struct bio *bp) CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("sastrategy: queue count now %d\n", softc->queue_count)); } - + /* * Schedule ourselves for performing the work. */ @@ -1107,7 +1101,6 @@ bailout: return (error); } - static void safillprot(struct sa_softc *softc, int *indent, struct sbuf *sb) { @@ -1771,7 +1764,6 @@ extget_bailout: mt = (struct mtop *)arg; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("saioctl: op=0x%x count=0x%x\n", mt->mt_op, mt->mt_count)); @@ -2348,7 +2340,7 @@ saregister(struct cam_periph *periph, void *arg) caddr_t match; char tmpstr[80]; int error; - + cgd = (struct ccb_getdev *)arg; if (cgd == NULL) { printf("saregister: no getdev CCB, can't register device\n"); @@ -2579,7 +2571,6 @@ sastart(struct cam_periph *periph, union ccb *start_ccb) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("sastart\n")); - switch (softc->state) { case SA_STATE_NORMAL: { @@ -2781,7 +2772,6 @@ again: } } - static void sadone(struct cam_periph *periph, union ccb *done_ccb) { @@ -2806,7 +2796,6 @@ sadone(struct cam_periph *periph, union ccb *done_ccb) } if (error == EIO) { - /* * Catastrophic error. Mark the tape as frozen * (we no longer know tape position). @@ -2887,7 +2876,6 @@ samount(struct cam_periph *periph, int oflags, struct cdev *dev) UNUSED_PARAMETER(oflags); UNUSED_PARAMETER(dev); - softc = (struct sa_softc *)periph->softc; /* @@ -2898,7 +2886,7 @@ samount(struct cam_periph *periph, int oflags, struct cdev *dev) * we don't care about the unit read state and can instead use * this opportunity to attempt to reserve the tape unit. */ - + if (softc->flags & SA_FLAG_TAPE_MOUNTED) { ccb = cam_periph_getccb(periph, 1); scsi_test_unit_ready(&ccb->csio, 0, NULL, @@ -3038,8 +3026,6 @@ samount(struct cam_periph *periph, int oflags, struct cdev *dev) */ softc->max_blk = scsi_3btoul(rblim->maximum); softc->min_blk = scsi_2btoul(rblim->minimum); - - } /* * Next, perform a mode sense to determine @@ -3287,7 +3273,6 @@ tryagain: error = 0; /* not an error */ } - if (error == 0) { softc->flags |= SA_FLAG_TAPE_MOUNTED; } @@ -3664,7 +3649,6 @@ retry: if ((mode_hdr->blk_desc_len == 0) && (params_to_get & SA_PARAM_COMPRESSION) && (params_to_get & ~(SA_PARAM_COMPRESSION))) { - /* * Decrease the mode buffer length by the size of * the compression page, to make sure the data @@ -4330,7 +4314,6 @@ retry: printf("\n"); } - if (error) { /* * If we can, try without setting density/blocksize. @@ -4520,7 +4503,7 @@ saextget(struct cdev *dev, struct cam_periph *periph, struct sbuf *sb, SASBADDUINTDESC(sb, indent, softc->blk_gran, %u, blk_gran, "Block granularity supported by tape drive and media"); - + maxio_tmp = min(softc->max_blk, softc->maxio); SASBADDUINTDESC(sb, indent, maxio_tmp, %u, max_effective_iosize, @@ -4774,7 +4757,6 @@ sawritefilemarks(struct cam_periph *periph, int nmarks, int setmarks, int immed) immed, setmarks, nmarks, SSD_FULL_SIZE, IO_TIMEOUT); softc->dsreg = MTIO_DSREG_REST; - error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats); if (error == 0 && nmarks) { @@ -5274,7 +5256,6 @@ safilldenstypesb(struct sbuf *sb, int *indent, uint8_t *buf, int buf_len, if (buf_len < sizeof(*hdr)) goto bailout; - hdr = (struct scsi_density_hdr *)buf; hdr_len = scsi_2btoul(hdr->length); len_to_go = min(buf_len - sizeof(*hdr), hdr_len); @@ -5415,7 +5396,6 @@ safilldenstypesb(struct sbuf *sb, int *indent, uint8_t *buf, int buf_len, cur_offset, "Medium type name"); SAFILLDENSSBSTR(type_data, sb, *indent, description, desc_remain, len_to_go, cur_offset, "Description"); - } } if (need_close != 0) { @@ -5433,7 +5413,7 @@ static void safilldensitysb(struct sa_softc *softc, int *indent, struct sbuf *sb) { int i, is_density; - + SASBADDNODE(sb, *indent, mtdensity); SASBADDUINTDESC(sb, *indent, softc->media_density, %u, media_density, "Current Medium Density"); @@ -5558,7 +5538,7 @@ scsi_rewind(struct ccb_scsiio *csio, u_int32_t retries, scsi_cmd->opcode = REWIND; if (immediate) scsi_cmd->immediate = SREW_IMMED; - + cam_fill_csio(csio, retries, cbfcnp, CAM_DIR_NONE, tag_action, NULL, 0, sense_len, sizeof(*scsi_cmd), timeout); } @@ -5597,7 +5577,7 @@ scsi_write_filemarks(struct ccb_scsiio *csio, u_int32_t retries, scsi_cmd->byte2 |= SWFMRK_IMMED; if (setmark) scsi_cmd->byte2 |= SWFMRK_WSMK; - + scsi_ulto3b(num_marks, scsi_cmd->num_marks); cam_fill_csio(csio, retries, cbfcnp, CAM_DIR_NONE, tag_action, NULL, @@ -5700,7 +5680,6 @@ scsi_read_position_10(struct ccb_scsiio *csio, u_int32_t retries, sizeof(*scmd), timeout); - scmd = (struct scsi_tape_read_position *)&csio->cdb_io.cdb_bytes; bzero(scmd, sizeof(*scmd)); scmd->opcode = READ_POSITION; diff --git a/sys/cam/scsi/scsi_sa.h b/sys/cam/scsi/scsi_sa.h index 076589efc9ef..908b16b684cf 100644 --- a/sys/cam/scsi/scsi_sa.h +++ b/sys/cam/scsi/scsi_sa.h @@ -1000,7 +1000,7 @@ void scsi_load_unload(struct ccb_scsiio *csio, u_int32_t retries, u_int8_t tag_action, int immediate, int eot, int reten, int load, u_int8_t sense_len, u_int32_t timeout); - + void scsi_write_filemarks(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int immediate, int setmark, diff --git a/sys/cam/scsi/scsi_ses.h b/sys/cam/scsi/scsi_ses.h index ff8858276e42..86cc88ad27f1 100644 --- a/sys/cam/scsi/scsi_ses.h +++ b/sys/cam/scsi/scsi_ses.h @@ -155,7 +155,6 @@ ses_cfg_page_get_num_subenc(struct ses_cfg_page *page) return (page->hdr.page_specific_flags + 1); } - /*================ SCSI SES Control Diagnostic Page Structures ==============*/ struct ses_ctrl_common { uint8_t bytes[1]; @@ -2155,8 +2154,6 @@ struct ses_status_page_hdr { /* Element Descriptor Diagnostic Page: unused */ /* Additional Element Status Diagnostic Page: unused */ - - /* Summary SES Status Defines, Common Status Codes */ #define SES_OBJSTAT_UNSUPPORTED 0 #define SES_OBJSTAT_OK 1 diff --git a/sys/cam/scsi/scsi_sg.c b/sys/cam/scsi/scsi_sg.c index ebf40853649a..7a28ccf732af 100644 --- a/sys/cam/scsi/scsi_sg.c +++ b/sys/cam/scsi/scsi_sg.c @@ -211,7 +211,6 @@ sgdevgonecb(void *arg) mtx_unlock(mtx); } - static void sgoninvalidate(struct cam_periph *periph) { @@ -1038,4 +1037,3 @@ scsi_group_len(u_char cmd) group = (cmd >> 5) & 0x7; return (len[group]); } - diff --git a/sys/cam/scsi/scsi_targ_bh.c b/sys/cam/scsi/scsi_targ_bh.c index f0c7a9b6ae68..84aa16aa05f4 100644 --- a/sys/cam/scsi/scsi_targ_bh.c +++ b/sys/cam/scsi/scsi_targ_bh.c @@ -256,7 +256,7 @@ targbhenlun(struct cam_periph *periph) status); return (status); } - + softc->flags |= TARGBH_FLAG_LUN_ENABLED; /* @@ -449,7 +449,7 @@ targbhstart(struct cam_periph *periph, union ccb *start_ccb) ccb_flags flags; softc = (struct targbh_softc *)periph->softc; - + ccbh = TAILQ_FIRST(&softc->work_queue); if (ccbh == NULL) { xpt_release_ccb(start_ccb); @@ -478,7 +478,6 @@ targbhstart(struct cam_periph *periph, union ccb *start_ccb) csio->sense_data = atio->sense_data; flags |= CAM_SEND_SENSE; } - } cam_fill_ctio(csio, @@ -683,7 +682,6 @@ targbhdone(struct cam_periph *periph, union ccb *done_ccb) desc->data_resid -= desc->data_increment; xpt_release_ccb(done_ccb); if (softc->state != TARGBH_STATE_TEARDOWN) { - /* * Send the original accept TIO back to the * controller to handle more work. diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index 4341223791cf..b8713bded1cb 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -32,7 +32,6 @@ #include __FBSDID("$FreeBSD$"); - #include #include #include @@ -55,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include - /* Transaction information attached to each CCB sent by the user */ struct targ_cmd_descr { struct cam_periph_map_info mapinfo; @@ -599,7 +597,7 @@ targwrite(struct cdev *dev, struct uio *uio, int ioflag) } write_len += sizeof(user_ccb); } - + /* * If we've successfully taken in some amount of * data, return success for that data first. If @@ -731,7 +729,6 @@ targsendccb(struct targ_softc *softc, union ccb *ccb, if ((ccb_h->func_code == XPT_CONT_TARGET_IO) || (ccb_h->func_code == XPT_DEV_MATCH)) { - error = cam_periph_mapmem(ccb, mapinfo, softc->maxio); /* diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index 2a744b3e520b..2ec1490c0edf 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -797,7 +797,6 @@ again: */ if (((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) && ((softc->flags & PROBE_INQUIRY_CKSUM) == 0)) { - MD5Init(&softc->context); MD5Update(&softc->context, (unsigned char *)inq_buf, sizeof(struct scsi_inquiry_data)); @@ -1112,7 +1111,6 @@ proberequestbackoff(struct cam_periph *periph, struct cam_ed *device) return (0); } - /* * Jump sync_period up by one, but stop at 5MHz and fall back to Async. * We don't try to remember 'last' settings to see if the SIM actually @@ -1175,7 +1173,6 @@ probedone(struct cam_periph *periph, union ccb *done_ccb) case PROBE_TUR: { if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) { - if (cam_periph_error(done_ccb, 0, SF_NO_PRINT) == ERESTART) { outr: @@ -1593,7 +1590,6 @@ probe_device_check: */ } else if (cam_ccb_status(done_ccb) == CAM_REQ_CMP && (serial_buf->length > 0)) { - have_serialnum = 1; path->device->serial_num = (u_int8_t *)malloc((serial_buf->length + 1), @@ -2022,7 +2018,6 @@ scsi_scan_bus(struct cam_periph *periph, union ccb *request_ccb) low_target = 0; initiator_id = scan_info->cpi->initiator_id; - /* * We can scan all targets in parallel, or do it sequentially. */ @@ -2905,7 +2900,6 @@ scsi_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path && device_tagenb == FALSE) || ((scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) == 0 && device_tagenb == TRUE)) { - if ((scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) != 0) { /* * Delay change to use tags until after a @@ -2990,7 +2984,6 @@ scsi_dev_async(u_int32_t async_code, struct cam_eb *bus, struct cam_et *target, status = CAM_REQ_CMP_ERR; if (status == CAM_REQ_CMP) { - /* * Allow transfer negotiation to occur in a * tag free environment and after settle delay. @@ -3049,7 +3042,7 @@ _scsi_announce_periph(struct cam_periph *periph, u_int *speed, u_int *freq, stru xpt_action((union ccb*)cts); if (cam_ccb_status((union ccb *)cts) != CAM_REQ_CMP) return; - + /* Ask the SIM for its base transfer speed */ xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); cpi.ccb_h.func_code = XPT_PATH_INQ; diff --git a/sys/cam/scsi/smp_all.c b/sys/cam/scsi/smp_all.c index 545f6c21014e..1b82327f9fb9 100644 --- a/sys/cam/scsi/smp_all.c +++ b/sys/cam/scsi/smp_all.c @@ -618,4 +618,3 @@ smp_phy_control(struct ccb_smpio *smpio, uint32_t retries, request->config_bits0 = slumber_partial; request->pp_timeout_value = pp_timeout_value; } - -- cgit v1.2.3