summaryrefslogtreecommitdiff
blob: 822bd5700b568a0eb60f1793a517919803b83bbf (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
--- vmmon-only/linux/driver.c.orig	2016-07-28 22:10:27.464215083 +0200
+++ vmmon-only/linux/driver.c	2016-07-28 22:54:20.796362329 +0200
@@ -124,7 +124,16 @@ static struct vm_operations_struct vmuse
 #endif
 };
 
-static struct file_operations vmuser_fops;
+static struct file_operations vmuser_fops = {
+   .owner = THIS_MODULE,
+   .poll = LinuxDriverPoll,
+   .unlocked_ioctl = LinuxDriver_Ioctl,
+   .compat_ioctl = LinuxDriver_Ioctl,
+   .open = LinuxDriver_Open,
+   .release = LinuxDriver_Close,
+   .mmap = LinuxDriverMmap
+};
+
 static struct timer_list tscTimer;
 static Atomic_uint32 tsckHz;
 static VmTimeStart tsckHzStartTime;
@@ -317,21 +326,6 @@ init_module(void)
    linuxState.fastClockPriority = -20;
    linuxState.swapSize = VMMON_UNKNOWN_SWAP_SIZE;
 
-   /*
-    * Initialize the file_operations structure. Because this code is always
-    * compiled as a module, this is fine to do it here and not in a static
-    * initializer.
-    */
-
-   memset(&vmuser_fops, 0, sizeof vmuser_fops);
-   vmuser_fops.owner = THIS_MODULE;
-   vmuser_fops.poll = LinuxDriverPoll;
-   vmuser_fops.unlocked_ioctl = LinuxDriver_Ioctl;
-   vmuser_fops.compat_ioctl = LinuxDriver_Ioctl;
-   vmuser_fops.open = LinuxDriver_Open;
-   vmuser_fops.release = LinuxDriver_Close;
-   vmuser_fops.mmap = LinuxDriverMmap;
-
 #ifdef VMX86_DEVEL
    devel_init_module();
    linuxState.minor = 0;
--- vmnet-only/driver.c.orig	2016-04-15 01:48:48.000000000 +0200
+++ vmnet-only/driver.c	2016-07-28 22:54:20.797362329 +0200
@@ -137,7 +137,16 @@ static ssize_t  VNetFileOpWrite(struct f
 static long  VNetFileOpUnlockedIoctl(struct file * filp,
                                      unsigned int iocmd, unsigned long ioarg);
 
-static struct file_operations vnetFileOps;
+static struct file_operations vnetFileOps = {
+   .owner = THIS_MODULE,
+   .read = VNetFileOpRead,
+   .write = VNetFileOpWrite,
+   .poll = VNetFileOpPoll,
+   .unlocked_ioctl = VNetFileOpUnlockedIoctl,
+   .compat_ioctl = VNetFileOpUnlockedIoctl,
+   .open = VNetFileOpOpen,
+   .release = VNetFileOpClose
+};
 
 /*
  * Utility functions
@@ -317,22 +326,6 @@ init_module(void)
       goto err_proto;
    }
 
-   /*
-    * Initialize the file_operations structure. Because this code is always
-    * compiled as a module, this is fine to do it here and not in a static
-    * initializer.
-    */
-
-   memset(&vnetFileOps, 0, sizeof vnetFileOps);
-   vnetFileOps.owner = THIS_MODULE;
-   vnetFileOps.read = VNetFileOpRead;
-   vnetFileOps.write = VNetFileOpWrite;
-   vnetFileOps.poll = VNetFileOpPoll;
-   vnetFileOps.unlocked_ioctl = VNetFileOpUnlockedIoctl;
-   vnetFileOps.compat_ioctl = VNetFileOpUnlockedIoctl;
-   vnetFileOps.open = VNetFileOpOpen;
-   vnetFileOps.release = VNetFileOpClose;
-
    retval = register_chrdev(VNET_MAJOR_NUMBER, "vmnet", &vnetFileOps);
    if (retval) {
       LOG(0, (KERN_NOTICE "/dev/vmnet: could not register major device %d\n",