Skip to contentSkip to conversation

Split SCSI header files

PATCH Superseded Bart Van Assche 2 participants 6 messages Apr 7, 2015 – Apr 13, 2015

Subsystems (22)
Documentation SCSI USB Block layer +18 more subsystems

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Split SCSI header files

Move the constants and functions that are used by both initiator and target code to new header files such that the target code does no longer have to include initiator header files.

Changes in v3 of this series compared to v2:
- Renamed scsi_lib.h into scsi_common.h.
- Added a patch for replacing MAX_COMMAND_SIZE with BLK_MAX_CDB.
- Added a patch that minimizes the include directives in target code.

Changes in v2 of this series compared to v1:
- Dropped the scsi_lun.h header file and introduced scsi_lib.h.

The patches in this series are:
0001-Split-SCSI-header-files.patch 0002-Replace-MAX_COMMAND_SIZE-with-BLK_MAX_CDB.patch 0003-target-Correct-a-comment.patch 0004-target-Minimize-SCSI-header-include-directives.patch

#1 lore raw

PATCH v3 1/4 Split SCSI header files

Move the constants that are used by both initiator and target drivers into the new header file <scsi/scsi_proto.h>. Move the functions that are used by both subsystems into scsi_common.c/.h. This change will allow to remove the initiator SCSI header include directives from most SCSI target source files in a later patch.

Cc Nicholas Bellinger <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Mike Christie <[email protected]>
---
 drivers/scsi/Makefile      |   1 +
 drivers/scsi/scsi.c        |  46 -------
 drivers/scsi/scsi_common.c | 178 +++++++++++++++++++++++++++
 drivers/scsi/scsi_error.c  |  64 ----------
 drivers/scsi/scsi_scan.c   |  62 ----------
 include/scsi/scsi.h        | 291 +--------------------------------------------
 include/scsi/scsi_common.h |  64 ++++++++++
 include/scsi/scsi_device.h |   2 -
 include/scsi/scsi_eh.h     |  31 -----
 include/scsi/scsi_proto.h  | 281 +++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 527 insertions(+), 493 deletions(-)
 create mode 100644 drivers/scsi/scsi_common.c
 create mode 100644 include/scsi/scsi_common.h
 create mode 100644 include/scsi/scsi_proto.h
drivers/scsi/Makefile +1 -0
index dee160a..ee4517b 100644
@@ -161,6 +161,7 @@ obj-$(CONFIG_SCSI_OSD_INITIATOR) += osd/
 obj-$(CONFIG_SCSI_DEBUG)	+= scsi_debug.o
 scsi_mod-y			+= scsi.o hosts.o scsi_ioctl.o \
 				   scsicam.o scsi_error.o scsi_lib.o
+scsi_mod-y			+= scsi_common.o
 scsi_mod-$(CONFIG_SCSI_CONSTANTS) += constants.o
 scsi_mod-$(CONFIG_SCSI_DMA)	+= scsi_lib_dma.o
 scsi_mod-y			+= scsi_scan.o scsi_sysfs.o scsi_devinfo.o
drivers/scsi/scsi.c +0 -46

52 lines not on this page · raw message

drivers/scsi/scsi_common.c new file +178 -0

178 lines not on this page · raw message

drivers/scsi/scsi_error.c +0 -64

70 lines not on this page · raw message

drivers/scsi/scsi_scan.c +0 -62

68 lines not on this page · raw message

include/scsi/scsi.h +3 -288

326 lines not on this page · raw message

include/scsi/scsi_common.h new file +64 -0

64 lines not on this page · raw message

include/scsi/scsi_device.h +0 -2
index a4c9336..ae84b22 100644
@@ -413,8 +413,6 @@ extern void scsi_target_reap(struct scsi_target *);
 extern void scsi_target_block(struct device *);
 extern void scsi_target_unblock(struct device *, enum scsi_device_state);
 extern void scsi_remove_target(struct device *);
-extern void int_to_scsilun(u64, struct scsi_lun *);
-extern u64 scsilun_to_int(struct scsi_lun *);
 extern const char *scsi_device_state_name(enum scsi_device_state);
 extern int scsi_is_sdev_device(const struct device *);
 extern int scsi_is_target_device(const struct device *);
