diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2007-05-30 13:57:12 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2007-06-01 12:55:23 -0400 |
commit | 0801c242a33426fddc005c2f559a3d2fa6fca7eb (patch) | |
tree | be5b4b54766ee7f53458a5cd69e9f9ada8102676 /drivers/scsi | |
parent | 1d9bf13a9cf91f8faf221e98a64dd1157bcf5fa9 (diff) |
[SCSI] libiscsi, iscsi_tcp, ib_iser : add sw iscsi host get/set params helpers
iscsid and udev need to key off the hw address being
used so add some helpers for iser and iscsi tcp.
Also convert them
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Cc: Roland Dreier <rdreier@cisco.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 4 | ||||
-rw-r--r-- | drivers/scsi/libiscsi.c | 40 |
2 files changed, 44 insertions, 0 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index c9a3abf9e7b6..9a42fc074b76 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -2181,6 +2181,7 @@ static struct iscsi_transport iscsi_tcp_transport = { | |||
2181 | ISCSI_PERSISTENT_ADDRESS | | 2181 | ISCSI_PERSISTENT_ADDRESS | |
2182 | ISCSI_TARGET_NAME | | 2182 | ISCSI_TARGET_NAME | |
2183 | ISCSI_TPGT, | 2183 | ISCSI_TPGT, |
2184 | .host_param_mask = ISCSI_HOST_HWADDRESS, | ||
2184 | .host_template = &iscsi_sht, | 2185 | .host_template = &iscsi_sht, |
2185 | .conndata_size = sizeof(struct iscsi_conn), | 2186 | .conndata_size = sizeof(struct iscsi_conn), |
2186 | .max_conn = 1, | 2187 | .max_conn = 1, |
@@ -2197,6 +2198,9 @@ static struct iscsi_transport iscsi_tcp_transport = { | |||
2197 | .get_session_param = iscsi_session_get_param, | 2198 | .get_session_param = iscsi_session_get_param, |
2198 | .start_conn = iscsi_conn_start, | 2199 | .start_conn = iscsi_conn_start, |
2199 | .stop_conn = iscsi_tcp_conn_stop, | 2200 | .stop_conn = iscsi_tcp_conn_stop, |
2201 | /* iscsi host params */ | ||
2202 | .get_host_param = iscsi_host_get_param, | ||
2203 | .set_host_param = iscsi_host_set_param, | ||
2200 | /* IO */ | 2204 | /* IO */ |
2201 | .send_pdu = iscsi_conn_send_pdu, | 2205 | .send_pdu = iscsi_conn_send_pdu, |
2202 | .get_stats = iscsi_conn_get_stats, | 2206 | .get_stats = iscsi_conn_get_stats, |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 3f5b9b445b29..d430e227e9b7 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -1462,6 +1462,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) | |||
1462 | iscsi_pool_free(&session->cmdpool, (void**)session->cmds); | 1462 | iscsi_pool_free(&session->cmdpool, (void**)session->cmds); |
1463 | 1463 | ||
1464 | kfree(session->targetname); | 1464 | kfree(session->targetname); |
1465 | kfree(session->hwaddress); | ||
1465 | 1466 | ||
1466 | iscsi_destroy_session(cls_session); | 1467 | iscsi_destroy_session(cls_session); |
1467 | scsi_host_put(shost); | 1468 | scsi_host_put(shost); |
@@ -1990,6 +1991,45 @@ int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, | |||
1990 | } | 1991 | } |
1991 | EXPORT_SYMBOL_GPL(iscsi_conn_get_param); | 1992 | EXPORT_SYMBOL_GPL(iscsi_conn_get_param); |
1992 | 1993 | ||
1994 | int iscsi_host_get_param(struct Scsi_Host *shost, enum iscsi_host_param param, | ||
1995 | char *buf) | ||
1996 | { | ||
1997 | struct iscsi_session *session = iscsi_hostdata(shost->hostdata); | ||
1998 | int len; | ||
1999 | |||
2000 | switch (param) { | ||
2001 | case ISCSI_HOST_PARAM_HWADDRESS: | ||
2002 | if (!session->hwaddress) | ||
2003 | len = sprintf(buf, "%s\n", "default"); | ||
2004 | else | ||
2005 | len = sprintf(buf, "%s\n", session->hwaddress); | ||
2006 | break; | ||
2007 | default: | ||
2008 | return -ENOSYS; | ||
2009 | } | ||
2010 | |||
2011 | return len; | ||
2012 | } | ||
2013 | EXPORT_SYMBOL_GPL(iscsi_host_get_param); | ||
2014 | |||
2015 | int iscsi_host_set_param(struct Scsi_Host *shost, enum iscsi_host_param param, | ||
2016 | char *buf, int buflen) | ||
2017 | { | ||
2018 | struct iscsi_session *session = iscsi_hostdata(shost->hostdata); | ||
2019 | |||
2020 | switch (param) { | ||
2021 | case ISCSI_HOST_PARAM_HWADDRESS: | ||
2022 | if (!session->hwaddress) | ||
2023 | session->hwaddress = kstrdup(buf, GFP_KERNEL); | ||
2024 | break; | ||
2025 | default: | ||
2026 | return -ENOSYS; | ||
2027 | } | ||
2028 | |||
2029 | return 0; | ||
2030 | } | ||
2031 | EXPORT_SYMBOL_GPL(iscsi_host_set_param); | ||
2032 | |||
1993 | MODULE_AUTHOR("Mike Christie"); | 2033 | MODULE_AUTHOR("Mike Christie"); |
1994 | MODULE_DESCRIPTION("iSCSI library functions"); | 2034 | MODULE_DESCRIPTION("iSCSI library functions"); |
1995 | MODULE_LICENSE("GPL"); | 2035 | MODULE_LICENSE("GPL"); |