Re: [PATCH RFC] support multiple target instances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

I changed it to --control-port and -C


regards
ronnie sahlberg


On Thu, Feb 25, 2010 at 7:50 PM, FUJITA Tomonori
<fujita.tomonori@xxxxxxxxxxxxx> wrote:
> On Wed, 24 Feb 2010 14:29:18 +1100
> ronnie sahlberg <ronniesahlberg@xxxxxxxxx> wrote:
>
>> The part of the patch where we control the management channel seems to
>> have been lost/forgotten.
>>
>> Please find a patch attached that contains an updated version Or's
>> patch for specifying the management channel
>> to allow us to run multiple instances of tgtd concurrently.
>>
>> This can be useful in testing since on very powerful machines, the
>> single thread for the eventloop reaches 100% of one core, this caps
>> performance.
>
> adding specifying management port support is fine by me, as I said
> before, I don't fancy running multiple tgtd though.
>
> I have two comments:
>
> 1. We already have long options like "initiator-address" so I like
> clear long options. Something like 'management-port' or 'control-port'
> instead of 'mgmt-port'?
>
> 2. Is it better to have the same short option for tgtd and tgtadm?
>
>
> Thanks,
>

Attachment: 0001-Based-on-Or-Gerlitz-patch-from.patch.gz
Description: GNU Zip compressed data

From d1889a08964568253594710bfb188171ab0c5d0c Mon Sep 17 00:00:00 2001
From: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
Date: Fri, 26 Feb 2010 13:16:50 +1100
Subject: [PATCH] Based on Or Gerlitz patch from
 http://lists.wpkg.org/pipermail/stgt/2009-September/003207.html

Add support to tgtd and tgtadm to specify which command port to use
for the management channel.
This allows running multiple instances of tgtd on teh same host,
each using a unique command channel.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
---
 doc/htmlpages/tgtadm.8.html |   12 ++++++++----
 doc/htmlpages/tgtd.8.html   |   19 +++++++++++++------
 doc/manpages/tgtadm.8       |   13 +++++++++----
 doc/manpages/tgtd.8         |   13 ++++++++++---
 doc/tgtadm.8.xml            |   12 +++++++++++-
 doc/tgtd.8.xml              |   15 +++++++++++++++
 usr/mgmt.c                  |    7 +++++--
 usr/tgtadm.c                |   38 ++++++++++++++++++++++++--------------
 usr/tgtd.c                  |   10 +++++++++-
 9 files changed, 104 insertions(+), 35 deletions(-)

diff --git a/doc/htmlpages/tgtadm.8.html b/doc/htmlpages/tgtadm.8.html
index 9fa8329..cc4f712 100644
--- a/doc/htmlpages/tgtadm.8.html
+++ b/doc/htmlpages/tgtadm.8.html
@@ -1,7 +1,11 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>tgtadm</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="tgtadm.8"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>tgtadm &#8212; Linux SCSI Target Administration Utility</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">tgtadm --lld [driver] --op [operation] --mode [mode] [OPTION]...</code> </p></div></div><div class="refsect1" lang="en"><a name="id2475948"></a><h2>DESCRIPTION</h2><p>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>tgtadm</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="tgtadm.8"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>tgtadm &#8212; Linux SCSI Target Administration Utility</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">tgtadm [--control-port NNNN] --lld [driver] --op [operation] --mode [mode] [OPTION]...</code> </p></div></div><div class="refsect1" lang="en"><a name="id2475961"></a><h2>DESCRIPTION</h2><p>
       tgtadm is used to monitor and modify everything about Linux SCSI target
       software: targets, volumes, etc.