include/scsi/scsi_eh.h +0 -31
index 1e1421b..8d1d7fa 100644
@@ -7,43 +7,12 @@
 struct scsi_device;
 struct Scsi_Host;
 
-/*
- * This is a slightly modified SCSI sense "descriptor" format header.
- * The addition is to allow the 0x70 and 0x71 response codes. The idea
- * is to place the salient data from either "fixed" or "descriptor" sense
- * format into one structure to ease application processing.
- *
- * The original sense buffer should be kept around for those cases
- * in which more information is required (e.g. the LBA of a MEDIUM ERROR).
- */
-struct scsi_sense_hdr {		/* See SPC-3 section 4.5 */
-	u8 response_code;	/* permit: 0x0, 0x70, 0x71, 0x72, 0x73 */
-	u8 sense_key;
-	u8 asc;
-	u8 ascq;
-	u8 byte4;
-	u8 byte5;
-	u8 byte6;
-	u8 additional_length;	/* always 0 for fixed sense format */
-};
-
-static inline bool scsi_sense_valid(const struct scsi_sense_hdr *sshdr)
-{
-	if (!sshdr)
-		return false;
-
-	return (sshdr->response_code & 0x70) == 0x70;
-}
-
-
 extern void scsi_eh_finish_cmd(struct scsi_cmnd *scmd,
 			       struct list_head *done_q);
 extern void scsi_eh_flush_done_q(struct list_head *done_q);
 extern void scsi_report_bus_reset(struct Scsi_Host *, int);
 extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
 extern int scsi_block_when_processing_errors(struct scsi_device *);
-extern bool scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
-				 struct scsi_sense_hdr *sshdr);
 extern bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd,
 					 struct scsi_sense_hdr *sshdr);
 
include/scsi/scsi_proto.h new file +281 -0

281 lines not on this page · raw message

Signature · 1 line
2.1.4
#2 lore raw

PATCH v3 2/4 Replace MAX_COMMAND_SIZE with BLK_MAX_CDB

In reply to Bart Van Assche

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 by removing the MAX_COMMAND_SIZE definition manually from <scsi/scsi_cmnd.h> and also from drivers/usb/gadget/function/storage_common.h. The other changes in this patch have been generated with the help of the following command:

sed -i.orig 's/\([^a-zA-Z_]\)MAX_COMMAND_SIZE/\1BLK_MAX_CDB/g' $(git grep -lw MAX_COMMAND_SIZE)

Cc Nicholas Bellinger <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Mike Christie <[email protected]>
---
 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(-)
drivers/ata/libata-scsi.c +2 -2
index b061ba2..1ae14a7 100644
@@ -483,7 +483,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;
@@ -592,7 +592,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;
 
drivers/block/cciss_scsi.c +1 -1
index ecd845c..5cf43db 100644
@@ -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 *) 
drivers/scsi/53c700.c +4 -4
index 82abfce..da19099 100644
@@ -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;
 }
drivers/scsi/53c700.h +1 -1
index e06bdfe..dd06fb7 100644
@@ -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;
 };
 
drivers/scsi/gdth.c +3 -3
index 71e1380..455bb6c 100644
@@ -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));
 
drivers/scsi/gdth_proc.c +2 -2
index e66e997..88bfe50 100644
@@ -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);
drivers/scsi/hpsa.c +1 -1
index a1cfbd3..5179d9e 100644
@@ -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 -
drivers/scsi/isci/init.c +1 -1
index cd41b63..e0c9d07 100644
@@ -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)
drivers/scsi/mvumi.c +5 -5
index 3e6b866..93689c3 100644
@@ -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);
drivers/scsi/mvumi.h +1 -1
index 41f1687..712d456 100644
@@ -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];
 };
 
drivers/scsi/osst.c +48 -48

381 lines not on this page · raw message

drivers/scsi/osst.h +1 -1
index b4fea98..a49d0fa 100644
@@ -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;
drivers/scsi/qla1280.c +1 -1
index c68a66e..383344d 100644
@@ -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.
drivers/scsi/scsi_ioctl.c +2 -2
index c4f7b56..aa501d8 100644
@@ -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 */
drivers/scsi/scsi_scan.c +3 -3
index 202369b..085d139 100644
@@ -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;
@@ -1286,7 +1286,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;
drivers/scsi/st.c +26 -26

