- Fix reading of iBFT firmware with newer kernels

This commit is contained in:
Hans de Goede 2009-01-28 21:44:53 +00:00
parent 6b7a0556f3
commit 2043c5a8d9
2 changed files with 50 additions and 1 deletions

View File

@ -3,7 +3,7 @@
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.2.0.870
Release: 2%{?dist}
Release: 3%{?dist}
Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-870.1.tar.gz
Source1: iscsid.init
Source2: iscsidevs.init
@ -17,6 +17,7 @@ Patch5: iscsi-initiator-utils-only-root-use.patch
Patch6: iscsi-initiator-utils-start-iscsid.patch
Patch7: open-iscsi-2.0-870.1-add-libiscsi.patch
Patch8: open-iscsi-2.0-870.1-no-exit.patch
Patch9: open-iscsi-2.0-870.1-ibft-newer-kernel.patch
Group: System Environment/Daemons
License: GPLv2+
@ -53,6 +54,7 @@ developing applications that use %{name}.
%patch6 -p1 -b .start-iscsid
%patch7 -p1
%patch8 -p1
%patch9 -p1
%build
@ -156,6 +158,9 @@ fi
%{_includedir}/libiscsi.h
%changelog
* Wed Jan 28 2009 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-3
- Fix reading of iBFT firmware with newer kernels
* Wed Jan 28 2009 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-2
- Add libiscsi iscsi administration library and -devel subpackage

View File

@ -0,0 +1,44 @@
diff -up open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c~ open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c
--- open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c~ 2009-01-28 22:09:21.000000000 +0100
+++ open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c 2009-01-28 22:10:29.000000000 +0100
@@ -186,6 +186,40 @@ static int get_iface_from_device(const c
break;
}
+ closedir(dirfd);
+
+ if (rc != ENODEV)
+ return rc;
+
+ /* If not found try again with newer kernel networkdev sysfs layout */
+ strncat(dev_dir, "/net", FILENAMESZ);
+
+ if (!file_exist(dev_dir))
+ return rc;
+
+ dirfd = opendir(dev_dir);
+ if (!dirfd)
+ return errno;
+
+ while ((dent = readdir(dirfd))) {
+ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
+ continue;
+
+ /* Take the first "regular" directory entry */
+ if (strlen(dent->d_name) > (sizeof(context->iface) - 1)) {
+ rc = EINVAL;
+ printf("Net device %s too bug for iface buffer.\n",
+ dent->d_name);
+ break;
+ }
+
+ strcpy(context->iface, dent->d_name);
+ rc = 0;
+ break;
+ }
+
+ closedir(dirfd);
+
return rc;
}