Skip to contentSkip to conversation

Split SCSI header files

PATCH In review Bart Van Assche 3 participants 15 messages May 8, 2015 – May 11, 2015

Subsystems (22)
Documentation SCSI USB Block layer +18 more subsystems
lore
Share & tools
lore
#0 lore raw

v4 cover 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 v4 of this series compared to v3:
- Split the first patch of this series into two patches as proposed by Christoph.

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-Move-code-that-is-used-both-by-initiator-and-target-.patch 0003-Replace-MAX_COMMAND_SIZE-with-BLK_MAX_CDB.patch 0004-target-Correct-a-comment.patch 0005-target-Minimize-SCSI-header-include-directives.patch

#1 lore raw

PATCH v4 1/5 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>. 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]>
---
 include/scsi/scsi.h       | 272 +-------------------------------------------
 include/scsi/scsi_proto.h | 281 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 283 insertions(+), 270 deletions(-)
 create mode 100644 include/scsi/scsi_proto.h
include/scsi/scsi.h +2 -270
index d0a66aa..f238e6e 100644
@@ -1,9 +1,6 @@
 /*
  * This header file contains public constants and structures used by
- * the scsi code for linux.
- *
- * For documentation on the OPCODES, MESSAGES, and SENSE values,
- * please consult the SCSI standard.
+ * the SCSI initiator code.
  */
 #ifndef _SCSI_SCSI_H
 #define _SCSI_SCSI_H
@@ -11,6 +8,7 @@
 #include <linux/types.h>
 #include <linux/scatterlist.h>
 #include <linux/kernel.h>
+#include <scsi/scsi_proto.h>
 
 struct scsi_cmnd;
 