200 lines not on this page · raw message

drivers/scsi/st.h +1 -1
index f3eee0f..3e45170 100644
@@ -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;
drivers/target/target_core_pscsi.c +6 -6
index f6c954c..39e2b03 100644
@@ -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 */
drivers/usb/gadget/function/f_mass_storage.c +2 -2
index 811929c..05b7439 100644
@@ -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);
drivers/usb/gadget/function/storage_common.h +0 -3
index 70c8914..45d3b87 100644
@@ -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
drivers/usb/storage/cypress_atacb.c +2 -2
index 8514a2d..d29808d 100644
@@ -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 */
include/scsi/scsi_cmnd.h +0 -17
index 9fc1aec..3416b70 100644
@@ -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;
Signature · 1 line
2.1.4
#3 lore raw

PATCH v3 3/4 target: Correct a comment

In reply to Bart Van Assche

Correct the comment above the definition of TCM_MAX_COMMAND_SIZE. A quote from Christoph:

There aren't any legacy issues, we just decided to handle > 16 byte CDBs in the slow path.

Cc Nicholas Bellinger <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Mike Christie <[email protected]>
---
 include/target/target_core_base.h | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
include/target/target_core_base.h +2 -10
index 672150b..7a6e55f 100644
@@ -17,16 +17,8 @@
 /* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */
 #define TRANSPORT_MAX_LUNS_PER_TPG		256
 /*
- * By default we use 32-byte CDBs in TCM Core and subsystem plugin code.
- *
- * Note that both include/scsi/scsi_cmnd.h:MAX_COMMAND_SIZE and
- * include/linux/blkdev.h:BLOCK_MAX_CDB as of v2.6.36-rc4 still use
- * 16-byte CDBs by default and require an extra allocation for
- * 32-byte CDBs to because of legacy issues.
- *
- * Within TCM Core there are no such legacy limitiations, so we go ahead
- * use 32-byte CDBs by default and use include/scsi/scsi.h:scsi_command_size()
- * within all TCM Core and subsystem plugin code.
+ * Maximum size of a CDB that can be stored in se_cmd without allocating
+ * memory dynamically for the CDB.
  */
 #define TCM_MAX_COMMAND_SIZE			32
 /*
Signature · 1 line
2.1.4
#4 lore raw

PATCH v3 4/4 target: Minimize SCSI header #include directives

In reply to Bart Van Assche

Only include SCSI initiator header files in target code that needs these header files, namely the SCSI pass-through code and the tcm_loop driver. Change SCSI_SENSE_BUFFERSIZE into TRANSPORT_SENSE_BUFFER in target code because the former is intended for initiator code and the latter for target code.

Cc Christoph Hellwig <[email protected]>
Cc Nicholas Bellinger <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Mike Christie <[email protected]>
---
 Documentation/target/tcm_mod_builder.py    | 7 ++-----
 drivers/infiniband/ulp/srpt/ib_srpt.c      | 1 +
 drivers/infiniband/ulp/srpt/ib_srpt.h      | 2 +-
 drivers/target/iscsi/iscsi_target.c        | 2 +-
 drivers/target/iscsi/iscsi_target_device.c | 1 -
 drivers/target/iscsi/iscsi_target_tmr.c    | 2 +-
 drivers/target/sbp/sbp_target.c            | 2 +-
 drivers/target/target_core_alua.c          | 3 +--
 drivers/target/target_core_device.c        | 4 ++--
 drivers/target/target_core_fabric_lib.c    | 2 --
 drivers/target/target_core_file.c          | 3 +--
 drivers/target/target_core_iblock.c        | 3 +--
 drivers/target/target_core_pr.c            | 3 +--
 drivers/target/target_core_pscsi.c         | 2 --
 drivers/target/target_core_pscsi.h         | 6 +++---
 drivers/target/target_core_rd.c            | 3 +--
 drivers/target/target_core_sbc.c           | 2 +-
 drivers/target/target_core_spc.c           | 3 ++-
 drivers/target/target_core_stat.c          | 3 ---
 drivers/target/target_core_tmr.c           | 2 --
 drivers/target/target_core_tpg.c           | 3 +--
 drivers/target/target_core_transport.c     | 4 +---
 drivers/target/target_core_ua.c            | 3 +--
 drivers/target/target_core_user.c          | 5 +++--
 drivers/target/target_core_xcopy.c         | 3 +--
 drivers/target/tcm_fc/tfc_cmd.c            | 4 ----
 drivers/target/tcm_fc/tfc_conf.c           | 4 ----
 drivers/target/tcm_fc/tfc_io.c             | 4 ----
 drivers/target/tcm_fc/tfc_sess.c           | 4 ----
 drivers/usb/gadget/legacy/tcm_usb_gadget.c | 1 -
 drivers/usb/gadget/legacy/tcm_usb_gadget.h | 1 -
 drivers/vhost/scsi.c                       | 3 ++-
 drivers/xen/xen-scsiback.c                 | 5 +----
 include/target/iscsi/iscsi_target_core.h   | 1 -
 include/target/target_core_base.h          | 3 +--
 include/trace/events/target.h              | 2 +-
 36 files changed, 32 insertions(+), 74 deletions(-)
Documentation/target/tcm_mod_builder.py +2 -5
index 2b47704..cd9d124 100755
@@ -558,11 +558,8 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
 	buf += "#include <linux/string.h>\n"
 	buf += "#include <linux/ctype.h>\n"
 	buf += "#include <asm/unaligned.h>\n"
-	buf += "#include <scsi/scsi.h>\n"
-	buf += "#include <scsi/scsi_host.h>\n"
-	buf += "#include <scsi/scsi_device.h>\n"
-	buf += "#include <scsi/scsi_cmnd.h>\n"
-	buf += "#include <scsi/libfc.h>\n\n"
+	buf += "#include <scsi/scsi_common.h>\n"
+	buf += "#include <scsi/scsi_proto.h>\n"
 	buf += "#include <target/target_core_base.h>\n"
 	buf += "#include <target/target_core_fabric.h>\n"
 	buf += "#include <target/target_core_configfs.h>\n\n"
drivers/infiniband/ulp/srpt/ib_srpt.c +1 -0
index 6e0a477..e95145a 100644
@@ -41,6 +41,7 @@
 #include <linux/string.h>
 #include <linux/delay.h>
 #include <linux/atomic.h>
+#include <scsi/scsi_proto.h>
 #include <scsi/scsi_tcq.h>
 #include <target/configfs_macros.h>
 #include <target/target_core_base.h>
drivers/infiniband/ulp/srpt/ib_srpt.h +1 -1
index 3dae156..d85c0c2 100644
@@ -245,7 +245,7 @@ struct srpt_send_ioctx {
 	u8			n_rdma;
 	u8			n_rbuf;
 	bool			queue_status_only;
-	u8			sense_data[SCSI_SENSE_BUFFERSIZE];
+	u8			sense_data[TRANSPORT_SENSE_BUFFER];
 };
 
 /**
drivers/target/iscsi/iscsi_target.c +1 -1
index 2accb6e..168ac7d 100644
@@ -23,7 +23,7 @@
 #include <linux/module.h>
 #include <linux/idr.h>
 #include <asm/unaligned.h>
-#include <scsi/scsi_device.h>
+#include <scsi/scsi_proto.h>
 #include <scsi/iscsi_proto.h>
 #include <scsi/scsi_tcq.h>
 #include <target/target_core_base.h>
drivers/target/iscsi/iscsi_target_device.c +0 -1
index 34c3cd1..5fabcd3 100644
@@ -17,7 +17,6 @@
  * GNU General Public License for more details.
  ******************************************************************************/
 
