UBUNTU: SAUCE: Updated ndiswrapper to 1.56
authorTim Gardner <tim.gardner@canonical.com>
Wed, 19 May 2010 15:17:26 +0000 (09:17 -0600)
committerLeann Ogasawara <leann.ogasawara@canonical.com>
Mon, 28 Mar 2011 13:48:40 +0000 (06:48 -0700)
BugLink: http://bugs.launchpad.net/bugs/582555

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>

ubuntu/ndiswrapper/loader.c
ubuntu/ndiswrapper/ndiswrapper.h
ubuntu/ndiswrapper/ntoskernel.h
ubuntu/ndiswrapper/pe_linker.c
ubuntu/ndiswrapper/usb.c
ubuntu/ndiswrapper/wrapndis.c

index e1be090..5c231c7 100644 (file)
@@ -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);
index ae7b963..a7187e8 100644 (file)
@@ -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"
index 46aeb53..ff0535b 100644 (file)
@@ -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;
 }
index 46badd1..b2637ff 100644 (file)
@@ -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]);
index 81a17b3..f2ddfb4 100644 (file)
@@ -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);
index 3de1fbd..404e1e3 100644 (file)
@@ -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;