[stgt] [PATCH 1/1] iscsi: add support to use multiple portals for iscsi

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Thu Apr 14 11:08:57 CEST 2011


Sorry for the delay.

On Sat, 9 Apr 2011 12:49:48 +1000
ronnie sahlberg <ronniesahlberg at gmail.com> wrote:

> From a0da7338636798417a232b8482244c84728d6596 Mon Sep 17 00:00:00 2001
> From: Ronnie Sahlberg <ronniesahlberg at gmail.com>
> Date: Sat, 9 Apr 2011 12:41:05 +1000
> Subject: [PATCH] Add support for multiple portals,
>  keep a list of the portals that are in use, and have this list
>  default to [0::0] and 0.0.0.0 wilcards for ipv6/ipv4 in case the user
>  does not specify a portal.
> 
> This allows
> tgtd --iscsi portal=10.1.1.1:3260,portal=10.1.1.2:3261,portal=10.1.1.2:3262
> 
> Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
> ---
>  usr/iscsi/iscsi_tcp.c |   30 +++++++++++++++++++++++++++---
>  usr/iscsi/iscsid.c    |   43 +++++++++++++++++++++++++++++++------------
>  usr/iscsi/iscsid.h    |   11 +++++++++--
>  usr/iscsi/isns.c      |   15 ++++++++++-----
>  4 files changed, 77 insertions(+), 22 deletions(-)

(snip)

> diff --git a/usr/iscsi/iscsid.h b/usr/iscsi/iscsid.h
> index e496712..5e3db12 100644
> --- a/usr/iscsi/iscsid.h
> +++ b/usr/iscsi/iscsid.h
> @@ -266,8 +266,14 @@ enum task_flags {
>  	TASK_in_scsi,
>  };
>  
> -extern int iscsi_listen_port;
> -extern char *iscsi_portal_addr;
> +struct iscsi_portal {
> +	struct iscsi_portal *next;
> +	char *addr;
> +	int port;
> +	int fd;
> +};

Can you simply use struct list_head like?

+struct iscsi_portal {
+	struct list_head iscsi_portal_siblings;
+	char *addr;
+	int port;
+	int fd;
+};

I always like to use list_head (and with its accessors) for the
simplicity and readability.


Thanks!
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list