-#include <scsi/scsi_device.h>
 #include <target/target_core_base.h>
 #include <target/target_core_fabric.h>
 
drivers/target/iscsi/iscsi_target_tmr.c +1 -1
index b0224a7..fe9a582 100644
@@ -17,7 +17,7 @@
  ******************************************************************************/
 
 #include <asm/unaligned.h>
-#include <scsi/scsi_device.h>
+#include <scsi/scsi_proto.h>
 #include <scsi/iscsi_proto.h>
 #include <target/target_core_base.h>
 #include <target/target_core_fabric.h>
drivers/target/sbp/sbp_target.c +1 -1
index 9512af6..30aecb9 100644
@@ -30,7 +30,7 @@
 #include <linux/ctype.h>
 #include <linux/firewire.h>
 #include <linux/firewire-constants.h>
-#include <scsi/scsi.h>
+#include <scsi/scsi_proto.h>
 #include <scsi/scsi_tcq.h>
 #include <target/target_core_base.h>
 #include <target/target_core_backend.h>
drivers/target/target_core_alua.c +1 -2
index 75cbde1..29904a9 100644
@@ -28,8 +28,7 @@
 #include <linux/configfs.h>
 #include <linux/export.h>
 #include <linux/file.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_proto.h>
 #include <asm/unaligned.h>
 
 #include <target/target_core_base.h>
