[PATCH v4 3/5] Replace MAX_COMMAND_SIZE with BLK_MAX_CDB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since the two constants MAX_COMMAND_SIZE and BLK_MAX_CDB have
the same meaning, replace MAX_COMMAND_SIZE with BLK_MAX_CDB.

This patch has been generated as follows:
- Removed the MAX_COMMAND_SIZE definitions manually from
  <scsi/scsi_cmnd.h> and also from
  drivers/usb/gadget/function/storage_common.h.
- Ran the following command over the Linux source tree:
  sed -i.orig 's/\([^a-zA-Z_]\)MAX_COMMAND_SIZE/\1BLK_MAX_CDB/g' $(git grep -lw MAX_COMMAND_SIZE)

Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
Cc: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
Cc: Hannes Reinecke <hare@xxxxxxx>
Cc: Mike Christie <michaelc@xxxxxxxxxxx>
---
 drivers/ata/libata-scsi.c                    |  4 +-
 drivers/block/cciss_scsi.c                   |  2 +-
 drivers/scsi/53c700.c                        |  8 +--
 drivers/scsi/53c700.h                        |  2 +-
 drivers/scsi/gdth.c                          |  6 +-
 drivers/scsi/gdth_proc.c                     |  4 +-
 drivers/scsi/hpsa.c                          |  2 +-
 drivers/scsi/isci/init.c                     |  2 +-
 drivers/scsi/mvumi.c                         | 10 +--
 drivers/scsi/mvumi.h                         |  2 +-
 drivers/scsi/osst.c                          | 96 ++++++++++++++--------------
 drivers/scsi/osst.h                          |  2 +-
 drivers/scsi/qla1280.c                       |  2 +-
 drivers/scsi/scsi_ioctl.c                    |  4 +-
 drivers/scsi/scsi_scan.c                     |  6 +-
 drivers/scsi/st.c                            | 52 +++++++--------
 drivers/scsi/st.h                            |  2 +-
 drivers/target/target_core_pscsi.c           | 12 ++--
 drivers/usb/gadget/function/f_mass_storage.c |  4 +-
 drivers/usb/gadget/function/storage_common.h |  3 -
 drivers/usb/storage/cypress_atacb.c          |  4 +-
 include/scsi/scsi_cmnd.h                     | 17 -----
 22 files changed, 113 insertions(+), 133 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 3131adc..582b5d4 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -498,7 +498,7 @@ static int ata_get_identity(struct ata_port *ap, struct scsi_device *sdev,
 int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
 {
 	int rc = 0;
-	u8 scsi_cmd[MAX_COMMAND_SIZE];
+	u8 scsi_cmd[BLK_MAX_CDB];
 	u8 args[4], *argbuf = NULL, *sensebuf = NULL;
 	int argsize = 0;
 	enum dma_data_direction data_dir;
@@ -607,7 +607,7 @@ error:
 int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
 {
 	int rc = 0;
-	u8 scsi_cmd[MAX_COMMAND_SIZE];
+	u8 scsi_cmd[BLK_MAX_CDB];
 	u8 args[7], *sensebuf = NULL;
 	int cmd_result;
 
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index ecd845c..5cf43db 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -856,7 +856,7 @@ cciss_scsi_detect(ctlr_info_t *h)
 	sh->this_id = SELF_SCSI_ID;  
 	sh->can_queue = cciss_tape_cmds;
 	sh->sg_tablesize = h->maxsgentries;
-	sh->max_cmd_len = MAX_COMMAND_SIZE;
+	sh->max_cmd_len = BLK_MAX_CDB;
 	sh->max_sectors = h->cciss_max_sectors;
 
 	((struct cciss_scsi_adapter_data_t *) 
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 82abfce..da19099 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -595,7 +595,7 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata,
 			(struct NCR_700_command_slot *)SCp->host_scribble;
 
 		dma_unmap_single(hostdata->dev, slot->pCmd,
-				 MAX_COMMAND_SIZE, DMA_TO_DEVICE);
+				 BLK_MAX_CDB, DMA_TO_DEVICE);
 		if (slot->flags == NCR_700_FLAG_AUTOSENSE) {
 			char *cmnd = NCR_700_get_sense_cmnd(SCp->device);
 
@@ -997,7 +997,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
 				 * here */
 				NCR_700_unmap(hostdata, SCp, slot);
 				dma_unmap_single(hostdata->dev, slot->pCmd,
-						 MAX_COMMAND_SIZE,
+						 BLK_MAX_CDB,
 						 DMA_TO_DEVICE);
 
 				cmnd[0] = REQUEST_SENSE;
@@ -1017,7 +1017,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
 				cmnd[8] = SCp->cmd_len;
 				SCp->cmd_len = 6; /* command length for
 						   * REQUEST_SENSE */
-				slot->pCmd = dma_map_single(hostdata->dev, cmnd, MAX_COMMAND_SIZE, DMA_TO_DEVICE);
+				slot->pCmd = dma_map_single(hostdata->dev, cmnd, BLK_MAX_CDB, DMA_TO_DEVICE);
 				slot->dma_handle = dma_map_single(hostdata->dev, SCp->sense_buffer, SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
 				slot->SG[0].ins = bS_to_host(SCRIPT_MOVE_DATA_IN | SCSI_SENSE_BUFFERSIZE);
 				slot->SG[0].pAddr = bS_to_host(slot->dma_handle);
@@ -1895,7 +1895,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
 	}
 	slot->resume_offset = 0;
 	slot->pCmd = dma_map_single(hostdata->dev, SCp->cmnd,
-				    MAX_COMMAND_SIZE, DMA_TO_DEVICE);
+				    BLK_MAX_CDB, DMA_TO_DEVICE);
 	NCR_700_start_command(SCp);
 	return 0;
 }
diff --git a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h
index e06bdfe..dd06fb7 100644
--- a/drivers/scsi/53c700.h
+++ b/drivers/scsi/53c700.h
@@ -80,7 +80,7 @@ struct NCR_700_Device_Parameters {
 	/* space for creating a request sense command. Really, except
 	 * for the annoying SCSI-2 requirement for LUN information in
 	 * cmnd[1], this could be in static storage */
-	unsigned char cmnd[MAX_COMMAND_SIZE];
+	unsigned char cmnd[BLK_MAX_CDB];
 	__u8	depth;
 };
 
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 71e1380..fa4f4bb 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -4472,7 +4472,7 @@ static int gdth_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
     gdth_ha_str *ha; 
     Scsi_Cmnd *scp;
     unsigned long flags;
-    char cmnd[MAX_COMMAND_SIZE];   
+    char cmnd[BLK_MAX_CDB];
     void __user *argp = (void __user *)arg;
 
     memset(cmnd, 0xff, 12);
@@ -4632,8 +4632,8 @@ static void gdth_flush(gdth_ha_str *ha)
 {
     int             i;
     gdth_cmd_str    gdtcmd;
-    char            cmnd[MAX_COMMAND_SIZE];   
-    memset(cmnd, 0xff, MAX_COMMAND_SIZE);
+    char            cmnd[BLK_MAX_CDB];
+    memset(cmnd, 0xff, BLK_MAX_CDB);
 
     TRACE2(("gdth_flush() hanum %d\n", ha->hanum));
 
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
index e66e997..88bfe50 100644
--- a/drivers/scsi/gdth_proc.c
+++ b/drivers/scsi/gdth_proc.c
@@ -32,7 +32,7 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer,
     gdth_cpar_str   *pcpar;
     u64         paddr;
 
-    char            cmnd[MAX_COMMAND_SIZE];
+    char            cmnd[BLK_MAX_CDB];
     memset(cmnd, 0xff, 12);
     memset(&gdtcmd, 0, sizeof(gdth_cmd_str));
 
@@ -157,7 +157,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
     gdth_defcnt_str *pdef;
     gdth_cdrinfo_str *pcdi;
     gdth_hget_str *phg;
-    char cmnd[MAX_COMMAND_SIZE];
+    char cmnd[BLK_MAX_CDB];
 
     gdtcmd = kmalloc(sizeof(*gdtcmd), GFP_KERNEL);
     estr = kmalloc(sizeof(*estr), GFP_KERNEL);
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 8eab107..a616885 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4249,7 +4249,7 @@ static int hpsa_register_scsi(struct ctlr_info *h)
 	sh->n_io_port = 0;
 	sh->this_id = -1;
 	sh->max_channel = 3;
-	sh->max_cmd_len = MAX_COMMAND_SIZE;
+	sh->max_cmd_len = BLK_MAX_CDB;
 	sh->max_lun = HPSA_MAX_LUN;
 	sh->max_id = HPSA_MAX_LUN;
 	sh->can_queue = h->nr_cmds -
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index cd41b63..e0c9d07 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -595,7 +595,7 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id)
 
 	shost->max_id = ~0;
 	shost->max_lun = ~0;
-	shost->max_cmd_len = MAX_COMMAND_SIZE;
+	shost->max_cmd_len = BLK_MAX_CDB;
 
 	err = scsi_add_host(shost, &pdev->dev);
 	if (err)
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 3e6b866..93689c3 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -818,8 +818,8 @@ get_cmd:	cmd = mvumi_create_internal_cmd(mhba, 0);
 		frame->device_id = device_id;
 		frame->cmd_flag = CMD_FLAG_NON_DATA;
 		frame->data_transfer_length = 0;
-		frame->cdb_length = MAX_COMMAND_SIZE;
-		memset(frame->cdb, 0, MAX_COMMAND_SIZE);
+		frame->cdb_length = BLK_MAX_CDB;
+		memset(frame->cdb, 0, BLK_MAX_CDB);
 		frame->cdb[0] = SCSI_CMD_MARVELL_SPECIFIC;
 		frame->cdb[1] = CDB_CORE_MODULE;
 		frame->cdb[2] = CDB_CORE_SHUTDOWN;
@@ -1748,9 +1748,9 @@ static int mvumi_get_event(struct mvumi_hba *mhba, unsigned char msg)
 	frame->device_id = 0;
 	frame->cmd_flag = CMD_FLAG_DATA_IN;
 	frame->req_function = CL_FUN_SCSI_CMD;
-	frame->cdb_length = MAX_COMMAND_SIZE;
+	frame->cdb_length = BLK_MAX_CDB;
 	frame->data_transfer_length = sizeof(struct mvumi_event_req);
-	memset(frame->cdb, 0, MAX_COMMAND_SIZE);
+	memset(frame->cdb, 0, BLK_MAX_CDB);
 	frame->cdb[0] = APICDB0_EVENT;
 	frame->cdb[1] = msg;
 	mvumi_issue_blocked_cmd(mhba, cmd);
@@ -2450,7 +2450,7 @@ static int mvumi_io_attach(struct mvumi_hba *mhba)
 	host->max_sectors = mhba->max_transfer_size / 512;
 	host->cmd_per_lun = (mhba->max_io - 1) ? (mhba->max_io - 1) : 1;
 	host->max_id = mhba->max_target_id;
-	host->max_cmd_len = MAX_COMMAND_SIZE;
+	host->max_cmd_len = BLK_MAX_CDB;
 	host->transportt = &mvumi_transport_template;
 
 	ret = scsi_add_host(host, &mhba->pdev->dev);
diff --git a/drivers/scsi/mvumi.h b/drivers/scsi/mvumi.h
index 41f1687..712d456 100644
--- a/drivers/scsi/mvumi.h
+++ b/drivers/scsi/mvumi.h
@@ -285,7 +285,7 @@ struct mvumi_msg_frame {
 	u32 data_transfer_length;
 	u16 request_id;
 	u16 reserved1;
-	u8 cdb[MAX_COMMAND_SIZE];
+	u8 cdb[BLK_MAX_CDB];
 	u32 payload[1];
 };
 
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 5033223..4c60352 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -749,7 +749,7 @@ err_out:
 static int osst_wait_ready(struct osst_tape * STp, struct osst_request ** aSRpnt,
 				 unsigned timeout, int initial_delay)
 {
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	struct osst_request   * SRpnt;
 	unsigned long		startwait = jiffies;
 #if DEBUG
@@ -762,7 +762,7 @@ static int osst_wait_ready(struct osst_tape * STp, struct osst_request ** aSRpnt
 	if (initial_delay > 0)
 		msleep(jiffies_to_msecs(initial_delay));
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = TEST_UNIT_READY;
 
 	SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, DMA_NONE, STp->timeout, MAX_RETRIES, 1);
@@ -783,7 +783,7 @@ static int osst_wait_ready(struct osst_tape * STp, struct osst_request ** aSRpnt
 #endif
 	    msleep(100);
 
-	    memset(cmd, 0, MAX_COMMAND_SIZE);
+	    memset(cmd, 0, BLK_MAX_CDB);
 	    cmd[0] = TEST_UNIT_READY;
 
 	    SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, DMA_NONE, STp->timeout, MAX_RETRIES, 1);
@@ -813,7 +813,7 @@ static int osst_wait_ready(struct osst_tape * STp, struct osst_request ** aSRpnt
  */
 static int osst_wait_for_medium(struct osst_tape * STp, struct osst_request ** aSRpnt, unsigned timeout)
 {
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	struct osst_request   * SRpnt;
 	unsigned long		startwait = jiffies;
 #if DEBUG
@@ -823,7 +823,7 @@ static int osst_wait_for_medium(struct osst_tape * STp, struct osst_request ** a
 	printk(OSST_DEB_MSG "%s:D: Reached onstream wait for medium\n", name);
 #endif
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = TEST_UNIT_READY;
 
 	SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, DMA_NONE, STp->timeout, MAX_RETRIES, 1);
@@ -841,7 +841,7 @@ static int osst_wait_for_medium(struct osst_tape * STp, struct osst_request ** a
 #endif
 	    msleep(100);
 
-	    memset(cmd, 0, MAX_COMMAND_SIZE);
+	    memset(cmd, 0, BLK_MAX_CDB);
 	    cmd[0] = TEST_UNIT_READY;
 
 	    SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, DMA_NONE, STp->timeout, MAX_RETRIES, 1);
@@ -882,7 +882,7 @@ static int osst_position_tape_and_confirm(struct osst_tape * STp, struct osst_re
  */
 static int osst_flush_drive_buffer(struct osst_tape * STp, struct osst_request ** aSRpnt)
 {
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	struct osst_request   * SRpnt;
 	int			result = 0;
 	int			delay  = OSST_WAIT_WRITE_COMPLETE;
@@ -892,7 +892,7 @@ static int osst_flush_drive_buffer(struct osst_tape * STp, struct osst_request *
 	printk(OSST_DEB_MSG "%s:D: Reached onstream flush drive buffer (write filemark)\n", name);
 #endif
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = WRITE_FILEMARKS;
 	cmd[1] = 1;
 
@@ -972,7 +972,7 @@ static int osst_wait_frame(struct osst_tape * STp, struct osst_request ** aSRpnt
 static int osst_recover_wait_frame(struct osst_tape * STp, struct osst_request ** aSRpnt, int writing)
 {
 	struct osst_request   * SRpnt;
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	unsigned long   	startwait = jiffies;
 	int			retval    = 1;
         char		      * name      = tape_name(STp);
@@ -984,7 +984,7 @@ static int osst_recover_wait_frame(struct osst_tape * STp, struct osst_request *
 
 		/* write zero fm then read pos - if shows write error, try to recover - if no progress, wait */
 
-		memset(cmd, 0, MAX_COMMAND_SIZE);
+		memset(cmd, 0, BLK_MAX_CDB);
 		cmd[0] = WRITE_FILEMARKS;
 		cmd[1] = 1;
 		SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, DMA_NONE, STp->timeout,
@@ -1001,7 +1001,7 @@ static int osst_recover_wait_frame(struct osst_tape * STp, struct osst_request *
 			schedule_timeout_interruptible(HZ / OSST_POLL_PER_SEC);
 
 			STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24;
-			memset(cmd, 0, MAX_COMMAND_SIZE);
+			memset(cmd, 0, BLK_MAX_CDB);
 			cmd[0] = READ_POSITION;
 
 			SRpnt = osst_do_scsi(SRpnt, STp, cmd, 20, DMA_FROM_DEVICE, STp->timeout,
@@ -1029,7 +1029,7 @@ static int osst_recover_wait_frame(struct osst_tape * STp, struct osst_request *
  */
 static int osst_read_frame(struct osst_tape * STp, struct osst_request ** aSRpnt, int timeout)
 {
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	struct osst_request   * SRpnt;
 	int			retval = 0;
 #if DEBUG
@@ -1041,7 +1041,7 @@ static int osst_read_frame(struct osst_tape * STp, struct osst_request ** aSRpnt
 		if (osst_wait_frame (STp, aSRpnt, STp->first_frame_position, 0, timeout))
 			retval = osst_recover_wait_frame(STp, aSRpnt, 0);
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = READ_6;
 	cmd[1] = 1;
 	cmd[4] = 1;
@@ -1102,7 +1102,7 @@ static int osst_initiate_read(struct osst_tape * STp, struct osst_request ** aSR
 {
 	struct st_partstat    * STps   = &(STp->ps[STp->partition]);
 	struct osst_request   * SRpnt  ;
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	int			retval = 0;
 	char		      * name   = tape_name(STp);
 
@@ -1119,7 +1119,7 @@ static int osst_initiate_read(struct osst_tape * STp, struct osst_request ** aSR
 		 *      Issue a read 0 command to get the OnStream drive
                  *      read frames into its buffer.
 		 */
-		memset(cmd, 0, MAX_COMMAND_SIZE);
+		memset(cmd, 0, BLK_MAX_CDB);
 		cmd[0] = READ_6;
 		cmd[1] = 1;
 
@@ -1471,7 +1471,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct osst
 {
 	struct osst_request   * SRpnt = * aSRpnt;
 	unsigned char	      * buffer, * p;
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	int			flag, new_frame, i;
 	int			nframes          = STp->cur_frames;
 	int			blks_per_frame   = ntohs(STp->buffer->aux->dat.dat_list[0].blk_cnt);
@@ -1501,7 +1501,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct osst
 #endif
 	for (i = 0, p = buffer; i < nframes; i++, p += OS_DATA_SIZE) {
 
-		memset(cmd, 0, MAX_COMMAND_SIZE);
+		memset(cmd, 0, BLK_MAX_CDB);
 		cmd[0] = 0x3C;		/* Buffer Read           */
 		cmd[1] = 6;		/* Retrieve Faulty Block */
 		cmd[7] = 32768 >> 8;
@@ -1567,7 +1567,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct osst
 		osst_init_aux(STp, STp->buffer->aux->frame_type, frame_seq_number+i,
 			       	logical_blk_num + i*blks_per_frame,
 			       	ntohl(STp->buffer->aux->dat.dat_list[0].blk_sz), blks_per_frame);
-		memset(cmd, 0, MAX_COMMAND_SIZE);
+		memset(cmd, 0, BLK_MAX_CDB);
 		cmd[0] = WRITE_6;
 		cmd[1] = 1;
 		cmd[4] = 1;
@@ -1592,7 +1592,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct osst
 #if DEBUG
 				printk(OSST_DEB_MSG "%s:D: Check re-write successful\n", name);
 #endif
-				memset(cmd, 0, MAX_COMMAND_SIZE);
+				memset(cmd, 0, BLK_MAX_CDB);
 				cmd[0] = WRITE_FILEMARKS;
 				cmd[1] = 1;
 				SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, DMA_NONE,
@@ -1607,7 +1607,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct osst
 				flag = STp->buffer->syscall_result;
 				while ( !flag && time_before(jiffies, startwait + 60*HZ) ) {
 
-					memset(cmd, 0, MAX_COMMAND_SIZE);
+					memset(cmd, 0, BLK_MAX_CDB);
 					cmd[0] = TEST_UNIT_READY;
 
 					SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, DMA_NONE, STp->timeout,
@@ -1667,7 +1667,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct osst
 static int osst_reposition_and_retry(struct osst_tape * STp, struct osst_request ** aSRpnt,
 					unsigned int frame, unsigned int skip, int pending)
 {
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	struct osst_request   * SRpnt;
 	char		      * name      = tape_name(STp);
 	int			expected  = 0;
@@ -1707,7 +1707,7 @@ static int osst_reposition_and_retry(struct osst_tape * STp, struct osst_request
 		}
 		if (pending && STp->cur_frames < 50) {
 
-			memset(cmd, 0, MAX_COMMAND_SIZE);
+			memset(cmd, 0, BLK_MAX_CDB);
 			cmd[0] = WRITE_6;
 			cmd[1] = 1;
 			cmd[4] = 1;
@@ -2152,11 +2152,11 @@ static int osst_space_over_filemarks_forward_fast(struct osst_tape * STp, struct
 #if DEBUG
 static void osst_set_retries(struct osst_tape * STp, struct osst_request ** aSRpnt, int retries)
 {
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	struct osst_request   * SRpnt  = * aSRpnt;
 	char		      * name   = tape_name(STp);
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = MODE_SELECT;
 	cmd[1] = 0x10;
 	cmd[4] = NUMBER_RETRIES_PAGE_LENGTH + MODE_HEADER_LENGTH;
@@ -2682,7 +2682,7 @@ static unsigned int osst_parse_firmware_rev (const char * str)
  */
 static int osst_configure_onstream(struct osst_tape *STp, struct osst_request ** aSRpnt)
 {
-	unsigned char                  cmd[MAX_COMMAND_SIZE];
+	unsigned char                  cmd[BLK_MAX_CDB];
 	char                         * name = tape_name(STp);
 	struct osst_request          * SRpnt = * aSRpnt;
 	osst_mode_parameter_header_t * header;
@@ -2707,7 +2707,7 @@ static int osst_configure_onstream(struct osst_tape *STp, struct osst_request **
 	 * Configure 32.5KB (data+aux) frame size.
          * Get the current frame size from the block size mode page
 	 */
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = MODE_SENSE;
 	cmd[1] = 8;
 	cmd[2] = BLOCK_SIZE_PAGE;
@@ -2745,7 +2745,7 @@ static int osst_configure_onstream(struct osst_tape *STp, struct osst_request **
 	bs->record32 = 0;
 	bs->record32_5 = 1;
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = MODE_SELECT;
 	cmd[1] = 0x10;
 	cmd[4] = BLOCK_SIZE_PAGE_LENGTH + MODE_HEADER_LENGTH;
@@ -2771,7 +2771,7 @@ static int osst_configure_onstream(struct osst_tape *STp, struct osst_request **
 	 * Set vendor name to 'LIN4' for "Linux support version 4".
 	 */
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = MODE_SELECT;
 	cmd[1] = 0x10;
 	cmd[4] = VENDOR_IDENT_PAGE_LENGTH + MODE_HEADER_LENGTH;
@@ -2799,7 +2799,7 @@ static int osst_configure_onstream(struct osst_tape *STp, struct osst_request **
 	    return (-EIO);
 	}
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = MODE_SENSE;
 	cmd[1] = 8;
 	cmd[2] = CAPABILITIES_PAGE;
@@ -2819,7 +2819,7 @@ static int osst_configure_onstream(struct osst_tape *STp, struct osst_request **
 
 	drive_buffer_size = ntohs(cp->buffer_size) / 2;
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = MODE_SENSE;
 	cmd[1] = 8;
 	cmd[2] = TAPE_PARAMTR_PAGE;
@@ -2882,7 +2882,7 @@ static int cross_eof(struct osst_tape *STp, struct osst_request ** aSRpnt, int f
 
 static int osst_get_frame_position(struct osst_tape *STp, struct osst_request ** aSRpnt)
 {
-	unsigned char		scmd[MAX_COMMAND_SIZE];
+	unsigned char		scmd[BLK_MAX_CDB];
 	struct osst_request   * SRpnt;
 	int			result = 0;
 	char    	      * name   = tape_name(STp);
@@ -2895,7 +2895,7 @@ static int osst_get_frame_position(struct osst_tape *STp, struct osst_request **
 
 	if (STp->ready != ST_READY) return (-EIO);
 
-	memset (scmd, 0, MAX_COMMAND_SIZE);
+	memset (scmd, 0, BLK_MAX_CDB);
 	scmd[0] = READ_POSITION;
 
 	STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24;
@@ -2916,7 +2916,7 @@ static int osst_get_frame_position(struct osst_tape *STp, struct osst_request **
 		if (result == -EIO) {	/* re-read position - this needs to preserve media errors */
 			unsigned char mysense[16];
 			memcpy (mysense, SRpnt->sense, 16);
-			memset (scmd, 0, MAX_COMMAND_SIZE);
+			memset (scmd, 0, BLK_MAX_CDB);
 			scmd[0] = READ_POSITION;
 			STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24;
 			SRpnt = osst_do_scsi(SRpnt, STp, scmd, 20, DMA_FROM_DEVICE,
@@ -2966,7 +2966,7 @@ static int osst_get_frame_position(struct osst_tape *STp, struct osst_request **
 /* Set the tape block */
 static int osst_set_frame_position(struct osst_tape *STp, struct osst_request ** aSRpnt, int ppos, int skip)
 {
-	unsigned char		scmd[MAX_COMMAND_SIZE];
+	unsigned char		scmd[BLK_MAX_CDB];
 	struct osst_request   * SRpnt;
 	struct st_partstat    * STps;
 	int			result = 0;
@@ -2988,7 +2988,7 @@ static int osst_set_frame_position(struct osst_tape *STp, struct osst_request **
 		if (debugging)
 			printk(OSST_DEB_MSG "%s:D: Setting ppos to %d.\n", name, pp);
 #endif
-		memset (scmd, 0, MAX_COMMAND_SIZE);
+		memset (scmd, 0, BLK_MAX_CDB);
 		scmd[0] = SEEK_10;
 		scmd[1] = 1;
 		scmd[3] = (pp >> 24);
@@ -3053,7 +3053,7 @@ static int osst_flush_write_buffer(struct osst_tape *STp, struct osst_request **
 {
 	int			offset, transfer, blks = 0;
 	int			result = 0;
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	struct osst_request   * SRpnt = *aSRpnt;
 	struct st_partstat    * STps;
 	char		      * name = tape_name(STp);
@@ -3100,7 +3100,7 @@ static int osst_flush_write_buffer(struct osst_tape *STp, struct osst_request **
 			if (osst_wait_frame (STp, aSRpnt, STp->first_frame_position, -50, 120))
 				result = osst_recover_wait_frame(STp, aSRpnt, 1);
 
-		memset(cmd, 0, MAX_COMMAND_SIZE);
+		memset(cmd, 0, BLK_MAX_CDB);
 		cmd[0] = WRITE_6;
 		cmd[1] = 1;
 		cmd[4] = 1;
@@ -3243,7 +3243,7 @@ static int osst_flush_buffer(struct osst_tape * STp, struct osst_request ** aSRp
 
 static int osst_write_frame(struct osst_tape * STp, struct osst_request ** aSRpnt, int synchronous)
 {
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	struct osst_request   * SRpnt;
 	int			blks;
 #if DEBUG
@@ -3276,7 +3276,7 @@ static int osst_write_frame(struct osst_tape * STp, struct osst_request ** aSRpn
 	STp->ps[STp->partition].rw = ST_WRITING;
 	STp->write_type            = OS_WRITE_DATA;
 			
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0]   = WRITE_6;
 	cmd[1]   = 1;
 	cmd[4]   = 1;						/* one frame at a time... */
@@ -4058,7 +4058,7 @@ static int osst_int_ioctl(struct osst_tape * STp, struct osst_request ** aSRpnt,
 	long			ltmp;
 	int			i, ioctl_result;
 	int			chg_eof = 1;
-	unsigned char		cmd[MAX_COMMAND_SIZE];
+	unsigned char		cmd[BLK_MAX_CDB];
 	struct osst_request   * SRpnt = * aSRpnt;
 	struct st_partstat    * STps;
 	int			fileno, blkno, at_sm, frame_seq_numbr, logical_blk_num;
@@ -4079,7 +4079,7 @@ static int osst_int_ioctl(struct osst_tape * STp, struct osst_request ** aSRpnt,
 	frame_seq_numbr = STp->frame_seq_number;
 	logical_blk_num = STp->logical_blk_num;
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	switch (cmd_in) {
 	 case MTFSFM:
 		chg_eof = 0; /* Changed from the FSF after this */
@@ -4441,7 +4441,7 @@ static int __os_scsi_tape_open(struct inode * inode, struct file * filp)
 {
 	unsigned short	      flags;
 	int		      i, b_size, new_session = 0, retval = 0;
-	unsigned char	      cmd[MAX_COMMAND_SIZE];
+	unsigned char	      cmd[BLK_MAX_CDB];
 	struct osst_request * SRpnt = NULL;
 	struct osst_tape    * STp;
 	struct st_modedef   * STm;
@@ -4542,7 +4542,7 @@ static int __os_scsi_tape_open(struct inode * inode, struct file * filp)
 	STp->nbr_waits = STp->nbr_finished = 0;
 #endif
 
-	memset (cmd, 0, MAX_COMMAND_SIZE);
+	memset (cmd, 0, BLK_MAX_CDB);
 	cmd[0] = TEST_UNIT_READY;
 
 	SRpnt = osst_do_scsi(NULL, STp, cmd, 0, DMA_NONE, STp->timeout, MAX_RETRIES, 1);
@@ -4561,7 +4561,7 @@ static int __os_scsi_tape_open(struct inode * inode, struct file * filp)
 			goto err_out;
 		}
 		if (SRpnt->sense[13] == 2) {	/* initialize command required (LOAD) */
-			memset (cmd, 0, MAX_COMMAND_SIZE);
+			memset (cmd, 0, BLK_MAX_CDB);
         		cmd[0] = START_STOP;
 			cmd[1] = 1;
 			cmd[4] = 1;
@@ -4579,7 +4579,7 @@ static int __os_scsi_tape_open(struct inode * inode, struct file * filp)
 
 		for (i=0; i < 10; i++) {
 
-			memset (cmd, 0, MAX_COMMAND_SIZE);
+			memset (cmd, 0, BLK_MAX_CDB);
 			cmd[0] = TEST_UNIT_READY;
 
 			SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, DMA_NONE,
@@ -4613,7 +4613,7 @@ static int __os_scsi_tape_open(struct inode * inode, struct file * filp)
 	if (!STp->buffer->syscall_result && STp->header_ok &&
 	    !SRpnt->result && SRpnt->sense[0] == 0) {
 
-		memset(cmd, 0, MAX_COMMAND_SIZE);
+		memset(cmd, 0, BLK_MAX_CDB);
 		cmd[0] = MODE_SENSE;
 		cmd[1] = 8;
 		cmd[2] = VENDOR_IDENT_PAGE;
@@ -4665,7 +4665,7 @@ static int __os_scsi_tape_open(struct inode * inode, struct file * filp)
 	if ((STp->buffer)->syscall_result != 0 &&   /* in all error conditions except no medium */ 
 	    (SRpnt->sense[2] != 2 || SRpnt->sense[12] != 0x3A) ) {
 
-		memset(cmd, 0, MAX_COMMAND_SIZE);
+		memset(cmd, 0, BLK_MAX_CDB);
 		cmd[0] = MODE_SELECT;
 		cmd[1] = 0x10;
 		cmd[4] = 4 + MODE_HEADER_LENGTH;
@@ -4688,7 +4688,7 @@ static int __os_scsi_tape_open(struct inode * inode, struct file * filp)
 
 		for (i=0; i < 10; i++) {
 
-			memset (cmd, 0, MAX_COMMAND_SIZE);
+			memset (cmd, 0, BLK_MAX_CDB);
 			cmd[0] = TEST_UNIT_READY;
 
 			SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, DMA_NONE,
diff --git a/drivers/scsi/osst.h b/drivers/scsi/osst.h
index b4fea98..a49d0fa 100644
--- a/drivers/scsi/osst.h
+++ b/drivers/scsi/osst.h
@@ -630,7 +630,7 @@ struct osst_tape {
 
 /* scsi tape command */
 struct osst_request {
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 	unsigned char sense[SCSI_SENSE_BUFFERSIZE];
 	int result;
 	struct osst_tape *stp;
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index c68a66e..383344d 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -2853,7 +2853,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
 		cmd->cmnd[0], (long)CMD_HANDLE(sp->cmd));
 	dprintk(2, "             bus %i, target %i, lun %i\n",
 		SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), SCSI_LUN_32(cmd));
-	qla1280_dump_buffer(2, cmd->cmnd, MAX_COMMAND_SIZE);
+	qla1280_dump_buffer(2, cmd->cmnd, BLK_MAX_CDB);
 
 	/*
 	 * Build command packet.
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index c4f7b56..aa501d8 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -138,7 +138,7 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
 
 int scsi_set_medium_removal(struct scsi_device *sdev, char state)
 {
-	char scsi_cmd[MAX_COMMAND_SIZE];
+	char scsi_cmd[BLK_MAX_CDB];
 	int ret;
 
 	if (!sdev->removable || !sdev->lockable)
@@ -198,7 +198,7 @@ static int scsi_ioctl_get_pci(struct scsi_device *sdev, void __user *arg)
  */
 int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
 {
-	char scsi_cmd[MAX_COMMAND_SIZE];
+	char scsi_cmd[BLK_MAX_CDB];
 
 	/* Check for deprecated ioctls ... all the ioctls which don't
 	 * follow the new unique numbering scheme are deprecated */
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 5d90cf4..a5323a2 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -179,7 +179,7 @@ int scsi_complete_async_scans(void)
 static void scsi_unlock_floptical(struct scsi_device *sdev,
 				  unsigned char *result)
 {
-	unsigned char scsi_cmd[MAX_COMMAND_SIZE];
+	unsigned char scsi_cmd[BLK_MAX_CDB];
 
 	sdev_printk(KERN_NOTICE, sdev, "unlocking floptical drive\n");
 	scsi_cmd[0] = MODE_SENSE;
@@ -558,7 +558,7 @@ static void sanitize_inquiry_string(unsigned char *s, int len)
 static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
 			  int result_len, int *bflags)
 {
-	unsigned char scsi_cmd[MAX_COMMAND_SIZE];
+	unsigned char scsi_cmd[BLK_MAX_CDB];
 	int first_inquiry_len, try_inquiry_len, next_inquiry_len;
 	int response_len = 0;
 	int pass, count, result;
@@ -1292,7 +1292,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
 				int rescan)
 {
 	char devname[64];
-	unsigned char scsi_cmd[MAX_COMMAND_SIZE];
+	unsigned char scsi_cmd[BLK_MAX_CDB];
 	unsigned int length;
 	u64 lun;
 	unsigned int num_luns;
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 9a1c342..de46b86 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -670,7 +670,7 @@ static int write_behind_check(struct scsi_tape * STp)
 static int cross_eof(struct scsi_tape * STp, int forward)
 {
 	struct st_request *SRpnt;
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 
 	cmd[0] = SPACE;
 	cmd[1] = 0x01;		/* Space FileMarks */
@@ -707,7 +707,7 @@ static int st_flush_write_buffer(struct scsi_tape * STp)
 {
 	int transfer, blks;
 	int result;
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 	struct st_request *SRpnt;
 	struct st_partstat *STps;
 
@@ -721,7 +721,7 @@ static int st_flush_write_buffer(struct scsi_tape * STp)
 		transfer = STp->buffer->buffer_bytes;
 		DEBC_printk(STp, "Flushing %d bytes.\n", transfer);
 
-		memset(cmd, 0, MAX_COMMAND_SIZE);
+		memset(cmd, 0, BLK_MAX_CDB);
 		cmd[0] = WRITE_6;
 		cmd[1] = 1;
 		blks = transfer / STp->block_size;
@@ -912,14 +912,14 @@ static int test_ready(struct scsi_tape *STp, int do_wait)
 {
 	int attentions, waits, max_wait, scode;
 	int retval = CHKRES_READY, new_session = 0;
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 	struct st_request *SRpnt = NULL;
 	struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
 
 	max_wait = do_wait ? ST_BLOCK_SECONDS : 0;
 
 	for (attentions=waits=0; ; ) {
-		memset((void *) &cmd[0], 0, MAX_COMMAND_SIZE);
+		memset((void *) &cmd[0], 0, BLK_MAX_CDB);
 		cmd[0] = TEST_UNIT_READY;
 		SRpnt = st_do_scsi(SRpnt, STp, cmd, 0, DMA_NONE,
 				   STp->long_timeout, MAX_READY_RETRIES, 1);
@@ -985,7 +985,7 @@ static int test_ready(struct scsi_tape *STp, int do_wait)
 static int check_tape(struct scsi_tape *STp, struct file *filp)
 {
 	int i, retval, new_session = 0, do_wait;
-	unsigned char cmd[MAX_COMMAND_SIZE], saved_cleaning;
+	unsigned char cmd[BLK_MAX_CDB], saved_cleaning;
 	unsigned short st_flags = filp->f_flags;
 	struct st_request *SRpnt = NULL;
 	struct st_modedef *STm;
@@ -1051,7 +1051,7 @@ static int check_tape(struct scsi_tape *STp, struct file *filp)
 	if (STp->omit_blklims)
 		STp->min_block = STp->max_block = (-1);
 	else {
-		memset((void *) &cmd[0], 0, MAX_COMMAND_SIZE);
+		memset((void *) &cmd[0], 0, BLK_MAX_CDB);
 		cmd[0] = READ_BLOCK_LIMITS;
 
 		SRpnt = st_do_scsi(SRpnt, STp, cmd, 6, DMA_FROM_DEVICE,
@@ -1077,7 +1077,7 @@ static int check_tape(struct scsi_tape *STp, struct file *filp)
 		}
 	}
 
-	memset((void *) &cmd[0], 0, MAX_COMMAND_SIZE);
+	memset((void *) &cmd[0], 0, BLK_MAX_CDB);
 	cmd[0] = MODE_SENSE;
 	cmd[4] = 12;
 
@@ -1286,7 +1286,7 @@ static int st_open(struct inode *inode, struct file *filp)
 static int st_flush(struct file *filp, fl_owner_t id)
 {
 	int result = 0, result2;
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 	struct st_request *SRpnt;
 	struct scsi_tape *STp = filp->private_data;
 	struct st_modedef *STm = &(STp->modes[STp->current_mode]);
@@ -1322,7 +1322,7 @@ static int st_flush(struct file *filp, fl_owner_t id)
 		DEBC_printk(STp, "Async write waits %d, finished %d.\n",
 			    STp->nbr_waits, STp->nbr_finished);
 #endif
-		memset(cmd, 0, MAX_COMMAND_SIZE);
+		memset(cmd, 0, BLK_MAX_CDB);
 		cmd[0] = WRITE_FILEMARKS;
 		if (STp->immediate_filemark)
 			cmd[1] = 1;
@@ -1570,7 +1570,7 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
 	ssize_t retval;
 	int undone, retry_eot = 0, scode;
 	int async_write;
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 	const char __user *b_point;
 	struct st_request *SRpnt = NULL;
 	struct scsi_tape *STp = filp->private_data;
@@ -1659,7 +1659,7 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
 
 	total = count;
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = WRITE_6;
 	cmd[1] = (STp->block_size != 0);
 
@@ -1846,7 +1846,7 @@ static long read_tape(struct scsi_tape *STp, long count,
 		      struct st_request ** aSRpnt)
 {
 	int transfer, blks, bytes;
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 	struct st_request *SRpnt;
 	struct st_modedef *STm;
 	struct st_partstat *STps;
@@ -1877,7 +1877,7 @@ static long read_tape(struct scsi_tape *STp, long count,
 		}
 	}
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = READ_6;
 	cmd[1] = (STp->block_size != 0);
 	if (!cmd[1] && STp->sili)
@@ -2418,10 +2418,10 @@ static int st_set_options(struct scsi_tape *STp, long options)
    parameter, if necessary. */
 static int read_mode_page(struct scsi_tape *STp, int page, int omit_block_descs)
 {
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 	struct st_request *SRpnt;
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = MODE_SENSE;
 	if (omit_block_descs)
 		cmd[1] = MODE_SENSE_OMIT_BDESCS;
@@ -2444,11 +2444,11 @@ static int read_mode_page(struct scsi_tape *STp, int page, int omit_block_descs)
 static int write_mode_page(struct scsi_tape *STp, int page, int slow)
 {
 	int pgo;
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 	struct st_request *SRpnt;
 	int timeout;
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = MODE_SELECT;
 	cmd[1] = MODE_SELECT_PAGE_FORMAT;
 	pgo = MODE_HEADER_LENGTH + (STp->buffer)->b_data[MH_OFF_BDESCS_LENGTH];
@@ -2544,7 +2544,7 @@ static int st_compression(struct scsi_tape * STp, int state)
 static int do_load_unload(struct scsi_tape *STp, struct file *filp, int load_code)
 {
 	int retval = (-EIO), timeout;
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 	struct st_partstat *STps;
 	struct st_request *SRpnt;
 
@@ -2555,7 +2555,7 @@ static int do_load_unload(struct scsi_tape *STp, struct file *filp, int load_cod
 			return (-EIO);
 	}
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	cmd[0] = START_STOP;
 	if (load_code)
 		cmd[4] |= 1;
@@ -2643,7 +2643,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
 	long ltmp;
 	int ioctl_result;
 	int chg_eof = 1;
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 	struct st_request *SRpnt;
 	struct st_partstat *STps;
 	int fileno, blkno, at_sm, undone;
@@ -2662,7 +2662,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
 	blkno = STps->drv_block;
 	at_sm = STps->at_sm;
 
-	memset(cmd, 0, MAX_COMMAND_SIZE);
+	memset(cmd, 0, BLK_MAX_CDB);
 	switch (cmd_in) {
 	case MTFSFM:
 		chg_eof = 0;	/* Changed from the FSF after this */
@@ -3046,13 +3046,13 @@ static int get_location(struct scsi_tape *STp, unsigned int *block, int *partiti
 			int logical)
 {
 	int result;
-	unsigned char scmd[MAX_COMMAND_SIZE];
+	unsigned char scmd[BLK_MAX_CDB];
 	struct st_request *SRpnt;
 
 	if (STp->ready != ST_READY)
 		return (-EIO);
 
-	memset(scmd, 0, MAX_COMMAND_SIZE);
+	memset(scmd, 0, BLK_MAX_CDB);
 	if ((STp->device)->scsi_level < SCSI_2) {
 		scmd[0] = QFA_REQUEST_BLOCK;
 		scmd[4] = 3;
@@ -3109,7 +3109,7 @@ static int set_location(struct scsi_tape *STp, unsigned int block, int partition
 	int result, p;
 	unsigned int blk;
 	int timeout;
-	unsigned char scmd[MAX_COMMAND_SIZE];
+	unsigned char scmd[BLK_MAX_CDB];
 	struct st_request *SRpnt;
 
 	if (STp->ready != ST_READY)
@@ -3138,7 +3138,7 @@ static int set_location(struct scsi_tape *STp, unsigned int block, int partition
 		}
 	}
 
-	memset(scmd, 0, MAX_COMMAND_SIZE);
+	memset(scmd, 0, BLK_MAX_CDB);
 	if ((STp->device)->scsi_level < SCSI_2) {
 		scmd[0] = QFA_SEEK_BLOCK;
 		scmd[2] = (block >> 16);
diff --git a/drivers/scsi/st.h b/drivers/scsi/st.h
index f3eee0f..3e45170 100644
--- a/drivers/scsi/st.h
+++ b/drivers/scsi/st.h
@@ -24,7 +24,7 @@ struct scsi_tape;
 
 /* scsi tape command */
 struct st_request {
-	unsigned char cmd[MAX_COMMAND_SIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 	unsigned char sense[SCSI_SENSE_BUFFERSIZE];
 	int result;
 	struct scsi_tape *stp;
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index f6c954c..39e2b03 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -153,14 +153,14 @@ static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag)
 static void pscsi_tape_read_blocksize(struct se_device *dev,
 		struct scsi_device *sdev)
 {
-	unsigned char cdb[MAX_COMMAND_SIZE], *buf;
+	unsigned char cdb[BLK_MAX_CDB], *buf;
 	int ret;
 
 	buf = kzalloc(12, GFP_KERNEL);
 	if (!buf)
 		return;
 
-	memset(cdb, 0, MAX_COMMAND_SIZE);
+	memset(cdb, 0, BLK_MAX_CDB);
 	cdb[0] = MODE_SENSE;
 	cdb[4] = 0x0c; /* 12 bytes */
 
@@ -201,14 +201,14 @@ pscsi_set_inquiry_info(struct scsi_device *sdev, struct t10_wwn *wwn)
 static int
 pscsi_get_inquiry_vpd_serial(struct scsi_device *sdev, struct t10_wwn *wwn)
 {
-	unsigned char cdb[MAX_COMMAND_SIZE], *buf;
+	unsigned char cdb[BLK_MAX_CDB], *buf;
 	int ret;
 
 	buf = kzalloc(INQUIRY_VPD_SERIAL_LEN, GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
 
-	memset(cdb, 0, MAX_COMMAND_SIZE);
+	memset(cdb, 0, BLK_MAX_CDB);
 	cdb[0] = INQUIRY;
 	cdb[1] = 0x01; /* Query VPD */
 	cdb[2] = 0x80; /* Unit Serial Number */
@@ -236,7 +236,7 @@ static void
 pscsi_get_inquiry_vpd_device_ident(struct scsi_device *sdev,
 		struct t10_wwn *wwn)
 {
-	unsigned char cdb[MAX_COMMAND_SIZE], *buf, *page_83;
+	unsigned char cdb[BLK_MAX_CDB], *buf, *page_83;
 	int ident_len, page_len, off = 4, ret;
 	struct t10_vpd *vpd;
 
@@ -244,7 +244,7 @@ pscsi_get_inquiry_vpd_device_ident(struct scsi_device *sdev,
 	if (!buf)
 		return;
 
-	memset(cdb, 0, MAX_COMMAND_SIZE);
+	memset(cdb, 0, BLK_MAX_CDB);
 	cdb[0] = INQUIRY;
 	cdb[1] = 0x01; /* Query VPD */
 	cdb[2] = 0x83; /* Device Identifier */
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index 3cc109f..faa09dc 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -277,7 +277,7 @@ struct fsg_common {
 	unsigned int		fsg_num_buffers;
 
 	int			cmnd_size;
-	u8			cmnd[MAX_COMMAND_SIZE];
+	u8			cmnd[BLK_MAX_CDB];
 
 	unsigned int		nluns;
 	unsigned int		lun;
@@ -2132,7 +2132,7 @@ static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh)
 
 	/* Is the CBW meaningful? */
 	if (cbw->Lun >= FSG_MAX_LUNS || cbw->Flags & ~US_BULK_FLAG_IN ||
-			cbw->Length <= 0 || cbw->Length > MAX_COMMAND_SIZE) {
+			cbw->Length <= 0 || cbw->Length > BLK_MAX_CDB) {
 		DBG(fsg, "non-meaningful CBW: lun = %u, flags = 0x%x, "
 				"cmdlen %u\n",
 				cbw->Lun, cbw->Flags, cbw->Length);
diff --git a/drivers/usb/gadget/function/storage_common.h b/drivers/usb/gadget/function/storage_common.h
index 70c8914..45d3b87 100644
--- a/drivers/usb/gadget/function/storage_common.h
+++ b/drivers/usb/gadget/function/storage_common.h
@@ -65,9 +65,6 @@ do {									\
 
 #endif /* DUMP_MSGS */
 
-/* Length of a SCSI Command Data Block */
-#define MAX_COMMAND_SIZE	16
-
 /* SCSI Sense Key/Additional Sense Code/ASC Qualifier values */
 #define SS_NO_SENSE				0
 #define SS_COMMUNICATION_FAILURE		0x040800
diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
index b3466d1..081f69d 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -82,7 +82,7 @@ static struct us_unusual_dev cypress_unusual_dev_list[] = {
  */
 static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 {
-	unsigned char save_cmnd[MAX_COMMAND_SIZE];
+	unsigned char save_cmnd[BLK_MAX_CDB];
 
 	if (likely(srb->cmnd[0] != ATA_16 && srb->cmnd[0] != ATA_12)) {
 		usb_stor_transparent_scsi_command(srb, us);
@@ -90,7 +90,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 	}
 
 	memcpy(save_cmnd, srb->cmnd, sizeof(save_cmnd));
-	memset(srb->cmnd, 0, MAX_COMMAND_SIZE);
+	memset(srb->cmnd, 0, BLK_MAX_CDB);
 
 	/* check if we support the command */
 	if (save_cmnd[1] >> 5) /* MULTIPLE_COUNT */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 9fc1aec..3416b70 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -14,23 +14,6 @@ struct scsi_driver;
 
 #include <scsi/scsi_device.h>
 
-/*
- * MAX_COMMAND_SIZE is:
- * The longest fixed-length SCSI CDB as per the SCSI standard.
- * fixed-length means: commands that their size can be determined
- * by their opcode and the CDB does not carry a length specifier, (unlike
- * the VARIABLE_LENGTH_CMD(0x7f) command). This is actually not exactly
- * true and the SCSI standard also defines extended commands and
- * vendor specific commands that can be bigger than 16 bytes. The kernel
- * will support these using the same infrastructure used for VARLEN CDB's.
- * So in effect MAX_COMMAND_SIZE means the maximum size command scsi-ml
- * supports without specifying a cmd_len by ULD's
- */
-#define MAX_COMMAND_SIZE 16
-#if (MAX_COMMAND_SIZE > BLK_MAX_CDB)
-# error MAX_COMMAND_SIZE can not be bigger than BLK_MAX_CDB
-#endif
-
 struct scsi_data_buffer {
 	struct sg_table table;
 	unsigned length;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux