summaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_file.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-06-17 18:40:52 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-06-21 11:29:52 -0700
commitb02c2cf1a1975100963905b9d731656e9a05bd48 (patch)
treeac01bb63925e9988e3d2879927cd321f47161928 /drivers/target/target_core_file.c
parentc9e649fdc1a0a55e72a649045c496bafd728e005 (diff)
downloadlinux-b02c2cf1a1975100963905b9d731656e9a05bd48.tar.gz
linux-b02c2cf1a1975100963905b9d731656e9a05bd48.tar.xz
linux-b02c2cf1a1975100963905b9d731656e9a05bd48.zip
target: add struct spc_ops + initial ->execute_rw pointer usage
Remove the execute_cmd method in struct se_subsystem_api, and always use the one directly in struct se_cmd. To make life simpler for SBC virtual backends a struct spc_ops that is passed to sbc_parse_cmd is added. For now it only contains an execute_rw member, but more will follow with the subsequent commits. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_file.c')
-rw-r--r--drivers/target/target_core_file.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index e2df30867b13..720ed59834fc 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -375,9 +375,11 @@ static void fd_emulate_sync_cache(struct se_cmd *cmd)
}
}
-static int fd_execute_cmd(struct se_cmd *cmd, struct scatterlist *sgl,
- u32 sgl_nents, enum dma_data_direction data_direction)
+static int fd_execute_rw(struct se_cmd *cmd)
{
+ struct scatterlist *sgl = cmd->t_data_sg;
+ u32 sgl_nents = cmd->t_data_nents;
+ enum dma_data_direction data_direction = cmd->data_direction;
struct se_device *dev = cmd->se_dev;
int ret = 0;
@@ -550,6 +552,15 @@ static sector_t fd_get_blocks(struct se_device *dev)
return div_u64(dev_size, dev->se_sub_dev->se_dev_attrib.block_size);
}
+static struct spc_ops fd_spc_ops = {
+ .execute_rw = fd_execute_rw,
+};
+
+static int fd_parse_cdb(struct se_cmd *cmd)
+{
+ return sbc_parse_cdb(cmd, &fd_spc_ops);
+}
+
static struct se_subsystem_api fileio_template = {
.name = "fileio",
.owner = THIS_MODULE,
@@ -561,8 +572,7 @@ static struct se_subsystem_api fileio_template = {
.allocate_virtdevice = fd_allocate_virtdevice,
.create_virtdevice = fd_create_virtdevice,
.free_device = fd_free_device,
- .parse_cdb = sbc_parse_cdb,
- .execute_cmd = fd_execute_cmd,
+ .parse_cdb = fd_parse_cdb,
.do_sync_cache = fd_emulate_sync_cache,
.check_configfs_dev_params = fd_check_configfs_dev_params,
.set_configfs_dev_params = fd_set_configfs_dev_params,