@@ -1289,8 +1289,42 @@ 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(const struct device *dev)
+{
+ struct iscsi_flash_conn *f_conn;
+ struct iscsi_flash_session *f_sess;
+ struct device *dev_tmp = (struct device *)dev;
+
+ if (iscsi_is_flashnode_conn_dev(dev_tmp, NULL)) {
+ f_conn = iscsi_dev_to_flash_conn(dev);
+ return iscsi_flashnode_conn_net(f_conn);
+ } else if (iscsi_is_flashnode_session_dev(dev_tmp)) {
+ 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,
};
/**
@@ -516,8 +516,6 @@ extern void
iscsi_destroy_flashnode_sess(struct iscsi_flash_session *fnode_sess);
extern void iscsi_destroy_all_flashnode(struct Scsi_Host *shost);
-extern int iscsi_flashnode_bus_match(struct device *dev,
- struct device_driver *drv);
extern struct device *
iscsi_find_flashnode_sess(struct Scsi_Host *shost, void *data,
int (*fn)(struct device *dev, void *data));
@@ -526,8 +524,6 @@ iscsi_find_flashnode_conn(struct iscsi_flash_session *fnode_sess);
extern bool iscsi_is_flashnode_session_dev(struct device *dev);
-extern bool iscsi_is_flashnode_session_dev(struct device *dev);
-
extern char *
iscsi_get_ipaddress_state_name(enum iscsi_ipaddress_state port_state);
extern char *iscsi_get_router_state_name(enum iscsi_router_state router_state);