@@ -49,171 +47,6 @@ enum scsi_timeouts {
  */
 #define SCAN_WILD_CARD	~0
 
-/*
- *      SCSI opcodes
- */
-
-#define TEST_UNIT_READY       0x00
-#define REZERO_UNIT           0x01
-#define REQUEST_SENSE         0x03
-#define FORMAT_UNIT           0x04
-#define READ_BLOCK_LIMITS     0x05
-#define REASSIGN_BLOCKS       0x07
-#define INITIALIZE_ELEMENT_STATUS 0x07
-#define READ_6                0x08
-#define WRITE_6               0x0a
-#define SEEK_6                0x0b
-#define READ_REVERSE          0x0f
-#define WRITE_FILEMARKS       0x10
-#define SPACE                 0x11
-#define INQUIRY               0x12
-#define RECOVER_BUFFERED_DATA 0x14
-#define MODE_SELECT           0x15
-#define RESERVE               0x16
-#define RELEASE               0x17
-#define COPY                  0x18
-#define ERASE                 0x19
-#define MODE_SENSE            0x1a
-#define START_STOP            0x1b
-#define RECEIVE_DIAGNOSTIC    0x1c
-#define SEND_DIAGNOSTIC       0x1d
-#define ALLOW_MEDIUM_REMOVAL  0x1e
-
-#define READ_FORMAT_CAPACITIES 0x23
-#define SET_WINDOW            0x24
-#define READ_CAPACITY         0x25
-#define READ_10               0x28
-#define WRITE_10              0x2a
-#define SEEK_10               0x2b
-#define POSITION_TO_ELEMENT   0x2b
-#define WRITE_VERIFY          0x2e
-#define VERIFY                0x2f
-#define SEARCH_HIGH           0x30
-#define SEARCH_EQUAL          0x31
-#define SEARCH_LOW            0x32
-#define SET_LIMITS            0x33
-#define PRE_FETCH             0x34
-#define READ_POSITION         0x34
-#define SYNCHRONIZE_CACHE     0x35
-#define LOCK_UNLOCK_CACHE     0x36
-#define READ_DEFECT_DATA      0x37
-#define MEDIUM_SCAN           0x38
-#define COMPARE               0x39
-#define COPY_VERIFY           0x3a
-#define WRITE_BUFFER          0x3b
-#define READ_BUFFER           0x3c
-#define UPDATE_BLOCK          0x3d
-#define READ_LONG             0x3e
-#define WRITE_LONG            0x3f
-#define CHANGE_DEFINITION     0x40
-#define WRITE_SAME            0x41
-#define UNMAP		      0x42
-#define READ_TOC              0x43
-#define READ_HEADER           0x44
-#define GET_EVENT_STATUS_NOTIFICATION 0x4a
-#define LOG_SELECT            0x4c
-#define LOG_SENSE             0x4d
-#define XDWRITEREAD_10        0x53
-#define MODE_SELECT_10        0x55
-#define RESERVE_10            0x56
-#define RELEASE_10            0x57
-#define MODE_SENSE_10         0x5a
-#define PERSISTENT_RESERVE_IN 0x5e
-#define PERSISTENT_RESERVE_OUT 0x5f
-#define VARIABLE_LENGTH_CMD   0x7f
-#define REPORT_LUNS           0xa0
-#define SECURITY_PROTOCOL_IN  0xa2
-#define MAINTENANCE_IN        0xa3
-#define MAINTENANCE_OUT       0xa4
-#define MOVE_MEDIUM           0xa5
-#define EXCHANGE_MEDIUM       0xa6
-#define READ_12               0xa8
-#define SERVICE_ACTION_OUT_12 0xa9
-#define WRITE_12              0xaa
-#define READ_MEDIA_SERIAL_NUMBER 0xab /* Obsolete with SPC-2 */
-#define SERVICE_ACTION_IN_12  0xab
-#define WRITE_VERIFY_12       0xae
-#define VERIFY_12	      0xaf
-#define SEARCH_HIGH_12        0xb0
-#define SEARCH_EQUAL_12       0xb1
-#define SEARCH_LOW_12         0xb2
-#define SECURITY_PROTOCOL_OUT 0xb5
-#define READ_ELEMENT_STATUS   0xb8
-#define SEND_VOLUME_TAG       0xb6
-#define WRITE_LONG_2          0xea
-#define EXTENDED_COPY         0x83
-#define RECEIVE_COPY_RESULTS  0x84
-#define ACCESS_CONTROL_IN     0x86
-#define ACCESS_CONTROL_OUT    0x87
-#define READ_16               0x88
-#define COMPARE_AND_WRITE     0x89
-#define WRITE_16              0x8a
-#define READ_ATTRIBUTE        0x8c
-#define WRITE_ATTRIBUTE	      0x8d
-#define VERIFY_16	      0x8f
-#define SYNCHRONIZE_CACHE_16  0x91
-#define WRITE_SAME_16	      0x93
-#define SERVICE_ACTION_BIDIRECTIONAL 0x9d
-#define SERVICE_ACTION_IN_16  0x9e
-#define SERVICE_ACTION_OUT_16 0x9f
-/* values for service action in */
-#define	SAI_READ_CAPACITY_16  0x10
-#define SAI_GET_LBA_STATUS    0x12
-#define SAI_REPORT_REFERRALS  0x13
-/* values for VARIABLE_LENGTH_CMD service action codes
- * see spc4r17 Section D.3.5, table D.7 and D.8 */
-#define VLC_SA_RECEIVE_CREDENTIAL 0x1800
-/* values for maintenance in */
-#define MI_REPORT_IDENTIFYING_INFORMATION 0x05
-#define MI_REPORT_TARGET_PGS  0x0a
-#define MI_REPORT_ALIASES     0x0b
-#define MI_REPORT_SUPPORTED_OPERATION_CODES 0x0c
-#define MI_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS 0x0d
-#define MI_REPORT_PRIORITY    0x0e
-#define MI_REPORT_TIMESTAMP   0x0f
-#define MI_MANAGEMENT_PROTOCOL_IN 0x10
-/* value for MI_REPORT_TARGET_PGS ext header */
-#define MI_EXT_HDR_PARAM_FMT  0x20
-/* values for maintenance out */
-#define MO_SET_IDENTIFYING_INFORMATION 0x06
-#define MO_SET_TARGET_PGS     0x0a
-#define MO_CHANGE_ALIASES     0x0b
-#define MO_SET_PRIORITY       0x0e
-#define MO_SET_TIMESTAMP      0x0f
-#define MO_MANAGEMENT_PROTOCOL_OUT 0x10
-/* values for variable length command */
-#define XDREAD_32	      0x03
-#define XDWRITE_32	      0x04
-#define XPWRITE_32	      0x06
-#define XDWRITEREAD_32	      0x07
-#define READ_32		      0x09
-#define VERIFY_32	      0x0a
-#define WRITE_32	      0x0b
-#define WRITE_SAME_32	      0x0d
-
-/* Values for T10/04-262r7 */
-#define	ATA_16		      0x85	/* 16-byte pass-thru */
-#define	ATA_12		      0xa1	/* 12-byte pass-thru */
-
-/* Vendor specific CDBs start here */
-#define VENDOR_SPECIFIC_CDB 0xc0
-
-/*
- *	SCSI command lengths
- */
-
-#define SCSI_MAX_VARLEN_CDB_SIZE 260
-
-/* defined in T10 SCSI Primary Commands-2 (SPC2) */
-struct scsi_varlen_cdb_hdr {
-	__u8 opcode;        /* opcode always == VARIABLE_LENGTH_CMD */
-	__u8 control;
-	__u8 misc[5];
-	__u8 additional_cdb_length;         /* total cdb length - 8 */
-	__be16 service_action;
-	/* service specific data follows */
-};
-
 static inline unsigned
 scsi_varlen_cdb_length(const void *hdr)
 {
@@ -240,22 +73,6 @@ extern void
 scsi_unregister_acpi_bus_type(struct acpi_bus_type *bus);
 #endif
 
-/*
- *  SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft
- *  T10/1561-D Revision 4 Draft dated 7th November 2002.
- */
-#define SAM_STAT_GOOD            0x00
-#define SAM_STAT_CHECK_CONDITION 0x02
-#define SAM_STAT_CONDITION_MET   0x04
-#define SAM_STAT_BUSY            0x08
-#define SAM_STAT_INTERMEDIATE    0x10
-#define SAM_STAT_INTERMEDIATE_CONDITION_MET 0x14
-#define SAM_STAT_RESERVATION_CONFLICT 0x18
-#define SAM_STAT_COMMAND_TERMINATED 0x22	/* obsolete in SAM-3 */
-#define SAM_STAT_TASK_SET_FULL   0x28
-#define SAM_STAT_ACA_ACTIVE      0x30
-#define SAM_STAT_TASK_ABORTED    0x40
-
 /** scsi_status_is_good - check the status return.
  *
  * @status: the status passed up from the driver (including host and
@@ -279,84 +96,6 @@ static inline int scsi_status_is_good(int status)
 		(status == SAM_STAT_COMMAND_TERMINATED));
 }
 
-/*
- *  Status codes. These are deprecated as they are shifted 1 bit right
- *  from those found in the SCSI standards. This causes confusion for
- *  applications that are ported to several OSes. Prefer SAM Status codes
- *  above.
- */
-
-#define GOOD                 0x00
-#define CHECK_CONDITION      0x01
-#define CONDITION_GOOD       0x02
-#define BUSY                 0x04
-#define INTERMEDIATE_GOOD    0x08
-#define INTERMEDIATE_C_GOOD  0x0a
-#define RESERVATION_CONFLICT 0x0c
-#define COMMAND_TERMINATED   0x11
-#define QUEUE_FULL           0x14
-#define ACA_ACTIVE           0x18
-#define TASK_ABORTED         0x20
-
-#define STATUS_MASK          0xfe
-
-/*
- *  SENSE KEYS
- */
-
-#define NO_SENSE            0x00
-#define RECOVERED_ERROR     0x01
-#define NOT_READY           0x02
-#define MEDIUM_ERROR        0x03
-#define HARDWARE_ERROR      0x04
-#define ILLEGAL_REQUEST     0x05
-#define UNIT_ATTENTION      0x06
-#define DATA_PROTECT        0x07
-#define BLANK_CHECK         0x08
-#define COPY_ABORTED        0x0a
-#define ABORTED_COMMAND     0x0b
-#define VOLUME_OVERFLOW     0x0d
-#define MISCOMPARE          0x0e
-
-
-/*
- *  DEVICE TYPES
- *  Please keep them in 0x%02x format for $MODALIAS to work
- */
-
-#define TYPE_DISK           0x00
-#define TYPE_TAPE           0x01
-#define TYPE_PRINTER        0x02
-#define TYPE_PROCESSOR      0x03    /* HP scanners use this */
-#define TYPE_WORM           0x04    /* Treated as ROM by our system */
-#define TYPE_ROM            0x05
-#define TYPE_SCANNER        0x06
-#define TYPE_MOD            0x07    /* Magneto-optical disk - 
-				     * - treated as TYPE_DISK */
-#define TYPE_MEDIUM_CHANGER 0x08
-#define TYPE_COMM           0x09    /* Communications device */
-#define TYPE_RAID           0x0c
-#define TYPE_ENCLOSURE      0x0d    /* Enclosure Services Device */
-#define TYPE_RBC	    0x0e
-#define TYPE_OSD            0x11
-#define TYPE_ZBC            0x14
-#define TYPE_WLUN           0x1e    /* well-known logical unit */
-#define TYPE_NO_LUN         0x7f
-
-/* SCSI protocols; these are taken from SPC-3 section 7.5 */
-enum scsi_protocol {
-	SCSI_PROTOCOL_FCP = 0,	/* Fibre Channel */
-	SCSI_PROTOCOL_SPI = 1,	/* parallel SCSI */
-	SCSI_PROTOCOL_SSA = 2,	/* Serial Storage Architecture - Obsolete */
-	SCSI_PROTOCOL_SBP = 3,	/* firewire */
-	SCSI_PROTOCOL_SRP = 4,	/* Infiniband RDMA */
-	SCSI_PROTOCOL_ISCSI = 5,
-	SCSI_PROTOCOL_SAS = 6,
-	SCSI_PROTOCOL_ADT = 7,	/* Media Changers */
-	SCSI_PROTOCOL_ATA = 8,
-	SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */
-};
-
 /* Returns a human-readable name for the device */
 extern const char * scsi_device_type(unsigned type);
 
@@ -380,13 +119,6 @@ struct ccs_modesel_head {
 };
 
 /*
- * ScsiLun: 8 byte LUN.
- */
-struct scsi_lun {
-	__u8 scsi_lun[8];
-};
-
-/*
  * The Well Known LUNS (SAM-3) in our int representation of a LUN
  */
 #define SCSI_W_LUN_BASE 0xc100
include/scsi/scsi_proto.h new file +281 -0

281 lines not on this page · raw message

Signature · 1 line
2.1.4
Reviewed-by on v4 1/5
#2 lore raw
Quoted 11 lines · Bart Van Assche

Move the constants that are used by both initiator and target drivers into the new header file <scsi/scsi_proto.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]>

---

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		               zSeries & Storage
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#4 lore raw

PATCH v4 2/5 Move code that is used both by initiator and target drivers

In reply to Bart Van Assche

Move the functions that are used by both the initiator and target 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        |  19 +----
 include/scsi/scsi_common.h |  64 ++++++++++++++++
 include/scsi/scsi_device.h |   2 -
 include/scsi/scsi_eh.h     |  31 --------
 9 files changed, 244 insertions(+), 223 deletions(-)
 create mode 100644 drivers/scsi/scsi_common.c
 create mode 100644 include/scsi/scsi_common.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 +1 -18
index f238e6e..e0a3398 100644
@@ -8,6 +8,7 @@
 #include <linux/types.h>
 #include <linux/scatterlist.h>
 #include <linux/kernel.h>
+#include <scsi/scsi_common.h>
 #include <scsi/scsi_proto.h>
 
 struct scsi_cmnd;
@@ -47,22 +48,6 @@ enum scsi_timeouts {
  */
 #define SCAN_WILD_CARD	~0
 
-static inline unsigned
-scsi_varlen_cdb_length(const void *hdr)
-{
-	return ((struct scsi_varlen_cdb_hdr *)hdr)->additional_cdb_length + 8;
-}
-
-extern const unsigned char scsi_command_size_tbl[8];
-#define COMMAND_SIZE(opcode) scsi_command_size_tbl[((opcode) >> 5) & 7]
-
-static inline unsigned
-scsi_command_size(const unsigned char *cmnd)
-{
-	return (cmnd[0] == VARIABLE_LENGTH_CMD) ?
-		scsi_varlen_cdb_length(cmnd) : COMMAND_SIZE(cmnd[0]);
-}
-
 #ifdef CONFIG_ACPI
 struct acpi_bus_type;
 
@@ -96,8 +81,6 @@ static inline int scsi_status_is_good(int status)
 		(status == SAM_STAT_COMMAND_TERMINATED));
 }
 
