~ubuntu-branches/ubuntu/jaunty/ndiswrapper/jaunty

« back to all changes in this revision

Viewing changes to driver/loader.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-11-21 14:17:35 UTC
  • mfrom: (1.2.11 upstream) (2.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20081121141735-hzymcfoy3up8hego
Tags: 1.53-2ubuntu1
* Merge with Debian; remaining changes:
  - Build for lpia.
  - debian/control:
    + Update description to point out that the kernel source package is
      not required with the standard Ubuntu kernel.
    + Change the Maintainer address.
  - debian/control:
    + Drop ndiswrapper-source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
static struct nt_list wrap_devices;
50
50
static struct nt_list wrap_drivers;
51
51
 
52
 
int wrap_device_type(int data1)
 
52
static int wrap_device_type(int data1)
53
53
{
54
54
        int i;
55
55
        for (i = 0; i < sizeof(class_guids) / sizeof(class_guids[0]); i++)
100
100
                        EXIT1(return NULL);
101
101
                }
102
102
                INIT_COMPLETION(loader_complete);
103
 
                ret = call_usermodehelper("/sbin/loadndisdriver", argv, env
104
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
105
 
                                          , 1
106
 
#endif
107
 
                        );
 
103
                ret = call_usermodehelper("/sbin/loadndisdriver", argv, env, 1);
108
104
                if (ret) {
109
105
                        up(&loader_mutex);
110
106
                        ERROR("couldn't load driver %s; check system log "
266
262
                        EXIT1(return NULL);
267
263
                }
268
264
                INIT_COMPLETION(loader_complete);
269
 
                ret = call_usermodehelper("/sbin/loadndisdriver", argv, env
270
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
271
 
                                          , 1
272
 
#endif
273
 
                        );
 
265
                ret = call_usermodehelper("/sbin/loadndisdriver", argv, env, 1);
274
266
                if (ret) {
275
267
                        up(&loader_mutex);
276
268
                        ERROR("couldn't load file %s/%s; check system log "
598
590
        } else {
599
591
                printk(KERN_INFO "%s: driver %s (%s) loaded\n",
600
592
                       DRIVER_NAME, wrap_driver->name, wrap_driver->version);
601
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
602
593
                add_taint(TAINT_PROPRIETARY_MODULE);
603
 
                /* older kernels don't seem to have a way to set
604
 
                 * tainted information */
605
 
#endif
606
594
                EXIT1(return 0);
607
595
        }
608
596
}
620
608
        .resume         = wrap_pnp_resume_pci_device,
621
609
};
622
610
 
623
 
#ifdef CONFIG_USB
 
611
#ifdef ENABLE_USB
624
612
static struct usb_device_id wrap_usb_id_table[] = {
625
613
        {
626
614
                .driver_info = 1
632
620
        .id_table = wrap_usb_id_table,
633
621
        .probe = wrap_pnp_start_usb_device,
634
622
        .disconnect = __devexit_p(wrap_pnp_remove_usb_device),
635
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
636
623
        .suspend = wrap_pnp_suspend_usb_device,
637
624
        .resume = wrap_pnp_resume_usb_device,
638
 
#endif
639
625
};
640
626
#endif
641
627
 
650
636
                wrap_pci_driver.name = NULL;
651
637
        }
652
638
 
653
 
#ifdef CONFIG_USB
 
639
#ifdef ENABLE_USB
654
640
        res = usb_register(&wrap_usb_driver);
655
641
        if (res < 0) {
656
642
                ERROR("couldn't register usb driver: %d", res);
675
661
 
676
662
        if (wrap_pci_driver.name)
677
663
                pci_unregister_driver(&wrap_pci_driver);
678
 
#ifdef CONFIG_USB
 
664
#ifdef ENABLE_USB
679
665
        if (wrap_usb_driver.name)
680
666
                usb_deregister(&wrap_usb_driver);
681
667
#endif
712
698
                        EXIT1(return NULL);
713
699
                }
714
700
                INIT_COMPLETION(loader_complete);
715
 
                ret = call_usermodehelper("/sbin/loadndisdriver", argv, env
716
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
717
 
                                          , 1
718
 
#endif
719
 
                        );
 
701
                ret = call_usermodehelper("/sbin/loadndisdriver", argv, env, 1);
720
702
                if (ret) {
721
703
                        up(&loader_mutex);
722
704
                        TRACE1("couldn't load device %04x:%04x; check system "
775
757
        struct load_device load_device;
776
758
        struct load_driver_file load_bin_file;
777
759
        int ret;
 
760
        void __user *addr = (void __user *)arg;
778
761
 
779
762
        ENTER1("cmd: %u", cmd);
780
763
 
781
764
        ret = 0;
782
765
        switch (cmd) {
783
766
        case WRAP_IOCTL_LOAD_DEVICE:
784
 
                if (copy_from_user(&load_device, (void *)arg,
785
 
                                   sizeof(load_device))) {
 
767
                if (copy_from_user(&load_device, addr, sizeof(load_device))) {
786
768
                        ret = -EFAULT;
787
769
                        break;
788
770
                }
814
796
                        ret = -EINVAL;
815
797
                break;
816
798
        case WRAP_IOCTL_LOAD_DRIVER:
817
 
                TRACE1("loading driver at %p", (void *)arg);
 
799
                TRACE1("loading driver at %p", addr);
818
800
                load_driver = vmalloc(sizeof(*load_driver));
819
801
                if (!load_driver) {
820
802
                        ret = -ENOMEM;
821
803
                        break;
822
804
                }
823
 
                if (copy_from_user(load_driver, (void *)arg,
824
 
                                   sizeof(*load_driver)))
 
805
                if (copy_from_user(load_driver, addr, sizeof(*load_driver)))
825
806
                        ret = -EFAULT;
826
807
                else
827
808
                        ret = load_user_space_driver(load_driver);
828
809
                vfree(load_driver);
829
810
                break;
830
811
        case WRAP_IOCTL_LOAD_BIN_FILE:
831
 
                if (copy_from_user(&load_bin_file, (void *)arg,
832
 
                                   sizeof(load_bin_file)))
 
812
                if (copy_from_user(&load_bin_file, addr, sizeof(load_bin_file)))
833
813
                        ret = -EFAULT;
834
814
                else
835
815
                        ret = add_bin_file(&load_bin_file);