diff options
author | Robby Workman <rworkman@slackbuilds.org> | 2011-03-25 19:27:59 -0500 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2011-03-25 23:26:50 -0500 |
commit | e9eea28ccecd20a97c24eee01cfb74bdd25b970f (patch) | |
tree | 24113322a2f5bd9d97a80cb3a4cf14dcdc62f4bb | |
parent | c42b490bdecabc331d7f26565918fbc3b5b27c1e (diff) | |
download | slackbuilds-e9eea28ccecd20a97c24eee01cfb74bdd25b970f.tar.gz |
network/ndiswrapper: Fixed build on 2.6.3{5,6,7,8}.x kernels
Thanks to Gentoo for the set of patches.
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
4 files changed, 147 insertions, 1 deletions
diff --git a/network/ndiswrapper/ndiswrapper.SlackBuild b/network/ndiswrapper/ndiswrapper.SlackBuild index fd7a6834d1..006ce7c8e6 100644 --- a/network/ndiswrapper/ndiswrapper.SlackBuild +++ b/network/ndiswrapper/ndiswrapper.SlackBuild @@ -26,7 +26,7 @@ PRGNAM=ndiswrapper VERSION=${VERSION:-1.56} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} # Automatically determine the architecture we're building on: @@ -75,6 +75,9 @@ find . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; +# Thanks to Gentoo for the patchset +for i in $CWD/patches/*.patch; do patch -p1 < $i ; done + CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ make KVERS=$KERNEL diff --git a/network/ndiswrapper/patches/ndiswrapper-1.56-2.6.35.patch b/network/ndiswrapper/patches/ndiswrapper-1.56-2.6.35.patch new file mode 100644 index 0000000000..dc99ce2a2b --- /dev/null +++ b/network/ndiswrapper/patches/ndiswrapper-1.56-2.6.35.patch @@ -0,0 +1,90 @@ +Index: a/driver/wrapndis.c +=================================================================== +--- a/driver/wrapndis.c (revision 2723) ++++ a/driver/wrapndis.c (working copy) +@@ -950,20 +950,34 @@ static void set_multicast_list(struct nd + packet_filter |= NDIS_PACKET_TYPE_PROMISCUOUS | + NDIS_PACKET_TYPE_ALL_LOCAL; + } else if (net_dev->flags & IFF_ALLMULTI || +- net_dev->mc_count > wnd->multicast_size) { ++ netdev_mc_count(net_dev) > wnd->multicast_size) { + packet_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; + TRACE2("0x%08x", packet_filter); +- } else if (net_dev->mc_count > 0) { ++ } else if (netdev_mc_count(net_dev) > 0) { + int i, size; + char *buf; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) ++ struct netdev_hw_addr *ha; ++#else + struct dev_mc_list *mclist; +- size = min(wnd->multicast_size, net_dev->mc_count); +- TRACE2("%d, %d", wnd->multicast_size, net_dev->mc_count); ++#endif ++ size = min(wnd->multicast_size, netdev_mc_count(net_dev)); ++ TRACE2("%d, %d", wnd->multicast_size, netdev_mc_count(net_dev)); + buf = kmalloc(size * ETH_ALEN, GFP_KERNEL); + if (!buf) { + WARNING("couldn't allocate memory"); + EXIT2(return); + } ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) ++ i = 0; ++ netdev_for_each_mc_addr(ha, net_dev) { ++ if (i >= size) ++ break; ++ memcpy(buf + i * ETH_ALEN, ha->addr, ETH_ALEN); ++ TRACE2(MACSTRSEP, MAC2STR(ha->addr)); ++ i++; ++ } ++#else + mclist = net_dev->mc_list; + for (i = 0; i < size && mclist; mclist = mclist->next) { + if (mclist->dmi_addrlen != ETH_ALEN) +@@ -972,6 +986,7 @@ static void set_multicast_list(struct nd + TRACE2(MACSTRSEP, MAC2STR(mclist->dmi_addr)); + i++; + } ++#endif + res = mp_set(wnd, OID_802_3_MULTICAST_LIST, buf, i * ETH_ALEN); + if (res == NDIS_STATUS_SUCCESS && i > 0) + packet_filter |= NDIS_PACKET_TYPE_MULTICAST; +Index: a/driver/usb.c +=================================================================== +--- a/driver/usb.c (revision 2723) ++++ a/driver/usb.c (working copy) +@@ -191,7 +191,7 @@ static void wrap_free_urb(struct urb *ur + if (wrap_urb->flags & WRAP_URB_COPY_BUFFER) { + USBTRACE("freeing DMA buffer for URB: %p %p", + urb, urb->transfer_buffer); +- usb_buffer_free(IRP_WRAP_DEVICE(irp)->usb.udev, ++ usb_free_coherent(IRP_WRAP_DEVICE(irp)->usb.udev, + urb->transfer_buffer_length, + urb->transfer_buffer, urb->transfer_dma); + } +@@ -304,7 +304,7 @@ static struct urb *wrap_alloc_urb(struct + #endif + )) { + urb->transfer_buffer = +- usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags, ++ usb_alloc_coherent(wd->usb.udev, buf_len, alloc_flags, + &urb->transfer_dma); + if (!urb->transfer_buffer) { + WARNING("couldn't allocate dma buf"); +Index: a/driver/ntoskernel.h +=================================================================== +--- a/driver/ntoskernel.h (revision 2723) ++++ a/driver/ntoskernel.h (working copy) +@@ -324,6 +324,12 @@ typedef u32 pm_message_t; + kmem_cache_create(name, size, align, flags, NULL) + #endif + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) ++#define netdev_mc_count(dev) ((dev)->mc_count) ++#define usb_alloc_coherent(dev, size, mem_flags, dma) (usb_buffer_alloc((dev), (size), (mem_flags), (dma))) ++#define usb_free_coherent(dev, size, addr, dma) (usb_buffer_free((dev), (size), (addr), (dma))) ++#endif ++ + #include "winnt_types.h" + #include "ndiswrapper.h" + #include "pe_linker.h" diff --git a/network/ndiswrapper/patches/ndiswrapper-1.56-2.6.36.patch b/network/ndiswrapper/patches/ndiswrapper-1.56-2.6.36.patch new file mode 100644 index 0000000000..f3ca705d4a --- /dev/null +++ b/network/ndiswrapper/patches/ndiswrapper-1.56-2.6.36.patch @@ -0,0 +1,29 @@ +--- ndiswrapper/driver/loader.c 2010/09/13 08:35:26 2725 ++++ ndiswrapper/driver/loader.c 2010/09/13 08:43:15 2726 +@@ -750,8 +750,13 @@ + } + + /* called with loader_mutex is down */ ++#ifdef HAVE_UNLOCKED_IOCTL ++static long wrapper_ioctl(struct file *file, ++ unsigned int cmd, unsigned long arg) ++#else + static int wrapper_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) ++#endif + { + struct load_driver *load_driver; + struct load_device load_device; +@@ -831,7 +836,12 @@ + + static struct file_operations wrapper_fops = { + .owner = THIS_MODULE, ++ ++#ifdef HAVE_UNLOCKED_IOCTL ++ .unlocked_ioctl = wrapper_ioctl, ++#else + .ioctl = wrapper_ioctl, ++#endif + .release = wrapper_ioctl_release, + }; + diff --git a/network/ndiswrapper/patches/ndiswrapper-1.56-2.6.38.patch b/network/ndiswrapper/patches/ndiswrapper-1.56-2.6.38.patch new file mode 100644 index 0000000000..68af95e50d --- /dev/null +++ b/network/ndiswrapper/patches/ndiswrapper-1.56-2.6.38.patch @@ -0,0 +1,24 @@ +--- ndiswrapper/driver/wrapndis.c 2010/09/13 09:36:56 2728 ++++ ndiswrapper/driver/wrapndis.c 2011/02/14 17:00:00 2729 +@@ -13,16 +13,16 @@ + * + */ + +-#include "ndis.h" +-#include "iw_ndis.h" +-#include "pnp.h" +-#include "loader.h" +-#include "wrapndis.h" + #include <linux/inetdevice.h> + #include <linux/ip.h> + #include <linux/tcp.h> + #include <linux/udp.h> + #include <linux/in.h> ++#include "ndis.h" ++#include "iw_ndis.h" ++#include "pnp.h" ++#include "loader.h" ++#include "wrapndis.h" + #include "wrapper.h" + + /* Functions callable from the NDIS driver */ |