Re: [PATCH 1/8] ibft scanning fails on newer kernels

2011-06-22 Thread Hannes Reinecke

On 06/21/2011 11:39 PM, Mike Christie wrote:

On 06/21/2011 04:23 AM, Hannes Reinecke wrote:

Newer kernels provide the 'net' link as a directory, instead of the
'net:XX' link with previous kernels. The sysfs scanning code has
enablement to work with this, but the directory lookup doesn't
work properly.


What is the bug exactly? What kernel does this break on? It seems to
work ok for me.

The patch seems like a enhancement and not a bug fix?? Before the patch
the code would loop through everything in the dir. If that fails then it
would drop down and look for just net. With your patch it now detects
if we are doing net:XX or net when we first fine either one.

Patch looks ok to me. Just want to make sure what is broken or not.


Hmm. Now that you mention it. Indeed it's not required anymore.
As the patch is rather old it's actually a merge artefact.
So we wouldn't be needing it.

Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries  Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

--
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH 1/8] ibft scanning fails on newer kernels

2011-06-21 Thread Hannes Reinecke
Newer kernels provide the 'net' link as a directory, instead of the
'net:XX' link with previous kernels. The sysfs scanning code has
enablement to work with this, but the directory lookup doesn't
work properly.

References: bnc#561596

Signed-off-by: Hannes Reinecke h...@suse.de
---
 utils/fwparam_ibft/fwparam_ibft_sysfs.c |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/utils/fwparam_ibft/fwparam_ibft_sysfs.c 
b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
index 9185c85..486deec 100644
--- a/utils/fwparam_ibft/fwparam_ibft_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
@@ -84,7 +84,7 @@ static int find_sysfs_dirs(const char *fpath, const struct 
stat *sb,
 static int get_iface_from_device(char *id, struct boot_context *context)
 {
char dev_dir[FILENAMESZ];
-   int rc = ENODEV;
+   int rc = EOPNOTSUPP;
DIR *dirfd;
struct dirent *dent;
 
@@ -99,8 +99,7 @@ static int get_iface_from_device(char *id, struct 
boot_context *context)
return errno;
 
while ((dent = readdir(dirfd))) {
-   if (!strcmp(dent-d_name, .) || !strcmp(dent-d_name, ..) ||
-   strncmp(dent-d_name, net:, 4))
+   if (!strcmp(dent-d_name, .) || !strcmp(dent-d_name, ..))
continue;
 
if (!strncmp(dent-d_name, net:, 4)) {
@@ -116,17 +115,19 @@ static int get_iface_from_device(char *id, struct 
boot_context *context)
rc = EINVAL;
rc = 0;
break;
-   } else {
-   printf(Could not read ethernet to net link.\n);
-   rc = EOPNOTSUPP;
+   }
+   if (!strcmp(dent-d_name, net)) {
+   rc = ENODEV;
break;
}
}
 
closedir(dirfd);
 
-   if (rc != ENODEV)
+   if (rc != ENODEV) {
+   printf(Could not read ethernet to net link\n.);
return rc;
+   }
 
/* If not found try again with newer kernel networkdev sysfs layout */
strlcat(dev_dir, /net, FILENAMESZ);
-- 
1.7.3.4

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.