]> CyberLeo.Net >> Repos - CDN/portage-cdn.git/blob - app-emulation/vmware-modules/files/1.0.0.20-vmmon-2.6.26.patch
Initial import
[CDN/portage-cdn.git] / app-emulation / vmware-modules / files / 1.0.0.20-vmmon-2.6.26.patch
1 --- vmmon-only/linux/driver.c   2008-08-07 22:04:50.000000000 +0200
2 +++ vmmon-only/linux/driver.c   2008-08-07 22:06:57.000000000 +0200
3 @@ -23,7 +23,9 @@
4  #include <linux/smp_lock.h>
5  
6  #include <linux/poll.h>
7 -
8 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
9 +# include <linux/mm.h>
10 +#endif
11  /*
12   * Power Management: hook resume to work around
13   * BIOS bugs where VT is not properly enabled after S4
14 @@ -179,23 +181,32 @@
15  
16  static int LinuxDriver_Close(struct inode *inode, struct file *filp);
17  static unsigned int LinuxDriverPoll(struct file *file, poll_table *wait);
18 -#if defined(VMW_NOPAGE_261)
19 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
20 +# if defined(VMW_NOPAGE_261)
21  static struct page *LinuxDriverNoPage(struct vm_area_struct *vma,
22                             unsigned long address, int *type);
23 -#elif defined(KERNEL_2_4_0)
24 +# elif defined(KERNEL_2_4_0)
25  static struct page *LinuxDriverNoPage(struct vm_area_struct *vma,
26                            unsigned long address, int unused);
27 -#else
28 +# else
29  static unsigned long LinuxDriverNoPage(struct vm_area_struct *vma,
30                            unsigned long address, int write_access);
31 -#endif
32 -static int LinuxDriverMmap(struct file *filp, struct vm_area_struct *vma);
33 -
34 -static void LinuxDriverPollTimeout(unsigned long clientData);
35 +# endif
36  
37  static struct vm_operations_struct vmuser_mops = {
38         .nopage = LinuxDriverNoPage
39  };
40 +#else
41 +static int LinuxDriverNoPage(struct vm_area_struct *vma,
42 +                          struct vm_fault *fdata);
43 +
44 +static struct vm_operations_struct vmuser_mops = {
45 +       .fault = LinuxDriverNoPage
46 +};
47 +#endif
48 +static int LinuxDriverMmap(struct file *filp, struct vm_area_struct *vma);
49 +
50 +static void LinuxDriverPollTimeout(unsigned long clientData);
51  
52  static struct file_operations vmuser_fops;
53  static struct timer_list tscTimer;
54 @@ -1172,20 +1183,20 @@
55   *
56   *-----------------------------------------------------------------------------
57   */
58 -
59 -#ifdef VMW_NOPAGE_261
60 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
61 +# ifdef VMW_NOPAGE_261
62  static struct page *LinuxDriverNoPage(struct vm_area_struct *vma, //IN
63                                       unsigned long address,      //IN
64                                       int *type)                  //OUT: Fault type
65 -#elif defined(KERNEL_2_4_0)
66 +# elif defined(KERNEL_2_4_0)
67  static struct page *LinuxDriverNoPage(struct vm_area_struct *vma, //IN
68                                       unsigned long address,      //IN
69                                       int unused)                 //nothing
70 -#else
71 +# else
72  static unsigned long LinuxDriverNoPage(struct vm_area_struct *vma,//IN
73                                        unsigned long address,     //IN
74                                        int write_access)          //IN
75 -#endif
76 +# endif
77  {
78         VMLinux *vmLinux = (VMLinux *) vma->vm_file->private_data;
79         unsigned long pg;
80 @@ -1198,15 +1209,37 @@
81         }
82         page = vmLinux->pages4Gb[pg];
83         get_page(page);
84 -#ifdef KERNEL_2_4_0
85 -#ifdef VMW_NOPAGE_261
86 +# ifdef KERNEL_2_4_0
87 +#  ifdef VMW_NOPAGE_261
88          *type = VM_FAULT_MINOR;
89 -#endif
90 +#  endif
91         return page;
92 -#else
93 +# else
94         return page_address(page);
95 -#endif
96 +# endif
97 +}
98 +#else
99 +/*  For kernel upper or equal to  2.6.26 */
100 +static int LinuxDriverNoPage(struct vm_area_struct *vma,
101 +                          struct vm_fault *fdata)
102 +{
103 +       VMLinux *vmLinux = (VMLinux *) vma->vm_file->private_data;
104 +       unsigned long pg;
105 +       struct page* page;
106 +
107 +       pg = fdata->pgoff;
108 +       pg = VMMON_MAP_OFFSET(pg);
109 +       if (pg >= vmLinux->size4Gb) {
110 +               return VM_FAULT_MAJOR;
111 +       }
112 +       page = vmLinux->pages4Gb[pg];
113 +       get_page(page);
114 +       fdata->page = page;
115 +        return VM_FAULT_MINOR;
116  }
117 +#endif
118 +
119 +
120  
121  
122  /*