summaryrefslogtreecommitdiff
blob: 43b495062883f9dbbd427063021fa8766d8e76af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
diff -u -r source-original/vmblock-only/linux/dentry.c source/vmblock-only/linux/dentry.c
--- source-original/vmblock-only/linux/dentry.c	2011-03-26 04:03:06.000000000 +0100
+++ source/vmblock-only/linux/dentry.c	2011-05-14 19:05:49.000000000 +0200
@@ -103,8 +103,11 @@
        actualDentry->d_op->d_revalidate) {
       return actualDentry->d_op->d_revalidate(actualDentry, nd);
    }
-
-   if (path_lookup(iinfo->name, 0, &actualNd)) {
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
+   if (kern_path(iinfo->name, 0, &actualNd)) {
+#else
+   if (compat_path_lookup(iinfo->name, 0, &actualNd)) {
+#endif
       LOG(4, "DentryOpRevalidate: [%s] no longer exists\n", iinfo->name);
       return 0;
    }
diff -u -r source-original/vmblock-only/linux/filesystem.c source/vmblock-only/linux/filesystem.c
--- source-original/vmblock-only/linux/filesystem.c	2011-03-26 04:03:06.000000000 +0100
+++ source/vmblock-only/linux/filesystem.c	2011-05-14 19:05:57.000000000 +0200
@@ -44,8 +44,13 @@
 /* File system operations */
 
 #if defined(VMW_GETSB_2618)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
+static struct dentry *FsOpMount(struct file_system_type *fsType, int flags,
+                     const char *devName, void *rawData);
+#else
 static int FsOpGetSb(struct file_system_type *fsType, int flags,
                      const char *devName, void *rawData, struct vfsmount *mnt);
+#endif
 #else
 static struct super_block *FsOpGetSb(struct file_system_type *fsType, int flags,
                                      const char *devName, void *rawData);
@@ -66,7 +71,11 @@
 static struct file_system_type fsType = {
    .owner = THIS_MODULE,
    .name = VMBLOCK_FS_NAME,
+   #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
+   .mount = FsOpMount,
+   #else
    .get_sb = FsOpGetSb,
+   #endif
    .kill_sb = kill_anon_super,
 };
 
@@ -335,8 +344,11 @@
       Warning("Iget: could not make full name\n");
       goto error_inode;
    }
-
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
+   if (kern_path(iinfo->name, 0, &actualNd)) {
+#else
    if (compat_path_lookup(iinfo->name, 0, &actualNd)) {
+#endif
       /*
        * This file does not exist, so we create an inode that doesn't know
        * about its underlying file.  Operations that create files and
@@ -533,18 +545,17 @@
    return 0;
 }
 
-
 #if defined(VMW_GETSB_2618)
 /*
  *-----------------------------------------------------------------------------
  *
- * FsOpGetSb --
+ * FsOpGetSb/FsOpMount --
  *
  *    Invokes generic kernel code to prepare superblock for
  *    deviceless filesystem.
  *
  * Results:
- *    0 on success
+ *    0/dentry on success
  *    negative error code on failure
  *
  * Side effects:
@@ -552,7 +563,17 @@
  *
  *-----------------------------------------------------------------------------
  */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
+struct dentry *
+FsOpMount(struct file_system_type *fs_type, // IN: file system type of mount
+          int flags,                        // IN: mount flags
+          const char *dev_name,             // IN: device mounting on
+          void *rawData)                    // IN: mount arguments
+{
+   return mount_nodev(fs_type, flags, rawData, FsOpReadSuper);
+}
 
+#else
 static int
 FsOpGetSb(struct file_system_type *fs_type, // IN: file system type of mount
           int flags,                        // IN: mount flags
@@ -562,6 +583,7 @@
 {
    return get_sb_nodev(fs_type, flags, rawData, FsOpReadSuper, mnt);
 }
+#endif
 #else
 /*
  *-----------------------------------------------------------------------------
diff -u -r source-original/vmblock-only/linux/module.c source/vmblock-only/linux/module.c
--- source-original/vmblock-only/linux/module.c	2011-03-26 04:03:06.000000000 +0100
+++ source/vmblock-only/linux/module.c	2011-05-14 20:01:54.000000000 +0200
@@ -78,7 +78,6 @@
 VMBlockInit(void)
 {
    int ret;
-
    ret = VMBlockInitControlOps();
    if (ret < 0) {
       goto error;
diff -u -r source-original/vmci-only/linux/driver.c source/vmci-only/linux/driver.c
--- source-original/vmci-only/linux/driver.c	2011-03-26 06:37:32.000000000 +0100
+++ source/vmci-only/linux/driver.c	2011-04-02 13:32:12.000000000 +0200
@@ -42,7 +42,6 @@
 #include <linux/miscdevice.h>
 #include <linux/poll.h>
 #include <linux/smp.h>
-#include <linux/smp_lock.h>
 
 #include "compat_file.h"
 #include "compat_highmem.h"
diff -u -r source-original/vmmon-only/linux/driver.c source/vmmon-only/linux/driver.c
--- source-original/vmmon-only/linux/driver.c	2011-03-26 06:37:28.000000000 +0100
+++ source/vmmon-only/linux/driver.c	2011-04-02 13:26:59.000000000 +0200
@@ -780,7 +780,7 @@
 
 
 #define POLLQUEUE_MAX_TASK 1000
-static spinlock_t pollQueueLock __attribute__((unused)) = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(pollQueueLock);
 static void *pollQueue[POLLQUEUE_MAX_TASK];
 static unsigned int pollQueueCount = 0;
 
@@ -1041,7 +1041,8 @@
 		* but unfortunately there is no way how to detect that
 		* we are building for RedHat's kernel...
 		*/
-	       static spinlock_t timerLock = SPIN_LOCK_UNLOCKED;
+
+	       static DEFINE_SPINLOCK(timerLock);
 
 	       spin_lock(&timerLock);
 	       mod_timer(&linuxState.pollTimer, jiffies + 1);
diff -u -r source-original/vmmon-only/linux/hostif.c source/vmmon-only/linux/hostif.c
--- source-original/vmmon-only/linux/hostif.c	2011-03-26 06:37:27.000000000 +0100
+++ source/vmmon-only/linux/hostif.c	2011-04-02 13:27:58.000000000 +0200
@@ -46,7 +46,6 @@
 #include <linux/mman.h>
 
 #include <linux/smp.h>
-#include <linux/smp_lock.h>
 
 #include <asm/io.h>
 #include <linux/mc146818rtc.h>
diff -u -r source-original/vmmon-only/linux/iommu.c source/vmmon-only/linux/iommu.c
--- source-original/vmmon-only/linux/iommu.c	2011-03-26 06:37:27.000000000 +0100
+++ source/vmmon-only/linux/iommu.c	2011-04-02 13:28:58.000000000 +0200
@@ -44,7 +44,7 @@
 
 
 static LIST_HEAD(passthruDeviceList);
-static spinlock_t passthruDeviceListLock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(passthruDeviceListLock);
 static void *pciHolePage = NULL;
 
 /*
diff -u -r source-original/vmnet-only/driver.c source/vmnet-only/driver.c
--- source-original/vmnet-only/driver.c	2011-03-26 06:37:29.000000000 +0100
+++ source/vmnet-only/driver.c	2011-04-02 14:14:57.000000000 +0200
@@ -28,7 +28,6 @@
 #include <linux/poll.h>
 
 #include <linux/smp.h>
-#include <linux/smp_lock.h>
 
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
@@ -105,7 +104,7 @@
  * not have vnetStructureMutex already acquired,
  * it is most certainly a bug.
  */
-static rwlock_t vnetPeerLock = RW_LOCK_UNLOCKED;
+static DEFINE_RWLOCK(vnetPeerLock);
 
 /*
  * All concurrent changes to the network structure are
@@ -115,6 +114,7 @@
  * vnetStructureMutex and vnetPeerLock for write.
  */
 compat_define_mutex(vnetStructureMutex);
+compat_define_mutex(vnetMutex);
 
 #if defined(VM_X86_64) && !defined(HAVE_COMPAT_IOCTL)
 /*
@@ -264,11 +264,11 @@
 			    struct file * filp)  // IN:
 {
    int ret = -ENOTTY;
-   lock_kernel();
+   compat_mutex_lock(&vnetMutex);
    if (filp && filp->f_op && filp->f_op->ioctl == VNetFileOpIoctl) {
       ret = VNetFileOpIoctl(filp->f_dentry->d_inode, filp, iocmd, ioarg);
    }
-   unlock_kernel();
+   compat_mutex_unlock(&vnetMutex);
    return ret;
 }
 
@@ -1134,9 +1134,9 @@
    if (filp && filp->f_dentry) {
       inode = filp->f_dentry->d_inode;
    }
-   lock_kernel();
+   compat_mutex_lock(&vnetMutex);
    err = VNetFileOpIoctl(inode, filp, iocmd, ioarg);
-   unlock_kernel();
+   compat_mutex_unlock(&vnetMutex);
    return err;
 }
 #endif
diff -u -r source-original/vmnet-only/filter.c source/vmnet-only/filter.c
--- source-original/vmnet-only/filter.c	2011-03-26 06:37:29.000000000 +0100
+++ source/vmnet-only/filter.c	2011-04-02 14:16:50.000000000 +0200
@@ -85,7 +85,7 @@
  * callbacks can be concurrently executing on multiple threads on multiple
  * CPUs, so we should revisit locking for allowing for that in the future.
  */
-spinlock_t activeRuleLock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(activeRuleLock);
 
 /*
  * Logging.
diff -u -r source-original/vmnet-only/hub.c source/vmnet-only/hub.c
--- source-original/vmnet-only/hub.c	2011-03-26 06:37:29.000000000 +0100
+++ source/vmnet-only/hub.c	2011-04-02 14:15:56.000000000 +0200
@@ -81,7 +81,7 @@
  * so we use __attribute__((unused)) to quiet the compiler.
  */
 
-static spinlock_t vnetHubLock __attribute__((unused)) = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(vnetHubLock);
 
 
 /*
diff -u -r source-original/vsock-only/linux/af_vsock.c source/vsock-only/linux/af_vsock.c
--- source-original/vsock-only/linux/af_vsock.c	2011-03-26 04:03:08.000000000 +0100
+++ source/vsock-only/linux/af_vsock.c	2011-04-02 13:33:39.000000000 +0200
@@ -102,7 +102,6 @@
 #include <linux/miscdevice.h>
 #include <linux/poll.h>
 #include <linux/smp.h>
-#include <linux/smp_lock.h>
 #include <asm/io.h>
 #if defined(__x86_64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
 #   if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
diff -u -r source-original/vsock-only/linux/util.c source/vsock-only/linux/util.c
--- source-original/vsock-only/linux/util.c	2011-03-26 04:03:08.000000000 +0100
+++ source/vsock-only/linux/util.c	2011-04-02 13:35:45.000000000 +0200
@@ -34,7 +34,7 @@
 struct list_head vsockBindTable[VSOCK_HASH_SIZE + 1];
 struct list_head vsockConnectedTable[VSOCK_HASH_SIZE];
 
-spinlock_t vsockTableLock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(vsockTableLock);
 
 /*
  * snprintf() wasn't exported until 2.4.10: fall back on sprintf in those