diff mbox

Maverick pull request, update ndiswrapper LP582555

Message ID 20100519165058.18C17F899A@sepang.rtg.net
State Accepted
Delegated to: Leann Ogasawara
Headers show

Commit Message

Tim Gardner May 19, 2010, 4:50 p.m. UTC
The following changes since commit 3108c5784e934fecc2a8b16ff6a36df3c461bd40:
  Leann Ogasawara (1):
        UBUNTU: Ubuntu-2.6.34-3.10

are available in the git repository at:

  git://kernel.ubuntu.com/rtg/ubuntu-maverick.git lp582555

Tim Gardner (1):
      UBUNTU: SAUCE: Updated ndiswrapper to 1.56

 ubuntu/ndiswrapper/loader.c      |    2 +-
 ubuntu/ndiswrapper/ndiswrapper.h |    2 +-
 ubuntu/ndiswrapper/ntoskernel.h  |    6 ++--
 ubuntu/ndiswrapper/pe_linker.c   |   64 ++++++++++++++++----------------------
 ubuntu/ndiswrapper/usb.c         |    2 +-
 ubuntu/ndiswrapper/wrapndis.c    |    4 +-
 6 files changed, 35 insertions(+), 45 deletions(-)
From c254875e48a028963fb6663b0e3ed8106cc11710 Mon Sep 17 00:00:00 2001
From: Tim Gardner <tim.gardner@canonical.com>
Date: Wed, 19 May 2010 09:17:26 -0600
Subject: [PATCH] UBUNTU: SAUCE: Updated ndiswrapper to 1.56

BugLink: http://bugs.launchpad.net/bugs/582555

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 ubuntu/ndiswrapper/loader.c      |    2 +-
 ubuntu/ndiswrapper/ndiswrapper.h |    2 +-
 ubuntu/ndiswrapper/ntoskernel.h  |    6 ++--
 ubuntu/ndiswrapper/pe_linker.c   |   64 ++++++++++++++++----------------------
 ubuntu/ndiswrapper/usb.c         |    2 +-
 ubuntu/ndiswrapper/wrapndis.c    |    4 +-
 6 files changed, 35 insertions(+), 45 deletions(-)

Comments

Leann Ogasawara May 21, 2010, 12:48 a.m. UTC | #1
Thanks for doing this, applied to Maverick master.

Thanks,
Leann
diff mbox

Patch

diff --git a/ubuntu/ndiswrapper/loader.c b/ubuntu/ndiswrapper/loader.c
index e1be090..5c231c7 100644
--- a/ubuntu/ndiswrapper/loader.c
+++ b/ubuntu/ndiswrapper/loader.c
@@ -847,7 +847,7 @@  int loader_init(void)
 
 	InitializeListHead(&wrap_drivers);
 	InitializeListHead(&wrap_devices);
-	init_MUTEX(&loader_mutex);
+	sema_init(&loader_mutex, 1);
 	init_completion(&loader_complete);
 	if ((err = misc_register(&wrapper_misc)) < 0 ) {
 		ERROR("couldn't register module (%d)", err);
diff --git a/ubuntu/ndiswrapper/ndiswrapper.h b/ubuntu/ndiswrapper/ndiswrapper.h
index ae7b963..a7187e8 100644
--- a/ubuntu/ndiswrapper/ndiswrapper.h
+++ b/ubuntu/ndiswrapper/ndiswrapper.h
@@ -16,7 +16,7 @@ 
 #ifndef _NDISWRAPPER_H_
 #define _NDISWRAPPER_H_
 
-#define DRIVER_VERSION "1.55"
+#define DRIVER_VERSION "1.56"
 #define UTILS_VERSION "1.9"
 
 #define DRIVER_NAME "ndiswrapper"
diff --git a/ubuntu/ndiswrapper/ntoskernel.h b/ubuntu/ndiswrapper/ntoskernel.h
index 46aeb53..ff0535b 100644
--- a/ubuntu/ndiswrapper/ntoskernel.h
+++ b/ubuntu/ndiswrapper/ntoskernel.h
@@ -875,7 +875,7 @@  static inline struct nt_slist *PopEntrySList(nt_slist_header *head,
 #define u64_low_32(x) ((u32)x)
 #define u64_high_32(x) ((u32)(x >> 32))
 
-static inline u64 cmpxchg8b(volatile u64 *ptr, u64 old, u64 new)
+static inline u64 nt_cmpxchg8b(volatile u64 *ptr, u64 old, u64 new)
 {
 	u64 prev;
 
@@ -900,7 +900,7 @@  static inline struct nt_slist *PushEntrySList(nt_slist_header *head,
 		entry->next = old.next;
 		new.next = entry;
 		new.depth = old.depth + 1;
-	} while (cmpxchg8b(&head->align, old.align, new.align) != old.align);
+	} while (nt_cmpxchg8b(&head->align, old.align, new.align) != old.align);
 	TRACE4("%p, %p, %p", head, entry, old.next);
 	return old.next;
 }
@@ -917,7 +917,7 @@  static inline struct nt_slist *PopEntrySList(nt_slist_header *head,
 			break;
 		new.next = entry->next;
 		new.depth = old.depth - 1;
-	} while (cmpxchg8b(&head->align, old.align, new.align) != old.align);
+	} while (nt_cmpxchg8b(&head->align, old.align, new.align) != old.align);
 	TRACE4("%p, %p", head, entry);
 	return entry;
 }
diff --git a/ubuntu/ndiswrapper/pe_linker.c b/ubuntu/ndiswrapper/pe_linker.c
index 46badd1..b2637ff 100644
--- a/ubuntu/ndiswrapper/pe_linker.c
+++ b/ubuntu/ndiswrapper/pe_linker.c
@@ -73,45 +73,36 @@  extern struct wrap_export ntoskernel_exports[], ntoskernel_io_exports[],
 extern struct wrap_export usb_exports[];
 #endif
 
