[Open-FCoE] [RFC PATCH] libhbalinux: Fix the junk characters in adapter name

Ma, Steve steve.ma at intel.com
Wed Apr 15 22:15:36 UTC 2009



>-----Original Message-----
>From: Love, Robert W
>Sent: Wednesday, April 15, 2009 1:18 PM
>To: Ma, Steve; devel at open-fcoe.org
>Subject: RE: [Open-FCoE] [RFC PATCH] libhbalinux: Fix the junk characters
>in adapter name
>
>Steve Ma wrote:
>> When the adapter name (ap->ad_name) is created in sysfs_scan
>> routine, the name contains junk characters instead the ethernet
>> interface name (ethx). This patch is to have correct interface
>> name in ap->ad_name.
>> ---
>>
>>  lport.c |    6 ++++--
>>  1 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/lport.c b/lport.c
>> index 7b1b18a..4e2ad48 100644
>> --- a/lport.c
>> +++ b/lport.c
>> @@ -168,6 +168,10 @@ sysfs_scan(struct dirent *dp, void *arg)
>>  	if (!cp)
>>  		goto skip;
>>
>> +	/* Save the ifname */
>> +	cp += 6;
>I don't really like this hard coded number here. Can't we change the
>string we're searching for in strstr() from " over " to "eth" to
>find the ifname?
>
I agree. I don't like that either. I will change that.

>> +	sa_strncpy_safe(ifname, sizeof(ifname), cp, strlen(cp));
>> +
>>  	/*
>>  	 * See if host_dir is a PCI device directory
>>  	 * If not, try it as a net device.
>> @@ -181,8 +185,6 @@ sysfs_scan(struct dirent *dp, void *arg)
>>  		snprintf(hba_dir, sizeof(hba_dir), "%s/device/..", host_dir);
>>  	} else {
>>  		/* assume a net device */
>> -		cp += 6;
>> -		sa_strncpy_safe(ifname, sizeof(ifname), cp, strlen(cp));
>>  		snprintf(hba_dir, sizeof(hba_dir), SYSFS_HBA_DIR "/%s/device",
>>  			ifname);
>>  		i = readlink(hba_dir, buf, sizeof(buf) - 1);
>>
>> _______________________________________________
>> devel mailing list
>> devel at open-fcoe.org
>> http://www.open-fcoe.org/mailman/listinfo/devel




More information about the devel mailing list