diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2008-05-21 16:54:16 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-07-12 09:22:21 -0400 |
commit | 88dfd340b9dece8fcaa1a2d4c782338926c017f7 (patch) | |
tree | 89800910ef8636f00d2c66ce4e83a161087857e6 /drivers/scsi/libiscsi.c | |
parent | 06520edea0fc7007985fa4cd51560149feb3f442 (diff) |
[SCSI] iscsi class: Add session initiatorname and ifacename sysfs attrs.
This adds two new attrs used for creating initiator ports and
binding sessions to hardware.
The session level initiatorname:
Since bnx2i does a scsi_host per host device, we need to add the
iface initiator port settings on the session, so we can create
multiple initiator ports (each with different inames) per device/scsi_host.
The current iname reflects that qla4xxx can have one iname per hba, and we are
allocating a host per session for software. The iname on the host will
remain so we can export and set the hba level qla4xxx setting.
The ifacename attr:
To bind a session to a some peice of hardware in userspace we maintain
some mappings, but during boot or iscsid restart (iscsid contains the user
space part of the driver) we need to be able to figure out which of those
host mappings abstractions maps to certain sessions. This patch adds
a ifacename attr, which userspace can set to id the host side of the
endpoint across pivot_roots and iscsid restarts.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r-- | drivers/scsi/libiscsi.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index e88b726ab2e0..c1af2aa8e4e0 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -1990,6 +1990,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) | |||
1990 | kfree(session->username); | 1990 | kfree(session->username); |
1991 | kfree(session->username_in); | 1991 | kfree(session->username_in); |
1992 | kfree(session->targetname); | 1992 | kfree(session->targetname); |
1993 | kfree(session->initiatorname); | ||
1994 | kfree(session->ifacename); | ||
1993 | 1995 | ||
1994 | iscsi_destroy_session(cls_session); | 1996 | iscsi_destroy_session(cls_session); |
1995 | module_put(owner); | 1997 | module_put(owner); |
@@ -2453,6 +2455,14 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn, | |||
2453 | if (!conn->persistent_address) | 2455 | if (!conn->persistent_address) |
2454 | return -ENOMEM; | 2456 | return -ENOMEM; |
2455 | break; | 2457 | break; |
2458 | case ISCSI_PARAM_IFACE_NAME: | ||
2459 | if (!session->ifacename) | ||
2460 | session->ifacename = kstrdup(buf, GFP_KERNEL); | ||
2461 | break; | ||
2462 | case ISCSI_PARAM_INITIATOR_NAME: | ||
2463 | if (!session->initiatorname) | ||
2464 | session->initiatorname = kstrdup(buf, GFP_KERNEL); | ||
2465 | break; | ||
2456 | default: | 2466 | default: |
2457 | return -ENOSYS; | 2467 | return -ENOSYS; |
2458 | } | 2468 | } |
@@ -2519,6 +2529,15 @@ int iscsi_session_get_param(struct iscsi_cls_session *cls_session, | |||
2519 | case ISCSI_PARAM_PASSWORD_IN: | 2529 | case ISCSI_PARAM_PASSWORD_IN: |
2520 | len = sprintf(buf, "%s\n", session->password_in); | 2530 | len = sprintf(buf, "%s\n", session->password_in); |
2521 | break; | 2531 | break; |
2532 | case ISCSI_PARAM_IFACE_NAME: | ||
2533 | len = sprintf(buf, "%s\n", session->ifacename); | ||
2534 | break; | ||
2535 | case ISCSI_PARAM_INITIATOR_NAME: | ||
2536 | if (!session->initiatorname) | ||
2537 | len = sprintf(buf, "%s\n", "unknown"); | ||
2538 | else | ||
2539 | len = sprintf(buf, "%s\n", session->initiatorname); | ||
2540 | break; | ||
2522 | default: | 2541 | default: |
2523 | return -ENOSYS; | 2542 | return -ENOSYS; |
2524 | } | 2543 | } |
@@ -2606,6 +2625,7 @@ int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param, | |||
2606 | else | 2625 | else |
2607 | len = sprintf(buf, "%s\n", | 2626 | len = sprintf(buf, "%s\n", |
2608 | ihost->local_address); | 2627 | ihost->local_address); |
2628 | break; | ||
2609 | default: | 2629 | default: |
2610 | return -ENOSYS; | 2630 | return -ENOSYS; |
2611 | } | 2631 | } |