-    </p></div><div class="refsect1" lang="en"><a name="id2475959"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term"><code class="option">--lld [driver] --op new --mode target --tid=[id] --targetname [name]</code></span></dt><dd><p>
+    </p></div><div class="refsect1" lang="en"><a name="id2475971"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term"><code class="option">--control-port NNNN</code></span></dt><dd><p>
+	    It is possible to run multiple concurrent instances of tgtd
+	    on a host. This argument is used to control which instance
+	    the tgtadm command will operate on.
+          </p></dd><dt><span class="term"><code class="option">--lld [driver] --op new --mode target --tid=[id] --targetname [name]</code></span></dt><dd><p>
 	    add a new target with [id] and [name].
           </p></dd><dt><span class="term"><code class="option">--lld [driver] --op delete --mode target --tid=[id]</code></span></dt><dd><p>
 	    delete specific target with [id]. The target must have no active I_T nexus.
@@ -28,9 +32,9 @@
 	    display version and exit.
           </p></dd><dt><span class="term"><code class="option">--help</code></span></dt><dd><p>
 	    display a list of available options and exits.
-          </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2476142"></a><h2>SEE ALSO</h2><p>
+          </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2476171"></a><h2>SEE ALSO</h2><p>
       tgtd(8), tgt-admin(8), tgt-setup-lun(8).
       <a class="ulink" href="http://stgt.sourceforge.net/"; target="_top">http://stgt.sourceforge.net/</a>
-    </p></div><div class="refsect1" lang="en"><a name="id2476157"></a><h2>REPORTING BUGS</h2><p>
+    </p></div><div class="refsect1" lang="en"><a name="id2476185"></a><h2>REPORTING BUGS</h2><p>
       Report bugs to &lt;stgt@xxxxxxxxxxxxxxx&gt;
     </p></div></div></body></html>
diff --git a/doc/htmlpages/tgtd.8.html b/doc/htmlpages/tgtd.8.html
index 47cdda8..7aa914b 100644
--- a/doc/htmlpages/tgtd.8.html
+++ b/doc/htmlpages/tgtd.8.html
@@ -1,19 +1,26 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>tgtd</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="tgtd.8"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>tgtd &#8212; The SCSI Target Daemon</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">tgtd</code> </p></div><div class="cmdsynopsis"><p><code class="command">tgtd</code>  [-d --debug &lt;INTEGER&gt;] [-f --foregound] [-h --help] [--iscsi &lt;...&gt;]</p></div></div><div class="refsect1" lang="en"><a name="id2475936"></a><h2>DESCRIPTION</h2><p>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>tgtd</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="tgtd.8"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>tgtd &#8212; The SCSI Target Daemon</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">tgtd</code> </p></div><div class="cmdsynopsis"><p><code class="command">tgtd</code>  [-C --control-port &lt;INTEGER&gt;] [-d --debug &lt;INTEGER&gt;] [-f --foregound] [-h --help] [--iscsi &lt;...&gt;]</p></div></div><div class="refsect1" lang="en"><a name="id2475959"></a><h2>DESCRIPTION</h2><p>
       Tgtd is a SCSI Target daemon. It can be used to provide iSCSI target
       service to a network.
-    </p></div><div class="refsect1" lang="en"><a name="id2475947"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-d --debug &lt;INTEGER&gt;</span></dt><dd><p>
+    </p></div><div class="refsect1" lang="en"><a name="id2475970"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-d --debug &lt;INTEGER&gt;</span></dt><dd><p>
             Set to non-zero value to activate additional debugging messages to
 	    be logged.
           </p></dd><dt><span class="term">-f --foreground</span></dt><dd><p>
             Run the daemon in the foreground.
           </p></dd><dt><span class="term">-h --help</span></dt><dd><p>
             Print help text to the screen.
+          </p></dd><dt><span class="term">-C --control-port &lt;INTEGER&gt;</span></dt><dd><p>
+	    This comamnd is used to specify the control port to use for
+	    this instance of tgtd. This allows to run multiple instances of 
+	    TGTD on a host.
+          </p><p>
+	    TGTADM has a matching argument to control which instance to connect
+	    to.
           </p></dd><dt><span class="term">--iscsi &lt;...&gt;</span></dt><dd><p>
 	    ISCSI specific options.
             See the ISCSI section below for options specific to this frontend.
