~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/target/tcm_mod_builder.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 =========================================
  2 The TCM v4 fabric module script generator
  3 =========================================
  4 
  5 Greetings all,
  6 
  7 This document is intended to be a mini-HOWTO for using the tcm_mod_builder.py
  8 script to generate a brand new functional TCM v4 fabric .ko module of your very own,
  9 that once built can be immediately be loaded to start access the new TCM/ConfigFS
 10 fabric skeleton, by simply using::
 11 
 12         modprobe $TCM_NEW_MOD
 13         mkdir -p /sys/kernel/config/target/$TCM_NEW_MOD
 14 
 15 This script will create a new drivers/target/$TCM_NEW_MOD/, and will do the following
 16 
 17         1) Generate new API callers for drivers/target/target_core_fabric_configs.c logic
 18            ->make_tpg(), ->drop_tpg(), ->make_wwn(), ->drop_wwn().  These are created
 19            into $TCM_NEW_MOD/$TCM_NEW_MOD_configfs.c
 20         2) Generate basic infrastructure for loading/unloading LKMs and TCM/ConfigFS fabric module
 21            using a skeleton struct target_core_fabric_ops API template.
 22         3) Based on user defined T10 Proto_Ident for the new fabric module being built,
 23            the TransportID / Initiator and Target WWPN related handlers for
 24            SPC-3 persistent reservation are automatically generated in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c
 25            using drivers/target/target_core_fabric_lib.c logic.
 26         4) NOP API calls for all other Data I/O path and fabric dependent attribute logic
 27            in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c
 28 
 29 tcm_mod_builder.py depends upon the mandatory '-p $PROTO_IDENT' and '-m
 30 $FABRIC_MOD_name' parameters, and actually running the script looks like::
 31 
 32   target:/mnt/sdb/lio-core-2.6.git/Documentation/target# python tcm_mod_builder.py -p iSCSI -m tcm_nab5000
 33   tcm_dir: /mnt/sdb/lio-core-2.6.git/Documentation/target/../../
 34   Set fabric_mod_name: tcm_nab5000
 35   Set fabric_mod_dir:
 36   /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000
 37   Using proto_ident: iSCSI
 38   Creating fabric_mod_dir:
 39   /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000
 40   Writing file:
 41   /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_base.h
 42   Using tcm_mod_scan_fabric_ops:
 43   /mnt/sdb/lio-core-2.6.git/Documentation/target/../../include/target/target_core_fabric_ops.h
 44   Writing file:
 45   /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_fabric.c
 46   Writing file:
 47   /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_fabric.h
 48   Writing file:
 49   /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_configfs.c
 50   Writing file:
 51   /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/Kbuild
 52   Writing file:
 53   /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/Kconfig
 54   Would you like to add tcm_nab5000to drivers/target/Kbuild..? [yes,no]: yes
 55   Would you like to add tcm_nab5000to drivers/target/Kconfig..? [yes,no]: yes
 56 
 57 At the end of tcm_mod_builder.py. the script will ask to add the following
 58 line to drivers/target/Kbuild::
 59 
 60         obj-$(CONFIG_TCM_NAB5000)       += tcm_nab5000/
 61 
 62 and the same for drivers/target/Kconfig::
 63 
 64         source "drivers/target/tcm_nab5000/Kconfig"
 65 
 66 #) Run 'make menuconfig' and select the new CONFIG_TCM_NAB5000 item::
 67 
 68         <M>   TCM_NAB5000 fabric module
 69 
 70 #) Build using 'make modules', once completed you will have::
 71 
 72     target:/mnt/sdb/lio-core-2.6.git# ls -la drivers/target/tcm_nab5000/
 73     total 1348
 74     drwxr-xr-x 2 root root   4096 2010-10-05 03:23 .
 75     drwxr-xr-x 9 root root   4096 2010-10-05 03:22 ..
 76     -rw-r--r-- 1 root root    282 2010-10-05 03:22 Kbuild
 77     -rw-r--r-- 1 root root    171 2010-10-05 03:22 Kconfig
 78     -rw-r--r-- 1 root root     49 2010-10-05 03:23 modules.order
 79     -rw-r--r-- 1 root root    738 2010-10-05 03:22 tcm_nab5000_base.h
 80     -rw-r--r-- 1 root root   9096 2010-10-05 03:22 tcm_nab5000_configfs.c
 81     -rw-r--r-- 1 root root 191200 2010-10-05 03:23 tcm_nab5000_configfs.o
 82     -rw-r--r-- 1 root root  40504 2010-10-05 03:23 .tcm_nab5000_configfs.o.cmd
 83     -rw-r--r-- 1 root root   5414 2010-10-05 03:22 tcm_nab5000_fabric.c
 84     -rw-r--r-- 1 root root   2016 2010-10-05 03:22 tcm_nab5000_fabric.h
 85     -rw-r--r-- 1 root root 190932 2010-10-05 03:23 tcm_nab5000_fabric.o
 86     -rw-r--r-- 1 root root  40713 2010-10-05 03:23 .tcm_nab5000_fabric.o.cmd
 87     -rw-r--r-- 1 root root 401861 2010-10-05 03:23 tcm_nab5000.ko
 88     -rw-r--r-- 1 root root    265 2010-10-05 03:23 .tcm_nab5000.ko.cmd
 89     -rw-r--r-- 1 root root    459 2010-10-05 03:23 tcm_nab5000.mod.c
 90     -rw-r--r-- 1 root root  23896 2010-10-05 03:23 tcm_nab5000.mod.o
 91     -rw-r--r-- 1 root root  22655 2010-10-05 03:23 .tcm_nab5000.mod.o.cmd
 92     -rw-r--r-- 1 root root 379022 2010-10-05 03:23 tcm_nab5000.o
 93     -rw-r--r-- 1 root root    211 2010-10-05 03:23 .tcm_nab5000.o.cmd
 94 
 95 #) Load the new module, create a lun_0 configfs group, and add new TCM Core
 96    IBLOCK backstore symlink to port::
 97 
 98     target:/mnt/sdb/lio-core-2.6.git# insmod drivers/target/tcm_nab5000.ko
 99     target:/mnt/sdb/lio-core-2.6.git# mkdir -p /sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0
