diff options
author | Eddie Wai <eddie.wai@broadcom.com> | 2013-08-23 14:04:11 -0700 |
---|---|---|
committer | Mike Christie <michaelc@cs.wisc.edu> | 2013-09-12 00:01:07 -0700 |
commit | 487c312c96379e45648c782cee5b0d469cba80d0 (patch) | |
tree | 902bf377f21ec6ae574d08945e50b2c8ad7e1c55 /usr/iscsi_sysfs.c | |
parent | 5992173f13550d75659fec1d7e1f6e87895d560a (diff) | |
download | open-iscsi-487c312c96379e45648c782cee5b0d469cba80d0.tar.gz |
ISCSID: Added the extraction of the session boot info
This patch does the work to extract the corresponding
<boot_root>->ethernetN net params as specified from the kernel
session boot_nic sysfs entry based on the transport param
use_boot_info.
This is only populated for iscsi_tcp and bnx2i.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Diffstat (limited to 'usr/iscsi_sysfs.c')
-rw-r--r-- | usr/iscsi_sysfs.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c index aed10a3..56cb90c 100644 --- a/usr/iscsi_sysfs.c +++ b/usr/iscsi_sysfs.c @@ -674,6 +674,43 @@ free_fnode: return rc; } +static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session) +{ + char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN]; + char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN]; + + /* Extract boot info */ + strlcpy(boot_name, "boot_target", sizeof(boot_name)); + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, + boot_content, BOOT_NAME_MAXLEN)) + return -1; + strlcpy(boot_name, "boot_nic", sizeof(boot_name)); + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic, + BOOT_NAME_MAXLEN)) + return -1; + strlcpy(boot_name, "boot_root", sizeof(boot_name)); + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root, + BOOT_NAME_MAXLEN)) + return -1; + + /* If all boot_root/boot_target/boot_nic exist, then extract the + info from the boot nic */ + if (sysfs_get_str(boot_nic, boot_root, "vlan", boot_content, + BOOT_NAME_MAXLEN)) + log_debug(5, "could not read %s/%s/vlan", boot_root, boot_nic); + else + iface->vlan_id = atoi(boot_content); + + if (sysfs_get_str(boot_nic, boot_root, "subnet-mask", + iface->subnet_mask, NI_MAXHOST)) + log_debug(5, "could not read %s/%s/subnet", boot_root, + boot_nic); + + log_debug(5, "sysfs read boot returns %s/%s/ vlan = %d subnet = %s", + boot_root, boot_nic, iface->vlan_id, iface->subnet_mask); + return 0; +} + /* * Read in iface settings based on host and session values. If * session is not passed in, then the ifacename will not be set. And @@ -802,6 +839,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, int host_no, } } + if (session && t->template->use_boot_info) + iscsi_sysfs_read_boot(iface, session); + if (!iface_kern_id) goto done; |