scsi: target: Rename sbc_ops to exec_cmd_ops
authorMike Christie <michael.christie@oracle.com>
Fri, 7 Apr 2023 20:05:47 +0000 (15:05 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 12 Apr 2023 01:55:36 +0000 (21:55 -0400)
The next patches allow us to call the block layer's pr_ops from the
backends. This will require allowing the backends to hook into the cmd
processing for SPC commands, so this renames sbc_ops to a more generic
exec_cmd_ops.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230407200551.12660-15-michael.christie@oracle.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/target_core_file.c
drivers/target/target_core_iblock.c
drivers/target/target_core_rd.c
drivers/target/target_core_sbc.c
drivers/target/target_core_spc.c
include/target/target_core_backend.h

index ce0e000b74fc39cda2ede86d585e4e423b4b24d7..4d447520bab87d6133ba2611f37c4955e641fe5c 100644 (file)
@@ -896,7 +896,7 @@ static void fd_free_prot(struct se_device *dev)
        fd_dev->fd_prot_file = NULL;
 }
 
-static struct sbc_ops fd_sbc_ops = {
+static struct exec_cmd_ops fd_exec_cmd_ops = {
        .execute_rw             = fd_execute_rw,
        .execute_sync_cache     = fd_execute_sync_cache,
        .execute_write_same     = fd_execute_write_same,
@@ -906,7 +906,7 @@ static struct sbc_ops fd_sbc_ops = {
 static sense_reason_t
 fd_parse_cdb(struct se_cmd *cmd)
 {
-       return sbc_parse_cdb(cmd, &fd_sbc_ops);
+       return sbc_parse_cdb(cmd, &fd_exec_cmd_ops);
 }
 
 static const struct target_backend_ops fileio_ops = {
index cc838ffd129472ef14b8fa2e4f2a77129e974d3b..d93f24f9687d436395037710a20a8b886ad1f541 100644 (file)
@@ -869,7 +869,7 @@ static unsigned int iblock_get_io_opt(struct se_device *dev)
        return bdev_io_opt(bd);
 }
 
-static struct sbc_ops iblock_sbc_ops = {
+static struct exec_cmd_ops iblock_exec_cmd_ops = {
        .execute_rw             = iblock_execute_rw,
        .execute_sync_cache     = iblock_execute_sync_cache,
        .execute_write_same     = iblock_execute_write_same,
@@ -879,7 +879,7 @@ static struct sbc_ops iblock_sbc_ops = {
 static sense_reason_t
 iblock_parse_cdb(struct se_cmd *cmd)
 {
-       return sbc_parse_cdb(cmd, &iblock_sbc_ops);
+       return sbc_parse_cdb(cmd, &iblock_exec_cmd_ops);
 }
 
 static bool iblock_get_write_cache(struct se_device *dev)
index 6648c1c90e19650ab9b69505c70b63d091acdd96..6f67cc09c2b5b8e591248eb9a2b7422fa8a71597 100644 (file)
@@ -643,14 +643,14 @@ static void rd_free_prot(struct se_device *dev)
        rd_release_prot_space(rd_dev);
 }
 
-static struct sbc_ops rd_sbc_ops = {
+static struct exec_cmd_ops rd_exec_cmd_ops = {
        .execute_rw             = rd_execute_rw,
 };
 
 static sense_reason_t
 rd_parse_cdb(struct se_cmd *cmd)
 {
-       return sbc_parse_cdb(cmd, &rd_sbc_ops);
+       return sbc_parse_cdb(cmd, &rd_exec_cmd_ops);
 }
 
 static const struct target_backend_ops rd_mcp_ops = {
index 7536ca7976068a7837c3c5f55f8817909ffa761b..6a02561cc20ce9fb73fbc5f25ee5db0f375058fc 100644 (file)
@@ -192,7 +192,7 @@ EXPORT_SYMBOL(sbc_get_write_same_sectors);
 static sense_reason_t
 sbc_execute_write_same_unmap(struct se_cmd *cmd)
 {
-       struct sbc_ops *ops = cmd->protocol_data;
+       struct exec_cmd_ops *ops = cmd->protocol_data;
        sector_t nolb = sbc_get_write_same_sectors(cmd);
        sense_reason_t ret;
 
@@ -271,7 +271,8 @@ static inline unsigned long long transport_lba_64(unsigned char *cdb)
 }
 
 static sense_reason_t
-sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *ops)
+sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags,
+                    struct exec_cmd_ops *ops)
 {
        struct se_device *dev = cmd->se_dev;
        sector_t end_lba = dev->transport->get_blocks(dev) + 1;
@@ -340,7 +341,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *op
 static sense_reason_t
 sbc_execute_rw(struct se_cmd *cmd)
 {
-       struct sbc_ops *ops = cmd->protocol_data;
+       struct exec_cmd_ops *ops = cmd->protocol_data;
 
        return ops->execute_rw(cmd, cmd->t_data_sg, cmd->t_data_nents,
                               cmd->data_direction);
@@ -566,7 +567,7 @@ out:
 static sense_reason_t
 sbc_compare_and_write(struct se_cmd *cmd)
 {
-       struct sbc_ops *ops = cmd->protocol_data;
+       struct exec_cmd_ops *ops = cmd->protocol_data;
        struct se_device *dev = cmd->se_dev;
        sense_reason_t ret;
        int rc;
@@ -764,7 +765,7 @@ sbc_check_dpofua(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb)
 }
 
 sense_reason_t
-sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
+sbc_parse_cdb(struct se_cmd *cmd, struct exec_cmd_ops *ops)
 {
        struct se_device *dev = cmd->se_dev;
        unsigned char *cdb = cmd->t_task_cdb;
@@ -1076,7 +1077,7 @@ EXPORT_SYMBOL(sbc_get_device_type);
 static sense_reason_t
 sbc_execute_unmap(struct se_cmd *cmd)
 {
-       struct sbc_ops *ops = cmd->protocol_data;
+       struct exec_cmd_ops *ops = cmd->protocol_data;
        struct se_device *dev = cmd->se_dev;
        unsigned char *buf, *ptr = NULL;
        sector_t lba;
index fcc7b10a7ae3547e1ebc3a61cc735abae94c8ba9..00d34616df5dfbd1f08efe43d522bd4c883fd506 100644 (file)
@@ -1431,7 +1431,7 @@ static struct target_opcode_descriptor tcm_opcode_write_verify16 = {
 
 static bool tcm_is_ws_enabled(struct se_cmd *cmd)
 {
-       struct sbc_ops *ops = cmd->protocol_data;
+       struct exec_cmd_ops *ops = cmd->protocol_data;
        struct se_device *dev = cmd->se_dev;
 
        return (dev->dev_attrib.emulate_tpws && !!ops->execute_unmap) ||
@@ -1544,7 +1544,7 @@ static struct target_opcode_descriptor tcm_opcode_sync_cache16 = {
 
 static bool tcm_is_unmap_enabled(struct se_cmd *cmd)
 {
-       struct sbc_ops *ops = cmd->protocol_data;
+       struct exec_cmd_ops *ops = cmd->protocol_data;
        struct se_device *dev = cmd->se_dev;
 
        return ops->execute_unmap && dev->dev_attrib.emulate_tpu;
index a3c193df25b329cfd3edc579711c461cbb499be0..c5df78959532f1a99db5a730880aa3b966d3796a 100644 (file)
@@ -62,7 +62,7 @@ struct target_backend_ops {
        struct configfs_attribute **tb_dev_action_attrs;
 };
 
-struct sbc_ops {
+struct exec_cmd_ops {
        sense_reason_t (*execute_rw)(struct se_cmd *cmd, struct scatterlist *,
                                     u32, enum dma_data_direction);
        sense_reason_t (*execute_sync_cache)(struct se_cmd *cmd);
@@ -86,7 +86,7 @@ sense_reason_t        spc_emulate_report_luns(struct se_cmd *cmd);
 sense_reason_t spc_emulate_inquiry_std(struct se_cmd *, unsigned char *);
 sense_reason_t spc_emulate_evpd_83(struct se_cmd *, unsigned char *);
 
-sense_reason_t sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops);
+sense_reason_t sbc_parse_cdb(struct se_cmd *cmd, struct exec_cmd_ops *ops);
 u32    sbc_get_device_rev(struct se_device *dev);
 u32    sbc_get_device_type(struct se_device *dev);
 sector_t       sbc_get_write_same_sectors(struct se_cmd *cmd);