From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758104Ab0JEKzr (ORCPT ); Tue, 5 Oct 2010 06:55:47 -0400 Received: from smtp126.sbc.mail.sp1.yahoo.com ([69.147.65.185]:20073 "HELO smtp126.sbc.mail.sp1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752108Ab0JEKzp (ORCPT ); Tue, 5 Oct 2010 06:55:45 -0400 X-Yahoo-SMTP: fzDSGlOswBCWnIOrNw7KwwK1j9PqyNbe5PtLKiS4dDU.UNl_t6bdEZu9tTLW X-YMail-OSG: CK3meT4VM1kZGUlMuJLqo8VOfreMAMFBRNYWCq0YvoQQxYI S2IBZwIkKhmaeRsv32rQQHlht4mEPfGN6K3Aa9cEXrpe8dS1Ia8zOxJKiDrZ voV1H2VdKH0tw6rgHEb.BpoAYX5SgiAjs7hWdIqFKexb5yzLqWyyvYcePy4_ Zo5wM1JWNbGFxEKm9ELZsQz92DUVOtxY73ojZBpQ6E0L2V5ULeDIitEE0tc. 9UChEcEnISBJLeUKRut1UGtSisc_Zk1Kb8Ewp0cTnoElIOwbSNUazsb9SIPd nG9N7sbMEUe3ynUYeZ8azD19YLVuNpr.mpu8Zdt8UnvY2wfmG2qlw70.M X-Yahoo-Newman-Property: ymail-3 Subject: Re: [RFC v2 20/21] tcm: Add Kbuild and Kconfig for drivers/target, Documentation/target/tcm_mod_builder.py From: "Nicholas A. Bellinger" To: FUJITA Tomonori Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, michaelc@cs.wisc.edu, hch@lst.de, hare@suse.de, James.Bottomley@suse.de, axboe@kernel.dk, bharrosh@panasas.com In-Reply-To: <20101005163323P.fujita.tomonori@lab.ntt.co.jp> References: <1285195906-11804-1-git-send-email-nab@linux-iscsi.org> <20101005163323P.fujita.tomonori@lab.ntt.co.jp> Content-Type: text/plain Date: Tue, 05 Oct 2010 03:51:28 -0700 Message-Id: <1286275888.20824.37.camel@haakon2.linux-iscsi.org> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2010-10-05 at 16:38 +0900, FUJITA Tomonori wrote: > On Wed, 22 Sep 2010 15:51:46 -0700 > "Nicholas A. Bellinger" wrote: > > > From: Nicholas Bellinger > > > > Add TCM Kbuild and Kconfig files and update drivers/ to pick up drivers/target. > > Add Docmentation/target/ for tcm_mod_builder.py script for generating new > > TCM v4 fabric modules functional ConfigFS skeletons. > > > > Signed-off-by: Nicholas A. Bellinger > > --- > > Documentation/target/tcm_mod_builder.py | 1039 ++++++++++++++++++++++++++++++ > > Documentation/target/tcm_mod_builder.txt | 138 ++++ > > drivers/Kconfig | 2 + > > drivers/Makefile | 1 + > > drivers/target/Kbuild | 27 + > > drivers/target/Kconfig | 34 + > > 6 files changed, 1241 insertions(+), 0 deletions(-) > > create mode 100755 Documentation/target/tcm_mod_builder.py > > create mode 100644 Documentation/target/tcm_mod_builder.txt > > create mode 100644 drivers/target/Kbuild > > create mode 100644 drivers/target/Kconfig > > > +++ b/Documentation/target/tcm_mod_builder.txt > > @@ -0,0 +1,138 @@ > > +>>>>>>>>>> The TCM v4 fabric module script generator <<<<<<<<<< > > + > > +Greetings all, > > + > > +This document is intended to be a mini-HOWTO for using the tcm_mod_builder.py > > +script to generate a brand new functional TCM v4 fabric .ko module of your very own, > > +that once built can be immediately be loaded to start access the new TCM/ConfigFS > > +fabric skeleton, by simplying using: > > + > > + modprobe $TCM_NEW_MOD > > + mkdir -p /sys/kernel/config/target/$TCM_NEW_MOD > > + > > +This script will create a new drivers/target/$TCM_NEW_MOD/, and will do the following > > + > > + *) Generate new API callers for drivers/target/target_core_fabric_configs.c logic > > + ->make_nodeacl(), ->drop_nodeacl(), ->make_tpg(), ->drop_tpg() > > + ->make_wwn(), ->drop_wwn(). These are created into $TCM_NEW_MOD/$TCM_NEW_MOD_configfs.c > > + *) Generate basic infrastructure for loading/unloading LKMs and TCM/ConfigFS fabric module > > + using a skeleton struct target_core_fabric_ops API template. > > + *) Based on user defined T10 Proto_Ident for the new fabric module being built, > > + the TransportID / Initiator and Target WWPN related handlers for > > + SPC-3 persistent reservation are automatically generated in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c > > + using drivers/target/target_core_fabric_lib.c logic. > > + *) NOP API calls for all other Data I/O path and fabric dependent attribute logic > > + in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c > > + > > +So far the generation of new functional ConfigFS skeletons supports for FC, > > +SAS and iSCSI proto_idents, which is defined at the top of tcm_mod_builder.py:main(). > > +Once proto_ident is selected in main(), and the handful of other global variables at top > > +of tcm_mod_builder.py are correct, actually running the script looks like: > > + > > +target:/mnt/sdb/lio-core-2.6.git/Documentation/target# ./tcm_mod_builder.py > > +Writing file: > > +/mnt/sdb/lio-core-2.6.git/drivers/target/tcm_nab5000/tcm_nab5000_base.h > > +Using tcm_mod_scan_fabric_ops: > > I thought that I can use this to write IBM vscsi target driver but I > got: > > fujita@rose:~/git/linux-next/Documentation/target$ ./tcm_mod_builder.py > Creating fabric_mod_dir: /mnt/sdb/lio-core-2.6.git/drivers/target/tcm_nab5000 > Traceback (most recent call last): > File "./tcm_mod_builder.py", line 1039, in > main() > File "./tcm_mod_builder.py", line 1028, in main > tcm_mod_create_module_subdir() > File "./tcm_mod_builder.py", line 38, in tcm_mod_create_module_subdir > ret = os.mkdir(fabric_mod_dir) > OSError: [Errno 2] No such file or directory: '/mnt/sdb/lio-core-2.6.git/drivers/target/tcm_nab5000' > > > And looks like tcm_dir isn't configurable. Hi Tomo, I just pushed some updates into lio-core-2.6.git/lio-4.0 to allow: './tcm_mod_builder.py -p $PROTO_IDENT -m $TCM_MOD_NAME' to be called instead of the original hardcoded values used when generating a new TCM fabric module configfs skeleton. The commitdiff is here: http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=commitdiff;h=b9509f44b2fdcd95499e4276349ac3c6cd8407cf The tcm_mod_builder.txt mini-HOWTO has also been updated here: http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=blob;f=Documentation/target/tcm_mod_builder.txt;hb=refs/heads/lio-4.0 So from there, you should be able to call: ./tcm_mod_builder.py -p SAS -m tcm_ibmvtgt' to generate drivers/target/tcm_ibmvtgt/ with the default SAS (or FC or iSCSI) protocol ident handlers. Thanks! --nab