On 4/11/07, FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp> wrote: > From: "Mark Harvey" <markh794 at gmail.com> > Subject: Re: [Stgt-devel] vtl patch. > Date: Wed, 11 Apr 2007 12:06:18 +1000 > > > On 4/11/07, FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp> wrote: > > > From: "Mark Harvey" <markh794 at gmail.com> > > > Subject: [Stgt-devel] vtl patch. > > > Date: Thu, 5 Apr 2007 09:56:10 +1000 > > > > > > > Apologies for this being an attachment. It is rather large to include > > > > inline (57k). > > > > > > > > Follow up to feedback from earlier postings, I have implemented the following: > > > > > > > > > > > > This patch includes the following changes. > > > > > > > > - Patch to tgtadm so multiple '--name, --value' arguments can be passed. > > > > > > Why do we need multiple arguments? > > > > > > I prefer to keep the current semantics: > > > > > > $ tgtadm --lld iscsi --mode logicalunit --op update --tid=1 --lun=0 \ > > > -n VendorIdent -v QUANTUM > > > $ tgtadm --lld iscsi --mode logicalunit --op update --tid=1 --lun=0 \ > > > -n ProductIdent -v SDLT600 > > > $ tgtadm --lld iscsi --mode logicalunit --op update --tid=1 --lun=0 \ > > > -n ProductRev -v 0001 > > > $ tgtadm --lld iscsi --mode logicalunit --op update --tid=1 --lun=0 \ > > > -n SerialNumber -v XYZZY10 > > > > > > rather than: > > > > > > tgtadm --lld iscsi --mode logicalunit --op update --tid=1 --lun=0 \ > > > -n VendorIdent -v QUANTUM \ > > > -n ProductIdent -v SDLT600 \ > > > -n ProductRev -v 0001 \ > > > -n SerialNumber -v XYZZY10 > > > > > > > > > The rest looks ok. > > > > > > > Thanks for the feedback. > > > > While setting the Vendor Ident etc can be easly acheived one field at > > a time, configuring the parameters for the SMC device requires > > multiple parameters at the same time. > > > > > > e.g. > > > (Reserve address space for storage slots) > > > --name=ElementType --value=[1|2|3] > > > --name=StartAddress --value=number > > > --name=Quanity --value=number > > > --name=Sides --value=[1|2] (Single/double sided) > > > > I need to get the element type, starting address and number of slots > > and if media is single/double sided (or at minimum, the element type > > and the element address - if configuring a slot per instance of > > tgtcmd) > > I can't find "ElementType" in ssc3_config or smc_config. Will you > implement it later? Yes. I am in the process of implementing the this now. Nothing that actually compiles, let alone run. I am working on implementing the MODE SENSE/MODE LOG command, with initial config of page 0x1d (Element Address Assignment). I hope to post something new tomorrow so what was previously 'theoretical' will have some code example with what I'm trying to achieve. > Do you need a configuration like 'only when X is true, Y is > necessary'? I think that you can still do that with the current > semantics, 'one field at a time'. You just need to check whether the > configuration is valid when a user tries to start a target. Though > with a 'multiple fields at a time' scheme, the checking would be > a bit easier. > > I don't like '--name a --value b --name b --value c ...' because it > doesn't look like the standard (GNU) option way. I can't say I like it either, however it does seem to be the cleanest way.. I'm open to suggestions. Only other idea I had was to group up all non-processed arguments from the getopt_long(), re-format into a argc/argv[] type and pass this thru to the SMC/SSC module for additional processing. This would allow the SMC/SSC module to perform their own getopt_long() Regards Mark |