netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Leech <cleech@redhat.com>
To: netdev@vger.kernel.org, containers@lists.linux-foundation.org
Subject: [PATCH 9/9] iscsi: filter flashnode sysfs by net namespace
Date: Tue,  7 Nov 2017 14:45:13 -0800	[thread overview]
Message-ID: <20171107224513.4217-10-cleech@redhat.com> (raw)
In-Reply-To: <20171107224513.4217-1-cleech@redhat.com>

Finished the net namespace support for flashnode sysfs devices

Signed-off-by: Chris Leech <cleech@redhat.com>
---
 drivers/scsi/scsi_transport_iscsi.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 5ffda170ac9d..783971d72c4c 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1268,8 +1268,41 @@ static int iscsi_is_flashnode_conn_dev(struct device *dev, void *data)
 	return dev->type == &iscsi_flashnode_conn_dev_type;
 }
 
+static struct net *iscsi_flashnode_sess_net(struct iscsi_flash_session *f_sess)
+{
+	struct Scsi_Host *shost = iscsi_flash_session_to_shost(f_sess);
+	struct iscsi_cls_host *ihost = shost->shost_data;
+
+	return iscsi_host_net(ihost);
+}
+
+static struct net *iscsi_flashnode_conn_net(struct iscsi_flash_conn *f_conn)
+{
+	struct iscsi_flash_session *f_sess =
+		iscsi_flash_conn_to_flash_session(f_conn);
+
+	return iscsi_flashnode_sess_net(f_sess);
+}
+
+static const void *iscsi_flashnode_namespace(struct device *dev)
+{
+	struct iscsi_flash_conn *f_conn;
+	struct iscsi_flash_session *f_sess;
+
+	if (iscsi_is_flashnode_conn_dev(dev, NULL)) {
+		f_conn = iscsi_dev_to_flash_conn(dev);
+		return iscsi_flashnode_conn_net(f_conn);
+	} else if (iscsi_is_flashnode_session_dev(dev)) {
+		f_sess = iscsi_dev_to_flash_session(dev);
+		return iscsi_flashnode_sess_net(f_sess);
+	}
+	return NULL;
+}
+
 static struct class iscsi_flashnode = {
 	.name = "iscsi_flashnode",
+	.ns_type = &net_ns_type_operations,
+	.namespace = iscsi_flashnode_namespace,
 };
 
 /**
-- 
2.9.5

      parent reply	other threads:[~2017-11-07 22:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20171107180156.GD29597@straylight.hirudinean.org>
     [not found] ` <20171107180156.GD29597-r8IHplWLGbA5tHQWs+pTeqPFFGjUI2lm2LY78lusg7I@public.gmane.org>
2017-11-07 22:45   ` [PATCH 0/9] use network namespace for iSCSI control interfaces Chris Leech
2017-11-07 22:45     ` [PATCH 2/9] iscsi: associate endpoints with a host Chris Leech
2017-11-07 22:45     ` [PATCH 3/9] iscsi: sysfs filtering by network namespace Chris Leech
     [not found]     ` <20171107224513.4217-1-cleech-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-07 22:45       ` [PATCH 1/9] iscsi: create per-net iscsi netlink kernel sockets Chris Leech
2017-11-07 22:45       ` [PATCH 4/9] iscsi: make all iSCSI netlink multicast namespace aware Chris Leech
2017-11-08 10:31       ` [PATCH 0/9] use network namespace for iSCSI control interfaces David Laight
2017-11-15  0:25         ` Chris Leech
2017-11-21 11:26           ` David Laight
2017-11-21 19:46             ` Eric W. Biederman
     [not found]             ` <687d0196888f4325aebc0989a8e12ced-1XygrNkDbNvwg4NCKwmqgw@public.gmane.org>
2017-11-21 20:20               ` Chris Leech
2017-11-07 22:45     ` [PATCH 5/9] iscsi: set netns for iscsi_tcp hosts Chris Leech
2017-11-07 22:45     ` [PATCH 6/9] iscsi: check net namespace for all iscsi lookups Chris Leech
2017-11-07 22:45     ` [PATCH 7/9] iscsi: convert flashnode devices from bus to class Chris Leech
2017-11-07 22:45     ` [PATCH 8/9] iscsi: rename iscsi_bus_flash_* to iscsi_flash_* Chris Leech
2017-11-07 22:45     ` Chris Leech [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171107224513.4217-10-cleech@redhat.com \
    --to=cleech@redhat.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).