-static char *get_export(char *name)
+static int get_export(char *name, generic_func *func)
 {
-	int i;
-
-	for (i = 0 ; ntoskernel_exports[i].name != NULL; i++)
-		if (strcmp(ntoskernel_exports[i].name, name) == 0)
-			return (char *)ntoskernel_exports[i].func;
-
-	for (i = 0 ; ntoskernel_io_exports[i].name != NULL; i++)
-		if (strcmp(ntoskernel_io_exports[i].name, name) == 0)
-			return (char *)ntoskernel_io_exports[i].func;
-
-	for (i = 0 ; ndis_exports[i].name != NULL; i++)
-		if (strcmp(ndis_exports[i].name, name) == 0)
-			return (char *)ndis_exports[i].func;
-
-	for (i = 0 ; crt_exports[i].name != NULL; i++)
-		if (strcmp(crt_exports[i].name, name) == 0)
-			return (char *)crt_exports[i].func;
-
-	for (i = 0 ; hal_exports[i].name != NULL; i++)
-		if (strcmp(hal_exports[i].name, name) == 0)
-			return (char *)hal_exports[i].func;
-
-	for (i = 0 ; rtl_exports[i].name != NULL; i++)
-		if (strcmp(rtl_exports[i].name, name) == 0)
-			return (char *)rtl_exports[i].func;
-
+	int i, j;
+
+	struct wrap_export *exports[] = {
+		ntoskernel_exports,
+		ntoskernel_io_exports,
+		ndis_exports,
+		crt_exports,
+		hal_exports,
+		rtl_exports,
 #ifdef ENABLE_USB
-	for (i = 0 ; usb_exports[i].name != NULL; i++)
-		if (strcmp(usb_exports[i].name, name) == 0)
-			return (char *)usb_exports[i].func;
+		usb_exports,
 #endif
+	};
+
+	for (j = 0; j < ARRAY_SIZE(exports); j++)
+		for (i = 0; exports[j][i].name != NULL; i++)
+			if (strcmp(exports[j][i].name, name) == 0) {
+				*func = exports[j][i].func;
+				return 0;
+			}
 
 	for (i = 0; i < num_pe_exports; i++)
-		if (strcmp(pe_exports[i].name, name) == 0)
-			return (char *)pe_exports[i].addr;
+		if (strcmp(pe_exports[i].name, name) == 0) {
+			*func = pe_exports[i].addr;
+			return 0;
+		}
 
-	return NULL;
+	return -1;
 }
 #endif // TEST_LOADER
 
@@ -220,7 +211,7 @@  static int import(void *image, IMAGE_IMPORT_DESCRIPTOR *dirent, char *dll)
 	char *symname = NULL;
 	int i;
 	int ret = 0;
-	void *adr;
+	generic_func adr;
 
 	lookup_tbl  = RVA2VA(image, dirent->u.OriginalFirstThunk, ULONG_PTR *);
 	address_tbl = RVA2VA(image, dirent->FirstThunk, ULONG_PTR *);
@@ -237,10 +228,9 @@  static int import(void *image, IMAGE_IMPORT_DESCRIPTOR *dirent, char *dll)
 					   ~IMAGE_ORDINAL_FLAG) + 2), char *);
 		}
 
-		adr = get_export(symname);
-		if (adr == NULL) {
+		ret = get_export(symname, &adr);
+		if (ret < 0) {
 			ERROR("unknown symbol: %s:'%s'", dll, symname);
-			ret = -1;
 		} else {
 			DBGLINKER("found symbol: %s:%s: addr: %p, rva = %Lu",
 				  dll, symname, adr, (uint64_t)address_tbl[i]);
diff --git a/ubuntu/ndiswrapper/usb.c b/ubuntu/ndiswrapper/usb.c
index 81a17b3..f2ddfb4 100644
--- a/ubuntu/ndiswrapper/usb.c
+++ b/ubuntu/ndiswrapper/usb.c
@@ -234,7 +234,7 @@  wstdcall void wrap_cancel_irp(struct device_object *dev_obj, struct irp *irp)
 	USBTRACE("canceling urb %p", urb);
 	if (wrap_cancel_urb(IRP_WRAP_URB(irp))) {
 		irp->cancel = FALSE;
-		ERROR("urb %p can't be canceld: %d", urb,
+		ERROR("urb %p can't be canceled: %d", urb,
 		      IRP_WRAP_URB(irp)->state);
 	} else
 		USBTRACE("urb %p canceled", urb);
diff --git a/ubuntu/ndiswrapper/wrapndis.c b/ubuntu/ndiswrapper/wrapndis.c
index 3de1fbd..404e1e3 100644
--- a/ubuntu/ndiswrapper/wrapndis.c
+++ b/ubuntu/ndiswrapper/wrapndis.c
@@ -2064,8 +2064,8 @@  static wstdcall NTSTATUS NdisAddDevice(struct driver_object *drv_obj,
 	}
 	nmb->next_device = IoAttachDeviceToDeviceStack(fdo, pdo);
 	spin_lock_init(&wnd->tx_ring_lock);
-	init_MUTEX(&wnd->tx_ring_mutex);
-	init_MUTEX(&wnd->ndis_req_mutex);
+	sema_init(&wnd->tx_ring_mutex, 1);
+	sema_init(&wnd->ndis_req_mutex, 1);
 	wnd->ndis_req_done = 0;
 	initialize_work(&wnd->tx_work, tx_worker, wnd);
 	wnd->tx_ring_start = 0;