[python-ethtool/el5/master: 3/3] Added libnl-1.0 support patch for RHEL5

dsommers dsommers at fedoraproject.org
Wed Jan 19 18:27:46 UTC 2011


commit 516d1b6d696a3f8a291bb37ed1edd314d79e4a1f
Author: David Sommerseth <davids at redhat.com>
Date:   Wed Jan 19 19:27:04 2011 +0100

    Added libnl-1.0 support patch for RHEL5
    
    Signed-off-by: David Sommerseth <davids at redhat.com>

 python-ethtool-libnl-1.0-support.patch |   71 ++++++++++++++++++++++++++++++++
 python-ethtool.spec                    |    2 +
 2 files changed, 73 insertions(+), 0 deletions(-)
---
diff --git a/python-ethtool-libnl-1.0-support.patch b/python-ethtool-libnl-1.0-support.patch
new file mode 100644
index 0000000..43c53db
--- /dev/null
+++ b/python-ethtool-libnl-1.0-support.patch
@@ -0,0 +1,71 @@
+diff --git a/python-ethtool/etherinfo.c b/python-ethtool/etherinfo.c
+index 3d2072b..23f03c6 100644
+--- a/python-ethtool/etherinfo.c
++++ b/python-ethtool/etherinfo.c
+@@ -30,6 +30,52 @@
+ #include "etherinfo_struct.h"
+ #include "etherinfo.h"
+ 
++#ifdef LIBNL_1_0
++#define NLHDR_COMMON                            \
++        int                     ce_refcnt;      \
++        struct nl_object_ops *  ce_ops;         \
++        struct nl_cache *       ce_cache;       \
++        struct nl_list_head     ce_list;        \
++        int                     ce_msgtype;     \
++        int                     ce_flags;       \
++        uint32_t                ce_mask;
++
++struct nl_cache
++{
++        struct nl_list_head     c_items;
++        int                     c_nitems;
++        int                     c_iarg1;
++        int                     c_iarg2;
++        struct nl_cache_ops *   c_ops;
++};
++
++struct nl_object
++{
++        NLHDR_COMMON
++};
++
++void nl_cache_free(struct nl_cache *cache)
++{
++        struct nl_object *obj, *tmp;
++
++        if( !cache )
++                return;
++
++        nl_list_for_each_entry_safe(obj, tmp, &cache->c_items, ce_list) {
++                struct nl_cache *cache = obj->ce_cache;
++                if( !cache ) {
++                        break;
++                }
++
++                nl_list_del(&obj->ce_list);
++                obj->ce_cache = NULL;
++                nl_object_put(obj);
++                cache->c_nitems--;
++        }
++        free(cache);
++}
++#endif
++
+ /*
+  *
+  *   Internal functions for working with struct etherinfo
+diff --git a/setup.py b/setup.py
+index bde04dc..9adff64 100644
+--- a/setup.py
++++ b/setup.py
+@@ -67,7 +67,8 @@ setup(name='ethtool',
+             include_dirs = libnl['include'],
+             library_dirs = libnl['libdirs'],
+             libraries = libnl['libs'],
+-            define_macros = [('VERSION', '"%s"' % version)]
++            define_macros = [('VERSION', '"%s"' % version),
++                             ('LIBNL_1_0', None)]
+             )
+         ]
+ )
diff --git a/python-ethtool.spec b/python-ethtool.spec
index 3d4c609..01b054a 100644
--- a/python-ethtool.spec
+++ b/python-ethtool.spec
@@ -7,6 +7,7 @@ Version: 0.6
 Release: 1%{?dist}
 URL: http://fedorapeople.org/gitweb?p=dsommers/public_git/python-ethtool.git;a=summary
 Source: http://dsommers.fedorapeople.org/python-ethtool/%{name}-%{version}.tar.bz2
+Patch0: python-ethtool-libnl-1.0-support.patch
 License: GPLv2
 Group: System Environment/Libraries
 BuildRequires: python-devel libnl-devel
@@ -22,6 +23,7 @@ PCI locations.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %{__python} setup.py build


More information about the scm-commits mailing list