commit:     8435434eab0fc7c5d08581822ebda283458578c1
Author:     Evan Teran <evan.teran <AT> gmail <DOT> com>
AuthorDate: Sat Oct 11 15:40:41 2014 +0000
Commit:     Evan Teran <evan.teran <AT> gmail <DOT> com>
CommitDate: Sat Oct 11 15:40:41 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/vmware.git;a=commit;h=8435434e
adding vmware-modules-279.2-r1, (workstation 10) which compiles cleanrly on 
3.10.0, 3.11.0 and 3.12.0

---
 .../vmware-modules/files/279-3.10-00-userns.patch  |  37 +++++++
 .../vmware-modules/files/279-3.10-01-getname.patch |  19 ++++
 .../files/279-3.10-02-unused-typedef.patch         | 112 ++++++++++++++++++++
 .../vmware-modules/files/279-3.10-03-dentry.patch  |  30 ++++++
 .../vmware-modules/files/279-3.10-04-inode.patch   |  31 ++++++
 .../vmware-modules/files/279-3.10-05-hub.patch     |  21 ++++
 app-emulation/vmware-modules/files/279-apic.patch  |  12 +++
 .../vmware-modules/files/279-filldir.patch         |  91 +++++++++++++++++
 .../vmware-modules/files/279-hardened.patch        | 113 +++++++++++++++++++++
 .../files/279-makefile-include.patch               |  65 ++++++++++++
 .../files/279-makefile-kernel-dir.patch            |  85 ++++++++++++++++
 .../vmware-modules/files/279-netdevice.patch       |  24 +++++
 .../vmware-modules/files/279-putname.patch         |  13 +++
 .../vmware-modules/files/279-vmblock.patch         |  23 +++++
 .../vmware-modules/vmware-modules-279.2-r1.ebuild  | 109 ++++++++++++++++++++
 15 files changed, 785 insertions(+)

