aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-11-16 09:46:48 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2011-12-14 06:26:05 -0500
commitc4795fb20edf2fe2c862c8fe9f8b681edeb79ac1 (patch)
tree506a8cb0a12ea2b56c5ebed5e6bc2a0d842c069d
parente26d99aed42ec6cdc9540d19c77ac5d4dd2c5b00 (diff)
target: header reshuffle, part2
This reorganized the headers under include/target into: - target_core_base.h stays as is with all target-wide data stuctures and defines - target_core_backend.h contains the whole interface to I/O backends - target_core_fabric.h contains the whole interface to fabric modules Except for those only the various configfs macro headers stay around. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rwxr-xr-xDocumentation/target/tcm_mod_builder.py15
-rw-r--r--drivers/target/iscsi/iscsi_target.c3
-rw-r--r--drivers/target/iscsi/iscsi_target_configfs.c6
-rw-r--r--drivers/target/iscsi/iscsi_target_device.c3
-rw-r--r--drivers/target/iscsi/iscsi_target_erl0.c2
-rw-r--r--drivers/target/iscsi/iscsi_target_erl1.c2
-rw-r--r--drivers/target/iscsi/iscsi_target_erl2.c2
-rw-r--r--drivers/target/iscsi/iscsi_target_login.c2
-rw-r--r--drivers/target/iscsi/iscsi_target_nego.c2
-rw-r--r--drivers/target/iscsi/iscsi_target_nodeattrib.c1
-rw-r--r--drivers/target/iscsi/iscsi_target_stat.c1
-rw-r--r--drivers/target/iscsi/iscsi_target_tmr.c2
-rw-r--r--drivers/target/iscsi/iscsi_target_tpg.c4
-rw-r--r--drivers/target/iscsi/iscsi_target_util.c4
-rw-r--r--drivers/target/loopback/tcm_loop.c7
-rw-r--r--drivers/target/target_core_alua.c5
-rw-r--r--drivers/target/target_core_cdb.c4
-rw-r--r--drivers/target/target_core_configfs.c5
-rw-r--r--drivers/target/target_core_device.c6
-rw-r--r--drivers/target/target_core_fabric_configfs.c5
-rw-r--r--drivers/target/target_core_fabric_lib.c5
-rw-r--r--drivers/target/target_core_file.c3
-rw-r--r--drivers/target/target_core_hba.c5
-rw-r--r--drivers/target/target_core_iblock.c3
-rw-r--r--drivers/target/target_core_pr.c7
-rw-r--r--drivers/target/target_core_pscsi.c3
-rw-r--r--drivers/target/target_core_rd.c4
-rw-r--r--drivers/target/target_core_stat.c4
-rw-r--r--drivers/target/target_core_tmr.c6
-rw-r--r--drivers/target/target_core_tpg.c6
-rw-r--r--drivers/target/target_core_transport.c7
-rw-r--r--drivers/target/target_core_ua.c4
-rw-r--r--drivers/target/tcm_fc/tfc_cmd.c6
-rw-r--r--drivers/target/tcm_fc/tfc_conf.c6
-rw-r--r--drivers/target/tcm_fc/tfc_io.c5
-rw-r--r--drivers/target/tcm_fc/tfc_sess.c5
-rw-r--r--include/target/target_core_backend.h65
-rw-r--r--include/target/target_core_base.h91
-rw-r--r--include/target/target_core_device.h9
-rw-r--r--include/target/target_core_fabric.h (renamed from include/target/target_core_fabric_ops.h)88
-rw-r--r--include/target/target_core_fabric_lib.h28
-rw-r--r--include/target/target_core_tmr.h31
-rw-r--r--include/target/target_core_tpg.h22
-rw-r--r--include/target/target_core_transport.h256
44 files changed, 288 insertions, 462 deletions
diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py
index 7ef9b843d529..e2abb29fb993 100755
--- a/Documentation/target/tcm_mod_builder.py
+++ b/Documentation/target/tcm_mod_builder.py
@@ -230,14 +230,9 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
230 buf += "#include <linux/ctype.h>\n" 230 buf += "#include <linux/ctype.h>\n"
231 buf += "#include <asm/unaligned.h>\n\n" 231 buf += "#include <asm/unaligned.h>\n\n"
232 buf += "#include <target/target_core_base.h>\n" 232 buf += "#include <target/target_core_base.h>\n"
233 buf += "#include <target/target_core_transport.h>\n" 233 buf += "#include <target/target_core_fabric.h>\n"
234 buf += "#include <target/target_core_fabric_ops.h>\n"
235 buf += "#include <target/target_core_fabric_configfs.h>\n" 234 buf += "#include <target/target_core_fabric_configfs.h>\n"
236 buf += "#include <target/target_core_fabric_lib.h>\n"
237 buf += "#include <target/target_core_device.h>\n"
238 buf += "#include <target/target_core_tpg.h>\n"
239 buf += "#include <target/target_core_configfs.h>\n" 235 buf += "#include <target/target_core_configfs.h>\n"
240 buf += "#include <target/target_core_base.h>\n"
241 buf += "#include <target/configfs_macros.h>\n\n" 236 buf += "#include <target/configfs_macros.h>\n\n"
242 buf += "#include \"" + fabric_mod_name + "_base.h\"\n" 237 buf += "#include \"" + fabric_mod_name + "_base.h\"\n"
243 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" 238 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n"
@@ -514,7 +509,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
514 509
515def tcm_mod_scan_fabric_ops(tcm_dir): 510def tcm_mod_scan_fabric_ops(tcm_dir):
516 511
517 fabric_ops_api = tcm_dir + "include/target/target_core_fabric_ops.h" 512 fabric_ops_api = tcm_dir + "include/target/target_core_fabric.h"
518 513
519 print "Using tcm_mod_scan_fabric_ops: " + fabric_ops_api 514 print "Using tcm_mod_scan_fabric_ops: " + fabric_ops_api
520 process_fo = 0; 515 process_fo = 0;
@@ -579,11 +574,7 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
579 buf += "#include <scsi/scsi_cmnd.h>\n" 574 buf += "#include <scsi/scsi_cmnd.h>\n"
580 buf += "#include <scsi/libfc.h>\n\n" 575 buf += "#include <scsi/libfc.h>\n\n"
581 buf += "#include <target/target_core_base.h>\n" 576 buf += "#include <target/target_core_base.h>\n"
582 buf += "#include <target/target_core_transport.h>\n" 577 buf += "#include <target/target_core_fabric.h>\n"
583 buf += "#include <target/target_core_fabric_ops.h>\n"
584 buf += "#include <target/target_core_fabric_lib.h>\n"
585 buf += "#include <target/target_core_device.h>\n"
586 buf += "#include <target/target_core_tpg.h>\n"
587 buf += "#include <target/target_core_configfs.h>\n\n" 578 buf += "#include <target/target_core_configfs.h>\n\n"
588 buf += "#include \"" + fabric_mod_name + "_base.h\"\n" 579 buf += "#include \"" + fabric_mod_name + "_base.h\"\n"
589 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" 580 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n"
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 8599545cdf9e..f74a62d46eea 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -27,8 +27,7 @@
27#include <scsi/scsi_device.h> 27#include <scsi/scsi_device.h>
28#include <scsi/iscsi_proto.h> 28#include <scsi/iscsi_proto.h>
29#include <target/target_core_base.h> 29#include <target/target_core_base.h>
30#include <target/target_core_tmr.h> 30#include <target/target_core_fabric.h>
31#include <target/target_core_transport.h>
32 31
33#include "iscsi_target_core.h" 32#include "iscsi_target_core.h"
34#include "iscsi_target_parameters.h" 33#include "iscsi_target_parameters.h"
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index db327845e46b..c04d389a2ff2 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -22,12 +22,8 @@
22#include <linux/configfs.h> 22#include <linux/configfs.h>
23#include <linux/export.h> 23#include <linux/export.h>
24#include <target/target_core_base.h> 24#include <target/target_core_base.h>
25#include <target/target_core_transport.h> 25#include <target/target_core_fabric.h>
26#include <target/target_core_fabric_ops.h>
27#include <target/target_core_fabric_configfs.h> 26#include <target/target_core_fabric_configfs.h>
28#include <target/target_core_fabric_lib.h>
29#include <target/target_core_device.h>
30#include <target/target_core_tpg.h>
31#include <target/target_core_configfs.h> 27#include <target/target_core_configfs.h>
32#include <target/configfs_macros.h> 28#include <target/configfs_macros.h>
33 29
diff --git a/drivers/target/iscsi/iscsi_target_device.c b/drivers/target/iscsi/iscsi_target_device.c
index a19fa5eea88e..f63ea35bc4ae 100644
--- a/drivers/target/iscsi/iscsi_target_device.c
+++ b/drivers/target/iscsi/iscsi_target_device.c
@@ -21,8 +21,7 @@
21 21
22#include <scsi/scsi_device.h> 22#include <scsi/scsi_device.h>
23#include <target/target_core_base.h> 23#include <target/target_core_base.h>
24#include <target/target_core_device.h> 24#include <target/target_core_fabric.h>
25#include <target/target_core_transport.h>
26 25
27#include "iscsi_target_core.h" 26#include "iscsi_target_core.h"
28#include "iscsi_target_device.h" 27#include "iscsi_target_device.h"
diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c
index b7ffc3cd40cc..478451167b62 100644
--- a/drivers/target/iscsi/iscsi_target_erl0.c
+++ b/drivers/target/iscsi/iscsi_target_erl0.c
@@ -21,7 +21,7 @@
21 21
22#include <scsi/iscsi_proto.h> 22#include <scsi/iscsi_proto.h>
23#include <target/target_core_base.h> 23#include <target/target_core_base.h>
24#include <target/target_core_transport.h> 24#include <target/target_core_fabric.h>
25 25
26#include "iscsi_target_core.h" 26#include "iscsi_target_core.h"
27#include "iscsi_target_seq_pdu_list.h" 27#include "iscsi_target_seq_pdu_list.h"
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
index 101b1beb3bca..255c0d67e898 100644
--- a/drivers/target/iscsi/iscsi_target_erl1.c
+++ b/drivers/target/iscsi/iscsi_target_erl1.c
@@ -21,7 +21,7 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <scsi/iscsi_proto.h> 22#include <scsi/iscsi_proto.h>
23#include <target/target_core_base.h> 23#include <target/target_core_base.h>
24#include <target/target_core_transport.h> 24#include <target/target_core_fabric.h>
25 25
26#include "iscsi_target_core.h" 26#include "iscsi_target_core.h"
27#include "iscsi_target_seq_pdu_list.h" 27#include "iscsi_target_seq_pdu_list.h"
diff --git a/drivers/target/iscsi/iscsi_target_erl2.c b/drivers/target/iscsi/iscsi_target_erl2.c
index 0b8404c30125..1af1f21af21f 100644
--- a/drivers/target/iscsi/iscsi_target_erl2.c
+++ b/drivers/target/iscsi/iscsi_target_erl2.c
@@ -21,7 +21,7 @@
21 21
22#include <scsi/iscsi_proto.h> 22#include <scsi/iscsi_proto.h>
23#include <target/target_core_base.h> 23#include <target/target_core_base.h>
24#include <target/target_core_transport.h> 24#include <target/target_core_fabric.h>
25 25
26#include "iscsi_target_core.h" 26#include "iscsi_target_core.h"
27#include "iscsi_target_datain_values.h" 27#include "iscsi_target_datain_values.h"
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
index d734bdec24f9..d74e278ec8f7 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -23,7 +23,7 @@
23#include <linux/crypto.h> 23#include <linux/crypto.h>
24#include <scsi/iscsi_proto.h> 24#include <scsi/iscsi_proto.h>
25#include <target/target_core_base.h> 25#include <target/target_core_base.h>
26#include <target/target_core_transport.h> 26#include <target/target_core_fabric.h>
27 27
28#include "iscsi_target_core.h" 28#include "iscsi_target_core.h"
29#include "iscsi_target_tq.h" 29#include "iscsi_target_tq.h"
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index 98936cb7c294..53eea5c827f0 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -21,7 +21,7 @@
21#include <linux/ctype.h> 21#include <linux/ctype.h>
22#include <scsi/iscsi_proto.h> 22#include <scsi/iscsi_proto.h>
23#include <target/target_core_base.h> 23#include <target/target_core_base.h>
24#include <target/target_core_tpg.h> 24#include <target/target_core_fabric.h>
25 25
26#include "iscsi_target_core.h" 26#include "iscsi_target_core.h"
27#include "iscsi_target_parameters.h" 27#include "iscsi_target_parameters.h"
diff --git a/drivers/target/iscsi/iscsi_target_nodeattrib.c b/drivers/target/iscsi/iscsi_target_nodeattrib.c
index aeafbe0cd7d1..ac047d8a7a13 100644
--- a/drivers/target/iscsi/iscsi_target_nodeattrib.c
+++ b/drivers/target/iscsi/iscsi_target_nodeattrib.c
@@ -19,7 +19,6 @@
19 ******************************************************************************/ 19 ******************************************************************************/
20 20
21#include <target/target_core_base.h> 21#include <target/target_core_base.h>
22#include <target/target_core_transport.h>
23 22
24#include "iscsi_target_core.h" 23#include "iscsi_target_core.h"
25#include "iscsi_target_device.h" 24#include "iscsi_target_device.h"
diff --git a/drivers/target/iscsi/iscsi_target_stat.c b/drivers/target/iscsi/iscsi_target_stat.c
index f1db83077e0a..5a1aac0ec7de 100644
--- a/drivers/target/iscsi/iscsi_target_stat.c
+++ b/drivers/target/iscsi/iscsi_target_stat.c
@@ -23,7 +23,6 @@
23#include <linux/export.h> 23#include <linux/export.h>
24#include <scsi/iscsi_proto.h> 24#include <scsi/iscsi_proto.h>
25#include <target/target_core_base.h> 25#include <target/target_core_base.h>
26#include <target/target_core_transport.h>
27#include <target/configfs_macros.h> 26#include <target/configfs_macros.h>
28 27
29#include "iscsi_target_core.h" 28#include "iscsi_target_core.h"
diff --git a/drivers/target/iscsi/iscsi_target_tmr.c b/drivers/target/iscsi/iscsi_target_tmr.c
index 490207eacde9..255ed35da815 100644
--- a/drivers/target/iscsi/iscsi_target_tmr.c
+++ b/drivers/target/iscsi/iscsi_target_tmr.c
@@ -21,7 +21,7 @@
21#include <asm/unaligned.h> 21#include <asm/unaligned.h>
22#include <scsi/iscsi_proto.h> 22#include <scsi/iscsi_proto.h>
23#include <target/target_core_base.h> 23#include <target/target_core_base.h>
24#include <target/target_core_transport.h> 24#include <target/target_core_fabric.h>
25 25
26#include "iscsi_target_core.h" 26#include "iscsi_target_core.h"
27#include "iscsi_target_seq_pdu_list.h" 27#include "iscsi_target_seq_pdu_list.h"
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
index d4cf2cd25c44..cfbcf6e4877d 100644
--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -19,10 +19,8 @@
19 ******************************************************************************/ 19 ******************************************************************************/
20 20
21#include <target/target_core_base.h> 21#include <target/target_core_base.h>
22#include <target/target_core_transport.h> 22#include <target/target_core_fabric.h>
23#include <target/target_core_fabric_ops.h>
24#include <target/target_core_configfs.h> 23#include <target/target_core_configfs.h>
25#include <target/target_core_tpg.h>
26 24
27#include "iscsi_target_core.h" 25#include "iscsi_target_core.h"
28#include "iscsi_target_erl0.h" 26#include "iscsi_target_erl0.h"
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index 02348f727bd4..c1daea190859 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -22,9 +22,7 @@
22#include <scsi/scsi_tcq.h> 22#include <scsi/scsi_tcq.h>
23#include <scsi/iscsi_proto.h> 23#include <scsi/iscsi_proto.h>
24#include <target/target_core_base.h> 24#include <target/target_core_base.h>
25#include <target/target_core_transport.h> 25#include <target/target_core_fabric.h>
26#include <target/target_core_tmr.h>
27#include <target/target_core_fabric_ops.h>
28#include <target/target_core_configfs.h> 26#include <target/target_core_configfs.h>
29 27
30#include "iscsi_target_core.h" 28#include "iscsi_target_core.h"
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 81d5832fbbd5..d427a290e184 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -33,14 +33,9 @@
33#include <scsi/scsi_cmnd.h> 33#include <scsi/scsi_cmnd.h>
34 34
35#include <target/target_core_base.h> 35#include <target/target_core_base.h>
36#include <target/target_core_transport.h> 36#include <target/target_core_fabric.h>
37#include <target/target_core_fabric_ops.h>
38#include <target/target_core_fabric_configfs.h> 37#include <target/target_core_fabric_configfs.h>
39#include <target/target_core_fabric_lib.h>
40#include <target/target_core_configfs.h> 38#include <target/target_core_configfs.h>
41#include <target/target_core_device.h>
42#include <target/target_core_tpg.h>
43#include <target/target_core_tmr.h>
44 39
45#include "tcm_loop.h" 40#include "tcm_loop.h"
46 41
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index 097eb5a49648..1b1edd14f4bf 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -32,9 +32,8 @@
32#include <scsi/scsi_cmnd.h> 32#include <scsi/scsi_cmnd.h>
33 33
34#include <target/target_core_base.h> 34#include <target/target_core_base.h>
35#include <target/target_core_device.h> 35#include <target/target_core_backend.h>
36#include <target/target_core_transport.h> 36#include <target/target_core_fabric.h>
37#include <target/target_core_fabric_ops.h>
38#include <target/target_core_configfs.h> 37#include <target/target_core_configfs.h>
39 38
40#include "target_core_internal.h" 39#include "target_core_internal.h"
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c
index 8f2934fcc68c..59219509d886 100644
--- a/drivers/target/target_core_cdb.c
+++ b/drivers/target/target_core_cdb.c
@@ -29,8 +29,8 @@
29#include <scsi/scsi.h> 29#include <scsi/scsi.h>
30 30
31#include <target/target_core_base.h> 31#include <target/target_core_base.h>
32#include <target/target_core_transport.h> 32#include <target/target_core_backend.h>
33#include <target/target_core_fabric_ops.h> 33#include <target/target_core_fabric.h>
34 34
35#include "target_core_internal.h" 35#include "target_core_internal.h"
36#include "target_core_ua.h" 36#include "target_core_ua.h"
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index ac55af56ba12..3c358907a4a6 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -39,9 +39,8 @@
39#include <linux/spinlock.h> 39#include <linux/spinlock.h>
40 40
41#include <target/target_core_base.h> 41#include <target/target_core_base.h>
42#include <target/target_core_device.h> 42#include <target/target_core_backend.h>
43#include <target/target_core_transport.h> 43#include <target/target_core_fabric.h>
44#include <target/target_core_fabric_ops.h>
45#include <target/target_core_fabric_configfs.h> 44#include <target/target_core_fabric_configfs.h>
46#include <target/target_core_configfs.h> 45#include <target/target_core_configfs.h>
47#include <target/configfs_macros.h> 46#include <target/configfs_macros.h>
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 28ffe0b52bde..1f74de25a92f 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -42,10 +42,8 @@
42#include <scsi/scsi_device.h> 42#include <scsi/scsi_device.h>
43 43
44#include <target/target_core_base.h> 44#include <target/target_core_base.h>
45#include <target/target_core_device.h> 45#include <target/target_core_backend.h>
46#include <target/target_core_tpg.h> 46#include <target/target_core_fabric.h>
47#include <target/target_core_transport.h>
48#include <target/target_core_fabric_ops.h>
49 47
50#include "target_core_internal.h" 48#include "target_core_internal.h"
51#include "target_core_alua.h" 49#include "target_core_alua.h"
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
index fa1e4eb01bc7..4f77cce22646 100644
--- a/drivers/target/target_core_fabric_configfs.c
+++ b/drivers/target/target_core_fabric_configfs.c
@@ -36,10 +36,7 @@
36#include <linux/configfs.h> 36#include <linux/configfs.h>
37 37
38#include <target/target_core_base.h> 38#include <target/target_core_base.h>
39#include <target/target_core_device.h> 39#include <target/target_core_fabric.h>
40#include <target/target_core_tpg.h>
41#include <target/target_core_transport.h>
42#include <target/target_core_fabric_ops.h>
43#include <target/target_core_fabric_configfs.h> 40#include <target/target_core_fabric_configfs.h>
44#include <target/target_core_configfs.h> 41#include <target/target_core_configfs.h>
45#include <target/configfs_macros.h> 42#include <target/configfs_macros.h>
diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c
index dd9ae929dda2..32d7feb405ec 100644
--- a/drivers/target/target_core_fabric_lib.c
+++ b/drivers/target/target_core_fabric_lib.c
@@ -34,10 +34,7 @@
34#include <scsi/scsi_cmnd.h> 34#include <scsi/scsi_cmnd.h>
35 35
36#include <target/target_core_base.h> 36#include <target/target_core_base.h>
37#include <target/target_core_device.h> 37#include <target/target_core_fabric.h>
38#include <target/target_core_transport.h>
39#include <target/target_core_fabric_lib.h>
40#include <target/target_core_fabric_ops.h>
41#include <target/target_core_configfs.h> 38#include <target/target_core_configfs.h>
42 39
43#include "target_core_internal.h" 40#include "target_core_internal.h"
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index b4864fba4ef0..ed7e05353d62 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -37,8 +37,7 @@
37#include <scsi/scsi_host.h> 37#include <scsi/scsi_host.h>
38 38
39#include <target/target_core_base.h> 39#include <target/target_core_base.h>
40#include <target/target_core_device.h> 40#include <target/target_core_backend.h>
41#include <target/target_core_transport.h>
42 41
43#include "target_core_file.h" 42#include "target_core_file.h"
44 43
diff --git a/drivers/target/target_core_hba.c b/drivers/target/target_core_hba.c
index 26c1238976cb..3dd1bd4b6f71 100644
--- a/drivers/target/target_core_hba.c
+++ b/drivers/target/target_core_hba.c
@@ -37,9 +37,8 @@
37#include <net/tcp.h> 37#include <net/tcp.h>
38 38
39#include <target/target_core_base.h> 39#include <target/target_core_base.h>
40#include <target/target_core_device.h> 40#include <target/target_core_backend.h>
41#include <target/target_core_tpg.h> 41#include <target/target_core_fabric.h>
42#include <target/target_core_transport.h>
43 42
44#include "target_core_internal.h" 43#include "target_core_internal.h"
45 44
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 4aa992204438..feebbfe6cbd0 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -42,8 +42,7 @@
42#include <scsi/scsi_host.h> 42#include <scsi/scsi_host.h>
43 43
44#include <target/target_core_base.h> 44#include <target/target_core_base.h>
45#include <target/target_core_device.h> 45#include <target/target_core_backend.h>
46#include <target/target_core_transport.h>
47 46
48#include "target_core_iblock.h" 47#include "target_core_iblock.h"
49 48
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 36fa9a5f1ba6..d2b73b3f4e6c 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -33,11 +33,8 @@
33#include <asm/unaligned.h> 33#include <asm/unaligned.h>
34 34
35#include <target/target_core_base.h> 35#include <target/target_core_base.h>
36#include <target/target_core_device.h> 36#include <target/target_core_backend.h>
37#include <target/target_core_tmr.h> 37#include <target/target_core_fabric.h>
38#include <target/target_core_tpg.h>
39#include <target/target_core_transport.h>
40#include <target/target_core_fabric_ops.h>
41#include <target/target_core_configfs.h> 38#include <target/target_core_configfs.h>
42 39
43#include "target_core_internal.h" 40#include "target_core_internal.h"
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 8b15e56b0384..5d8851de3aee 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -44,8 +44,7 @@
44#include <scsi/scsi_tcq.h> 44#include <scsi/scsi_tcq.h>
45 45
46#include <target/target_core_base.h> 46#include <target/target_core_base.h>
47#include <target/target_core_device.h> 47#include <target/target_core_backend.h>
48#include <target/target_core_transport.h>
49 48
50#include "target_core_pscsi.h" 49#include "target_core_pscsi.h"
51 50
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
index 02e51faa2f4e..94b4087dadd5 100644
--- a/drivers/target/target_core_rd.c
+++ b/drivers/target/target_core_rd.c
@@ -37,9 +37,7 @@
37#include <scsi/scsi_host.h> 37#include <scsi/scsi_host.h>
38 38
39#include <target/target_core_base.h> 39#include <target/target_core_base.h>
40#include <target/target_core_device.h> 40#include <target/target_core_backend.h>
41#include <target/target_core_transport.h>
42#include <target/target_core_fabric_ops.h>
43 41
44#include "target_core_rd.h" 42#include "target_core_rd.h"
45 43
diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c
index d2ba9266ff4d..6d8a90464f2e 100644
--- a/drivers/target/target_core_stat.c
+++ b/drivers/target/target_core_stat.c
@@ -43,8 +43,8 @@
43#include <scsi/scsi_host.h> 43#include <scsi/scsi_host.h>
44 44
45#include <target/target_core_base.h> 45#include <target/target_core_base.h>
46#include <target/target_core_transport.h> 46#include <target/target_core_backend.h>
47#include <target/target_core_fabric_ops.h> 47#include <target/target_core_fabric.h>
48#include <target/target_core_configfs.h> 48#include <target/target_core_configfs.h>
49#include <target/configfs_macros.h> 49#include <target/configfs_macros.h>
50 50
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
index 47bc26ba7865..fc9d74890319 100644
--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -32,10 +32,8 @@
32#include <scsi/scsi_cmnd.h> 32#include <scsi/scsi_cmnd.h>
33 33
34#include <target/target_core_base.h> 34#include <target/target_core_base.h>
35#include <target/target_core_device.h> 35#include <target/target_core_backend.h>
36#include <target/target_core_tmr.h> 36#include <target/target_core_fabric.h>
37#include <target/target_core_transport.h>
38#include <target/target_core_fabric_ops.h>
39#include <target/target_core_configfs.h> 37#include <target/target_core_configfs.h>
40 38
41#include "target_core_internal.h" 39#include "target_core_internal.h"
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
index 0a936fae3d23..b7668029bb31 100644
--- a/drivers/target/target_core_tpg.c
+++ b/drivers/target/target_core_tpg.c
@@ -39,10 +39,8 @@
39#include <scsi/scsi_cmnd.h> 39#include <scsi/scsi_cmnd.h>
40 40
41#include <target/target_core_base.h> 41#include <target/target_core_base.h>
42#include <target/target_core_device.h> 42#include <target/target_core_backend.h>
43#include <target/target_core_tpg.h> 43#include <target/target_core_fabric.h>
44#include <target/target_core_transport.h>
45#include <target/target_core_fabric_ops.h>
46 44
47#include "target_core_internal.h" 45#include "target_core_internal.h"
48 46
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index e0ea63dedde3..72c13b7a349f 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -45,11 +45,8 @@
45#include <scsi/scsi_tcq.h> 45#include <scsi/scsi_tcq.h>
46 46
47#include <target/target_core_base.h> 47#include <target/target_core_base.h>
48#include <target/target_core_device.h> 48#include <target/target_core_backend.h>
49#include <target/target_core_tmr.h> 49#include <target/target_core_fabric.h>
50#include <target/target_core_tpg.h>
51#include <target/target_core_transport.h>
52#include <target/target_core_fabric_ops.h>
53#include <target/target_core_configfs.h> 50#include <target/target_core_configfs.h>
54 51
55#include "target_core_internal.h" 52#include "target_core_internal.h"
diff --git a/drivers/target/target_core_ua.c b/drivers/target/target_core_ua.c
index e2ae53c7e088..3e12f6bcfa10 100644
--- a/drivers/target/target_core_ua.c
+++ b/drivers/target/target_core_ua.c
@@ -30,9 +30,7 @@
30#include <scsi/scsi_cmnd.h> 30#include <scsi/scsi_cmnd.h>
31 31
32#include <target/target_core_base.h> 32#include <target/target_core_base.h>
33#include <target/target_core_device.h> 33#include <target/target_core_fabric.h>
34#include <target/target_core_transport.h>
35#include <target/target_core_fabric_ops.h>
36#include <target/target_core_configfs.h> 34#include <target/target_core_configfs.h>
37 35
38#include "target_core_internal.h" 36#include "target_core_internal.h"
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c
index 71fc9cea5dc9..dbbbc8376d01 100644
--- a/drivers/target/tcm_fc/tfc_cmd.c
+++ b/drivers/target/tcm_fc/tfc_cmd.c
@@ -39,12 +39,8 @@
39#include <scsi/fc_encode.h> 39#include <scsi/fc_encode.h>
40 40
41#include <target/target_core_base.h> 41#include <target/target_core_base.h>
42#include <target/target_core_transport.h> 42#include <target/target_core_fabric.h>
43#include <target/target_core_fabric_ops.h>
44#include <target/target_core_device.h>
45#include <target/target_core_tpg.h>
46#include <target/target_core_configfs.h> 43#include <target/target_core_configfs.h>
47#include <target/target_core_tmr.h>
48#include <target/configfs_macros.h> 44#include <target/configfs_macros.h>
49 45
50#include "tcm_fc.h" 46#include "tcm_fc.h"
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c
index 9402b7387cac..73852fbc857b 100644
--- a/drivers/target/tcm_fc/tfc_conf.c
+++ b/drivers/target/tcm_fc/tfc_conf.c
@@ -41,12 +41,8 @@
41#include <scsi/libfc.h> 41#include <scsi/libfc.h>
42 42
43#include <target/target_core_base.h> 43#include <target/target_core_base.h>
44#include <target/target_core_transport.h> 44#include <target/target_core_fabric.h>
45#include <target/target_core_fabric_ops.h>
46#include <target/target_core_fabric_configfs.h> 45#include <target/target_core_fabric_configfs.h>
47#include <target/target_core_fabric_lib.h>
48#include <target/target_core_device.h>
49#include <target/target_core_tpg.h>
50#include <target/target_core_configfs.h> 46#include <target/target_core_configfs.h>
51#include <target/configfs_macros.h> 47#include <target/configfs_macros.h>
52 48
diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c
index 1369b1cb103d..d8cabc21036d 100644
--- a/drivers/target/tcm_fc/tfc_io.c
+++ b/drivers/target/tcm_fc/tfc_io.c
@@ -48,10 +48,7 @@
48#include <scsi/fc_encode.h> 48#include <scsi/fc_encode.h>
49 49
50#include <target/target_core_base.h> 50#include <target/target_core_base.h>
51#include <target/target_core_transport.h> 51#include <target/target_core_fabric.h>
52#include <target/target_core_fabric_ops.h>
53#include <target/target_core_device.h>
54#include <target/target_core_tpg.h>
55#include <target/target_core_configfs.h> 52#include <target/target_core_configfs.h>
56#include <target/configfs_macros.h> 53#include <target/configfs_macros.h>
57 54
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
index 326921385aff..4c0507cf808c 100644
--- a/drivers/target/tcm_fc/tfc_sess.c
+++ b/drivers/target/tcm_fc/tfc_sess.c
@@ -40,10 +40,7 @@
40#include <scsi/libfc.h> 40#include <scsi/libfc.h>
41 41
42#include <target/target_core_base.h> 42#include <target/target_core_base.h>
43#include <target/target_core_transport.h> 43#include <target/target_core_fabric.h>
44#include <target/target_core_fabric_ops.h>
45#include <target/target_core_device.h>
46#include <target/target_core_tpg.h>
47#include <target/target_core_configfs.h> 44#include <target/target_core_configfs.h>
48#include <target/configfs_macros.h> 45#include <target/configfs_macros.h>
49 46
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
new file mode 100644
index 000000000000..4866499bdeeb
--- /dev/null
+++ b/include/target/target_core_backend.h
@@ -0,0 +1,65 @@
1#ifndef TARGET_CORE_BACKEND_H
2#define TARGET_CORE_BACKEND_H
3
4#define TRANSPORT_PLUGIN_PHBA_PDEV 1
5#define TRANSPORT_PLUGIN_VHBA_PDEV 2
6#define TRANSPORT_PLUGIN_VHBA_VDEV 3
7
8struct se_subsystem_api {
9 struct list_head sub_api_list;
10
11 char name[16];
12 struct module *owner;
13
14 u8 transport_type;
15
16 unsigned int fua_write_emulated : 1;
17 unsigned int write_cache_emulated : 1;
18
19 int (*attach_hba)(struct se_hba *, u32);
20 void (*detach_hba)(struct se_hba *);
21 int (*pmode_enable_hba)(struct se_hba *, unsigned long);
22 void *(*allocate_virtdevice)(struct se_hba *, const char *);
23 struct se_device *(*create_virtdevice)(struct se_hba *,
24 struct se_subsystem_dev *, void *);
25 void (*free_device)(void *);
26 int (*transport_complete)(struct se_task *task);
27 struct se_task *(*alloc_task)(unsigned char *cdb);
28 int (*do_task)(struct se_task *);
29 int (*do_discard)(struct se_device *, sector_t, u32);
30 void (*do_sync_cache)(struct se_task *);
31 void (*free_task)(struct se_task *);
32 ssize_t (*check_configfs_dev_params)(struct se_hba *,
33 struct se_subsystem_dev *);
34 ssize_t (*set_configfs_dev_params)(struct se_hba *,
35 struct se_subsystem_dev *, const char *, ssize_t);
36 ssize_t (*show_configfs_dev_params)(struct se_hba *,
37 struct se_subsystem_dev *, char *);
38 u32 (*get_device_rev)(struct se_device *);
39 u32 (*get_device_type)(struct se_device *);
40 sector_t (*get_blocks)(struct se_device *);
41 unsigned char *(*get_sense_buffer)(struct se_task *);
42};
43
44int transport_subsystem_register(struct se_subsystem_api *);
45void transport_subsystem_release(struct se_subsystem_api *);
46
47struct se_device *transport_add_device_to_core_hba(struct se_hba *,
48 struct se_subsystem_api *, struct se_subsystem_dev *, u32,
49 void *, struct se_dev_limits *, const char *, const char *);
50
51void transport_complete_sync_cache(struct se_cmd *, int);
52void transport_complete_task(struct se_task *, int);
53
54void target_get_task_cdb(struct se_task *, unsigned char *);
55
56void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
57int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
58int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *);
59int transport_set_vpd_ident(struct t10_vpd *, unsigned char *);
60
61/* core helpers also used by command snooping in pscsi */
62void *transport_kmap_first_data_page(struct se_cmd *);
63void transport_kunmap_first_data_page(struct se_cmd *);
64
65#endif /* TARGET_CORE_BACKEND_H */
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 6873c7dd9145..1d90fb33e60b 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -10,6 +10,7 @@
10#include <net/tcp.h> 10#include <net/tcp.h>
11 11
12#define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml" 12#define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml"
13#define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION
13 14
14/* Maximum Number of LUNs per Target Portal Group */ 15/* Maximum Number of LUNs per Target Portal Group */
15/* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */ 16/* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */
@@ -53,6 +54,72 @@
53/* Used by transport_get_inquiry_vpd_device_ident() */ 54/* Used by transport_get_inquiry_vpd_device_ident() */
54#define INQUIRY_VPD_DEVICE_IDENTIFIER_LEN 254 55#define INQUIRY_VPD_DEVICE_IDENTIFIER_LEN 254
55 56
57/* Attempts before moving from SHORT to LONG */
58#define PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD 3
59#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT 3 /* In milliseconds */
60#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_LONG 10 /* In milliseconds */
61
62#define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */
63
64/*
65 * struct se_subsystem_dev->su_dev_flags
66*/
67#define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001
68#define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002
69#define SDF_USING_UDEV_PATH 0x00000004
70#define SDF_USING_ALIAS 0x00000008
71
72/*
73 * struct se_device->dev_flags
74 */
75#define DF_READ_ONLY 0x00000001
76#define DF_SPC2_RESERVATIONS 0x00000002
77#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004
78
79/* struct se_dev_attrib sanity values */
80/* Default max_unmap_lba_count */
81#define DA_MAX_UNMAP_LBA_COUNT 0
82/* Default max_unmap_block_desc_count */
83#define DA_MAX_UNMAP_BLOCK_DESC_COUNT 0
84/* Default unmap_granularity */
85#define DA_UNMAP_GRANULARITY_DEFAULT 0
86/* Default unmap_granularity_alignment */
87#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0
88/* Emulation for Direct Page Out */
89#define DA_EMULATE_DPO 0
90/* Emulation for Forced Unit Access WRITEs */
91#define DA_EMULATE_FUA_WRITE 1
92/* Emulation for Forced Unit Access READs */
93#define DA_EMULATE_FUA_READ 0
94/* Emulation for WriteCache and SYNCHRONIZE_CACHE */
95#define DA_EMULATE_WRITE_CACHE 0
96/* Emulation for UNIT ATTENTION Interlock Control */
97#define DA_EMULATE_UA_INTLLCK_CTRL 0
98/* Emulation for TASK_ABORTED status (TAS) by default */
99#define DA_EMULATE_TAS 1
100/* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */
101#define DA_EMULATE_TPU 0
102/*
103 * Emulation for Thin Provisioning WRITE_SAME w/ UNMAP=1 bit using
104 * block/blk-lib.c:blkdev_issue_discard()
105 */
106#define DA_EMULATE_TPWS 0
107/* No Emulation for PSCSI by default */
108#define DA_EMULATE_RESERVATIONS 0
109/* No Emulation for PSCSI by default */
110#define DA_EMULATE_ALUA 0
111/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */
112#define DA_ENFORCE_PR_ISIDS 1
113#define DA_STATUS_MAX_SECTORS_MIN 16
114#define DA_STATUS_MAX_SECTORS_MAX 8192
115/* By default don't report non-rotating (solid state) medium */
116#define DA_IS_NONROT 0
117/* Queue Algorithm Modifier default for restricted reordering in control mode page */
118#define DA_EMULATE_REST_REORD 0
119
120#define SE_MODE_PAGE_BUF 512
121
122
56/* struct se_hba->hba_flags */ 123/* struct se_hba->hba_flags */
57enum hba_flags_table { 124enum hba_flags_table {
58 HBA_FLAGS_INTERNAL_USE = 0x01, 125 HBA_FLAGS_INTERNAL_USE = 0x01,
@@ -158,6 +225,30 @@ enum tcm_sense_reason_table {
158 TCM_RESERVATION_CONFLICT = 0x10, 225 TCM_RESERVATION_CONFLICT = 0x10,
159}; 226};
160 227
228/* fabric independent task management function values */
229enum tcm_tmreq_table {
230 TMR_ABORT_TASK = 1,
231 TMR_ABORT_TASK_SET = 2,
232 TMR_CLEAR_ACA = 3,
233 TMR_CLEAR_TASK_SET = 4,
234 TMR_LUN_RESET = 5,
235 TMR_TARGET_WARM_RESET = 6,
236 TMR_TARGET_COLD_RESET = 7,
237 TMR_FABRIC_TMR = 255,
238};
239
240/* fabric independent task management response values */
241enum tcm_tmrsp_table {
242 TMR_FUNCTION_COMPLETE = 0,
243 TMR_TASK_DOES_NOT_EXIST = 1,
244 TMR_LUN_DOES_NOT_EXIST = 2,
245 TMR_TASK_STILL_ALLEGIANT = 3,
246 TMR_TASK_FAILOVER_NOT_SUPPORTED = 4,
247 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5,
248 TMR_FUNCTION_AUTHORIZATION_FAILED = 6,
249 TMR_FUNCTION_REJECTED = 255,
250};
251
161struct se_obj { 252struct se_obj {
162 atomic_t obj_access_count; 253 atomic_t obj_access_count;
163} ____cacheline_aligned; 254} ____cacheline_aligned;
diff --git a/include/target/target_core_device.h b/include/target/target_core_device.h
deleted file mode 100644
index c6123a49014d..000000000000
--- a/include/target/target_core_device.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef TARGET_CORE_DEVICE_H
2#define TARGET_CORE_DEVICE_H
3
4
5// external
6extern int transport_lookup_cmd_lun(struct se_cmd *, u32);
7extern int transport_lookup_tmr_lun(struct se_cmd *, u32);
8
9#endif /* TARGET_CORE_DEVICE_H */
diff --git a/include/target/target_core_fabric_ops.h b/include/target/target_core_fabric.h
index 0256825f923d..d035d865dbef 100644
--- a/include/target/target_core_fabric_ops.h
+++ b/include/target/target_core_fabric.h
@@ -1,5 +1,5 @@
1/* Defined in target_core_configfs.h */ 1#ifndef TARGET_CORE_FABRIC_H
2struct target_fabric_configfs; 2#define TARGET_CORE_FABRIC_H
3 3
4struct target_core_fabric_ops { 4struct target_core_fabric_ops {
5 struct configfs_subsystem *tf_subsys; 5 struct configfs_subsystem *tf_subsys;
@@ -103,3 +103,87 @@ struct target_core_fabric_ops {
103 struct config_group *, const char *); 103 struct config_group *, const char *);
104 void (*fabric_drop_nodeacl)(struct se_node_acl *); 104 void (*fabric_drop_nodeacl)(struct se_node_acl *);
105}; 105};
106
107struct se_session *transport_init_session(void);
108void __transport_register_session(struct se_portal_group *,
109 struct se_node_acl *, struct se_session *, void *);
110void transport_register_session(struct se_portal_group *,
111 struct se_node_acl *, struct se_session *, void *);
112void transport_free_session(struct se_session *);
113void transport_deregister_session_configfs(struct se_session *);
114void transport_deregister_session(struct se_session *);
115
116
117void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
118 struct se_session *, u32, int, int, unsigned char *);
119int transport_lookup_cmd_lun(struct se_cmd *, u32);
120int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
121int transport_handle_cdb_direct(struct se_cmd *);
122int transport_generic_handle_cdb_map(struct se_cmd *);
123int transport_generic_handle_data(struct se_cmd *);
124int transport_generic_map_mem_to_cmd(struct se_cmd *cmd,
125 struct scatterlist *, u32, struct scatterlist *, u32);
126void transport_do_task_sg_chain(struct se_cmd *);
127int transport_generic_new_cmd(struct se_cmd *);
128
129void transport_generic_process_write(struct se_cmd *);
130
131void transport_generic_free_cmd(struct se_cmd *, int);
132
133bool transport_wait_for_tasks(struct se_cmd *);
134int transport_check_aborted_status(struct se_cmd *, int);
135int transport_send_check_condition_and_sense(struct se_cmd *, u8, int);
136
137void target_get_sess_cmd(struct se_session *, struct se_cmd *);
138int target_put_sess_cmd(struct se_session *, struct se_cmd *);
139void target_splice_sess_cmd_list(struct se_session *);
140void target_wait_for_sess_cmds(struct se_session *, int);
141
142int core_alua_check_nonop_delay(struct se_cmd *);
143
144struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
145void core_tmr_release_req(struct se_tmr_req *);
146int transport_generic_handle_tmr(struct se_cmd *);
147int transport_lookup_tmr_lun(struct se_cmd *, u32);
148
149struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *,
150 unsigned char *);
151void core_tpg_clear_object_luns(struct se_portal_group *);
152struct se_node_acl *core_tpg_add_initiator_node_acl(struct se_portal_group *,
153 struct se_node_acl *, const char *, u32);
154int core_tpg_del_initiator_node_acl(struct se_portal_group *,
155 struct se_node_acl *, int);
156int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *,
157 unsigned char *, u32, int);
158int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *,
159 struct se_portal_group *, void *, int);
160int core_tpg_deregister(struct se_portal_group *);
161
162/* SAS helpers */
163u8 sas_get_fabric_proto_ident(struct se_portal_group *);
164u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
165 struct t10_pr_registration *, int *, unsigned char *);
166u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
167 struct t10_pr_registration *, int *);
168char *sas_parse_pr_out_transport_id(struct se_portal_group *, const char *,
169 u32 *, char **);
170
171/* FC helpers */
172u8 fc_get_fabric_proto_ident(struct se_portal_group *);
173u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
174 struct t10_pr_registration *, int *, unsigned char *);
175u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
176 struct t10_pr_registration *, int *);
177char *fc_parse_pr_out_transport_id(struct se_portal_group *, const char *,
178 u32 *, char **);
179
180/* iSCSI helpers */
181u8 iscsi_get_fabric_proto_ident(struct se_portal_group *);
182u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
183 struct t10_pr_registration *, int *, unsigned char *);
184u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
185 struct t10_pr_registration *, int *);
186char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, const char *,
187 u32 *, char **);
188
189#endif /* TARGET_CORE_FABRICH */
diff --git a/include/target/target_core_fabric_lib.h b/include/target/target_core_fabric_lib.h
deleted file mode 100644
index c2f8d0e3a03b..000000000000
--- a/include/target/target_core_fabric_lib.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef TARGET_CORE_FABRIC_LIB_H
2#define TARGET_CORE_FABRIC_LIB_H
3
4extern u8 sas_get_fabric_proto_ident(struct se_portal_group *);
5extern u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
6 struct t10_pr_registration *, int *, unsigned char *);
7extern u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
8 struct t10_pr_registration *, int *);
9extern char *sas_parse_pr_out_transport_id(struct se_portal_group *,
10 const char *, u32 *, char **);
11
12extern u8 fc_get_fabric_proto_ident(struct se_portal_group *);
13extern u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
14 struct t10_pr_registration *, int *, unsigned char *);
15extern u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
16 struct t10_pr_registration *, int *);
17extern char *fc_parse_pr_out_transport_id(struct se_portal_group *,
18 const char *, u32 *, char **);
19
20extern u8 iscsi_get_fabric_proto_ident(struct se_portal_group *);
21extern u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
22 struct t10_pr_registration *, int *, unsigned char *);
23extern u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
24 struct t10_pr_registration *, int *);
25extern char *iscsi_parse_pr_out_transport_id(struct se_portal_group *,
26 const char *, u32 *, char **);
27
28#endif /* TARGET_CORE_FABRIC_LIB_H */
diff --git a/include/target/target_core_tmr.h b/include/target/target_core_tmr.h
deleted file mode 100644
index 36b3e0de99b4..000000000000
--- a/include/target/target_core_tmr.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef TARGET_CORE_TMR_H
2#define TARGET_CORE_TMR_H
3
4/* fabric independent task management function values */
5enum tcm_tmreq_table {
6 TMR_ABORT_TASK = 1,
7 TMR_ABORT_TASK_SET = 2,
8 TMR_CLEAR_ACA = 3,
9 TMR_CLEAR_TASK_SET = 4,
10 TMR_LUN_RESET = 5,
11 TMR_TARGET_WARM_RESET = 6,
12 TMR_TARGET_COLD_RESET = 7,
13 TMR_FABRIC_TMR = 255,
14};
15
16/* fabric independent task management response values */
17enum tcm_tmrsp_table {
18 TMR_FUNCTION_COMPLETE = 0,
19 TMR_TASK_DOES_NOT_EXIST = 1,
20 TMR_LUN_DOES_NOT_EXIST = 2,
21 TMR_TASK_STILL_ALLEGIANT = 3,
22 TMR_TASK_FAILOVER_NOT_SUPPORTED = 4,
23 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5,
24 TMR_FUNCTION_AUTHORIZATION_FAILED = 6,
25 TMR_FUNCTION_REJECTED = 255,
26};
27
28extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
29extern void core_tmr_release_req(struct se_tmr_req *);
30
31#endif /* TARGET_CORE_TMR_H */
diff --git a/include/target/target_core_tpg.h b/include/target/target_core_tpg.h
deleted file mode 100644
index 80ae59fdada3..000000000000
--- a/include/target/target_core_tpg.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef TARGET_CORE_TPG_H
2#define TARGET_CORE_TPG_H
3
4extern struct se_node_acl *core_tpg_check_initiator_node_acl(
5 struct se_portal_group *,
6 unsigned char *);
7extern void core_tpg_clear_object_luns(struct se_portal_group *);
8extern struct se_node_acl *core_tpg_add_initiator_node_acl(
9 struct se_portal_group *,
10 struct se_node_acl *,
11 const char *, u32);
12extern int core_tpg_del_initiator_node_acl(struct se_portal_group *,
13 struct se_node_acl *, int);
14extern int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *,
15 unsigned char *, u32, int);
16extern int core_tpg_register(struct target_core_fabric_ops *,
17 struct se_wwn *,
18 struct se_portal_group *, void *,
19 int);
20extern int core_tpg_deregister(struct se_portal_group *);
21
22#endif /* TARGET_CORE_TPG_H */
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h
deleted file mode 100644
index 68fe1f2c081c..000000000000
--- a/include/target/target_core_transport.h
+++ /dev/null
@@ -1,256 +0,0 @@
1#ifndef TARGET_CORE_TRANSPORT_H
2#define TARGET_CORE_TRANSPORT_H
3
4#define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION
5
6/* Attempts before moving from SHORT to LONG */
7#define PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD 3
8#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT 3 /* In milliseconds */
9#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_LONG 10 /* In milliseconds */
10
11#define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */
12
13#define TRANSPORT_PLUGIN_PHBA_PDEV 1
14#define TRANSPORT_PLUGIN_VHBA_PDEV 2
15#define TRANSPORT_PLUGIN_VHBA_VDEV 3
16
17/*
18 * struct se_subsystem_dev->su_dev_flags
19*/
20#define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001
21#define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002
22#define SDF_USING_UDEV_PATH 0x00000004
23#define SDF_USING_ALIAS 0x00000008
24
25/*
26 * struct se_device->dev_flags
27 */
28#define DF_READ_ONLY 0x00000001
29#define DF_SPC2_RESERVATIONS 0x00000002
30#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004
31
32/* struct se_dev_attrib sanity values */
33/* Default max_unmap_lba_count */
34#define DA_MAX_UNMAP_LBA_COUNT 0
35/* Default max_unmap_block_desc_count */
36#define DA_MAX_UNMAP_BLOCK_DESC_COUNT 0
37/* Default unmap_granularity */
38#define DA_UNMAP_GRANULARITY_DEFAULT 0
39/* Default unmap_granularity_alignment */
40#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0
41/* Emulation for Direct Page Out */
42#define DA_EMULATE_DPO 0
43/* Emulation for Forced Unit Access WRITEs */
44#define DA_EMULATE_FUA_WRITE 1
45/* Emulation for Forced Unit Access READs */
46#define DA_EMULATE_FUA_READ 0
47/* Emulation for WriteCache and SYNCHRONIZE_CACHE */
48#define DA_EMULATE_WRITE_CACHE 0
49/* Emulation for UNIT ATTENTION Interlock Control */
50#define DA_EMULATE_UA_INTLLCK_CTRL 0
51/* Emulation for TASK_ABORTED status (TAS) by default */
52#define DA_EMULATE_TAS 1
53/* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */
54#define DA_EMULATE_TPU 0
55/*
56 * Emulation for Thin Provisioning WRITE_SAME w/ UNMAP=1 bit using
57 * block/blk-lib.c:blkdev_issue_discard()
58 */
59#define DA_EMULATE_TPWS 0
60/* No Emulation for PSCSI by default */
61#define DA_EMULATE_RESERVATIONS 0
62/* No Emulation for PSCSI by default */
63#define DA_EMULATE_ALUA 0
64/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */
65#define DA_ENFORCE_PR_ISIDS 1
66#define DA_STATUS_MAX_SECTORS_MIN 16
67#define DA_STATUS_MAX_SECTORS_MAX 8192
68/* By default don't report non-rotating (solid state) medium */
69#define DA_IS_NONROT 0
70/* Queue Algorithm Modifier default for restricted reordering in control mode page */
71#define DA_EMULATE_REST_REORD 0
72
73#define SE_MODE_PAGE_BUF 512
74
75#define MOD_MAX_SECTORS(ms, bs) (ms % (PAGE_SIZE / bs))
76
77struct se_subsystem_api;
78
79extern int transport_subsystem_register(struct se_subsystem_api *);
80extern void transport_subsystem_release(struct se_subsystem_api *);
81extern struct se_session *transport_init_session(void);
82extern void __transport_register_session(struct se_portal_group *,
83 struct se_node_acl *,
84 struct se_session *, void *);
85extern void transport_register_session(struct se_portal_group *,
86 struct se_node_acl *,
87 struct se_session *, void *);
88extern void transport_free_session(struct se_session *);
89extern void transport_deregister_session_configfs(struct se_session *);
90extern void transport_deregister_session(struct se_session *);
91extern void transport_complete_sync_cache(struct se_cmd *, int);
92extern void transport_complete_task(struct se_task *, int);
93
94extern void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
95extern int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
96extern int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *);
97extern int transport_set_vpd_ident(struct t10_vpd *, unsigned char *);
98
99extern struct se_device *transport_add_device_to_core_hba(struct se_hba *,
100 struct se_subsystem_api *,
101 struct se_subsystem_dev *, u32,
102 void *, struct se_dev_limits *,
103 const char *, const char *);
104extern void transport_init_se_cmd(struct se_cmd *,
105 struct target_core_fabric_ops *,
106 struct se_session *, u32, int, int,
107 unsigned char *);
108void *transport_kmap_first_data_page(struct se_cmd *cmd);
109void transport_kunmap_first_data_page(struct se_cmd *cmd);
110extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
111extern int transport_handle_cdb_direct(struct se_cmd *);
112extern int transport_generic_handle_cdb_map(struct se_cmd *);
113extern int transport_generic_handle_data(struct se_cmd *);
114extern int transport_generic_handle_tmr(struct se_cmd *);
115extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32,
116 struct scatterlist *, u32);
117extern bool transport_wait_for_tasks(struct se_cmd *);
118extern int transport_check_aborted_status(struct se_cmd *, int);
119extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int);
120extern void transport_generic_free_cmd(struct se_cmd *, int);
121extern void target_get_sess_cmd(struct se_session *, struct se_cmd *);
122extern int target_put_sess_cmd(struct se_session *, struct se_cmd *);
123extern void target_splice_sess_cmd_list(struct se_session *);
124extern void target_wait_for_sess_cmds(struct se_session *, int);
125extern void transport_do_task_sg_chain(struct se_cmd *);
126extern void transport_generic_process_write(struct se_cmd *);
127extern int transport_generic_new_cmd(struct se_cmd *);
128/* From target_core_alua.c */
129extern int core_alua_check_nonop_delay(struct se_cmd *);
130/* From target_core_cdb.c */
131extern void target_get_task_cdb(struct se_task *task, unsigned char *cdb);
132
133/*
134 * Each se_transport_task_t can have N number of possible struct se_task's
135 * for the storage transport(s) to possibly execute.
136 * Used primarily for splitting up CDBs that exceed the physical storage
137 * HBA's maximum sector count per task.
138 */
139struct se_mem {
140 struct page *se_page;
141 u32 se_len;
142 u32 se_off;
143 struct list_head se_list;
144} ____cacheline_aligned;
145
146/*
147 * Each type of disk transport supported MUST have a template defined
148 * within its .h file.
149 */
150struct se_subsystem_api {
151 /*
152 * The Name. :-)
153 */
154 char name[16];
155 /*
156 * Transport Type.
157 */
158 u8 transport_type;
159
160 unsigned int fua_write_emulated : 1;
161 unsigned int write_cache_emulated : 1;
162
163 /*
164 * struct module for struct se_hba references
165 */
166 struct module *owner;
167 /*
168 * Used for global se_subsystem_api list_head
169 */
170 struct list_head sub_api_list;
171 /*
172 * attach_hba():
173 */
174 int (*attach_hba)(struct se_hba *, u32);
175 /*
176 * detach_hba():
177 */
178 void (*detach_hba)(struct se_hba *);
179 /*
180 * pmode_hba(): Used for TCM/pSCSI subsystem plugin HBA ->
181 * Linux/SCSI struct Scsi_Host passthrough
182 */
183 int (*pmode_enable_hba)(struct se_hba *, unsigned long);
184 /*
185 * allocate_virtdevice():
186 */
187 void *(*allocate_virtdevice)(struct se_hba *, const char *);
188 /*
189 * create_virtdevice(): Only for Virtual HBAs
190 */
191 struct se_device *(*create_virtdevice)(struct se_hba *,
192 struct se_subsystem_dev *, void *);
193 /*
194 * free_device():
195 */
196 void (*free_device)(void *);
197
198 /*
199 * transport_complete():
200 *
201 * Use transport_generic_complete() for majority of DAS transport
202 * drivers. Provided out of convenience.
203 */
204 int (*transport_complete)(struct se_task *task);
205 struct se_task *(*alloc_task)(unsigned char *cdb);
206 /*
207 * do_task():
208 */
209 int (*do_task)(struct se_task *);
210 /*
211 * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate
212 * UNMAP and WRITE_SAME_* w/ UNMAP=1 <-> Linux/Block Discard
213 */
214 int (*do_discard)(struct se_device *, sector_t, u32);
215 /*
216 * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate
217 * SYNCHRONIZE_CACHE_* <-> Linux/Block blkdev_issue_flush()
218 */
219 void (*do_sync_cache)(struct se_task *);
220 /*
221 * free_task():
222 */
223 void (*free_task)(struct se_task *);
224 /*
225 * check_configfs_dev_params():
226 */
227 ssize_t (*check_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *);
228 /*
229 * set_configfs_dev_params():
230 */
231 ssize_t (*set_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *,
232 const char *, ssize_t);
233 /*
234 * show_configfs_dev_params():
235 */
236 ssize_t (*show_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *,
237 char *);
238 /*
239 * get_device_rev():
240 */
241 u32 (*get_device_rev)(struct se_device *);
242 /*
243 * get_device_type():
244 */
245 u32 (*get_device_type)(struct se_device *);
246 /*
247 * Get the sector_t from a subsystem backstore..
248 */
249 sector_t (*get_blocks)(struct se_device *);
250 /*
251 * get_sense_buffer():
252 */
253 unsigned char *(*get_sense_buffer)(struct se_task *);
254} ____cacheline_aligned;
255
256#endif /* TARGET_CORE_TRANSPORT_H */