Finished of the net namespace support for flashnode sysfs devices
---
drivers/scsi/scsi_transport_iscsi.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/scsi/scsi_transport_iscsi.c
b/drivers/scsi/scsi_transport_iscsi.c
index 1ae4809a7684..eacd11557eb7 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1269,8 +1269,39 @@ 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
*fnode_sess)
+{
+ struct Scsi_Host *shost = iscsi_flash_session_to_shost(fnode_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
*fnode_conn)
+{
+ struct iscsi_flash_session *fnode_sess =
iscsi_flash_conn_to_flash_session(fnode_conn);
+
+ return iscsi_flashnode_sess_net(fnode_sess);
+}
+
+static const void *iscsi_flashnode_namespace(struct device *dev) {
+ struct iscsi_flash_conn *fnode_conn;
+ struct iscsi_flash_session *fnode_sess;
+
+ if (iscsi_is_flashnode_conn_dev(dev, NULL)) {
+ fnode_conn = iscsi_dev_to_flash_conn(dev);
+ return iscsi_flashnode_conn_net(fnode_conn);
+ } else if (iscsi_is_flashnode_session_dev(dev)) {
+ fnode_sess = iscsi_dev_to_flash_session(dev);
+ return iscsi_flashnode_sess_net(fnode_sess);
+ }
+ return NULL;
+}
+
static struct class iscsi_flashnode = {
.name = "iscsi_flashnode",
+ .ns_type = &net_ns_type_operations,
+ .namespace = iscsi_flashnode_namespace,
};
/**
--
2.9.4
--
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.