diff --git a/app-emulation/vmware-modules/files/279-3.10-00-userns.patch 
b/app-emulation/vmware-modules/files/279-3.10-00-userns.patch
new file mode 100644
index 0000000..c960b78
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-3.10-00-userns.patch
@@ -0,0 +1,37 @@
+--- a/vmblock-only/linux/inode.c   2013-03-20 17:37:48.000000000 +0100
++++ b/vmblock-only/linux/inode.c   2013-03-20 17:41:22.000000000 +0100
+@@ -135,7 +135,8 @@
+    inode->i_size = INODE_TO_IINFO(inode)->nameLen;
+    inode->i_version = 1;
+    inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+-   inode->i_uid = inode->i_gid = 0;
++   inode->i_uid = GLOBAL_ROOT_UID;
++   inode->i_gid = GLOBAL_ROOT_GID;
+    inode->i_op = &LinkInodeOps;
+ 
+    d_add(dentry, inode);
+
+--- a/vmci-only/linux/driver.c    2013-03-20 17:57:35.000000000 +0100
++++ b/vmci-only/linux/driver.c    2013-03-20 17:57:43.000000000 +0100
+@@ -740,7 +740,7 @@
+          goto init_release;
+       }
+ 
+-      user = current_uid();
++      user = from_kuid(current_user_ns(), current_uid());
+       retval = VMCIContext_InitContext(initBlock.cid, initBlock.flags,
+                                        0 /* Unused */, vmciLinux->userVersion,
+                                        &user, &vmciLinux->context);
+
+--- a/vsock-only/linux/af_vsock.c 2013-03-20 18:01:48.000000000 +0100
++++ b/vsock-only/linux/af_vsock.c 2013-03-20 18:01:58.000000000 +0100
+@@ -2866,7 +2866,7 @@
+       vsk->connectTimeout = psk->connectTimeout;
+    } else {
+       vsk->trusted = capable(CAP_NET_ADMIN);
+-      vsk->owner = current_uid();
++      vsk->owner = from_kuid(current_user_ns(), current_uid());
+       vsk->queuePairSize = VSOCK_DEFAULT_QP_SIZE;
+       vsk->queuePairMinSize = VSOCK_DEFAULT_QP_SIZE_MIN;
+       vsk->queuePairMaxSize = VSOCK_DEFAULT_QP_SIZE_MAX;
+

diff --git a/app-emulation/vmware-modules/files/279-3.10-01-getname.patch 
b/app-emulation/vmware-modules/files/279-3.10-01-getname.patch
new file mode 100644
index 0000000..7bcf536
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-3.10-01-getname.patch
@@ -0,0 +1,19 @@
+--- vmblock-only/linux/control.c       2014-03-15 15:28:40.871076076 +0100
++++ vmblock-only/linux/control.c.new   2014-03-15 15:29:15.079074439 +0100
+@@ -279,11 +279,17 @@
+    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--) {

diff --git 
a/app-emulation/vmware-modules/files/279-3.10-02-unused-typedef.patch 
b/app-emulation/vmware-modules/files/279-3.10-02-unused-typedef.patch
new file mode 100644
index 0000000..d030110
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-3.10-02-unused-typedef.patch
@@ -0,0 +1,112 @@
+--- vmblock-only/shared/vm_assert.h    2014-10-07 22:43:39.519402467 -0400
++++ vmblock-only/shared/vm_assert.h    2014-10-07 22:48:01.346409957 -0400
+@@ -317,7 +317,7 @@ EXTERN void WarningThrottled(uint32 *cou
+ #define ASSERT_ON_COMPILE(e) \
+    do { \
+       enum { AssertOnCompileMisused = ((e) ? 1 : -1) }; \
+-      typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
++      __attribute__((unused)) typedef char 
AssertOnCompileFailed[AssertOnCompileMisused]; \
+    } while (0)
+ 
+ 
+--- vmci-only/shared/vm_assert.h       2014-10-07 22:43:39.519402467 -0400
++++ vmci-only/shared/vm_assert.h       2014-10-07 22:47:51.829409685 -0400
+@@ -317,7 +317,7 @@ EXTERN void WarningThrottled(uint32 *cou
+ #define ASSERT_ON_COMPILE(e) \
+    do { \
+       enum { AssertOnCompileMisused = ((e) ? 1 : -1) }; \
+-      typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
++      __attribute__((unused)) typedef char 
AssertOnCompileFailed[AssertOnCompileMisused]; \
+    } while (0)
+ 
+ 
+--- vmmon-only/include/vm_assert.h     2014-10-07 22:43:39.520402467 -0400
++++ vmmon-only/include/vm_assert.h     2014-10-07 22:47:39.246409325 -0400
+@@ -317,7 +317,7 @@ EXTERN void WarningThrottled(uint32 *cou
+ #define ASSERT_ON_COMPILE(e) \
+    do { \
+       enum { AssertOnCompileMisused = ((e) ? 1 : -1) }; \
+-      typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
++      __attribute__((unused)) typedef char 
AssertOnCompileFailed[AssertOnCompileMisused]; \
+    } while (0)
+ 
+ 
+--- vmnet-only/vm_assert.h     2014-10-07 22:43:39.520402467 -0400
++++ vmnet-only/vm_assert.h     2014-10-07 22:47:55.804409799 -0400
+@@ -317,7 +317,7 @@ EXTERN void WarningThrottled(uint32 *cou
+ #define ASSERT_ON_COMPILE(e) \
+    do { \
+       enum { AssertOnCompileMisused = ((e) ? 1 : -1) }; \
+-      typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
++      __attribute__((unused)) typedef char 
AssertOnCompileFailed[AssertOnCompileMisused]; \
+    } while (0)
+ 
+ 
+--- vsock-only/shared/vm_assert.h      2014-10-07 22:47:11.595408534 -0400
++++ vsock-only/shared/vm_assert.h      2014-10-07 22:45:55.715406363 -0400
+@@ -317,7 +317,7 @@ EXTERN void WarningThrottled(uint32 *cou
+ #define ASSERT_ON_COMPILE(e) \
+    do { \
+       enum { AssertOnCompileMisused = ((e) ? 1 : -1) }; \
+-      typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
++      __attribute__((unused)) typedef char 
AssertOnCompileFailed[AssertOnCompileMisused]; \
+    } while (0)
+ 
+ 
+--- vsock-only/shared/vm_atomic.h      2013-11-05 23:33:27.000000000 -0500
++++ vsock-only/shared/vm_atomic.h      2014-10-07 22:53:06.024418673 -0400
+@@ -2394,7 +2394,7 @@ Atomic_TestBit64(Atomic_uint64 *var, //
+                                       && 8 * sizeof (out) == size             
\
+                                       && 8 * sizeof (cast) == size            
\
+                                          ? 1 : -1 };                          
\
+-      typedef char AssertOnCompileFailed[AssertOnCompileMisused];             
\
++      __attribute__((unused)) typedef char 
AssertOnCompileFailed[AssertOnCompileMisused];             \
+    }                                                                          
\
+                                                                               
\
+                                                                               
\
+--- vmci-only/shared/vm_atomic.h       2013-11-05 23:33:27.000000000 -0500
++++ vmci-only/shared/vm_atomic.h       2014-10-07 22:53:24.873419213 -0400
+@@ -2394,7 +2394,7 @@ Atomic_TestBit64(Atomic_uint64 *var, //
+                                       && 8 * sizeof (out) == size             
\
+                                       && 8 * sizeof (cast) == size            
\
+                                          ? 1 : -1 };                          
\
+-      typedef char AssertOnCompileFailed[AssertOnCompileMisused];             
\
++      __attribute__((unused)) typedef char 
AssertOnCompileFailed[AssertOnCompileMisused];             \
+    }                                                                          
\
+                                                                               
\
+                                                                               
\
+
+--- vmblock-only/shared/vm_atomic.h    2013-11-05 23:33:27.000000000 -0500
++++ vmblock-only/shared/vm_atomic.h    2014-10-07 22:53:31.073419390 -0400
+@@ -2394,7 +2394,7 @@ Atomic_TestBit64(Atomic_uint64 *var, //
+                                       && 8 * sizeof (out) == size             
\
+                                       && 8 * sizeof (cast) == size            
\
+                                          ? 1 : -1 };                          
\
+-      typedef char AssertOnCompileFailed[AssertOnCompileMisused];             
\
++      __attribute__((unused)) typedef char 
AssertOnCompileFailed[AssertOnCompileMisused];             \
+    }                                                                          
\
+                                                                               
\
+
+--- vmnet-only/vm_atomic.h     2013-11-06 00:40:52.000000000 -0500
++++ vmnet-only/vm_atomic.h     2014-10-07 23:04:50.637438831 -0400
+@@ -2394,7 +2394,7 @@ Atomic_TestBit64(Atomic_uint64 *var, //
+                                       && 8 * sizeof (out) == size             
\
+                                       && 8 * sizeof (cast) == size            
\
+                                          ? 1 : -1 };                          
\
+-      typedef char AssertOnCompileFailed[AssertOnCompileMisused];             
\
++      __attribute__((unused)) typedef char 
AssertOnCompileFailed[AssertOnCompileMisused];             \
+    }                                                                          
\
+                                                                               
\
+                                                                               
\
+                                                                               
                                                                           
+--- vmmon-only/include/vm_atomic.h   2013-11-06 00:40:52.000000000 -0500
++++ vmmon-only/include/vm_atomic.h   2014-10-07 23:04:50.637438831 -0400
+@@ -2394,7 +2394,7 @@ Atomic_TestBit64(Atomic_uint64 *var, //
+                                       && 8 * sizeof (out) == size             
\
+                                       && 8 * sizeof (cast) == size            
\
+                                          ? 1 : -1 };                          
\
+-      typedef char AssertOnCompileFailed[AssertOnCompileMisused];             
\
++      __attribute__((unused)) typedef char 
AssertOnCompileFailed[AssertOnCompileMisused];             \
+    }                                                                          
\
+                                                                               
\
+                                                                               
\

diff --git a/app-emulation/vmware-modules/files/279-3.10-03-dentry.patch 
b/app-emulation/vmware-modules/files/279-3.10-03-dentry.patch
new file mode 100644
index 0000000..8acecf5
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-3.10-03-dentry.patch
@@ -0,0 +1,30 @@
+diff -Naur vmblock-only/linux/dentry.c vmblock-only/linux/dentry.c
+--- vmblock-only/linux/dentry.c        2013-11-05 23:33:26.000000000 -0500
++++ vmblock-only/linux/dentry.c        2014-04-26 10:58:03.062635343 -0400
+@@ -32,7 +32,7 @@
+ #include "block.h"
+ 
+ 
+-static int DentryOpRevalidate(struct dentry *dentry, struct nameidata *nd);
++static int DentryOpRevalidate(struct dentry *dentry, unsigned int flags);
+ 
+ struct dentry_operations LinkDentryOps = {
+    .d_revalidate = DentryOpRevalidate,
+@@ -60,7 +60,7 @@
+ 
+ static int
+ DentryOpRevalidate(struct dentry *dentry,  // IN: dentry revalidating
+-                   struct nameidata *nd)   // IN: lookup flags & intent
++                   unsigned int flags)   // IN: lookup flags & intent
+ {
+    VMBlockInodeInfo *iinfo;
+    struct nameidata actualNd;
+@@ -101,7 +101,7 @@
+    if (actualDentry &&
+        actualDentry->d_op &&
+        actualDentry->d_op->d_revalidate) {
+-      return actualDentry->d_op->d_revalidate(actualDentry, nd);
++      return actualDentry->d_op->d_revalidate(actualDentry, flags);
+    }
+ 
+    if (compat_path_lookup(iinfo->name, 0, &actualNd)) {

diff --git a/app-emulation/vmware-modules/files/279-3.10-04-inode.patch 
b/app-emulation/vmware-modules/files/279-3.10-04-inode.patch
new file mode 100644
index 0000000..0d30dbe
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-3.10-04-inode.patch
@@ -0,0 +1,31 @@
+diff -Naur vmblock-only/linux/inode.c vmblock-only/linux/inode.c
+--- vmblock-only/linux/inode.c 2013-11-05 23:33:26.000000000 -0500
++++ vmblock-only/linux/inode.c 2014-04-26 10:58:03.063635343 -0400
+@@ -36,7 +36,7 @@
+ 
+ /* Inode operations */
+ static struct dentry *InodeOpLookup(struct inode *dir,
+-                                    struct dentry *dentry, struct nameidata 
*nd);
++                                    struct dentry *dentry, unsigned int 
flags);
+ static int InodeOpReadlink(struct dentry *dentry, char __user *buffer, int 
buflen);
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+ static void *InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd);
+@@ -75,7 +75,7 @@
+ 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
++              unsigned int flags)   // IN: lookup intent and information
+ {
+    char *filename;
+    struct inode *inode;
+@@ -221,7 +221,8 @@
+       goto out;
+    }
+ 
+-   ret = vfs_follow_link(nd, iinfo->name);
++   nd_set_link(nd, iinfo->name);
++   ret = 0;
+ 
+ out:
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)

