Move the scsi_medium_access_command() definition
PATCH 1/1 Move the scsi_medium_access_command() definition
Move the scsi_medium_access_command() definition from a header file into a .c file to reduce the kernel build time. This function is used by the scsi_debug and by the sd drivers.
Cc Douglas Gilbert <[email protected]>
Signed-off-by Bart Van Assche <[email protected]>
--- drivers/scsi/scsi_lib.c | 33 +++++++++++++++++++++++++++++++++ drivers/scsi/sd.h | 32 -------------------------------- include/scsi/scsi_cmnd.h | 2 ++ 3 files changed, 35 insertions(+), 32 deletions(-)
drivers/scsi/scsi_lib.c +33 -0
@@ -3119,3 +3119,36 @@ int scsi_vpd_tpg_id(struct scsi_device *sdev, int *rel_id)return group_id; }EXPORT_SYMBOL (scsi_vpd_tpg_id); + +bool scsi_medium_access_command (const struct scsi_cmnd *scmd) +{ +switch (scmd->cmnd[0 ]) { +case READ_6 : +case READ_10 : +case READ_12 : +case READ_16 : +case SYNCHRONIZE_CACHE : +case VERIFY : +case VERIFY_12 : +case VERIFY_16 : +case WRITE_6 : +case WRITE_10 : +case WRITE_12 : +case WRITE_16 : +case WRITE_SAME : +case WRITE_SAME_16 : +case UNMAP : +return true; +case VARIABLE_LENGTH_CMD : +switch (scmd->cmnd[9 ]) { +case READ_32 : +case VERIFY_32 : +case WRITE_32 : +case WRITE_SAME_32 : +return true; + } + } + +return false; +} +EXPORT_SYMBOL (scsi_medium_access_command);
drivers/scsi/sd.h +0 -32
@@ -136,38 +136,6 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk) sd_printk(prefix, sdsk, fmt, ##a); \ }while (0 ) -static inline int scsi_medium_access_command(struct scsi_cmnd *scmd) -{ -switch (scmd->cmnd[0 ]) { -case READ_6 : -case READ_10 : -case READ_12 : -case READ_16 : -case SYNCHRONIZE_CACHE : -case VERIFY : -case VERIFY_12 : -case VERIFY_16 : -case WRITE_6 : -case WRITE_10 : -case WRITE_12 : -case WRITE_16 : -case WRITE_SAME : -case WRITE_SAME_16 : -case UNMAP : -return 1 ; -case VARIABLE_LENGTH_CMD : -switch (scmd->cmnd[9 ]) { -case READ_32 : -case VERIFY_32 : -case WRITE_32 : -case WRITE_SAME_32 : -return 1 ; - } - } - -return 0 ; -} - static inline sector_t logical_to_sectors(struct scsi_device *sdev, sector_t blocks) {return blocks << (ilog2 (sdev->sector_size) -9 );
include/scsi/scsi_cmnd.h +2 -0
@@ -168,6 +168,8 @@ extern void scsi_kunmap_atomic_sg(void *virt);extern blk_status_t scsi_init_io (struct scsi_cmnd *cmd); +extern bool scsi_medium_access_command (const struct scsi_cmnd *scmd); +#ifdef CONFIG_SCSI_DMA extern int scsi_dma_map (struct scsi_cmnd *cmd);extern void scsi_dma_unmap (struct scsi_cmnd *cmd);