Skip to content

Commit

Permalink
app-emulation/vmware-modules: Add patches for compilation with Kernel…
Browse files Browse the repository at this point in the history
… 4.2, bug 561252

Patches prepared by Ognian Tenchev, original source https://communities.vmware.com/thread/517279

Package-Manager: portage-2.2.27
  • Loading branch information
akhuettel committed Feb 8, 2016
1 parent 9122ade commit bf1be07
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 0 deletions.
46 changes: 46 additions & 0 deletions app-emulation/vmware-modules/files/304-4.2-01-inode.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
--- vmblock-only/linux/inode.c.orig 2015-09-28 01:11:08.000000000 +0300
+++ vmblock-only/linux/inode.c 2015-09-28 01:14:32.318043465 +0300
@@ -44,7 +44,9 @@
static int InodeOpReadlink(struct dentry *, char __user *, int);
#endif

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+static const char *InodeOpFollowlink(struct dentry *dentry, void **cookie);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
static void *InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd);
#else
static int InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd);
@@ -221,13 +223,15 @@
*----------------------------------------------------------------------------
*/

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
-static void *
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+static const char *InodeOpFollowlink(struct dentry *dentry, void **cookie)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+static void * InodeOpFollowlink(struct dentry *dentry, // IN : dentry of symlink
+ struct nameidata *nd) // OUT: stores result
#else
-static int
-#endif
-InodeOpFollowlink(struct dentry *dentry, // IN : dentry of symlink
+static int InodeOpFollowlink(struct dentry *dentry, // IN : dentry of symlink
struct nameidata *nd) // OUT: stores result
+#endif
{
int ret;
VMBlockInodeInfo *iinfo;
@@ -244,7 +248,11 @@
goto out;
}

+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+ return *cookie = (char *)(iinfo->name);
+#else
nd_set_link(nd, iinfo->name);
+#endif

out:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
23 changes: 23 additions & 0 deletions app-emulation/vmware-modules/files/304-4.2-02-vmnetInt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- vmnet-only/vmnetInt.h.orig 2015-05-31 16:40:39.000000000 +0300
+++ vmnet-only/vmnetInt.h 2015-09-28 01:22:01.553054142 +0300
@@ -78,12 +78,16 @@

extern struct proto vmnet_proto;
#ifdef VMW_NETDEV_HAS_NET
-# define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \
- PF_NETLINK, _pri, &vmnet_proto)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+# define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \
+ PF_NETLINK, _pri, &vmnet_proto, 1)
#else
-# define compat_sk_alloc(_bri, _pri) sk_alloc(PF_NETLINK, _pri, &vmnet_proto, 1)
+# define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \
+ PF_NETLINK, _pri, &vmnet_proto)
+#endif
+#else
+# define compat_sk_alloc(_bri, _pri) sk_alloc(PF_NETLINK, _pri, &vmnet_proto, 1)
#endif
-

#ifdef NF_IP_LOCAL_IN
#define VMW_NF_INET_LOCAL_IN NF_IP_LOCAL_IN
13 changes: 13 additions & 0 deletions app-emulation/vmware-modules/files/304-4.2-03-af_vsock.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- vsock-only/linux/af_vsock.c.orig 2015-09-28 01:26:51.354061029 +0300
+++ vsock-only/linux/af_vsock.c 2015-09-28 01:25:11.196058649 +0300
@@ -2826,7 +2826,9 @@
* network namespace, and the option to zero the sock was dropped.
*
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+ sk = sk_alloc(net, vsockVmciFamilyOps.family, priority, &vsockVmciProto, 1);
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
sk = sk_alloc(vsockVmciFamilyOps.family, priority,
vsockVmciProto.slab_obj_size, vsockVmciProto.slab);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
50 changes: 50 additions & 0 deletions app-emulation/vmware-modules/files/304-4.2-04-driver.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
--- vmci-only/linux/driver.c.orig 2015-09-28 01:33:04.416069896 +0300
+++ vmci-only/linux/driver.c 2015-09-28 01:34:32.814071997 +0300
@@ -26,6 +26,7 @@

#include <linux/file.h>
#include <linux/fs.h>
+#include <linux/vmalloc.h>
#include <linux/init.h>
#if defined(__x86_64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
# include <linux/ioctl32.h>
@@ -713,7 +714,7 @@

case IOCTL_VMCI_INIT_CONTEXT: {
VMCIInitBlock initBlock;
- VMCIHostUser user;
+ uid_t user;

retval = copy_from_user(&initBlock, (void *)ioarg, sizeof initBlock);
if (retval != 0) {
@@ -736,7 +736,11 @@
goto init_release;
}

+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
user = current_uid();
+#else
+ user = from_kuid(&init_user_ns, current_uid());
+#endif
retval = VMCIContext_InitContext(initBlock.cid, initBlock.flags,
0 /* Unused */, vmciLinux->userVersion,
&user, &vmciLinux->context);

@@ -1683,7 +1684,7 @@
/* This should be last to make sure we are done initializing. */
retval = pci_register_driver(&vmci_driver);
if (retval < 0) {
- vfree(data_buffer);
+ kvfree(data_buffer);
data_buffer = NULL;
return retval;
}
@@ -2470,7 +2471,7 @@

if (guestDeviceInit) {
pci_unregister_driver(&vmci_driver);
- vfree(data_buffer);
+ kvfree(data_buffer);
guestDeviceInit = FALSE;
}

4 changes: 4 additions & 0 deletions app-emulation/vmware-modules/vmware-modules-304.2.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ src_prepare() {
kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-05-vmci_qpair.patch"
kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-06-vsock.patch"
kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-07-vsock.patch"
kernel_is ge 4 2 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.2-01-inode.patch"
kernel_is ge 4 2 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.2-02-vmnetInt.patch"
kernel_is ge 4 2 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.2-03-af_vsock.patch"
kernel_is ge 4 2 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.2-04-driver.patch"

# Allow user patches so they can support RC kernels and whatever else
epatch_user
Expand Down

0 comments on commit bf1be07

Please sign in to comment.