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?

> +     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
> [email protected]
> http://www.open-fcoe.org/mailman/listinfo/devel

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to