100     target:/mnt/sdb/lio-core-2.6.git# cd /sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0/
101     target:/sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0# ln -s /sys/kernel/config/target/core/iblock_0/lvm_test0 nab5000_port
102 
103     target:/sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0# cd -
104     target:/mnt/sdb/lio-core-2.6.git# tree /sys/kernel/config/target/nab5000/
105     /sys/kernel/config/target/nab5000/
106     |-- discovery_auth
107     |-- iqn.foo
108     |   `-- tpgt_1
109     |       |-- acls
110     |       |-- attrib
111     |       |-- lun
112     |       |   `-- lun_0
113     |       |       |-- alua_tg_pt_gp
114     |       |       |-- alua_tg_pt_offline
115     |       |       |-- alua_tg_pt_status
116     |       |       |-- alua_tg_pt_write_md
117     |   |       `-- nab5000_port -> ../../../../../../target/core/iblock_0/lvm_test0
118     |       |-- np
119     |       `-- param
120     `-- version
121 
122     target:/mnt/sdb/lio-core-2.6.git# lsmod
123     Module                  Size  Used by
124     tcm_nab5000             3935  4
125     iscsi_target_mod      193211  0
126     target_core_stgt        8090  0
127     target_core_pscsi      11122  1
128     target_core_file        9172  2
129     target_core_iblock      9280  1
130     target_core_mod       228575  31
131     tcm_nab5000,iscsi_target_mod,target_core_stgt,target_core_pscsi,target_core_file,target_core_iblock
132     libfc                  73681  0
133     scsi_debug             56265  0
134     scsi_tgt                8666  1 target_core_stgt
135     configfs               20644  2 target_core_mod
136 
137 ----------------------------------------------------------------------
138 
139 Future TODO items
140 =================
141 
142         1) Add more T10 proto_idents
143         2) Make tcm_mod_dump_fabric_ops() smarter and generate function pointer
144            defs directly from include/target/target_core_fabric_ops.h:struct target_core_fabric_ops
145            structure members.
146 
147 October 5th, 2010
148 
149 Nicholas A. Bellinger <nab@linux-iscsi.org>

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php