drivers/target/target_core_device.c +2 -2
index 79b4ec3..4015cbd 100644
@@ -35,8 +35,8 @@
 #include <linux/export.h>
 #include <net/sock.h>
 #include <net/tcp.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_device.h>
+#include <scsi/scsi_common.h>
+#include <scsi/scsi_proto.h>
 
 #include <target/target_core_base.h>
 #include <target/target_core_backend.h>
drivers/target/target_core_fabric_lib.c +0 -2
index 35bfe77..fdf31ef 100644
@@ -29,8 +29,6 @@
 #include <linux/ctype.h>
 #include <linux/spinlock.h>
 #include <linux/export.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_cmnd.h>
 
 #include <target/target_core_base.h>
 #include <target/target_core_fabric.h>
drivers/target/target_core_file.c +1 -2
index 44620fb..23e4152 100644
@@ -31,8 +31,7 @@
 #include <linux/spinlock.h>
 #include <linux/module.h>
 #include <linux/falloc.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_host.h>
+#include <scsi/scsi_proto.h>
 #include <asm/unaligned.h>
 
 #include <target/target_core_base.h>
drivers/target/target_core_iblock.c +1 -2
index d4a4b0f..d862711 100644
@@ -35,8 +35,7 @@
 #include <linux/genhd.h>
 #include <linux/file.h>
 #include <linux/module.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_host.h>
+#include <scsi/scsi_proto.h>
 #include <asm/unaligned.h>
 
 #include <target/target_core_base.h>
drivers/target/target_core_pr.c +1 -2
index 2de6fb8..2fc16b8 100644
@@ -28,8 +28,7 @@
 #include <linux/spinlock.h>
 #include <linux/list.h>
 #include <linux/file.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_proto.h>
 #include <asm/unaligned.h>
 
 #include <target/target_core_base.h>
drivers/target/target_core_pscsi.c +0 -2
index 39e2b03..98e64a2 100644
@@ -36,9 +36,7 @@
 #include <linux/module.h>
 #include <asm/unaligned.h>
 
-#include <scsi/scsi.h>
 #include <scsi/scsi_device.h>
-#include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_tcq.h>
 
drivers/target/target_core_pscsi.h +3 -3
index 1bd757d..8fee9b0 100644
@@ -16,13 +16,13 @@
 #define PS_TIMEOUT_OTHER	(500*HZ)
 
 #include <linux/device.h>
-#include <scsi/scsi_driver.h>
-#include <scsi/scsi_device.h>
 #include <linux/kref.h>
 #include <linux/kobject.h>
 
