diff -durp vmci-only.orig/linux/driver.c vmci-only/linux/driver.c --- vmci-only.orig/linux/driver.c 2011-09-28 09:44:11.917259948 +0200 +++ vmci-only/linux/driver.c 2011-09-28 09:49:38.325242628 +0200 @@ -144,7 +144,20 @@ static long LinuxDriver_UnlockedIoctl(st static int LinuxDriver_Close(struct inode *inode, struct file *filp); static unsigned int LinuxDriverPoll(struct file *file, poll_table *wait); -static struct file_operations vmuser_fops; +static struct file_operations vmuser_fops = { + .owner = THIS_MODULE, + .poll = LinuxDriverPoll, +#ifdef HAVE_UNLOCKED_IOCTL + .unlocked_ioctl = LinuxDriver_UnlockedIoctl, +#else + .ioctl = LinuxDriver_Ioctl, +#endif +#ifdef HAVE_COMPAT_IOCTL + .compat_ioctl = LinuxDriver_UnlockedIoctl, +#endif + .open = LinuxDriver_Open, + .release = LinuxDriver_Close, +}; #ifdef VM_X86_64 @@ -259,26 +272,6 @@ init_module(void) return -ENOMEM; } - /* - * 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; -#ifdef HAVE_UNLOCKED_IOCTL - vmuser_fops.unlocked_ioctl = LinuxDriver_UnlockedIoctl; -#else - vmuser_fops.ioctl = LinuxDriver_Ioctl; -#endif -#ifdef HAVE_COMPAT_IOCTL - vmuser_fops.compat_ioctl = LinuxDriver_UnlockedIoctl; -#endif - vmuser_fops.open = LinuxDriver_Open; - vmuser_fops.release = LinuxDriver_Close; - sprintf(linuxState.deviceName, "vmci"); linuxState.major = 10; linuxState.misc.minor = MISC_DYNAMIC_MINOR; diff -durp vmmon-only.orig/linux/driver.c vmmon-only/linux/driver.c --- vmmon-only.orig/linux/driver.c 2011-09-28 09:44:11.921259948 +0200 +++ vmmon-only/linux/driver.c 2011-09-28 09:52:08.797234491 +0200 @@ -202,7 +202,21 @@ static struct vm_operations_struct vmuse #endif }; -static struct file_operations vmuser_fops; +static struct file_operations vmuser_fops = { + .owner = THIS_MODULE, + .poll = LinuxDriverPoll, +#ifdef HAVE_UNLOCKED_IOCTL + .unlocked_ioctl = LinuxDriver_UnlockedIoctl, +#else + .ioctl = LinuxDriver_Ioctl, +#endif +#ifdef HAVE_COMPAT_IOCTL + .compat_ioctl = LinuxDriver_UnlockedIoctl, +#endif + .open = LinuxDriver_Open, + .release = LinuxDriver_Close, + .mmap = LinuxDriverMmap, +}; static struct timer_list tscTimer; /* @@ -419,27 +433,6 @@ init_module(void) spin_lock_init(&linuxState.pollListLock); #endif - /* - * 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; -#ifdef HAVE_UNLOCKED_IOCTL - vmuser_fops.unlocked_ioctl = LinuxDriver_UnlockedIoctl; -#else - vmuser_fops.ioctl = LinuxDriver_Ioctl; -#endif -#ifdef HAVE_COMPAT_IOCTL - vmuser_fops.compat_ioctl = LinuxDriver_UnlockedIoctl; -#endif - vmuser_fops.open = LinuxDriver_Open; - vmuser_fops.release = LinuxDriver_Close; - vmuser_fops.mmap = LinuxDriverMmap; - #ifdef VMX86_DEVEL devel_init_module(); linuxState.minor = 0; diff -durp vmnet-only.orig/driver.c vmnet-only/driver.c --- vmnet-only.orig/driver.c 2011-09-28 09:44:11.933259948 +0200 +++ vmnet-only/driver.c 2011-09-28 09:54:56.505225522 +0200 @@ -164,7 +164,22 @@ static long VNetFileOpUnlockedIoctl(str unsigned int iocmd, unsigned long ioarg); #endif -static struct file_operations vnetFileOps; +static struct file_operations vnetFileOps = { + .owner = THIS_MODULE, + .read = VNetFileOpRead, + .write = VNetFileOpWrite, + .poll = VNetFileOpPoll, +#ifdef HAVE_UNLOCKED_IOCTL + .unlocked_ioctl = VNetFileOpUnlockedIoctl, +#else + .ioctl = VNetFileOpIoctl, +#endif +#ifdef HAVE_COMPAT_IOCTL + .compat_ioctl = VNetFileOpUnlockedIoctl, +#endif + .open = VNetFileOpOpen, + .release = VNetFileOpClose, +}; /* * Utility functions @@ -476,28 +491,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; -#ifdef HAVE_UNLOCKED_IOCTL - vnetFileOps.unlocked_ioctl = VNetFileOpUnlockedIoctl; -#else - vnetFileOps.ioctl = VNetFileOpIoctl; -#endif -#ifdef HAVE_COMPAT_IOCTL - vnetFileOps.compat_ioctl = VNetFileOpUnlockedIoctl; -#endif - 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",