summaryrefslogtreecommitdiff
path: root/app-emulation/vmware-modules
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2016-03-19 18:00:56 +0100
committerAndreas K. Hüttel <dilfridge@gentoo.org>2016-03-19 18:07:26 +0100
commit9145c66663f46c0a80878683777aa644e7ead8b5 (patch)
tree979883057347f9b5567a3b4b10a1c36b91cdd313 /app-emulation/vmware-modules
parent21b480f8c1ff42ebeadbc8cdf81df08384f91e0b (diff)
downloadgentoo-9145c66663f46c0a80878683777aa644e7ead8b5.tar.gz
gentoo-9145c66663f46c0a80878683777aa644e7ead8b5.tar.xz
app-emulation/vmware-modules: Major version bump. Imported from the vmware overlay.
Many thanks to * Alex Xu <alex_y_xu@yahoo.ca> * Billy DeVincentis <billydv1@verizon.net> * Fabio Rossi <rossi.f@inwind.it> * Evan Teran <evan.teran@gmail.com> * Harris Landgarten <harrisl@lhjonline.com> and to everyone else who helped on bug 559798. Package-Manager: portage-2.2.27
Diffstat (limited to 'app-emulation/vmware-modules')
-rw-r--r--app-emulation/vmware-modules/files/308-3.10-00-dentry.patch43
-rw-r--r--app-emulation/vmware-modules/files/308-3.10-01-inode.patch94
-rw-r--r--app-emulation/vmware-modules/files/308-3.10-02-control.patch57
-rw-r--r--app-emulation/vmware-modules/files/308-3.10-03-inline.patch14
-rw-r--r--app-emulation/vmware-modules/files/308-3.11-00-readdir.patch41
-rw-r--r--app-emulation/vmware-modules/files/308-3.11-01-filldir.patch53
-rw-r--r--app-emulation/vmware-modules/files/308-3.15-00-vsock.patch46
-rw-r--r--app-emulation/vmware-modules/files/308-3.18-00-version-redefined.patch25
-rw-r--r--app-emulation/vmware-modules/files/308-3.19-00-compat-namei.patch24
-rw-r--r--app-emulation/vmware-modules/files/308-3.19-02-vmblock-path.patch67
-rw-r--r--app-emulation/vmware-modules/files/308-3.19-04-iovec.patch59
-rw-r--r--app-emulation/vmware-modules/files/308-3.19-05-vmci_qpair.patch25
-rw-r--r--app-emulation/vmware-modules/files/308-3.19-06-vsock.patch16
-rw-r--r--app-emulation/vmware-modules/files/308-3.19-07-vsock.patch13
-rw-r--r--app-emulation/vmware-modules/files/308-4.01-00-vsock.patch61
-rw-r--r--app-emulation/vmware-modules/files/308-4.02-00-nd_set_link.patch56
-rw-r--r--app-emulation/vmware-modules/files/308-4.02-01-sk_alloc.patch22
-rw-r--r--app-emulation/vmware-modules/files/308-4.03-00-vmci-misc_deregister.patch27
-rw-r--r--app-emulation/vmware-modules/files/308-4.03-00-vmmon-misc_deregister.patch14
-rw-r--r--app-emulation/vmware-modules/files/308-4.05-00-vmblock-follow_link.patch56
-rw-r--r--app-emulation/vmware-modules/files/308-apic.patch12
-rw-r--r--app-emulation/vmware-modules/files/308-hardened.patch89
-rw-r--r--app-emulation/vmware-modules/files/308-makefile-include.patch65
-rw-r--r--app-emulation/vmware-modules/files/308-makefile-kernel-dir.patch85
-rw-r--r--app-emulation/vmware-modules/files/308-netdevice.patch24
-rw-r--r--app-emulation/vmware-modules/vmware-modules-308.1.0.ebuild149
26 files changed, 1237 insertions, 0 deletions
diff --git a/app-emulation/vmware-modules/files/308-3.10-00-dentry.patch b/app-emulation/vmware-modules/files/308-3.10-00-dentry.patch
new file mode 100644
index 00000000000..5cc445fcadf
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.10-00-dentry.patch
@@ -0,0 +1,43 @@
+Minor change the API, now it just gets passed flags instead of a pointer to the nameidata
+--- a/vmblock-only/linux/dentry.c 2015-02-07 03:11:55.000000000 +0300
++++ c/vmblock-only/linux/dentry.c 2015-02-24 03:58:06.038605919 +0300
+@@ -32,7 +32,11 @@
+ #include "block.h"
+
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
+ static int DentryOpRevalidate(struct dentry *dentry, struct nameidata *nd);
++#else
++static int DentryOpRevalidate(struct dentry *dentry, unsigned int);
++#endif
+
+ struct dentry_operations LinkDentryOps = {
+ .d_revalidate = DentryOpRevalidate,
+@@ -58,9 +62,12 @@
+ *----------------------------------------------------------------------------
+ */
+
+-static int
+-DentryOpRevalidate(struct dentry *dentry, // IN: dentry revalidating
+- struct nameidata *nd) // IN: lookup flags & intent
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
++static int DentryOpRevalidate(struct dentry *dentry, struct nameidata *nd)
++#else
++static int DentryOpRevalidate(struct dentry *dentry, unsigned int flags)
++#endif
++
+ {
+ VMBlockInodeInfo *iinfo;
+ struct nameidata actualNd;
+@@ -101,7 +108,11 @@
+ if (actualDentry &&
+ actualDentry->d_op &&
+ actualDentry->d_op->d_revalidate) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
++ return actualDentry->d_op->d_revalidate(actualDentry, flags);
++#else
+ return actualDentry->d_op->d_revalidate(actualDentry, nd);
++#endif
+ }
+
+ if (compat_path_lookup(iinfo->name, 0, &actualNd)) {
diff --git a/app-emulation/vmware-modules/files/308-3.10-01-inode.patch b/app-emulation/vmware-modules/files/308-3.10-01-inode.patch
new file mode 100644
index 00000000000..e12d84d10e7
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.10-01-inode.patch
@@ -0,0 +1,94 @@
+Minor change the API, now it just gets passed flags instead of a pointer to the nameidata
+Properly initializes UID/GID with repsect to namespaces
+Some changes the readlink/setlink APIs
+--- a/vmblock-only/linux/inode.c 2015-02-07 03:11:55.000000000 +0300
++++ c/vmblock-only/linux/inode.c 2015-02-24 03:58:06.039605762 +0300
+@@ -35,9 +35,15 @@
+
+
+ /* Inode operations */
+-static struct dentry *InodeOpLookup(struct inode *dir,
+- struct dentry *dentry, struct nameidata *nd);
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
++static struct dentry *InodeOpLookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd);
+ static int InodeOpReadlink(struct dentry *dentry, char __user *buffer, int buflen);
++#else
++static struct dentry *InodeOpLookup(struct inode *, struct dentry *, unsigned int);
++static int InodeOpReadlink(struct dentry *, char __user *, int);
++#endif
++
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+ static void *InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd);
+ #else
+@@ -49,12 +55,15 @@
+ .lookup = InodeOpLookup,
+ };
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+ static struct inode_operations LinkInodeOps = {
++#else
++struct inode_operations LinkInodeOps = {
++#endif
+ .readlink = InodeOpReadlink,
+ .follow_link = InodeOpFollowlink,
+ };
+
+-
+ /*
+ *----------------------------------------------------------------------------
+ *
+@@ -75,7 +84,11 @@
+ static struct dentry *
+ InodeOpLookup(struct inode *dir, // IN: parent directory's inode
+ struct dentry *dentry, // IN: dentry to lookup
+- struct nameidata *nd) // IN: lookup intent and information
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
++ struct nameidata *nd) // IN: lookup intent and information
++#else
++ unsigned int flags)
++#endif
+ {
+ char *filename;
+ struct inode *inode;
+@@ -135,7 +148,12 @@
+ inode->i_size = INODE_TO_IINFO(inode)->nameLen;
+ inode->i_version = 1;
+ inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
+ inode->i_uid = inode->i_gid = 0;
++#else
++ inode->i_gid = make_kgid(current_user_ns(), 0);
++ inode->i_uid = make_kuid(current_user_ns(), 0);
++#endif
+ inode->i_op = &LinkInodeOps;
+
+ d_add(dentry, inode);
+@@ -177,7 +195,12 @@
+ return -EINVAL;
+ }
+
+- return vfs_readlink(dentry, buffer, buflen, iinfo->name);
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 99)
++ return vfs_readlink(dentry, buffer, buflen, iinfo->name);
++#else
++ return readlink_copy(buffer, buflen, iinfo->name);
++#endif
++
+ }
+
+
+@@ -221,7 +244,7 @@
+ goto out;
+ }
+
+- ret = vfs_follow_link(nd, iinfo->name);
++ nd_set_link(nd, iinfo->name);
+
+ out:
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+@@ -230,3 +253,4 @@
+ return ret;
+ #endif
+ }
++
diff --git a/app-emulation/vmware-modules/files/308-3.10-02-control.patch b/app-emulation/vmware-modules/files/308-3.10-02-control.patch
new file mode 100644
index 00000000000..92883533751
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.10-02-control.patch
@@ -0,0 +1,57 @@
+The API to create proc entries now takes the file ops structure directly, instead of being set after the fact
+Using new __getname/__putname API
+--- a/vmblock-only/linux/control.c 2015-02-07 03:11:55.000000000 +0300
++++ c/vmblock-only/linux/control.c 2015-02-24 03:58:06.038605919 +0300
+@@ -208,9 +208,11 @@
+ VMBlockSetProcEntryOwner(controlProcMountpoint);
+
+ /* Create /proc/fs/vmblock/dev */
+- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
+- VMBLOCK_CONTROL_MODE,
+- controlProcDirEntry);
++ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME,
++ VMBLOCK_CONTROL_MODE,
++ controlProcDirEntry,
++ &ControlFileOps);
++
+ if (!controlProcEntry) {
+ Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
+ remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
+@@ -218,7 +220,10 @@
+ return -EINVAL;
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
+ controlProcEntry->proc_fops = &ControlFileOps;
++#endif
++
+ return 0;
+ }
+
+@@ -287,18 +287,24 @@ ExecuteBlockOp(const char __user *buf,
+ int i;
+ int retval;
+
+- name = getname(buf);
++ name = __getname();
+ if (IS_ERR(name)) {
+ return PTR_ERR(name);
+ }
+
++ i = strncpy_from_user(name, buf, PATH_MAX);
++ if (i < 0 || i == PATH_MAX) {
++ __putname(name);
++ return -EINVAL;
++ }
++
+ for (i = strlen(name) - 1; i >= 0 && name[i] == '/'; i--) {
+ name[i] = '\0';
+ }
+
+ retval = i < 0 ? -EINVAL : blockOp(name, blocker);
+
+- putname(name);
++ __putname(name);
+
+ return retval;
+ }
diff --git a/app-emulation/vmware-modules/files/308-3.10-03-inline.patch b/app-emulation/vmware-modules/files/308-3.10-03-inline.patch
new file mode 100644
index 00000000000..fa8f36a35c2
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.10-03-inline.patch
@@ -0,0 +1,14 @@
+Hushes a warning
+--- a/vmmon-only/linux/driver.c 2015-02-07 03:54:16.000000000 +0300
++++ c/vmmon-only/linux/driver.c 2015-02-24 03:58:06.042605293 +0300
+@@ -1328,7 +1328,9 @@
+ *-----------------------------------------------------------------------------
+ */
+
+-__attribute__((always_inline)) static Bool
++#include <linux/compiler-gcc.h>
++
++__always_inline static Bool
+ LinuxDriverSyncReadTSCs(uint64 *delta) // OUT: TSC max - TSC min
+ {
+ TSCDelta tscDelta;
diff --git a/app-emulation/vmware-modules/files/308-3.11-00-readdir.patch b/app-emulation/vmware-modules/files/308-3.11-00-readdir.patch
new file mode 100644
index 00000000000..b2f76d3e2b3
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.11-00-readdir.patch
@@ -0,0 +1,41 @@
+replaces usage of vfs_readdir with iterate_dir. origionally found here:
+https://bugs.gentoo.org/show_bug.cgi?id=508204
+
+diff -Naur vmblock-only/linux/file.c vmblock-only/linux/file.c
+--- vmblock-only/linux/file.c 2013-11-05 23:33:26.000000000 -0500
++++ vmblock-only/linux/file.c 2014-04-26 10:58:03.062635343 -0400
+@@ -166,11 +166,9 @@
+
+ static int
+ FileOpReaddir(struct file *file, // IN
+- void *dirent, // IN
+- filldir_t filldir) // IN
++ struct dir_context *ctx)
+ {
+ int ret;
+- FilldirInfo info;
+ struct file *actualFile;
+
+ if (!file) {
+@@ -184,11 +182,8 @@
+ return -EINVAL;
+ }
+
+- info.filldir = filldir;
+- info.dirent = dirent;
+-
+ actualFile->f_pos = file->f_pos;
+- ret = vfs_readdir(actualFile, Filldir, &info);
++ ret = iterate_dir(actualFile, ctx);
+ file->f_pos = actualFile->f_pos;
+
+ return ret;
+@@ -237,7 +232,7 @@
+
+
+ struct file_operations RootFileOps = {
+- .readdir = FileOpReaddir,
++ .iterate = FileOpReaddir,
+ .open = FileOpOpen,
+ .release = FileOpRelease,
+ };
diff --git a/app-emulation/vmware-modules/files/308-3.11-01-filldir.patch b/app-emulation/vmware-modules/files/308-3.11-01-filldir.patch
new file mode 100644
index 00000000000..2eec99b7c1f
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.11-01-filldir.patch
@@ -0,0 +1,53 @@
+simply remove the code for Filldir since it is no longer used with the new
+iterate_dir API
+
+diff -rupN vmblock-only/linux/file.c vmblock-only.new/linux/file.c
+--- vmblock-only/linux/file.c 2014-10-07 23:22:46.832469618 -0400
++++ vmblock-only.new/linux/file.c 2014-10-07 23:24:35.276472720 -0400
+@@ -38,46 +38,6 @@ typedef u64 inode_num_t;
+ typedef ino_t inode_num_t;
+ #endif
+
+-/* Specifically for our filldir_t callback */
+-typedef struct FilldirInfo {
+- filldir_t filldir;
+- void *dirent;
+-} FilldirInfo;
+-
+-
+-/*
+- *----------------------------------------------------------------------------
+- *
+- * Filldir --
+- *
+- * Callback function for readdir that we use in place of the one provided.
+- * This allows us to specify that each dentry is a symlink, but pass through
+- * everything else to the original filldir function.
+- *
+- * Results:
+- * Original filldir's return value.
+- *
+- * Side effects:
+- * Directory information gets copied to user's buffer.
+- *
+- *----------------------------------------------------------------------------
+- */
+-
+-static int
+-Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir
+- const char *name, // IN: Dirent name
+- int namelen, // IN: len of dirent's name
+- loff_t offset, // IN: Offset
+- inode_num_t ino, // IN: Inode number of dirent
+- unsigned int d_type) // IN: Type of file
+-{
+- FilldirInfo *info = buf;
+-
+- /* Specify DT_LNK regardless */
+- return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK);
+-}
+-
+-
+ /* File operations */
+
+ /*
diff --git a/app-emulation/vmware-modules/files/308-3.15-00-vsock.patch b/app-emulation/vmware-modules/files/308-3.15-00-vsock.patch
new file mode 100644
index 00000000000..9e8d9d1a32f
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.15-00-vsock.patch
@@ -0,0 +1,46 @@
+removing the no longer existing second parameter to sk_data_ready
+doesn't seem it ever served a purpose.
+
+diff -rupN vsock-only/linux/notify.c vsock-only.new/linux/notify.c
+--- vsock-only/linux/notify.c 2013-11-05 23:33:27.000000000 -0500
++++ vsock-only.new/linux/notify.c 2014-10-05 23:46:47.943304728 -0400
+@@ -515,8 +515,11 @@ VSockVmciHandleWrote(struct sock *sk,
+ vsk = vsock_sk(sk);
+ PKT_FIELD(vsk, sentWaitingRead) = FALSE;
+ #endif
+-
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
++ sk->sk_data_ready(sk);
++#else
+ sk->sk_data_ready(sk, 0);
++#endif
+ }
+
+
+diff -rupN vsock-only/linux/notifyQState.c vsock-only.new/linux/notifyQState.c
+--- vsock-only/linux/notifyQState.c 2013-11-05 23:33:27.000000000 -0500
++++ vsock-only.new/linux/notifyQState.c 2014-10-05 23:46:33.231303931 -0400
+@@ -164,7 +164,11 @@ VSockVmciHandleWrote(struct sock *sk,
+ struct sockaddr_vm *dst, // IN: unused
+ struct sockaddr_vm *src) // IN: unused
+ {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
++ sk->sk_data_ready(sk);
++#else
+ sk->sk_data_ready(sk, 0);
++#endif
+ }
+
+
+@@ -566,7 +570,11 @@ VSockVmciNotifyPktRecvPostDequeue(struct
+ }
+
+ /* See the comment in VSockVmciNotifyPktSendPostEnqueue */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
++ sk->sk_data_ready(sk);
++#else
+ sk->sk_data_ready(sk, 0);
++#endif
+ }
+
+ return err;
diff --git a/app-emulation/vmware-modules/files/308-3.18-00-version-redefined.patch b/app-emulation/vmware-modules/files/308-3.18-00-version-redefined.patch
new file mode 100644
index 00000000000..22d6325c9a9
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.18-00-version-redefined.patch
@@ -0,0 +1,25 @@
+Hushes some (but not all warnings) relating to redefinitions of this define
+--- a/vmci-only/shared/vm_device_version.h 2015-02-07 03:11:55.000000000 +0300
++++ c/vmci-only/shared/vm_device_version.h 2015-02-24 03:58:06.041605450 +0300
+@@ -53,7 +53,9 @@
+ * VMware HD Audio codec
+ * VMware HD Audio controller
+ */
++#ifndef PCI_VENDOR_ID_VMWARE
+ #define PCI_VENDOR_ID_VMWARE 0x15AD
++#endif
+ #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
+ #define PCI_DEVICE_ID_VMWARE_SVGA 0x0710
+ #define PCI_DEVICE_ID_VMWARE_VGA 0x0711
+--- a/vmnet-only/vm_device_version.h 2015-02-07 03:54:16.000000000 +0300
++++ c/vmnet-only/vm_device_version.h 2015-02-24 03:58:06.044604981 +0300
+@@ -53,7 +53,9 @@
+ * VMware HD Audio codec
+ * VMware HD Audio controller
+ */
++#ifndef PCI_VENDOR_ID_VMWARE
+ #define PCI_VENDOR_ID_VMWARE 0x15AD
++#endif
+ #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
+ #define PCI_DEVICE_ID_VMWARE_SVGA 0x0710
+ #define PCI_DEVICE_ID_VMWARE_VGA 0x0711
diff --git a/app-emulation/vmware-modules/files/308-3.19-00-compat-namei.patch b/app-emulation/vmware-modules/files/308-3.19-00-compat-namei.patch
new file mode 100644
index 00000000000..0182077254a
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.19-00-compat-namei.patch
@@ -0,0 +1,24 @@
+A copy of this since it is no longer exported by the kernel headers
+--- a/vmblock-only/shared/compat_namei.h 2015-02-07 03:11:55.000000000 +0300
++++ c/vmblock-only/shared/compat_namei.h 2015-02-24 03:51:25.235286047 +0300
+@@ -21,6 +21,20 @@
+
+ #include <linux/namei.h>
+
++/* Copy-n-paste from kernel's source/fs/namei.c */
++struct nameidata {
++ struct path path;
++ struct qstr last;
++ struct path root;
++ struct inode *inode; /* path.dentry.d_inode */
++ unsigned int flags;
++ unsigned seq, m_seq;
++ int last_type;
++ unsigned depth;
++ struct file *base;
++ char *saved_names[MAX_NESTED_LINKS + 1];
++};
++
+ /*
+ * In 2.6.25-rc2, dentry and mount objects were removed from the nameidata
+ * struct. They were both replaced with a struct path.
diff --git a/app-emulation/vmware-modules/files/308-3.19-02-vmblock-path.patch b/app-emulation/vmware-modules/files/308-3.19-02-vmblock-path.patch
new file mode 100644
index 00000000000..178d1478ae5
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.19-02-vmblock-path.patch
@@ -0,0 +1,67 @@
+Sources:
+https://531682.bugs.gentoo.org/attachment.cgi?id=396484
+https://531682.bugs.gentoo.org/attachment.cgi?id=396482
+diff -rupN vmblock-only.orig/linux/dentry.c vmblock-only/linux/dentry.c
+--- vmblock-only.orig/linux/dentry.c 2015-02-14 18:05:46.000000000 -0500
++++ vmblock-only/linux/dentry.c 2015-02-14 18:09:59.000000000 -0500
+@@ -63,7 +63,7 @@ DentryOpRevalidate(struct dentry *dentry
+ unsigned int flags) // IN: lookup flags & intent
+ {
+ VMBlockInodeInfo *iinfo;
+- struct nameidata actualNd;
++ struct path actualNd;
+ struct dentry *actualDentry;
+ int ret;
+
+diff -rupN vmblock-only.orig/linux/filesystem.c vmblock-only/linux/filesystem.c
+--- vmblock-only.orig/linux/filesystem.c 2014-11-20 19:29:15.000000000 -0500
++++ vmblock-only/linux/filesystem.c 2015-02-14 18:10:49.000000000 -0500
+@@ -322,7 +322,7 @@ Iget(struct super_block *sb, // IN: f
+ {
+ VMBlockInodeInfo *iinfo;
+ struct inode *inode;
+- struct nameidata actualNd;
++ struct path actualNd;
+
+ ASSERT(sb);
+
+diff -rupN vmblock-only.orig/shared/compat_namei.h vmblock-only/shared/compat_namei.h
+--- vmblock-only.orig/shared/compat_namei.h 2014-11-20 19:29:15.000000000 -0500
++++ vmblock-only/shared/compat_namei.h 2015-02-14 18:08:38.000000000 -0500
+@@ -26,21 +26,21 @@
+ * struct. They were both replaced with a struct path.
+ */
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+-#define compat_vmw_nd_to_dentry(nd) (nd).path.dentry
++#define compat_vmw_nd_to_dentry(nd) (nd).dentry
+ #else
+ #define compat_vmw_nd_to_dentry(nd) (nd).dentry
+ #endif
+
+ /* In 2.6.25-rc2, path_release(&nd) was replaced with path_put(&nd.path). */
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+-#define compat_path_release(nd) path_put(&(nd)->path)
++#define compat_path_release(nd) path_put(nd)
+ #else
+ #define compat_path_release(nd) path_release(nd)
+ #endif
+
+ /* path_lookup was removed in 2.6.39 merge window VFS merge */
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
+-#define compat_path_lookup(name, flags, nd) kern_path(name, flags, &((nd)->path))
++#define compat_path_lookup(name, flags, nd) kern_path(name, flags, nd)
+ #else
+ #define compat_path_lookup(name, flags, nd) path_lookup(name, flags, nd)
+ #endif
+diff -u vmblock-only.orig/linux/file.c vmblock-only/linux/file.c
+--- vmblock-only.orig/linux/file.c 2015-02-11 12:18:29.000000000 -0500
++++ vmblock-only/linux/file.c 2015-02-11 12:41:41.000000000 -0500
+@@ -92,7 +92,7 @@
+ * and that would try to acquire the inode's semaphore; if the two inodes
+ * are the same we'll deadlock.
+ */
+- if (actualFile->f_dentry && inode == actualFile->f_dentry->d_inode) {
++ if (actualFile->f_path.dentry && inode == actualFile->f_path.dentry->d_inode) {
+ Warning("FileOpOpen: identical inode encountered, open cannot succeed.\n");
+ if (filp_close(actualFile, current->files) < 0) {
+ Warning("FileOpOpen: unable to close opened file.\n");
diff --git a/app-emulation/vmware-modules/files/308-3.19-04-iovec.patch b/app-emulation/vmware-modules/files/308-3.19-04-iovec.patch
new file mode 100644
index 00000000000..83f0cc8fcbb
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.19-04-iovec.patch
@@ -0,0 +1,59 @@
+Some parts of the iovec API were replaced by the similar message API. Refactoring the code to use that.
+--- a/vmci-only/linux/vmciKernelIf.c 2015-02-07 03:11:55.000000000 +0300
++++ c/vmci-only/linux/vmciKernelIf.c 2015-02-24 03:58:06.041605450 +0300
+@@ -40,6 +40,7 @@
+ #include <linux/socket.h> /* For memcpy_{to,from}iovec(). */
+ #include <linux/vmalloc.h>
+ #include <linux/wait.h>
++#include <linux/skbuff.h>
+
+ #include "compat_highmem.h"
+ #include "compat_interrupt.h"
+@@ -1196,21 +1197,21 @@
+ } else {
+ toCopy = size - bytesCopied;
+ }
+-
++ /* Code cloned from kernels drivers/misc/vmw_vmci/vmci_queue_pair.c */
+ if (isIovec) {
+- struct iovec *iov = (struct iovec *)src;
+- int err;
++ struct msghdr *msg = (struct msghdr *)src;
++ int err;
+
+- /* The iovec will track bytesCopied internally. */
+- err = memcpy_fromiovec((uint8 *)va + pageOffset, iov, toCopy);
+- if (err != 0) {
+- if (kernelIf->host) {
+- kunmap(kernelIf->u.h.page[pageIndex]);
++ /* The iovec will track bytes_copied internally. */
++ err = memcpy_from_msg((u8 *)va + pageOffset, msg, toCopy);
++ if (err != 0) {
++ if (kernelIf->host)
++ kunmap(kernelIf->u.h.page[pageIndex]);
++ return VMCI_ERROR_INVALID_ARGS;
+ }
+- return VMCI_ERROR_INVALID_ARGS;
+- }
+- } else {
+- memcpy((uint8 *)va + pageOffset, (uint8 *)src + bytesCopied, toCopy);
++ } else {
++ memcpy((u8 *)va + pageOffset,
++ (u8 *)src + bytesCopied, toCopy);
+ }
+
+ bytesCopied += toCopy;
+@@ -1273,11 +1274,11 @@
+ }
+
+ if (isIovec) {
+- struct iovec *iov = (struct iovec *)dest;
++ struct msghdr *msg = (struct msghdr *)dest;
+ int err;
+
+ /* The iovec will track bytesCopied internally. */
+- err = memcpy_toiovec(iov, (uint8 *)va + pageOffset, toCopy);
++ err = memcpy_to_msg(msg, (uint8 *)va + pageOffset, toCopy);
+ if (err != 0) {
+ if (kernelIf->host) {
+ kunmap(kernelIf->u.h.page[pageIndex]);
diff --git a/app-emulation/vmware-modules/files/308-3.19-05-vmci_qpair.patch b/app-emulation/vmware-modules/files/308-3.19-05-vmci_qpair.patch
new file mode 100644
index 00000000000..4dec3c46820
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.19-05-vmci_qpair.patch
@@ -0,0 +1,25 @@
+Some parts of the iovec API were replaced by the similar message API. Refactoring the code to use that.
+diff -rupN vsock-only.old/linux/af_vsock.c vsock-only/linux/af_vsock.c
+--- vsock-only.old/linux/af_vsock.c 2015-05-06 20:41:47.684046762 -0400
++++ vsock-only/linux/af_vsock.c 2015-05-06 20:52:15.245080779 -0400
+@@ -4629,7 +4629,7 @@ VSockVmciStreamSendmsg(struct kiocb *kio
+ * able to send.
+ */
+
+- written = vmci_qpair_enquev(vsk->qpair, msg->msg_iov,
++ written = vmci_qpair_enquev(vsk->qpair, &msg->msg_iter.iov,
+ len - totalWritten, 0);
+ if (written < 0) {
+ err = -ENOMEM;
+@@ -4874,9 +4874,9 @@ VSockVmciStreamRecvmsg(struct kiocb *kio
+ }
+
+ if (flags & MSG_PEEK) {
+- read = vmci_qpair_peekv(vsk->qpair, msg->msg_iov, len - copied, 0);
++ read = vmci_qpair_peekv(vsk->qpair, &msg->msg_iter.iov, len - copied, 0);
+ } else {
+- read = vmci_qpair_dequev(vsk->qpair, msg->msg_iov, len - copied, 0);
++ read = vmci_qpair_dequev(vsk->qpair, &msg->msg_iter.iov, len - copied, 0);
+ }
+
+ if (read < 0) {
diff --git a/app-emulation/vmware-modules/files/308-3.19-06-vsock.patch b/app-emulation/vmware-modules/files/308-3.19-06-vsock.patch
new file mode 100644
index 00000000000..9a2096e679a
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.19-06-vsock.patch
@@ -0,0 +1,16 @@
+Some parts of the iovec API were replaced by the similar message API. Refactoring the code to use that.
+diff -rupN vsock-only/linux/af_vsock.c vsock-only.new/linux/af_vsock.c
+--- vsock-only/linux/af_vsock.c 2015-05-05 11:31:35.710099711 -0400
++++ vsock-only.new/linux/af_vsock.c 2015-05-05 11:36:33.260115840 -0400
+@@ -4727,7 +4727,11 @@ VSockVmciDgramRecvmsg(struct kiocb *kioc
+ }
+
+ /* Place the datagram payload in the user's iovec. */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
+ err = skb_copy_datagram_iovec(skb, sizeof *dg, msg->msg_iov, payloadLen);
++#else
++ err = skb_copy_datagram_iter(skb, sizeof *dg, &msg->msg_iter, payloadLen);
++#endif
+ if (err) {
+ goto out;
+ }
diff --git a/app-emulation/vmware-modules/files/308-3.19-07-vsock.patch b/app-emulation/vmware-modules/files/308-3.19-07-vsock.patch
new file mode 100644
index 00000000000..6aec2cd3d7b
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-3.19-07-vsock.patch
@@ -0,0 +1,13 @@
+Some parts of the iovec API were replaced by the similar message API. Refactoring the code to use that.
+diff -rupN vsock-only/linux/af_vsock.c vsock-only.new/linux/af_vsock.c
+--- vsock-only/linux/af_vsock.c 2015-05-05 11:26:05.145081792 -0400
++++ vsock-only.new/linux/af_vsock.c 2015-05-05 11:30:54.304097466 -0400
+@@ -4266,7 +4266,7 @@ VSockVmciDgramSendmsg(struct kiocb *kioc
+ goto out;
+ }
+
+- memcpy_fromiovec(VMCI_DG_PAYLOAD(dg), msg->msg_iov, len);
++ memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len);
+
+ dg->dst = VMCI_MAKE_HANDLE(remoteAddr->svm_cid, remoteAddr->svm_port);
+ dg->src = VMCI_MAKE_HANDLE(vsk->localAddr.svm_cid, vsk->localAddr.svm_port);
diff --git a/app-emulation/vmware-modules/files/308-4.01-00-vsock.patch b/app-emulation/vmware-modules/files/308-4.01-00-vsock.patch
new file mode 100644
index 00000000000..5735cd50650
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-4.01-00-vsock.patch
@@ -0,0 +1,61 @@
+--- vsock-only/linux/af_vsock.c 2015-05-03 00:55:58.955156116 +0200
++++ vsock-only/linux/af_vsock.c.new 2015-05-03 01:01:14.305173750 +0200
+@@ -233,14 +233,10 @@
+ static int VSockVmciStreamGetsockopt(struct socket *sock, int level, int optname,
+ char __user *optval, int __user * optlen);
+
+-static int VSockVmciDgramSendmsg(struct kiocb *kiocb,
+- struct socket *sock, struct msghdr *msg, size_t len);
+-static int VSockVmciDgramRecvmsg(struct kiocb *kiocb, struct socket *sock,
+- struct msghdr *msg, size_t len, int flags);
+-static int VSockVmciStreamSendmsg(struct kiocb *kiocb,
+- struct socket *sock, struct msghdr *msg, size_t len);
+-static int VSockVmciStreamRecvmsg(struct kiocb *kiocb, struct socket *sock,
+- struct msghdr *msg, size_t len, int flags);
++static int VSockVmciDgramSendmsg(struct socket *sock, struct msghdr *msg, size_t len);
++static int VSockVmciDgramRecvmsg(struct socket *sock, struct msghdr *msg, size_t len, int flags);
++static int VSockVmciStreamSendmsg(struct socket *sock, struct msghdr *msg, size_t len);
++static int VSockVmciStreamRecvmsg(struct socket *sock, struct msghdr *msg, size_t len, int flags);
+
+ static int VSockVmciCreate(
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
+@@ -4211,8 +4207,7 @@
+ */
+
+ static int
+-VSockVmciDgramSendmsg(struct kiocb *kiocb, // UNUSED
+- struct socket *sock, // IN: socket to send on
++VSockVmciDgramSendmsg(struct socket *sock, // IN: socket to send on
+ struct msghdr *msg, // IN: message to send
+ size_t len) // IN: length of message
+ {
+@@ -4541,8 +4536,7 @@
+ */
+
+ static int
+-VSockVmciStreamSendmsg(struct kiocb *kiocb, // UNUSED
+- struct socket *sock, // IN: socket to send on
++VSockVmciStreamSendmsg(struct socket *sock, // IN: socket to send on
+ struct msghdr *msg, // IN: message to send
+ size_t len) // IN: length of message
+ {
+@@ -4710,8 +4704,7 @@
+ */
+
+ static int
+-VSockVmciDgramRecvmsg(struct kiocb *kiocb, // UNUSED
+- struct socket *sock, // IN: socket to receive from
++VSockVmciDgramRecvmsg(struct socket *sock, // IN: socket to receive from
+ struct msghdr *msg, // IN/OUT: message to receive into
+ size_t len, // IN: length of receive buffer
+ int flags) // IN: receive flags
+@@ -4803,8 +4796,7 @@
+ */
+
+ static int
+-VSockVmciStreamRecvmsg(struct kiocb *kiocb, // UNUSED
+- struct socket *sock, // IN: socket to receive from
++VSockVmciStreamRecvmsg(struct socket *sock, // IN: socket to receive from
+ struct msghdr *msg, // IN/OUT: message to receive into
+ size_t len, // IN: length of receive buffer
+ int flags) // IN: receive flags
diff --git a/app-emulation/vmware-modules/files/308-4.02-00-nd_set_link.patch b/app-emulation/vmware-modules/files/308-4.02-00-nd_set_link.patch
new file mode 100644
index 00000000000..66609bff630
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-4.02-00-nd_set_link.patch
@@ -0,0 +1,56 @@
+--- vmci-only/linux/driver.c 2015-02-07 01:11:55.000000000 +0100
++++ vmci-only/linux/driver.c.new 2015-07-23 00:28:25.713804866 +0200
+@@ -37,6 +37,7 @@
+ #include <linux/moduleparam.h>
+ #include <linux/poll.h>
+ #include <linux/smp.h>
++#include <linux/vmalloc.h>
+
+ #include "compat_highmem.h"
+ #include "compat_interrupt.h"
+--- vmblock-only/linux/inode.c 2015-08-23 00:34:11.959377109 +0200
++++ vmblock-only/linux/inode.c.new 2015-08-23 00:37:49.839389292 +0200
+@@ -38,7 +38,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, 1, 99)
++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);
+@@ -203,13 +205,19 @@
+ *----------------------------------------------------------------------------
+ */
+
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99)
++static const char *
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+ static void *
+ #else
+ static int
+ #endif
+ InodeOpFollowlink(struct dentry *dentry, // IN : dentry of symlink
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99)
++ void **cookie) // OUT: stores opaque pointer
++#else
+ struct nameidata *nd) // OUT: stores result
++#endif
+ {
+ int ret;
+ VMBlockInodeInfo *iinfo;
+@@ -226,7 +234,11 @@
+ goto out;
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99)
++ return *cookie = iinfo->name;
++#else
+ nd_set_link(nd, iinfo->name);
++#endif
+
+ out:
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
diff --git a/app-emulation/vmware-modules/files/308-4.02-01-sk_alloc.patch b/app-emulation/vmware-modules/files/308-4.02-01-sk_alloc.patch
new file mode 100644
index 00000000000..6437d6022a3
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-4.02-01-sk_alloc.patch
@@ -0,0 +1,22 @@
+--- vmnet-only/vmnetInt.h 2015-05-28 01:46:53.023206897 +0200
++++ vmnet-only/vmnetInt.h.new 2015-05-28 01:47:07.911207730 +0200
+@@ -79,7 +79,7 @@
+ 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)
++ PF_NETLINK, _pri, &vmnet_proto, 0)
+ #else
+ # define compat_sk_alloc(_bri, _pri) sk_alloc(PF_NETLINK, _pri, &vmnet_proto, 1)
+ #endif
+--- vsock-only/linux/af_vsock.c 2015-05-28 01:50:03.553217551 +0200
++++ vsock-only/linux/af_vsock.c.new 2015-05-28 01:54:55.248233862 +0200
+@@ -2829,7 +2829,7 @@
+ #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
+ sk = sk_alloc(vsockVmciFamilyOps.family, priority, &vsockVmciProto, 1);
+ #else
+- sk = sk_alloc(net, vsockVmciFamilyOps.family, priority, &vsockVmciProto);
++ sk = sk_alloc(net, vsockVmciFamilyOps.family, priority, &vsockVmciProto, 0);
+ #endif
+ if (!sk) {
+ return NULL;
diff --git a/app-emulation/vmware-modules/files/308-4.03-00-vmci-misc_deregister.patch b/app-emulation/vmware-modules/files/308-4.03-00-vmci-misc_deregister.patch
new file mode 100644
index 00000000000..b2d93a66db8
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-4.03-00-vmci-misc_deregister.patch
@@ -0,0 +1,27 @@
+diff -ru work.old/vmci-only/linux/driver.c work/vmci-only/linux/driver.c
+--- work.old/vmci-only/linux/driver.c 2015-09-14 21:07:49.751696932 +0200
++++ work/vmci-only/linux/driver.c 2015-09-14 22:10:48.015908198 +0200
+@@ -2467,8 +2467,6 @@
+ static void __exit
+ vmci_exit(void)
+ {
+- int retval;
+-
+ if (guestDeviceInit) {
+ pci_unregister_driver(&vmci_driver);
+ vfree(data_buffer);
+@@ -2480,12 +2478,8 @@
+
+ VMCI_HostCleanup();
+
+- retval = misc_deregister(&linuxState.misc);
+- if (retval) {
+- Warning(LGPFX "Module %s: error unregistering\n", VMCI_MODULE_NAME);
+- } else {
+- Log(LGPFX"Module %s: unloaded\n", VMCI_MODULE_NAME);
+- }
++ misc_deregister(&linuxState.misc);
++ Log(LGPFX"Module %s: unloaded\n", VMCI_MODULE_NAME);
+
+ hostDeviceInit = FALSE;
+ }
diff --git a/app-emulation/vmware-modules/files/308-4.03-00-vmmon-misc_deregister.patch b/app-emulation/vmware-modules/files/308-4.03-00-vmmon-misc_deregister.patch
new file mode 100644
index 00000000000..9f0df66faa2
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-4.03-00-vmmon-misc_deregister.patch
@@ -0,0 +1,14 @@
+diff -ru work.old/vmmon-only/linux/driver.c work/vmmon-only/linux/driver.c
+--- work.old/vmmon-only/linux/driver.c 2015-08-14 22:39:49.000000000 +0200
++++ work/vmmon-only/linux/driver.c 2015-09-14 22:11:06.807909249 +0200
+@@ -387,9 +387,7 @@
+ #ifdef VMX86_DEVEL
+ unregister_chrdev(linuxState.major, linuxState.deviceName);
+ #else
+- if (misc_deregister(&linuxState.misc)) {
+- Warning("Module %s: error unregistering\n", linuxState.deviceName);
+- }
++ misc_deregister(&linuxState.misc);
+ #endif
+
+ Log("Module %s: unloaded\n", linuxState.deviceName);
diff --git a/app-emulation/vmware-modules/files/308-4.05-00-vmblock-follow_link.patch b/app-emulation/vmware-modules/files/308-4.05-00-vmblock-follow_link.patch
new file mode 100644
index 00000000000..c1392924327
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-4.05-00-vmblock-follow_link.patch
@@ -0,0 +1,56 @@
+--- vmblock-only/linux/inode.c 2016-01-30 19:13:04.019947435 +0100
++++ vmblock-only/linux/inode.c.new 2016-01-30 19:13:56.226950354 +0100
+@@ -44,7 +44,9 @@
+ static int InodeOpReadlink(struct dentry *, char __user *, int);
+ #endif
+
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99)
++static const char *InodeOpFollowlink(struct dentry *dentry, struct inode *inode, void **cookie);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99)
+ 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);
+@@ -63,7 +65,11 @@
+ struct inode_operations LinkInodeOps = {
+ #endif
+ .readlink = InodeOpReadlink,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99)
++ .get_link = InodeOpFollowlink,
++#else
+ .follow_link = InodeOpFollowlink,
++#endif
+ };
+
+ /*
+@@ -231,6 +237,9 @@
+ static int
+ #endif
+ InodeOpFollowlink(struct dentry *dentry, // IN : dentry of symlink
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99)
++ struct inode *inode,
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99)
+ void **cookie) // OUT: stores opaque pointer
+ #else
+@@ -241,12 +250,20 @@
+ VMBlockInodeInfo *iinfo;
+
+ if (!dentry) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99)
++ ret = -ECHILD;
++#else
+ Warning("InodeOpReadlink: invalid args from kernel\n");
+ ret = -EINVAL;
++#endif
+ goto out;
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99)
++ iinfo = INODE_TO_IINFO(inode);
++#else
+ iinfo = INODE_TO_IINFO(dentry->d_inode);
++#endif
+ if (!iinfo) {
+ ret = -EINVAL;
+ goto out;
diff --git a/app-emulation/vmware-modules/files/308-apic.patch b/app-emulation/vmware-modules/files/308-apic.patch
new file mode 100644
index 00000000000..66cd4593324
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-apic.patch
@@ -0,0 +1,12 @@
+diff --git a/vmmon-only/linux/hostif.c b/vmmon-only/linux/hostif.c
+index f1f4b10..c43242f 100644
+--- a/vmmon-only/linux/hostif.c
++++ b/vmmon-only/linux/hostif.c
+@@ -55,6 +55,7 @@
+ #include <linux/kthread.h>
+ #include <linux/wait.h>
+
++#include <asm/apic.h>
+
+ #include "vmware.h"
+ #include "x86apic.h"
diff --git a/app-emulation/vmware-modules/files/308-hardened.patch b/app-emulation/vmware-modules/files/308-hardened.patch
new file mode 100644
index 00000000000..31d5917c37c
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-hardened.patch
@@ -0,0 +1,89 @@
+diff --git a/vmmon-only/linux/driver.c b/vmmon-only/linux/driver.c
+index b21dd44..960c2aa 100644
+--- a/vmmon-only/linux/driver.c
++++ b/vmmon-only/linux/driver.c
+@@ -178,7 +178,16 @@ static struct vm_operations_struct vmuser_mops = {
+ #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;
+@@ -357,21 +372,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;
+diff --git a/vmnet-only/driver.c b/vmnet-only/driver.c
+index b12b982..40bd4cf 100644
+--- a/vmnet-only/driver.c
++++ b/vmnet-only/driver.c
+@@ -165,7 +165,16 @@ static long VNetFileOpUnlockedIoctl(struct file * filp,
+ 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,
++ .unlocked_ioctl = VNetFileOpUnlockedIoctl,
++ .compat_ioctl = VNetFileOpUnlockedIoctl,
++ .open = VNetFileOpOpen,
++ .release = VNetFileOpClose
++};
+
+ /*
+ * Utility functions
+@@ -476,22 +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;
+- 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",
diff --git a/app-emulation/vmware-modules/files/308-makefile-include.patch b/app-emulation/vmware-modules/files/308-makefile-include.patch
new file mode 100644
index 00000000000..39c30003080
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-makefile-include.patch
@@ -0,0 +1,65 @@
+diff --git a/vmblock-only/Makefile.kernel b/vmblock-only/Makefile.kernel
+index ab7a727..e3ec9d2 100644
+--- a/vmblock-only/Makefile.kernel
++++ b/vmblock-only/Makefile.kernel
+@@ -19,7 +19,7 @@
+
+ INCLUDE += -I$(SRCROOT)/include
+
+-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE)
+
+ EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/cachecreate.c, -DVMW_KMEMCR_HAS_DTOR, )
+ EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/cachector.c, -DVMW_KMEMCR_CTOR_HAS_3_ARGS, )
+diff --git a/vmci-only/Makefile.kernel b/vmci-only/Makefile.kernel
+index ba343ee..861ea83 100644
+--- a/vmci-only/Makefile.kernel
++++ b/vmci-only/Makefile.kernel
+@@ -21,7 +21,7 @@ CC_OPTS += -DVMCI
+
+ INCLUDE += -I$(SRCROOT)/shared -I$(SRCROOT)/common -I$(SRCROOT)/linux
+
+-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE)
+
+ obj-m += $(DRIVER).o
+
+diff --git a/vmmon-only/Makefile.kernel b/vmmon-only/Makefile.kernel
+index 8770d1d..c4746c3 100644
+--- a/vmmon-only/Makefile.kernel
++++ b/vmmon-only/Makefile.kernel
+@@ -22,7 +22,7 @@ CC_OPTS += -DVMMON -DVMCORE
+ INCLUDE := -I$(SRCROOT)/include -I$(SRCROOT)/common -I$(SRCROOT)/linux \
+ -I$(SRCROOT)/vmcore
+
+-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE)
+
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/smpcall.c, -DVMW_HAVE_SMP_CALL_3ARG, )
+
+diff --git a/vmnet-only/Makefile.kernel b/vmnet-only/Makefile.kernel
+index d1e3133..665d428 100644
+--- a/vmnet-only/Makefile.kernel
++++ b/vmnet-only/Makefile.kernel
+@@ -19,7 +19,7 @@
+
+ INCLUDE := -I$(SRCROOT)
+
+-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE)
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/netdev_has_net.c,-DVMW_NETDEV_HAS_NET, )
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/netdev_has_dev_net.c,-DVMW_NETDEV_HAS_DEV_NET, )
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/nfhook_uses_skb.c,-DVMW_NFHOOK_USES_SKB, )
+diff --git a/vsock-only/Makefile.kernel b/vsock-only/Makefile.kernel
+index b4629ee..264b8cb 100644
+--- a/vsock-only/Makefile.kernel
++++ b/vsock-only/Makefile.kernel
+@@ -25,7 +25,7 @@ INCLUDE += -I$(SRCROOT)/include
+ INCLUDE += -I$(SRCROOT)/linux
+ INCLUDE += -I$(SRCROOT)/common
+
+-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE)
+ EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/netcreate_num_params.c, -DVMW_NETCREATE_KERNARG, )
+
+
diff --git a/app-emulation/vmware-modules/files/308-makefile-kernel-dir.patch b/app-emulation/vmware-modules/files/308-makefile-kernel-dir.patch
new file mode 100644
index 00000000000..1a647a3302d
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-makefile-kernel-dir.patch
@@ -0,0 +1,85 @@
+diff --git a/vmblock-only/Makefile b/vmblock-only/Makefile
+index 2b81323..746c8b8 100644
+--- a/vmblock-only/Makefile
++++ b/vmblock-only/Makefile
+@@ -49,10 +49,10 @@ VM_UNAME = $(shell uname -r)
+ ifdef LINUXINCLUDE
+ HEADER_DIR = $(LINUXINCLUDE)
+ else
+-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
++HEADER_DIR = $(KERNEL_DIR)
+ endif
+
+-BUILD_DIR = $(HEADER_DIR)/..
++BUILD_DIR = $(KBUILD_OUTPUT)
+
+ DRIVER := vmblock
+ PRODUCT := ws
+diff --git a/vmci-only/Makefile b/vmci-only/Makefile
+index 8e9c5be..6ec828b 100644
+--- a/vmci-only/Makefile
++++ b/vmci-only/Makefile
+@@ -49,10 +49,10 @@ VM_UNAME = $(shell uname -r)
+ ifdef LINUXINCLUDE
+ HEADER_DIR = $(LINUXINCLUDE)
+ else
+-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
++HEADER_DIR = $(KERNEL_DIR)
+ endif
+
+-BUILD_DIR = $(HEADER_DIR)/..
++BUILD_DIR = $(KBUILD_OUTPUT)
+
+ DRIVER := vmci
+ PRODUCT := ws
+diff --git a/vmmon-only/Makefile b/vmmon-only/Makefile
+index 5bd867b..91a83d4 100644
+--- a/vmmon-only/Makefile
++++ b/vmmon-only/Makefile
+@@ -49,10 +49,10 @@ VM_UNAME = $(shell uname -r)
+ ifdef LINUXINCLUDE
+ HEADER_DIR = $(LINUXINCLUDE)
+ else
+-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
++HEADER_DIR = $(KERNEL_DIR)
+ endif
+
+-BUILD_DIR = $(HEADER_DIR)/..
++BUILD_DIR = $(KBUILD_OUTPUT)
+
+ DRIVER := vmmon
+ PRODUCT := @@PRODUCT@@
+diff --git a/vmnet-only/Makefile b/vmnet-only/Makefile
+index d4eb73c..c7c6d38 100644
+--- a/vmnet-only/Makefile
++++ b/vmnet-only/Makefile
+@@ -49,10 +49,10 @@ VM_UNAME = $(shell uname -r)
+ ifdef LINUXINCLUDE
+ HEADER_DIR = $(LINUXINCLUDE)
+ else
+-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
++HEADER_DIR = $(KERNEL_DIR)
+ endif
+
+-BUILD_DIR = $(HEADER_DIR)/..
++BUILD_DIR = $(KBUILD_OUTPUT)
+
+ DRIVER := vmnet
+ PRODUCT := @@PRODUCT@@
+diff --git a/vsock-only/Makefile b/vsock-only/Makefile
+index 93dd61d..9765696 100644
+--- a/vsock-only/Makefile
++++ b/vsock-only/Makefile
+@@ -49,10 +49,10 @@ VM_UNAME = $(shell uname -r)
+ ifdef LINUXINCLUDE
+ HEADER_DIR = $(LINUXINCLUDE)
+ else
+-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
++HEADER_DIR = $(KERNEL_DIR)
+ endif
+
+-BUILD_DIR = $(HEADER_DIR)/..
++BUILD_DIR = $(KBUILD_OUTPUT)
+
+ DRIVER := vsock
+ PRODUCT := ws
diff --git a/app-emulation/vmware-modules/files/308-netdevice.patch b/app-emulation/vmware-modules/files/308-netdevice.patch
new file mode 100644
index 00000000000..35231a3205e
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-netdevice.patch
@@ -0,0 +1,24 @@
+diff --git a/vmnet-only/compat_netdevice.h b/vmnet-only/compat_netdevice.h
+index 7a56304..9ff4548 100644
+--- a/vmnet-only/compat_netdevice.h
++++ b/vmnet-only/compat_netdevice.h
+@@ -47,6 +47,19 @@
+ # define net_device device
+ #endif
+
++/* it looks like these have been removed from the kernel 3.1
++ * probably because the "transition" is considered complete.
++ * so to keep this source compatible we just redefine them like they were
++ * previously
++ */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
++#define HAVE_ALLOC_NETDEV /* feature macro: alloc_xxxdev
++ functions are available. */
++#define HAVE_FREE_NETDEV /* free_netdev() */
++#define HAVE_NETDEV_PRIV /* netdev_priv() */
++#define HAVE_NETIF_QUEUE
++#define HAVE_NET_DEVICE_OPS
++#endif
+
+ /*
+ * SET_MODULE_OWNER appeared sometime during 2.3.x. It was setting
diff --git a/app-emulation/vmware-modules/vmware-modules-308.1.0.ebuild b/app-emulation/vmware-modules/vmware-modules-308.1.0.ebuild
new file mode 100644
index 00000000000..98a4bd439ae
--- /dev/null
+++ b/app-emulation/vmware-modules/vmware-modules-308.1.0.ebuild
@@ -0,0 +1,149 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod user versionator udev
+
+PV_MAJOR=$(get_major_version)
+PV_MINOR=$(get_version_component_range 2-3)
+
+DESCRIPTION="VMware kernel modules"
+HOMEPAGE="http://www.vmware.com/"
+
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="pax_kernel +vmci +vsock"
+REQUIRED_USE="!vsock? ( !vmci )"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ || ( =app-emulation/vmware-player-12.${PV_MINOR}*
+ =app-emulation/vmware-workstation-12.${PV_MINOR}* )"
+
+S=${WORKDIR}
+
+pkg_setup() {
+ CONFIG_CHECK="~HIGH_RES_TIMERS"
+ if kernel_is ge 2 6 37 && kernel_is lt 2 6 39; then
+ CONFIG_CHECK="${CONFIG_CHECK} BKL"
+ fi
+ if use vmci ; then
+ CONFIG_CHECK="${CONFIG_CHECK} !VMWARE_VMCI"
+ else
+ CONFIG_CHECK="${CONFIG_CHECK} VMWARE_VMCI"
+ fi
+ if use vsock ; then
+ CONFIG_CHECK="${CONFIG_CHECK} !VMWARE_VMCI_VSOCKETS"
+ else
+ CONFIG_CHECK="${CONFIG_CHECK} VMWARE_VMCI_VSOCKETS"
+ fi
+
+ linux-info_pkg_setup
+
+ linux-mod_pkg_setup
+
+ VMWARE_GROUP=${VMWARE_GROUP:-vmware}
+
+ VMWARE_MODULE_LIST_ALL="vmblock vmmon vmnet vmci vsock"
+ VMWARE_MODULE_LIST="vmblock vmmon vmnet"
+ use vmci && VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmci"
+ use vsock && VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vsock"
+
+ VMWARE_MOD_DIR="${PN}-${PVR}"
+
+ BUILD_TARGETS="auto-build KERNEL_DIR=${KERNEL_DIR} KBUILD_OUTPUT=${KV_OUT_DIR}"
+
+ enewgroup "${VMWARE_GROUP}"
+
+ filter-flags -mfpmath=sse -mavx -mpclmul -maes
+ append-cflags -mno-sse # Found a problem similar to bug #492964
+
+ for mod in ${VMWARE_MODULE_LIST}; do
+ MODULE_NAMES="${MODULE_NAMES} ${mod}(misc:${S}/${mod}-only)"
+ done
+}
+
+src_unpack() {
+ cd "${S}"
+ for mod in ${VMWARE_MODULE_LIST_ALL}; do
+ tar -xf /opt/vmware/lib/vmware/modules/source/${mod}.tar
+ done
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PV_MAJOR}-makefile-kernel-dir.patch"
+ epatch "${FILESDIR}/${PV_MAJOR}-makefile-include.patch"
+ epatch "${FILESDIR}/${PV_MAJOR}-netdevice.patch"
+ use pax_kernel && epatch "${FILESDIR}/${PV_MAJOR}-hardened.patch"
+ epatch "${FILESDIR}/${PV_MAJOR}-apic.patch"
+
+ kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.10-00-dentry.patch"
+ kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.10-01-inode.patch"
+ kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.10-02-control.patch"
+ kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.10-03-inline.patch"
+ kernel_is ge 3 11 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.11-00-readdir.patch"
+ kernel_is ge 3 11 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.11-01-filldir.patch"
+ kernel_is ge 3 15 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.15-00-vsock.patch"
+ kernel_is ge 3 18 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.18-00-version-redefined.patch"
+ kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-00-compat-namei.patch"
+ kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-02-vmblock-path.patch"
+ kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-04-iovec.patch"
+ 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 01 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.01-00-vsock.patch"
+ kernel_is ge 4 02 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.02-00-nd_set_link.patch"
+ kernel_is ge 4 02 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.02-01-sk_alloc.patch"
+ kernel_is ge 4 03 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.03-00-vmci-misc_deregister.patch"
+
+ # Allow user patches so they can support RC kernels and whatever else
+ epatch_user
+}
+
+src_install() {
+ linux-mod_src_install
+ local udevrules="${T}/60-vmware.rules"
+ cat > "${udevrules}" <<-EOF
+ KERNEL=="vmci", GROUP="vmware", MODE="660"
+ KERNEL=="vmw_vmci", GROUP="vmware", MODE="660"
+ KERNEL=="vmmon", GROUP="vmware", MODE="660"
+ KERNEL=="vsock", GROUP="vmware", MODE="660"
+ EOF
+ udev_dorules "${udevrules}"
+
+ if ! use vmci ; then
+ dodir /etc/modprobe.d/
+
+ cat > "${D}"/etc/modprobe.d/vmware.conf <<-EOF
+ # Support for vmware vmci in kernel module
+ alias vmci vmw_vmci
+ EOF
+
+ export installed_modprobe_conf=1
+ fi
+ if ! use vsock ; then
+ dodir /etc/modprobe.d/
+ cat >> "${D}"/etc/modprobe.d/vmware.conf <<-EOF
+ # Support for vmware vsock in kernel module
+ alias vsock vmw_vsock_vmci_transport
+ EOF
+
+ export installed_modprobe_conf=1
+ fi
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+ if [ "${installed_modprobe_conf}"x == "x" ] ; then
+ if [ -f "${ROOT}/etc/modprobe.d/vmware.conf" ] ; then
+ ewarn "Please check the /etc/modprobe.d/vmware.conf file and"
+ ewarn "possible conflicts when using vmci and/or vsock modules built"
+ ewarn "out of kernel"
+ fi
+ fi
+}