+struct scsi_device;
+
 struct pscsi_plugin_task {
-	unsigned char pscsi_sense[SCSI_SENSE_BUFFERSIZE];
+	unsigned char pscsi_sense[TRANSPORT_SENSE_BUFFER];
 	int	pscsi_direction;
 	int	pscsi_result;
 	u32	pscsi_resid;
drivers/target/target_core_rd.c +1 -2
index 98e83ac..0a03597 100644
@@ -29,8 +29,7 @@
 #include <linux/timer.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_host.h>
+#include <scsi/scsi_proto.h>
 
 #include <target/target_core_base.h>
 #include <target/target_core_backend.h>
drivers/target/target_core_sbc.c +1 -1
index 3e72974..95defa7 100644
@@ -25,7 +25,7 @@
 #include <linux/ratelimit.h>
 #include <linux/crc-t10dif.h>
 #include <asm/unaligned.h>
-#include <scsi/scsi.h>
+#include <scsi/scsi_proto.h>
 #include <scsi/scsi_tcq.h>
 
 #include <target/target_core_base.h>
drivers/target/target_core_spc.c +2 -1
index 6c8bd6b..9ebae02 100644
@@ -24,7 +24,8 @@
 #include <linux/module.h>
 #include <asm/unaligned.h>
 
-#include <scsi/scsi.h>
+#include <scsi/scsi_proto.h>
+#include <scsi/scsi_common.h>
 #include <scsi/scsi_tcq.h>
 
 #include <target/target_core_base.h>
drivers/target/target_core_stat.c +0 -3
index 0353899..40f6c13 100644
@@ -33,9 +33,6 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/configfs.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_device.h>
-#include <scsi/scsi_host.h>
 
 #include <target/target_core_base.h>
 #include <target/target_core_backend.h>
drivers/target/target_core_tmr.c +0 -2
index fa5e157..e0201c9 100644
@@ -27,8 +27,6 @@
 #include <linux/spinlock.h>
 #include <linux/list.h>
 #include <linux/export.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_cmnd.h>
 
 #include <target/target_core_base.h>
 #include <target/target_core_backend.h>
drivers/target/target_core_tpg.c +1 -2
index 0696de9..3ec3a3f 100644
@@ -32,8 +32,7 @@
 #include <linux/export.h>
 #include <net/sock.h>
 #include <net/tcp.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_proto.h>
 
 #include <target/target_core_base.h>
 #include <target/target_core_backend.h>
drivers/target/target_core_transport.c +1 -3
index ac3cbab..7f36556 100644
@@ -37,9 +37,7 @@
 #include <asm/unaligned.h>
 #include <net/sock.h>
 #include <net/tcp.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_cmnd.h>
-#include <scsi/scsi_tcq.h>
+#include <scsi/scsi_proto.h>
 
 #include <target/target_core_base.h>
 #include <target/target_core_backend.h>
drivers/target/target_core_ua.c +1 -2
index 1738b16..e44cc94 100644
@@ -25,8 +25,7 @@
 
 #include <linux/slab.h>
 #include <linux/spinlock.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_proto.h>
 
 #include <target/target_core_base.h>
 #include <target/target_core_fabric.h>
drivers/target/target_core_user.c +3 -2
index 1a1bcf7..2a291ba 100644
@@ -19,12 +19,13 @@
 #include <linux/spinlock.h>
 #include <linux/module.h>
 #include <linux/idr.h>
+#include <linux/kernel.h>
 #include <linux/timer.h>
 #include <linux/parser.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_host.h>
 #include <linux/uio_driver.h>
 #include <net/genetlink.h>
+#include <scsi/scsi_common.h>
+#include <scsi/scsi_proto.h>
 #include <target/target_core_base.h>
 #include <target/target_core_fabric.h>
 #include <target/target_core_backend.h>
drivers/target/target_core_xcopy.c +1 -2
index 33ac39b..409ad9a 100644
@@ -25,8 +25,7 @@
 #include <linux/spinlock.h>
 #include <linux/list.h>
 #include <linux/configfs.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_proto.h>
 #include <asm/unaligned.h>
 
 #include <target/target_core_base.h>
drivers/target/tcm_fc/tfc_cmd.c +0 -4
index edcafa4..1bf78e7 100644
@@ -30,10 +30,6 @@
 #include <linux/hash.h>
 #include <linux/percpu_ida.h>
 #include <asm/unaligned.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_host.h>
-#include <scsi/scsi_device.h>
-#include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_tcq.h>
 #include <scsi/libfc.h>
 #include <scsi/fc_encode.h>
drivers/target/tcm_fc/tfc_conf.c +0 -4
index efdcb96..2536846 100644
@@ -34,10 +34,6 @@
 #include <linux/kernel.h>
 #include <linux/ctype.h>
 #include <asm/unaligned.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_host.h>
-#include <scsi/scsi_device.h>
-#include <scsi/scsi_cmnd.h>
 #include <scsi/libfc.h>
 
 #include <target/target_core_base.h>
drivers/target/tcm_fc/tfc_io.c +0 -4
index 583e755..fe585d1 100644
@@ -39,10 +39,6 @@
 #include <linux/hash.h>
 #include <linux/ratelimit.h>
 #include <asm/unaligned.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_host.h>
-#include <scsi/scsi_device.h>
-#include <scsi/scsi_cmnd.h>
 #include <scsi/libfc.h>
 #include <scsi/fc_encode.h>
 
drivers/target/tcm_fc/tfc_sess.c +0 -4
index ccee7e3..f2a616d 100644
@@ -32,10 +32,6 @@
 #include <linux/rculist.h>
 #include <linux/kref.h>
 #include <asm/unaligned.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_host.h>
-#include <scsi/scsi_device.h>
-#include <scsi/scsi_cmnd.h>
 #include <scsi/libfc.h>
 
 #include <target/target_core_base.h>
drivers/usb/gadget/legacy/tcm_usb_gadget.c +0 -1
index 6e0a019..889623c 100644
@@ -16,7 +16,6 @@
 #include <linux/usb/composite.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/storage.h>
-#include <scsi/scsi.h>
 #include <scsi/scsi_tcq.h>
 #include <target/target_core_base.h>
 #include <target/target_core_fabric.h>
drivers/usb/gadget/legacy/tcm_usb_gadget.h +0 -1
index 8289219..9fb3544 100644
@@ -6,7 +6,6 @@
 #include <linux/usb/composite.h>
 #include <linux/usb/uas.h>
 #include <linux/usb/storage.h>
-#include <scsi/scsi.h>
 #include <target/target_core_base.h>
 #include <target/target_core_fabric.h>
 
drivers/vhost/scsi.c +2 -1
index 71df240..694843f 100644
@@ -37,7 +37,8 @@
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
 #include <asm/unaligned.h>
-#include <scsi/scsi.h>
+#include <scsi/scsi_common.h>
+#include <scsi/scsi_proto.h>
 #include <target/target_core_base.h>
 #include <target/target_core_fabric.h>
 #include <target/target_core_fabric_configfs.h>
drivers/xen/xen-scsiback.c +1 -4
index 42bd55a..4796854 100644
@@ -47,10 +47,7 @@
 
 #include <generated/utsrelease.h>
 
-#include <scsi/scsi.h>
-#include <scsi/scsi_dbg.h>
-#include <scsi/scsi_eh.h>
-#include <scsi/scsi_tcq.h>
+#include <scsi/scsi_host.h> /* SG_ALL */
 
 #include <target/target_core_base.h>
 #include <target/target_core_fabric.h>
include/target/iscsi/iscsi_target_core.h +0 -1
index d3583d3..9d98498 100644
@@ -5,7 +5,6 @@
 #include <linux/configfs.h>
 #include <net/sock.h>
 #include <net/tcp.h>
-#include <scsi/scsi_cmnd.h>
 #include <scsi/iscsi_proto.h>
 #include <target/target_core_base.h>
 
include/target/target_core_base.h +1 -2
index 7a6e55f..bc6e6fa 100644
@@ -6,7 +6,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/blkdev.h>
 #include <linux/percpu_ida.h>
-#include <scsi/scsi_cmnd.h>
 #include <net/sock.h>
 #include <net/tcp.h>
 
@@ -25,7 +24,7 @@
  * From include/scsi/scsi_cmnd.h:SCSI_SENSE_BUFFERSIZE, currently
  * defined 96, but the real limit is 252 (or 260 including the header)
  */
-#define TRANSPORT_SENSE_BUFFER			SCSI_SENSE_BUFFERSIZE
+#define TRANSPORT_SENSE_BUFFER			96
 /* Used by transport_send_check_condition_and_sense() */
 #define SPC_SENSE_KEY_OFFSET			2
 #define SPC_ADD_SENSE_LEN_OFFSET		7
include/trace/events/target.h +1 -1
index 04c3c6e..50fea66 100644
@@ -6,7 +6,7 @@
 
 #include <linux/tracepoint.h>
 #include <linux/trace_seq.h>
-#include <scsi/scsi.h>
+#include <scsi/scsi_proto.h>
 #include <scsi/scsi_tcq.h>
 #include <target/target_core_base.h>
 
Signature · 1 line
2.1.4