-/* Returns a human-readable name for the device */
-extern const char * scsi_device_type(unsigned type);
 
 /*
  * standard mode-select header prepended to all mode-select commands
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 5a4bb5b..4942710 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);
 
Signature · 1 line
2.1.4
Reviewed-by on v4 2/5
#5 lore raw

Re: [PATCH v4 2/5] Move code that is used both by initiator and target drivers

Quoted 11 lines · Bart Van Assche

Move the functions that are used by both the initiator and target 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]>

---

Cheers,

Hannes

Signature · 9 lines
Dr. Hannes Reinecke		               zSeries & Storage
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw

PATCH v4 3/5 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 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)

Cc Nicholas Bellinger <[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 3131adc..582b5d4 100644
@@ -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;
 
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..fa4f4bb 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 8eab107..a616885 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 5d90cf4..a5323a2 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;
@@ -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;
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 3cc109f..faa09dc 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 b3466d1..081f69d 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
Reviewed-by on v4 3/5
#8 lore raw

Re: [PATCH v4 3/5] Replace MAX_COMMAND_SIZE with BLK_MAX_CDB

Quoted 10 lines · 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 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)

Quoted 6 lines
Cc Nicholas Bellinger <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Mike Christie <[email protected]>

---

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		               zSeries & Storage
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#9 lore raw

Re: [PATCH v4 3/5] Replace MAX_COMMAND_SIZE with BLK_MAX_CDB

In reply to Bart Van Assche

I know I suggested this, but as I have some other work to actually kill BLK_MAX_CDB now we might want to go for the light-weight variant where we just #define MAX_COMMAND_SIZE to BLK_MAX_CDB for now.

Sorry for causing this additional work.

#10 lore raw

Re: [PATCH v4 3/5] Replace MAX_COMMAND_SIZE with BLK_MAX_CDB

Quoted 5 lines · Christoph Hellwig

I know I suggested this, but as I have some other work to actually kill BLK_MAX_CDB now we might want to go for the light-weight variant where we just #define MAX_COMMAND_SIZE to BLK_MAX_CDB for now.

Sorry for causing this additional work.

Actually this makes my job easier because it allows me to drop a whole bunch of changes. Is the patch below what you had in mind ?

Thanks,

Bart.

From: Bart Van Assche <[email protected]>
Subject: [PATCH v5] Make MAX_COMMAND_SIZE identical to BLK_MAX_CDB

Since the two constants MAX_COMMAND_SIZE and BLK_MAX_CDB have the same meaning, define MAX_COMMAND_SIZE as BLK_MAX_CDB.

Cc Christoph Hellwig <[email protected]>
Cc Nicholas Bellinger <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Mike Christie <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Andrzej Pietrasiewicz <[email protected]>
---
 drivers/usb/gadget/function/storage_common.h |  3 ---
 include/scsi/scsi_cmnd.h                     | 17 +++--------------
 2 files changed, 3 insertions(+), 17 deletions(-)
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
include/scsi/scsi_cmnd.h +3 -14
index 9fc1aec..6379d07 100644
@@ -15,21 +15,10 @@ 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
+ * MAX_COMMAND_SIZE is the maximum length of a CDB that fits in struct request
+ * without allocating additional memory.
  */