-          </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2476014"></a><h2>ISCSI options</h2><p>
+          </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2476058"></a><h2>ISCSI options</h2><p>
       These parameters apply only to the iSCSI frontend.
-    </p><div class="refsect2" lang="en"><a name="id2476024"></a><h3>portal=&lt;ip-address[:port]&gt;</h3><p>
+    </p><div class="refsect2" lang="en"><a name="id2476067"></a><h3>portal=&lt;ip-address[:port]&gt;</h3><p>
 	This option is used to bind tgtd to a specific ip-address/portal and/or
 	port. By default tgtd will bind to port 3260 on the wildcard address.
       </p><p>
@@ -21,10 +28,10 @@
       </p><pre class="screen">
 	tgtd --iscsi portal=192.0.2.1:3260
       </pre><p>
-      </p></div></div><div class="refsect1" lang="en"><a name="id2476048"></a><h2>SEE ALSO</h2><p>
+      </p></div></div><div class="refsect1" lang="en"><a name="id2476091"></a><h2>SEE ALSO</h2><p>
       tgtadm(8), tgt-admin(8), tgt-setup-lun(8).
       <a class="ulink" href="http://stgt.sourceforge.net/"; target="_top">http://stgt.sourceforge.net/</a>
-    </p></div><div class="refsect1" lang="en"><a name="id2476062"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
+    </p></div><div class="refsect1" lang="en"><a name="id2476105"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
 This program is free software; you can redistribute it and/or modify<br>
 it under the terms of the GNU General Public License as published by<br>
 the Free Software Foundation; either version 2 of the License, or (at<br>
diff --git a/doc/manpages/tgtadm.8 b/doc/manpages/tgtadm.8
index c0568c0..37f64c7 100644
--- a/doc/manpages/tgtadm.8
+++ b/doc/manpages/tgtadm.8
@@ -1,11 +1,11 @@
 .\"     Title: tgtadm
 .\"    Author: 
 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 02/18/2010
+.\"      Date: 02/26/2010
 .\"    Manual: 
 .\"    Source: 
 .\"
-.TH "TGTADM" "8" "02/18/2010" "" ""
+.TH "TGTADM" "8" "02/26/2010" "" ""
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
@@ -13,13 +13,18 @@
 .SH "NAME"
 tgtadm - Linux SCSI Target Administration Utility
 .SH "SYNOPSIS"
-.HP 65
-\fBtgtadm \-\-lld [driver] \-\-op [operation] \-\-mode [mode] [OPTION]\.\.\.\fR
+.HP 87
+\fBtgtadm [\-\-control\-port NNNN] \-\-lld [driver] \-\-op [operation] \-\-mode [mode] [OPTION]\.\.\.\fR
 .SH "DESCRIPTION"
 .PP
 tgtadm is used to monitor and modify everything about Linux SCSI target software: targets, volumes, etc\.
 .SH "OPTIONS"
 .PP
+\fB\-\-control\-port NNNN\fR
+.RS 4
+It is possible to run multiple concurrent instances of tgtd on a host\. This argument is used to control which instance the tgtadm command will operate on\.
+.RE
+.PP
 \fB\-\-lld [driver] \-\-op new \-\-mode target \-\-tid=[id] \-\-targetname [name]\fR
 .RS 4
 add a new target with [id] and [name]\.
diff --git a/doc/manpages/tgtd.8 b/doc/manpages/tgtd.8
index dd33a2d..1bded50 100644
--- a/doc/manpages/tgtd.8
+++ b/doc/manpages/tgtd.8
@@ -1,11 +1,11 @@
 .\"     Title: tgtd
 .\"    Author: 
 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 02/18/2010
+.\"      Date: 02/26/2010
 .\"    Manual: 
 .\"    Source: 
 .\"
-.TH "TGTD" "8" "02/18/2010" "" ""
+.TH "TGTD" "8" "02/26/2010" "" ""
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
@@ -16,7 +16,7 @@ tgtd - The SCSI Target Daemon
 .HP 5
 \fBtgtd\fR
 .HP 5
-\fBtgtd\fR [\-d\ \-\-debug\ <INTEGER>] [\-f\ \-\-foregound] [\-h\ \-\-help] [\-\-iscsi\ <\.\.\.>]
+\fBtgtd\fR [\-C\ \-\-control\-port\ <INTEGER>] [\-d\ \-\-debug\ <INTEGER>] [\-f\ \-\-foregound] [\-h\ \-\-help] [\-\-iscsi\ <\.\.\.>]
 .SH "DESCRIPTION"
 .PP
 Tgtd is a SCSI Target daemon\. It can be used to provide iSCSI target service to a network\.
@@ -37,6 +37,13 @@ Run the daemon in the foreground\.
 Print help text to the screen\.
 .RE
 .PP
+\-C \-\-control\-port <INTEGER>
+.RS 4
+This comamnd is used to specify the control port to use for this instance of tgtd\. This allows to run multiple instances of TGTD on a host\.
+.sp
+TGTADM has a matching argument to control which instance to connect to\.
+.RE
+.PP
 \-\-iscsi <\.\.\.>
 .RS 4
 ISCSI specific options\. See the ISCSI section below for options specific to this frontend\.
diff --git a/doc/tgtadm.8.xml b/doc/tgtadm.8.xml
index 9d01df7..381555f 100644
--- a/doc/tgtadm.8.xml
+++ b/doc/tgtadm.8.xml
@@ -14,7 +14,7 @@
 
 <refsynopsisdiv>
 	<cmdsynopsis>
-		<command>tgtadm --lld [driver] --op [operation] --mode [mode] [OPTION]...</command>
+		<command>tgtadm [--control-port NNNN] --lld [driver] --op [operation] --mode [mode] [OPTION]...</command>
 	</cmdsynopsis>
 	
 </refsynopsisdiv>
@@ -31,6 +31,16 @@
     <title>OPTIONS</title>
 
     <variablelist>
+      <varlistentry><term><option>--control-port NNNN</option></term>
+        <listitem>
+          <para>
+	    It is possible to run multiple concurrent instances of tgtd
+	    on a host. This argument is used to control which instance
+	    the tgtadm command will operate on.
+          </para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry><term><option>--lld [driver] --op new --mode target --tid=[id] --targetname [name]</option></term>
         <listitem>
           <para>
diff --git a/doc/tgtd.8.xml b/doc/tgtd.8.xml
index c88a888..28e6009 100644
--- a/doc/tgtd.8.xml
+++ b/doc/tgtd.8.xml
@@ -19,6 +19,7 @@
 	
 	<cmdsynopsis>
 		<command>tgtd</command>
+		<arg choice="opt">-C --control-port &lt;INTEGER&gt;</arg>
 		<arg choice="opt">-d --debug &lt;INTEGER&gt;</arg>
 		<arg choice="opt">-f --foregound</arg>
 		<arg choice="opt">-h --help</arg>
@@ -64,6 +65,20 @@
         </listitem>
       </varlistentry>
 
+      <varlistentry><term>-C --control-port &lt;INTEGER&gt;</term>
+        <listitem>
+          <para>
+	    This comamnd is used to specify the control port to use for
+	    this instance of tgtd. This allows to run multiple instances of 
+	    TGTD on a host.
+          </para>
+          <para>
+	    TGTADM has a matching argument to control which instance to connect
+	    to.
+          </para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry><term>--iscsi &lt;...&gt;</term>
         <listitem>
           <para>
diff --git a/usr/mgmt.c b/usr/mgmt.c
index 7801ab0..7dc9f30 100644
--- a/usr/mgmt.c
+++ b/usr/mgmt.c
@@ -554,8 +554,10 @@ out:
 
 int ipc_init(void)
 {
+	extern short control_port;
 	int fd, err;
 	struct sockaddr_un addr;
+	char path[256];
 
 	fd = socket(AF_LOCAL, SOCK_STREAM, 0);
 	if (fd < 0) {
@@ -563,10 +565,11 @@ int ipc_init(void)
 		return -1;
 	}
 
-	unlink(TGT_IPC_NAMESPACE);
+	sprintf(path, "%s.%d", TGT_IPC_NAMESPACE, control_port);
+	unlink(path);
 	memset(&addr, 0, sizeof(addr));
 	addr.sun_family = AF_LOCAL;
-	strncpy(addr.sun_path, TGT_IPC_NAMESPACE, sizeof(addr.sun_path));
+	strncpy(addr.sun_path, path, sizeof(addr.sun_path));
 
 	err = bind(fd, (struct sockaddr *) &addr, sizeof(addr));
 	if (err) {
diff --git a/usr/tgtadm.c b/usr/tgtadm.c
index dd46985..4bd2227 100644
--- a/usr/tgtadm.c
+++ b/usr/tgtadm.c
@@ -122,10 +122,11 @@ struct option const long_options[] = {
 	{"bus", required_argument, NULL, 'B'},
 	{"device-type", required_argument, NULL, 'Y'},
 	{"outgoing", no_argument, NULL, 'O'},
+	{"control-port", required_argument, NULL, 'C'},
 	{NULL, 0, NULL, 0},
 };
 
-static char *short_options = "dhL:o:m:t:s:c:l:n:v:b:E:T:I:u:p:H:P:B:Y:O";
+static char *short_options = "dhL:o:m:t:s:c:l:n:v:b:E:T:I:u:p:H:P:B:Y:O:C";
 
 static void usage(int status)
 {
@@ -174,6 +175,7 @@ Linux SCSI Target Framework Administration Utility, version %s\n\
   --lld [driver] --mode account --op unbind --tid=[id] --user=[name]\n\
                         delete the specific account having [name] from specific\n\
                         target.\n\
+  --control-port NNNN   use control port NNNN\n\
   --help                display this help and exit\n\
 \n\
 Report bugs to <stgt@xxxxxxxxxxxxxxx>.\n", TGT_VERSION);
@@ -181,10 +183,14 @@ Report bugs to <stgt@xxxxxxxxxxxxxxx>.\n", TGT_VERSION);
 	exit(status == 0 ? 0 : EINVAL);
 }
 
+/* default port to use for the mgmt channel */
+static short int control_port = 0;
+
 static int ipc_mgmt_connect(int *fd)
 {
 	int err;
 	struct sockaddr_un addr;
+	char path[256];
 
 	*fd = socket(AF_LOCAL, SOCK_STREAM, 0);
 	if (*fd < 0) {
@@ -194,7 +200,8 @@ static int ipc_mgmt_connect(int *fd)
 
 	memset(&addr, 0, sizeof(addr));
 	addr.sun_family = AF_LOCAL;
-	strncpy(addr.sun_path, TGT_IPC_NAMESPACE, sizeof(addr.sun_path));
+	sprintf(path, "%s.%d", TGT_IPC_NAMESPACE, control_port);
+	strncpy(addr.sun_path, path, sizeof(addr.sun_path));
 
 	err = connect(*fd, (struct sockaddr *) &addr, sizeof(addr));
 	if (err < 0)
@@ -518,6 +525,9 @@ int main(int argc, char **argv)
 		case 'O':
 			ac_dir = ACCOUNT_TYPE_OUTGOING;
 			break;
+		case 'C':
+			control_port = strtol(optarg, NULL, 10);
+			break;
 		case 'd':
 			debug = 1;
 			break;
@@ -551,7 +561,7 @@ int main(int argc, char **argv)
 		}
 		switch (op) {
 		case OP_NEW:
-			rc = verify_mode_params(argc, argv, "LmotT");
+			rc = verify_mode_params(argc, argv, "LmotTC");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -564,7 +574,7 @@ int main(int argc, char **argv)
 			break;
 		case OP_DELETE:
 		case OP_SHOW:
-			rc = verify_mode_params(argc, argv, "Lmot");
+			rc = verify_mode_params(argc, argv, "LmotC");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -573,7 +583,7 @@ int main(int argc, char **argv)
 			break;
 		case OP_BIND:
 		case OP_UNBIND:
-			rc = verify_mode_params(argc, argv, "LmotIBH");
+			rc = verify_mode_params(argc, argv, "LmotIBHC");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -587,7 +597,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_UPDATE:
-			rc = verify_mode_params(argc, argv, "Lmotnv");
+			rc = verify_mode_params(argc, argv, "LmotnvC");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -609,7 +619,7 @@ int main(int argc, char **argv)
 	if (mode == MODE_ACCOUNT) {
 		switch (op) {
 		case OP_NEW:
-			rc = verify_mode_params(argc, argv, "Lmoup");
+			rc = verify_mode_params(argc, argv, "LmoupC");
 			if (rc) {
 				eprintf("logicalunit mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -621,7 +631,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_SHOW:
-			rc = verify_mode_params(argc, argv, "Lmo");
+			rc = verify_mode_params(argc, argv, "LmoC");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -629,7 +639,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_DELETE:
-			rc = verify_mode_params(argc, argv, "Lmou");
+			rc = verify_mode_params(argc, argv, "LmouC");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -637,7 +647,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_BIND:
-			rc = verify_mode_params(argc, argv, "LmotuO");
+			rc = verify_mode_params(argc, argv, "LmotuOC");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -653,7 +663,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_UNBIND:
-			rc = verify_mode_params(argc, argv, "Lmou");
+			rc = verify_mode_params(argc, argv, "LmouC");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -686,7 +696,7 @@ int main(int argc, char **argv)
 		}
 		switch (op) {
 		case OP_NEW:
-			rc = verify_mode_params(argc, argv, "LmotlbEY");
+			rc = verify_mode_params(argc, argv, "LmotlbEYC");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -699,7 +709,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_DELETE:
-			rc = verify_mode_params(argc, argv, "Lmotl");
+			rc = verify_mode_params(argc, argv, "LmotlC");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -707,7 +717,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_UPDATE:
-			rc = verify_mode_params(argc, argv, "LmotlP");
+			rc = verify_mode_params(argc, argv, "LmotlPC");
 			if (rc) {
 				eprintf("option '-%c' not supported in "
 					"logicalunit mode\n", rc);
diff --git a/usr/tgtd.c b/usr/tgtd.c
index 9d89f73..b335f03 100644
--- a/usr/tgtd.c
+++ b/usr/tgtd.c
@@ -50,12 +50,13 @@ static LIST_HEAD(tgt_sched_events_list);
 static struct option const long_options[] =
 {
 	{"foreground", no_argument, 0, 'f'},
+	{"control-port", required_argument, 0, 'C'},
 	{"debug", required_argument, 0, 'd'},
 	{"help", no_argument, 0, 'h'},
 	{0, 0, 0, 0},
 };
 
-static char *short_options = "fd:h";
+static char *short_options = "fd:hC";
 
 static void usage(int status)
 {
@@ -66,6 +67,7 @@ static void usage(int status)
 		printf("\
 Target framework daemon, version %s\n\
   -f, --foreground        make the program run in the foreground\n\
+  -C, --control-port NNNN use port NNNN for the mgmt channel\n\
   -d, --debug debuglevel  print debugging information\n\
   -h, --help              display this help and exit\n\
 ", TGT_VERSION);
@@ -73,6 +75,9 @@ Target framework daemon, version %s\n\
 	exit(status);
 }
 
+/* Default TGT mgmt port */
+short int control_port = 0;
+
 static void signal_catch(int signo) {
 }
 
@@ -377,6 +382,9 @@ int main(int argc, char **argv)
 		case 'f':
 			is_daemon = 0;
 			break;
+		case 'C':
+			control_port = atoi(optarg);
+			break;
 		case 'd':
 			is_debug = atoi(optarg);
 			break;
-- 
1.5.4.3


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux