Added patch to compile cleanly and without upstream's ugly hack

This commit is contained in:
Jan Zeleny 2009-07-31 17:51:10 +00:00
parent 2b4d8b8459
commit 57fc34410a
8 changed files with 39 additions and 230 deletions

View File

@ -1 +1 @@
fcoe-utils-1.0.7.tar.gz
fcoe-utils-1.0.8.tar.gz

View File

@ -1,12 +0,0 @@
--- fcoe-utils-1.0.7/fcoeadm.c 2009-03-27 21:40:22.000000000 +0100
+++ fcoe-utils-1.0.7/fcoeadm.c.free 2009-05-04 11:29:00.000000000 +0200
@@ -250,8 +250,8 @@ fcoeadm_find_fchost(char *ifname, char *
}
free(namelist[n]);
}
+ free(namelist);
}
- free(namelist);
return found;
}

View File

@ -1,7 +1,7 @@
--- fcoe-utils-1.0.7/etc/initd/initd.fedora 2009-03-27 21:40:22.000000000 +0100
+++ fcoe-utils-1.0.7/etc/initd/initd.fedora.update 2009-04-03 09:54:39.000000000 +0200
service_status()
@@ -243,6 +243,8 @@ service_status()
@@ -245,6 +245,8 @@ service_status()
else
echo "Created interfaces: $IF_LIST"
fi
@ -10,7 +10,7 @@
}
case "$1" in
@@ -282,6 +284,7 @@ case "$1" in
@@ -284,6 +286,7 @@ case "$1" in
;;
status)
service_status

View File

@ -20,8 +20,8 @@
# Description: Open-FCoE SAN Setup
### END INIT INFO
@@ -183,6 +186,9 @@ service_start()
daemon --pidfile ${PID_FILE} ${FCOEMON}
@@ -185,6 +187,9 @@ service_start()
daemon --pidfile ${PID_FILE} ${FCOEMON} ${FCOEMON_OPTS}
fi
+ echo
@ -30,7 +30,7 @@
return
}
@@ -218,6 +224,7 @@ service_stop()
@@ -220,6 +226,7 @@ service_stop()
done
rm -f /var/run/fcoemon.*
rm -f /tmp/fcoemon.dcbd.*

View File

@ -1,199 +0,0 @@
--- fcoe-utils-1.0.7/fcoeadm.c 2009-05-04 11:29:00.000000000 +0200
+++ fcoe-utils-1.0.7/fcoeadm.c.longOptions 2009-05-11 13:57:22.000000000 +0200
@@ -7,7 +7,7 @@
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
@@ -38,19 +38,19 @@ Copyright (c) 2009, Intel Corporation.\n
#define FCOE_CREATE SYSFS_FCOE "/create"
#define FCOE_DESTROY SYSFS_FCOE "/destroy"
-#define FCHOSTBUFLEN 64
+#define FCHOSTBUFLEN 64
static struct option fcoeadm_opts[] = {
- {"create", 1, 0, 'c'},
- {"destroy", 1, 0, 'd'},
- {"reset", 1, 0, 'r'},
- {"interface", 1, 0, 'a'},
- {"target", 1, 0, 't'},
- {"lun", 1, 0, 'l'},
- {"stats", 1, 0, 's'},
- {"help", 0, 0, 'h'},
- {"version", 0, 0, 'v'},
- {0, 0, 0, 0}
+ {"create", 1, 0, 'c'},
+ {"destroy", 1, 0, 'd'},
+ {"reset", 1, 0, 'r'},
+ {"interface", 1, 0, 'i'},
+ {"target", 1, 0, 't'},
+ {"lun", 1, 0, 'l'},
+ {"stats", 1, 0, 's'},
+ {"help", 0, 0, 'h'},
+ {"version", 0, 0, 'v'},
+ {0, 0, 0, 0}
};
struct opt_info _opt_info, *opt_info = &_opt_info;
@@ -230,7 +230,7 @@ fcoeadm_find_fchost(char *ifname, char *
while (n--) {
/* check symbolic name */
if (!fcoeadm_check_fchost(ifname,
- namelist[n]->d_name)) {
+ namelist[n]->d_name)) {
dname_len = strnlen(namelist[n]->d_name, len);
if (dname_len != len) {
/*
@@ -250,7 +250,7 @@ fcoeadm_find_fchost(char *ifname, char *
}
free(namelist[n]);
}
- free(namelist);
+ free(namelist);
}
return found;
@@ -320,7 +320,7 @@ fcoeadm_reset(char *ifname)
/*
* Parse a user-entered hex field.
- * Format may be xx-xx-xx OR xxxxxx OR xx:xx:xx for len bytes (up to 8).
+ * Format may be xx-xx-xx OR xxxxxx OR xx:xx:xx for len bytes (up to 8).
* Leading zeros may be omitted.
*/
static int
@@ -444,49 +444,53 @@ int main(int argc, char *argv[])
memset(opt_info, 0, sizeof(*opt_info));
while ((opt = getopt_long(argc, argv, "c:d:r:itl:s:n:hv",
- fcoeadm_opts, NULL)) != -1) {
+ fcoeadm_opts, NULL)) != -1) {
switch (opt) {
case 'c':
if ((argc < 2 || argc > 3) ||
- strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
- ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2))
+ strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
+ ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2 &&
+ argv[1][1] != '-'))
goto error;
rc = fcoeadm_create(optarg);
goto done;
case 'd':
if ((argc < 2 || argc > 3) ||
- strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
- ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2))
+ strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
+ ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2 &&
+ argv[1][1] != '-'))
goto error;
rc = fcoeadm_destroy(optarg);
goto done;
case 'r':
if ((argc < 2 || argc > 3) ||
- strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
- ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2))
+ strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1) ||
+ ((argc == 3) && strnlen(argv[1], MAX_ARG_LEN) > 2 &&
+ argv[1][1] != '-'))
goto error;
rc = fcoeadm_reset(optarg);
goto done;
case 'i':
- if (argc < 2 || argc > 3)
+ if (argc < 2 || argc > 3 ||
+ (argc == 3 && strnlen(argv[1], MAX_ARG_LEN) > 2 &&
+ (argv[1][1] != '-' || strchr(argv[1],'=') != NULL)))
goto error;
s = NULL;
- if (argc == 2 && argv[optind]) {
- if (strnlen(argv[optind], MAX_ARG_LEN) >
- (IFNAMSIZ - 1))
- goto error;
- if (strnlen(argv[optind], MAX_ARG_LEN) > 2)
- s = argv[optind] + 2;
+ if (argc == 2) {
+ if (argv[1][1] == '-')
+ s = strchr(argv[1],'=')+1;
+ else
+ s = argv[1]+2;
}
- if (argc == 3) {
- if ((optind == 1) &&
- strnlen(argv[1], MAX_ARG_LEN) > 2)
- goto error;
- s = argv[optind];
+ else {
+ s = argv[2];
}
- if (s)
+ if (s) {
+ if (strnlen(s,MAX_ARG_LEN) > (IFNAMSIZ - 1))
+ goto error;
strncpy(opt_info->ifname, s,
sizeof(opt_info->ifname));
+ }
if (strnlen(opt_info->ifname, IFNAMSIZ - 1)) {
if (fcoeadm_validate_interface(
opt_info->ifname,
@@ -497,21 +501,26 @@ int main(int argc, char *argv[])
rc = fcoeadm_display_adapter_info(opt_info);
goto done;
case 't':
- if ((argc < 2 || argc > 3) ||
- (argv[1] &&
- strnlen(argv[1], MAX_ARG_LEN) > (IFNAMSIZ - 1)) ||
- (argv[2] &&
- strnlen(argv[2], MAX_ARG_LEN) > (IFNAMSIZ - 1)))
+ if (argc < 2 || argc > 3 ||
+ (argc == 3 && strnlen(argv[1], MAX_ARG_LEN) > 2 &&
+ (argv[1][1] != '-' || strchr(argv[1],'=') != NULL)))
goto error;
- if (strnlen(argv[1], MAX_ARG_LEN) > 2) {
- if (argc >= 3)
+ s = NULL;
+ if (argc == 2) {
+ if (argv[1][1] == '-')
+ s = strchr(argv[1],'=')+1;
+ else
+ s = argv[1]+2;
+ }
+ else {
+ s = argv[2];
+ }
+ if (s) {
+ if (strnlen(s,MAX_ARG_LEN) > (IFNAMSIZ - 1))
goto error;
- strncpy(opt_info->ifname, argv[1] + 2,
+ strncpy(opt_info->ifname, s,
sizeof(opt_info->ifname));
}
- if (argv[2])
- strncpy(opt_info->ifname, argv[2],
- sizeof(opt_info->ifname));
if (strnlen(opt_info->ifname, IFNAMSIZ - 1)) {
if (fcoeadm_validate_interface(
opt_info->ifname,
@@ -538,7 +547,7 @@ int main(int argc, char *argv[])
goto done;
case 's':
if ((argc < 2 || argc > 5) ||
- strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1))
+ strnlen(optarg, MAX_ARG_LEN) > (IFNAMSIZ - 1))
goto error;
if (optarg)
strncpy(opt_info->ifname, optarg,
@@ -560,7 +569,7 @@ int main(int argc, char *argv[])
if (opt_info->n_interval <= 0)
goto error;
if (argv[optind] &&
- strnlen(argv[optind], MAX_ARG_LEN<<1) > MAX_ARG_LEN)
+ strnlen(argv[optind], MAX_ARG_LEN<<1) > MAX_ARG_LEN)
goto error;
opt_info->n_flag = 1;
goto stats;

View File

@ -0,0 +1,11 @@
--- fcoe-utils-1.0.8/Makefile.am.orig 2009-07-31 13:28:11.484799253 +0200
+++ fcoe-utils-1.0.8/Makefile.am 2009-07-31 13:28:38.331800646 +0200
@@ -5,7 +5,7 @@
endif
## all targets should look for headers in the include directory
-AM_CPPFLAGS = -I${srcdir}/include
+AM_CPPFLAGS = -I${srcdir}/include -I/lib/modules/`rpm -q --list kernel | grep "^/lib/modules/.*/build$$" | cut -f4 -d"/" | sort -r | head -1`/build/include
## pass the sysconfdir into the C proprocessor
AM_CFLAGS = -DSYSCONFDIR="\"${sysconfdir}\""

View File

@ -1,21 +1,25 @@
Name: fcoe-utils
Version: 1.0.7
Release: 8%{?dist}
Version: 1.0.8
Release: 2%{?dist}
Summary: Fibre Channel over Ethernet utilities
Group: Applications/System
License: GPLv2
URL: http://www.open-fcoe.org
Source0: http://www.open-fcoe.org/openfc/downloads/%{name}-%{version}.tar.gz
# This source was pulled from upstream git repository
# To make a tarball, just run:
# git clone git://open-fcoe.org/openfc/fcoe-utils.git && cd fcoe-utils
# git archive --prefix=fcoe-utils-%{version}/ v%{version} > ../fcoe-utils-%{version}.tar
# cd .. && gzip fcoe-utils-%{version}
Source0: %{name}-%{version}.tar.gz
Source1: quickstart.txt
Patch0: fcoe-utils-1.0.7-init.patch
Patch1: fcoe-utils-1.0.7-free.patch
Patch2: fcoe-utils-1.0.7-init-condrestart.patch
Patch3: fcoe-utils-1.0.7-longOpts.patch
Patch1: fcoe-utils-1.0.7-init-condrestart.patch
Patch2: fcoe-utils-1.0.8-includes.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libhbaapi-devel dcbd-devel
Requires: dcbd libhbalinux
BuildRequires: libhbaapi-devel dcbd-devel libtool automake kernel-devel
Requires: dcbd libhbalinux >= 1.0.8
Requires(post): chkconfig
Requires(preun): chkconfig initscripts
Requires(postun): initscripts
@ -28,12 +32,11 @@ fcoemon - service to configure DCB Ethernet QOS filters, works with dcbd
%prep
%setup -q
%patch0 -p1 -b .initPatch
%patch1 -p1 -b .freePatch
%patch2 -p1 -b .condrestartPatch
%patch3 -p1 -b .longOpts
%patch1 -p1 -b .condrestartPatch
%patch2 -p1 -b .includes-fix
%build
./bootstrap.sh
%configure
make %{?_smp_mflags}
@ -93,6 +96,12 @@ fi
%changelog
* Fri Jul 31 2009 Jan Zeleny <jzeleny@redhat.com> - 1.0.8-2
- patch for clean compilation without usage of upstream's ugly hack
* Thu Jul 30 2009 Jan Zeleny <jzeleny@redhat.com> - 1.0.8-1
- rebase of fcoe-utils to 1.0.8, adjusted spec file
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.7-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

View File

@ -1 +1 @@
66dc5a5605719875d5434d7dbb9f6d88 fcoe-utils-1.0.7.tar.gz
0f8ddd3e4a5d75dc9568fe7141364894 fcoe-utils-1.0.8.tar.gz