diff --git a/app-emulation/vmware-modules/files/279-3.10-05-hub.patch 
b/app-emulation/vmware-modules/files/279-3.10-05-hub.patch
new file mode 100644
index 0000000..50ab341
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-3.10-05-hub.patch
@@ -0,0 +1,21 @@
+diff -rupN vmnet-only/hub.c vmnet-only.new/hub.c
+--- vmnet-only/hub.c   2013-11-06 00:40:52.000000000 -0500
++++ vmnet-only.new/hub.c       2014-10-07 18:45:34.403918680 -0400
+@@ -129,7 +129,7 @@ VNetHubFindHubByID(uint8 idNum[VNET_PVN_
+ {
+    VNetHub *currHub = vnetHub;
+    while (currHub && (currHub->hubType != HUB_TYPE_PVN ||
+-                    memcmp(idNum, currHub->id.pvnID, sizeof idNum))) {
++                    memcmp(idNum, currHub->id.pvnID, VNET_PVN_ID_LEN))) {
+       currHub = currHub->next;
+    }
+    return currHub;
+@@ -312,7 +312,7 @@ VNetHubAlloc(Bool allocPvn, // IN: TRUE
+ 
+       if (allocPvn) {
+        hub->hubType = HUB_TYPE_PVN;
+-       memcpy(hub->id.pvnID, id, sizeof id);
++       memcpy(hub->id.pvnID, id, VNET_PVN_ID_LEN);
+        ++pvnInstance;
+       } else {
+        hub->hubType = HUB_TYPE_VNET;

diff --git a/app-emulation/vmware-modules/files/279-apic.patch 
b/app-emulation/vmware-modules/files/279-apic.patch
new file mode 100644
index 0000000..66cd459
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-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/279-filldir.patch 
b/app-emulation/vmware-modules/files/279-filldir.patch
new file mode 100644
index 0000000..6eb1f31
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-filldir.patch
@@ -0,0 +1,91 @@
+diff --git a/vmblock-only/linux/file.c b/vmblock-only/linux/file.c
+index d7ac1f6..5499169 100644
+--- a/vmblock-only/linux/file.c
++++ b/vmblock-only/linux/file.c
+@@ -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 */
+ 
+ /*
+@@ -166,11 +126,10 @@ FileOpOpen(struct inode *inode,  // IN
+ 
+ static int
+ FileOpReaddir(struct file *file,  // IN
+-              void *dirent,       // IN
+-              filldir_t filldir)  // IN
++              struct dir_context *ctx)  // IN
+ {
+    int ret;
+-   FilldirInfo info;
++
+    struct file *actualFile;
+ 
+    if (!file) {
+@@ -184,12 +143,10 @@ FileOpReaddir(struct file *file,  // IN
+       return -EINVAL;
+    }
+ 
+-   info.filldir = filldir;
+-   info.dirent = dirent;
+-
+-   actualFile->f_pos = file->f_pos;
+-   ret = vfs_readdir(actualFile, Filldir, &info);
+-   file->f_pos = actualFile->f_pos;
++   /* Ricky Wong Yung Fei:
++    * Manipulation of pos is now handled internally by iterate_dir().
++    */
++   ret = iterate_dir(actualFile, ctx);
+ 
+    return ret;
+ }
+@@ -237,7 +194,7 @@ FileOpRelease(struct inode *inode, // IN
+ 
+ 
+ struct file_operations RootFileOps = {
+-   .readdir = FileOpReaddir,
++   .iterate = FileOpReaddir,
+    .open    = FileOpOpen,
+    .release = FileOpRelease,
+ };

diff --git a/app-emulation/vmware-modules/files/279-hardened.patch 
b/app-emulation/vmware-modules/files/279-hardened.patch
new file mode 100644
index 0000000..cc3e041
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-hardened.patch
@@ -0,0 +1,113 @@
+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,22 @@ 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,
++#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;
+ 
+ /*
+@@ -357,27 +372,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 --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,22 @@ 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,
++#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",

diff --git a/app-emulation/vmware-modules/files/279-makefile-include.patch 
b/app-emulation/vmware-modules/files/279-makefile-include.patch
new file mode 100644
index 0000000..39c3000
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-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/279-makefile-kernel-dir.patch 
b/app-emulation/vmware-modules/files/279-makefile-kernel-dir.patch
new file mode 100644
index 0000000..1a647a3
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-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/279-netdevice.patch 
b/app-emulation/vmware-modules/files/279-netdevice.patch
new file mode 100644
index 0000000..35231a3
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-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/files/279-putname.patch 
b/app-emulation/vmware-modules/files/279-putname.patch
new file mode 100644
index 0000000..6e76130
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-putname.patch
@@ -0,0 +1,13 @@
+diff --git a/vmblock-only/linux/control.c b/vmblock-only/linux/control.c
+index 79716bd..2dd83fe 100644
+--- a/vmblock-only/linux/control.c
++++ b/vmblock-only/linux/control.c
+@@ -293,7 +293,7 @@ ExecuteBlockOp(const char __user *buf,                // 
IN: buffer with name
+ 
+    retval = i < 0 ? -EINVAL : blockOp(name, blocker);
+ 
+-   putname(name);
++   __putname(name);
+ 
+    return retval;
+ }

diff --git a/app-emulation/vmware-modules/files/279-vmblock.patch 
b/app-emulation/vmware-modules/files/279-vmblock.patch
new file mode 100644
index 0000000..0daf603
--- /dev/null
+++ b/app-emulation/vmware-modules/files/279-vmblock.patch
@@ -0,0 +1,23 @@
+diff -ruN work.orig/vmblock-only/linux/control.c 
work/vmblock-only/linux/control.c
+--- work.orig/vmblock-only/linux/control.c     2013-11-02 18:05:39.960226399 
+0100
++++ work/vmblock-only/linux/control.c  2013-11-02 18:09:11.760231432 +0100
+@@ -208,17 +208,14 @@
+    VMBlockSetProcEntryOwner(controlProcMountpoint);
+ 
+    /* Create /proc/fs/vmblock/dev */
+-   controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
+-                                        VMBLOCK_CONTROL_MODE,
+-                                        controlProcDirEntry);
+-   if (!controlProcEntry) {
++   controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME, 
VMBLOCK_CONTROL_MODE, controlProcDirEntry, &ControlFileOps);
++   if (controlProcEntry == NULL) {
+       Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
+       remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
+       remove_proc_entry(VMBLOCK_CONTROL_PROC_DIRNAME, NULL);
+       return -EINVAL;
+    }
+ 
+-   controlProcEntry->proc_fops = &ControlFileOps;
+    return 0;
+ }
+ 

diff --git a/app-emulation/vmware-modules/vmware-modules-279.2-r1.ebuild 
b/app-emulation/vmware-modules/vmware-modules-279.2-r1.ebuild
new file mode 100644
index 0000000..1212ca8
--- /dev/null
+++ b/app-emulation/vmware-modules/vmware-modules-279.2-r1.ebuild
@@ -0,0 +1,109 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: 
/var/cvsroot/gentoo-x86/app-emulation/vmware-modules/vmware-modules-279.2.ebuild,v
 1.5 2014/06/09 15:24:07 dilfridge Exp $
+
+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)
+
+DESCRIPTION="VMware kernel modules"
+HOMEPAGE="http://www.vmware.com/";
+
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="pax_kernel +vmci +vsock"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+       || ( =app-emulation/vmware-player-6.0.${PV_MINOR}*
+       =app-emulation/vmware-workstation-10.0.${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
+
+       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}/279-hardened.patch"
+       epatch "${FILESDIR}/${PV_MAJOR}-apic.patch"
+       kernel_is ge 3 7 0 && epatch "${FILESDIR}/${PV_MAJOR}-putname.patch"
+       kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-vmblock.patch"
+       kernel_is ge 3 10 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-3.10-00-userns.patch"
+       kernel_is ge 3 10 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-3.10-01-getname.patch"
+       kernel_is ge 3 10 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-3.10-02-unused-typedef.patch"
+       kernel_is ge 3 10 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-3.10-03-dentry.patch"
+       kernel_is ge 3 10 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-3.10-04-inode.patch"
+
+       # fixes a memcpy/memcmp bug in the hub code
+       kernel_is ge 3 10 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-3.10-05-hub.patch"
+       
+       kernel_is ge 3 11 0 && epatch "${FILESDIR}/${PV_MAJOR}-filldir.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}"
+}

Reply via email to