svn commit: r276616 - stable/10/sys/cam/ctl
Alexander Motin
mav at FreeBSD.org
Sat Jan 3 13:11:42 UTC 2015
Author: mav
Date: Sat Jan 3 13:11:39 2015
New Revision: 276616
URL: https://svnweb.freebsd.org/changeset/base/276616
Log:
MFC r275953: Replace ctl_min() macro with MIN().
Modified:
stable/10/sys/cam/ctl/ctl.c
stable/10/sys/cam/ctl/ctl.h
stable/10/sys/cam/ctl/ctl_backend_block.c
stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c
stable/10/sys/cam/ctl/ctl_frontend_internal.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c Sat Jan 3 13:10:23 2015 (r276615)
+++ stable/10/sys/cam/ctl/ctl.c Sat Jan 3 13:11:39 2015 (r276616)
@@ -1745,8 +1745,8 @@ ctl_ioctl_do_datamove(struct ctl_scsiio
i < ext_sg_entries && j < kern_sg_entries;) {
uint8_t *ext_ptr, *kern_ptr;
- len_to_copy = ctl_min(ext_sglist[i].len - ext_watermark,
- kern_sglist[j].len - kern_watermark);
+ len_to_copy = MIN(ext_sglist[i].len - ext_watermark,
+ kern_sglist[j].len - kern_watermark);
ext_ptr = (uint8_t *)ext_sglist[i].addr;
ext_ptr = ext_ptr + ext_watermark;
@@ -2836,8 +2836,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd,
bbr_info->scsi_status = metatask->taskinfo.bbrread.scsi_status;
memcpy(&bbr_info->sense_data,
&metatask->taskinfo.bbrread.sense_data,
- ctl_min(sizeof(bbr_info->sense_data),
- sizeof(metatask->taskinfo.bbrread.sense_data)));
+ MIN(sizeof(bbr_info->sense_data),
+ sizeof(metatask->taskinfo.bbrread.sense_data)));
cfi_free_metatask(metatask);
@@ -3644,7 +3644,7 @@ ctl_ffz(uint32_t *mask, uint32_t size)
num_chunks = (size >> 5);
if (num_chunks == 0)
num_chunks++;
- num_pieces = ctl_min((sizeof(uint32_t) * 8), size);
+ num_pieces = MIN((sizeof(uint32_t) * 8), size);
for (i = 0; i < num_chunks; i++) {
for (j = 0; j < num_pieces; j++) {
@@ -3891,7 +3891,7 @@ ctl_copy_io(union ctl_io *src, union ctl
*/
pool_ref = dest->io_hdr.pool;
- memcpy(dest, src, ctl_min(sizeof(*src), sizeof(*dest)));
+ memcpy(dest, src, MIN(sizeof(*src), sizeof(*dest)));
dest->io_hdr.pool = pool_ref;
/*
@@ -6754,7 +6754,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
header = (struct scsi_mode_hdr_6 *)ctsio->kern_data_ptr;
- header->datalen = ctl_min(total_len - 1, 254);
+ header->datalen = MIN(total_len - 1, 254);
if (control_dev == 0) {
header->dev_specific = 0x10; /* DPOFUA */
if ((lun->flags & CTL_LUN_READONLY) ||
@@ -6776,7 +6776,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
header = (struct scsi_mode_hdr_10 *)ctsio->kern_data_ptr;
- datalen = ctl_min(total_len - 2, 65533);
+ datalen = MIN(total_len - 2, 65533);
scsi_ulto2b(datalen, header->datalen);
if (control_dev == 0) {
header->dev_specific = 0x10; /* DPOFUA */
@@ -9517,7 +9517,7 @@ ctl_request_sense(struct ctl_scsiio *cts
(struct scsi_sense_data_fixed *)sense_ptr);
else
memcpy(sense_ptr, &lun->pending_sense[initidx],
- ctl_min(sizeof(*sense_ptr),
+ MIN(sizeof(*sense_ptr),
sizeof(lun->pending_sense[initidx])));
ctl_clear_mask(lun->have_ca, initidx);
@@ -12476,8 +12476,8 @@ ctl_inject_error(struct ctl_lun *lun, un
* checks.
*/
bcopy(&desc->custom_sense, &io->scsiio.sense_data,
- ctl_min(sizeof(desc->custom_sense),
- sizeof(io->scsiio.sense_data)));
+ MIN(sizeof(desc->custom_sense),
+ sizeof(io->scsiio.sense_data)));
io->scsiio.scsi_status = SCSI_STATUS_CHECK_COND;
io->scsiio.sense_len = SSD_FULL_SIZE;
io->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE;
@@ -12706,7 +12706,7 @@ ctl_datamove(union ctl_io *io)
*/
for (sg_entries_sent = 0; sg_entries_sent <
msg.dt.kern_sg_entries; msg.dt.sg_sequence++) {
- msg.dt.cur_sg_entries = ctl_min((sizeof(msg.dt.sg_list)/
+ msg.dt.cur_sg_entries = MIN((sizeof(msg.dt.sg_list)/
sizeof(msg.dt.sg_list[0])),
msg.dt.kern_sg_entries - sg_entries_sent);
@@ -13069,7 +13069,7 @@ ctl_datamove_remote_sgl_setup(union ctl_
for (i = 0; (i < sizeof(io->io_hdr.remote_sglist) /
sizeof(io->io_hdr.remote_sglist[0])) &&
(len_to_go > 0); i++) {
- local_sglist[i].len = ctl_min(len_to_go, 131072);
+ local_sglist[i].len = MIN(len_to_go, 131072);
CTL_SIZE_8B(local_dma_sglist[i].len,
local_sglist[i].len);
local_sglist[i].addr =
@@ -13205,8 +13205,8 @@ ctl_datamove_remote_xfer(union ctl_io *i
* also have enough slack left over at the end, though,
* to round up to the next 8 byte boundary.
*/
- cur_len = ctl_min(local_sglist[i].len - local_used,
- remote_sglist[j].len - remote_used);
+ cur_len = MIN(local_sglist[i].len - local_used,
+ remote_sglist[j].len - remote_used);
/*
* In this case, we have a size issue and need to decrease
@@ -13705,7 +13705,7 @@ ctl_queue_sense(union ctl_io *io)
}
memcpy(&lun->pending_sense[initidx], &io->scsiio.sense_data,
- ctl_min(sizeof(lun->pending_sense[initidx]),
+ MIN(sizeof(lun->pending_sense[initidx]),
sizeof(io->scsiio.sense_data)));
ctl_set_mask(lun->have_ca, initidx);
mtx_unlock(&lun->lun_lock);
Modified: stable/10/sys/cam/ctl/ctl.h
==============================================================================
--- stable/10/sys/cam/ctl/ctl.h Sat Jan 3 13:10:23 2015 (r276615)
+++ stable/10/sys/cam/ctl/ctl.h Sat Jan 3 13:11:39 2015 (r276616)
@@ -40,7 +40,6 @@
#ifndef _CTL_H_
#define _CTL_H_
-#define ctl_min(x,y) (((x) < (y)) ? (x) : (y))
#define CTL_RETVAL_COMPLETE 0
#define CTL_RETVAL_QUEUED 1
#define CTL_RETVAL_ALLOCATED 2
Modified: stable/10/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_backend_block.c Sat Jan 3 13:10:23 2015 (r276615)
+++ stable/10/sys/cam/ctl/ctl_backend_block.c Sat Jan 3 13:11:39 2015 (r276616)
@@ -2305,32 +2305,32 @@ ctl_be_block_create(struct ctl_be_block_
snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%4d",
softc->num_luns);
strncpy((char *)be_lun->ctl_be_lun.serial_num, tmpstr,
- ctl_min(sizeof(be_lun->ctl_be_lun.serial_num),
+ MIN(sizeof(be_lun->ctl_be_lun.serial_num),
sizeof(tmpstr)));
/* Tell the user what we used for a serial number */
strncpy((char *)params->serial_num, tmpstr,
- ctl_min(sizeof(params->serial_num), sizeof(tmpstr)));
+ MIN(sizeof(params->serial_num), sizeof(tmpstr)));
} else {
strncpy((char *)be_lun->ctl_be_lun.serial_num,
params->serial_num,
- ctl_min(sizeof(be_lun->ctl_be_lun.serial_num),
+ MIN(sizeof(be_lun->ctl_be_lun.serial_num),
sizeof(params->serial_num)));
}
if ((params->flags & CTL_LUN_FLAG_DEVID) == 0) {
snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%4d", softc->num_luns);
strncpy((char *)be_lun->ctl_be_lun.device_id, tmpstr,
- ctl_min(sizeof(be_lun->ctl_be_lun.device_id),
+ MIN(sizeof(be_lun->ctl_be_lun.device_id),
sizeof(tmpstr)));
/* Tell the user what we used for a device ID */
strncpy((char *)params->device_id, tmpstr,
- ctl_min(sizeof(params->device_id), sizeof(tmpstr)));
+ MIN(sizeof(params->device_id), sizeof(tmpstr)));
} else {
strncpy((char *)be_lun->ctl_be_lun.device_id,
params->device_id,
- ctl_min(sizeof(be_lun->ctl_be_lun.device_id),
- sizeof(params->device_id)));
+ MIN(sizeof(be_lun->ctl_be_lun.device_id),
+ sizeof(params->device_id)));
}
TASK_INIT(&be_lun->io_task, /*priority*/0, ctl_be_block_worker, be_lun);
Modified: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Sat Jan 3 13:10:23 2015 (r276615)
+++ stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Sat Jan 3 13:11:39 2015 (r276616)
@@ -313,8 +313,7 @@ ctl_backend_ramdisk_continue(union ctl_i
sg_entries = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr;
for (i = 0, len_filled = 0; i < sg_filled; i++) {
sg_entries[i].addr = softc->ramdisk_pages[i];
- sg_entries[i].len = ctl_min(PAGE_SIZE,
- len - len_filled);
+ sg_entries[i].len = MIN(PAGE_SIZE, len - len_filled);
len_filled += sg_entries[i].len;
}
io->io_hdr.flags |= CTL_FLAG_KDPTR_SGLIST;
@@ -614,32 +613,32 @@ ctl_backend_ramdisk_create(struct ctl_be
snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%4d",
softc->num_luns);
strncpy((char *)be_lun->ctl_be_lun.serial_num, tmpstr,
- ctl_min(sizeof(be_lun->ctl_be_lun.serial_num),
- sizeof(tmpstr)));
+ MIN(sizeof(be_lun->ctl_be_lun.serial_num),
+ sizeof(tmpstr)));
/* Tell the user what we used for a serial number */
strncpy((char *)params->serial_num, tmpstr,
- ctl_min(sizeof(params->serial_num), sizeof(tmpstr)));
+ MIN(sizeof(params->serial_num), sizeof(tmpstr)));
} else {
strncpy((char *)be_lun->ctl_be_lun.serial_num,
params->serial_num,
- ctl_min(sizeof(be_lun->ctl_be_lun.serial_num),
- sizeof(params->serial_num)));
+ MIN(sizeof(be_lun->ctl_be_lun.serial_num),
+ sizeof(params->serial_num)));
}
if ((params->flags & CTL_LUN_FLAG_DEVID) == 0) {
snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%4d", softc->num_luns);
strncpy((char *)be_lun->ctl_be_lun.device_id, tmpstr,
- ctl_min(sizeof(be_lun->ctl_be_lun.device_id),
- sizeof(tmpstr)));
+ MIN(sizeof(be_lun->ctl_be_lun.device_id),
+ sizeof(tmpstr)));
/* Tell the user what we used for a device ID */
strncpy((char *)params->device_id, tmpstr,
- ctl_min(sizeof(params->device_id), sizeof(tmpstr)));
+ MIN(sizeof(params->device_id), sizeof(tmpstr)));
} else {
strncpy((char *)be_lun->ctl_be_lun.device_id,
params->device_id,
- ctl_min(sizeof(be_lun->ctl_be_lun.device_id),
- sizeof(params->device_id)));
+ MIN(sizeof(be_lun->ctl_be_lun.device_id),
+ sizeof(params->device_id)));
}
STAILQ_INIT(&be_lun->cont_queue);
Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Sat Jan 3 13:10:23 2015 (r276615)
+++ stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Sat Jan 3 13:11:39 2015 (r276616)
@@ -401,8 +401,8 @@ cfcs_datamove(union ctl_io *io)
i < cam_sg_count && j < ctl_sg_count;) {
uint8_t *cam_ptr, *ctl_ptr;
- len_to_copy = ctl_min(cam_sglist[i].ds_len - cam_watermark,
- ctl_sglist[j].len - ctl_watermark);
+ len_to_copy = MIN(cam_sglist[i].ds_len - cam_watermark,
+ ctl_sglist[j].len - ctl_watermark);
cam_ptr = (uint8_t *)cam_sglist[i].ds_addr;
cam_ptr = cam_ptr + cam_watermark;
Modified: stable/10/sys/cam/ctl/ctl_frontend_internal.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_frontend_internal.c Sat Jan 3 13:10:23 2015 (r276615)
+++ stable/10/sys/cam/ctl/ctl_frontend_internal.c Sat Jan 3 13:11:39 2015 (r276616)
@@ -499,8 +499,8 @@ cfi_datamove(union ctl_io *io)
i < ext_sg_entries && j < kern_sg_entries;) {
uint8_t *ext_ptr, *kern_ptr;
- len_to_copy = ctl_min(ext_sglist[i].len - ext_watermark,
- kern_sglist[j].len - kern_watermark);
+ len_to_copy = MIN(ext_sglist[i].len - ext_watermark,
+ kern_sglist[j].len - kern_watermark);
ext_ptr = (uint8_t *)ext_sglist[i].addr;
ext_ptr = ext_ptr + ext_watermark;
@@ -1103,8 +1103,8 @@ cfi_metatask_bbr_errorparse(struct cfi_m
metatask->taskinfo.bbrread.scsi_status = io->scsiio.scsi_status;
memcpy(&metatask->taskinfo.bbrread.sense_data, &io->scsiio.sense_data,
- ctl_min(sizeof(metatask->taskinfo.bbrread.sense_data),
- sizeof(io->scsiio.sense_data)));
+ MIN(sizeof(metatask->taskinfo.bbrread.sense_data),
+ sizeof(io->scsiio.sense_data)));
if (io->scsiio.scsi_status == SCSI_STATUS_RESERV_CONFLICT) {
metatask->status = CFI_MT_ERROR;
More information about the svn-src-stable
mailing list