-#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
+#define MAX_COMMAND_SIZE BLK_MAX_CDB
 
 struct scsi_data_buffer {
 	struct sg_table table;
Signature · 1 line
2.1.4
Reviewed-by
#11 lore raw

Re: [PATCH v4 3/5] Replace MAX_COMMAND_SIZE with BLK_MAX_CDB

Quoted 2 lines · Bart Van Assche

Actually this makes my job easier because it allows me to drop a whole bunch of changes. Is the patch below what you had in mind ?

Yes, this looks good:

#12 lore raw

PATCH v4 4/5 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 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 480e9f8..0203774 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
Reviewed-by on v4 4/5
#13 lore raw

Re: [PATCH v4 4/5] target: Correct a comment

Quoted 29 lines · 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 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 +0 -5
index 480e9f8..0203774 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

include/target/target_core_base.h line 24

Quoted 10 lines
include/target/target_core_base.h +2 -5
- * 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
 /*

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		               zSeries & Storage
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#14 lore raw

PATCH v4 5/5 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. With this patch the only initiator include directives in target code that remain are as follows:

$ git grep -nHE 'include .scsi/(scsi.h|scsi_host.h|scsi_device.h|scsi_cmnd.h)' drivers/target drivers/infiniband/ulp/{isert,srpt} drivers/usb/gadget/legacy/tcm_*.[ch] drivers/{vhost,xen} include/{target,trace/events/target.h}
drivers/target/loopback/tcm_loop.c:29:#include <scsi/scsi.h>
drivers/target/loopback/tcm_loop.c:31:#include <scsi/scsi_host.h>
drivers/target/loopback/tcm_loop.c:32:#include <scsi/scsi_device.h>
drivers/target/loopback/tcm_loop.c:33:#include <scsi/scsi_cmnd.h>
drivers/target/target_core_pscsi.c:39:#include <scsi/scsi_device.h>
drivers/target/target_core_pscsi.c:40:#include <scsi/scsi_host.h>
drivers/xen/xen-scsiback.c:52:#include <scsi/scsi_host.h> /* SG_ALL */
Cc Nicholas Bellinger <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Chris Boot <[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 2ba71ce..6085e1f 100755
@@ -503,11 +503,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 9b84b4c..af70d39 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 34871a6..e0836c6 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 18b0f97..ce81f17 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 7faa6ae..2dd7ea3 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 f7e6e51..169f33c 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 1b7947c..31ed331a 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 c1aa965..83d50b3 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 a263bf5..8882686 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 8855781..39a95ad 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 7912aa1..52ea640 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 315ec34..a5bb0c4 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 47f0644..84de757 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 3fe5cb2..d89793a 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 dbc872a..21b438e 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 a600ff1..7a4486a 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 65dce13..86b699b 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 8b80add..789b047 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 5e19bb5..0841975 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 b7f5150..39223c3e 100644
@@ -49,10 +49,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 54e7af3..006983b 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 0203774..aec6f6a 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