open-vm-tools-kernel

This commit is contained in:
milisbir 2018-03-01 10:45:05 +02:00
parent 65630b8159
commit f628546d1e
6 changed files with 326 additions and 0 deletions

View File

@ -0,0 +1,74 @@
From 08836a47c56b47b658025e41a20027c5d915f836 Mon Sep 17 00:00:00 2001
From: "Scott M. Kroll" <skroll@gmail.com>
Date: Fri, 15 Aug 2014 10:40:38 -0400
Subject: [PATCH 1/3] Fix vmxnet module on kernels >= 3.16
* Add compat check for ethtool_ops in net_device struct.
* SET_ETHTOOL_OPS is no longer defined, but can be manually.
---
open-vm-tools/modules/linux/shared/compat_netdevice.h | 4 ++++
open-vm-tools/modules/linux/vmxnet/vmxnet.c | 13 ++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/open-vm-tools/modules/linux/shared/compat_netdevice.h b/open-vm-tools/modules/linux/shared/compat_netdevice.h
index 3aec25b..a65d59b 100644
--- a/open-vm-tools/modules/linux/shared/compat_netdevice.h
+++ b/open-vm-tools/modules/linux/shared/compat_netdevice.h
@@ -337,4 +337,8 @@ typedef netdev_features_t compat_netdev_features_t;
typedef u32 compat_netdev_features_t;
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) || defined(SET_ETHTOOL_OPS)
+#define VMW_HAVE_ETHTOOL_OPS 1
+#endif
+
#endif /* __COMPAT_NETDEVICE_H__ */
diff --git a/open-vm-tools/modules/linux/vmxnet/vmxnet.c b/open-vm-tools/modules/linux/vmxnet/vmxnet.c
index 33afb9b..40abde5 100644
--- a/open-vm-tools/modules/linux/vmxnet/vmxnet.c
+++ b/open-vm-tools/modules/linux/vmxnet/vmxnet.c
@@ -279,8 +279,7 @@ vmxnet_change_mtu(struct net_device *dev, int new_mtu)
#endif
-
-#ifdef SET_ETHTOOL_OPS
+#ifdef VMW_HAVE_ETHTOOL_OPS
/*
*----------------------------------------------------------------------------
*
@@ -526,7 +525,7 @@ vmxnet_ethtool_ops = {
};
-#else /* !defined(SET_ETHTOOL_OPS) */
+#else /* !defined(VMW_HAVE_ETHTOOL_OPS) */
/*
@@ -739,7 +738,7 @@ vmxnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
}
return -EOPNOTSUPP;
}
-#endif /* SET_ETHTOOL_OPS */
+#endif /* !defined(VMW_HAVE_ETHTOOL_OPS) */
/*
@@ -1142,8 +1141,12 @@ vmxnet_probe_device(struct pci_dev *pdev, // IN: vmxnet PCI device
dev->watchdog_timeo = VMXNET_WATCHDOG_TIMEOUT;
#endif
-#ifdef SET_ETHTOOL_OPS
+#ifdef VMW_HAVE_ETHTOOL_OPS
+# ifdef SET_ETHTOOL_OPS
SET_ETHTOOL_OPS(dev, &vmxnet_ethtool_ops);
+# else
+ dev->ethtool_ops = &vmxnet_ethtool_ops;
+# endif
#else
dev->do_ioctl = vmxnet_ioctl;
#endif
--
2.3.4

View File

@ -0,0 +1,86 @@
From 122f184d946a007a7ba3ae68386a20f33ed62e1e Mon Sep 17 00:00:00 2001
From: lotan <lotan@gmx.de>
Date: Mon, 8 Jun 2015 14:20:06 +0200
Subject: [PATCH] Support backing dev info kernel 4.0.
---
open-vm-tools/modules/linux/vmhgfs/filesystem.c | 16 ++++++++++++++++
open-vm-tools/modules/linux/vmhgfs/module.h | 4 ++++
open-vm-tools/modules/linux/vmhgfs/super.c | 3 +++
3 files changed, 23 insertions(+)
diff --git a/open-vm-tools/modules/linux/vmhgfs/filesystem.c b/open-vm-tools/modules/linux/vmhgfs/filesystem.c
index 10dd8ab..3148091 100644
--- a/open-vm-tools/modules/linux/vmhgfs/filesystem.c
+++ b/open-vm-tools/modules/linux/vmhgfs/filesystem.c
@@ -398,8 +398,21 @@ HgfsReadSuper(struct super_block *sb, // OUT: Superblock object
return PTR_ERR(si);
}
HGFS_SET_SB_TO_COMMON(sb, si);
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
+ memset(&si->bdi, 0, sizeof(si->bdi));
+ result = bdi_setup_and_register(&si->bdi, "vmhgfs");
+ if (result) {
+ kfree(si->shareName);
+ kfree(si);
+ }
+#endif
+
sb->s_magic = HGFS_SUPER_MAGIC;
sb->s_op = &HgfsSuperOperations;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
+ sb->s_bdi = &si->bdi;
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
sb->s_d_op = &HgfsDentryOperations;
@@ -439,6 +452,9 @@ HgfsReadSuper(struct super_block *sb, // OUT: Superblock object
exit:
if (result) {
dput(rootDentry);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
+ bdi_destroy(&si->bdi);
+#endif
kfree(si->shareName);
kfree(si);
}
diff --git a/open-vm-tools/modules/linux/vmhgfs/module.h b/open-vm-tools/modules/linux/vmhgfs/module.h
index b673dc1..f3eeffc 100644
--- a/open-vm-tools/modules/linux/vmhgfs/module.h
+++ b/open-vm-tools/modules/linux/vmhgfs/module.h
@@ -29,6 +29,7 @@
#include "driver-config.h"
#include <asm/atomic.h>
+#include <linux/backing-dev.h>
#include "compat_fs.h"
#include "compat_semaphore.h"
#include "compat_slab.h"
@@ -144,6 +145,9 @@ typedef struct HgfsSuperInfo {
char *shareName; /* Mounted share name. */
size_t shareNameLen; /* To avoid repeated strlen() calls. */
uint32 mntFlags; /* HGFS mount flags */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
+ struct backing_dev_info bdi;
+#endif
} HgfsSuperInfo;
/*
diff --git a/open-vm-tools/modules/linux/vmhgfs/super.c b/open-vm-tools/modules/linux/vmhgfs/super.c
index 04a2192..41f8713 100644
--- a/open-vm-tools/modules/linux/vmhgfs/super.c
+++ b/open-vm-tools/modules/linux/vmhgfs/super.c
@@ -152,6 +152,9 @@ HgfsPutSuper(struct super_block *sb) // IN: The superblock
si = HGFS_SB_TO_COMMON(sb);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
+ bdi_destroy(&si->bdi);
+#endif
kfree(si->shareName);
kfree(si);
}
--
2.3.6

View File

@ -0,0 +1,27 @@
From fbb6fe5ec57a2a0a9464ec5c433fc18793ebb05f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?D=C4=81vis?= <davispuh@gmail.com>
Date: Thu, 17 Sep 2015 18:05:29 +0300
Subject: [PATCH] Remove new_sync for Linux >= 4.1
---
open-vm-tools/modules/linux/vmhgfs/file.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/open-vm-tools/modules/linux/vmhgfs/file.c b/open-vm-tools/modules/linux/vmhgfs/file.c
index 0bc5ee3..ada3eee 100644
--- a/open-vm-tools/modules/linux/vmhgfs/file.c
+++ b/open-vm-tools/modules/linux/vmhgfs/file.c
@@ -169,8 +169,10 @@ struct file_operations HgfsFileFileOperations = {
.flush = HgfsFlush,
#if defined VMW_USE_AIO
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
.read = new_sync_read,
.write = new_sync_write,
+#endif // LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
.read_iter = HgfsFileRead,
.write_iter = HgfsFileWrite,
#else // LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
---
2.5.2

View File

@ -0,0 +1,93 @@
From b3a634a491da35d47a5e6e6120a21cba514fc3ec Mon Sep 17 00:00:00 2001
From: JackM
Date: Wed, 30 Sep 2015 23:16:40 +0300
Subject: [PATCH] vmhgfs support linux 4.2.x kernel
---
modules/linux/vmhgfs/link.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/open-vm-tools/modules/linux/vmhgfs/link.c b/open-vm-tools/modules/linux/vmhgfs/link.c
index 06f693b..72e97ff 100644
--- a/open-vm-tools/modules/linux/vmhgfs/link.c
+++ b/open-vm-tools/modules/linux/vmhgfs/link.c
@@ -35,7 +35,9 @@
#include "vm_assert.h"
/* HGFS symlink operations. */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+static void *HgfsFollowlink(struct dentry *dentry, void **cookie, struct nameidata *nd);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
static void *HgfsFollowlink(struct dentry *dentry,
struct nameidata *nd);
#else
@@ -45,7 +47,10 @@ static int HgfsFollowlink(struct dentry *dentry,
static int HgfsReadlink(struct dentry *dentry,
char __user *buffer,
int buflen);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+static void HgfsPutlink(struct dentry *dentry,
+ void *cookie);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
static void HgfsPutlink(struct dentry *dentry,
struct nameidata *nd,
void *cookie);
@@ -85,7 +90,9 @@ struct inode_operations HgfsLinkInodeOperations = {
*----------------------------------------------------------------------
*/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+static void *HgfsFollowlink(struct dentry *dentry, void **cookie, struct nameidata *nd)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
static void *
HgfsFollowlink(struct dentry *dentry, // IN: Dentry containing link
struct nameidata *nd) // OUT: Contains target dentry
@@ -124,7 +131,11 @@ HgfsFollowlink(struct dentry *dentry, // IN: Dentry containing link
} else {
LOG(6, (KERN_DEBUG "VMware hgfs: %s: calling nd_set_link %s\n",
__func__, fileName));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+ *cookie = fileName;
+#else
nd_set_link(nd, fileName);
+#endif
}
}
out:
@@ -219,7 +230,10 @@ HgfsReadlink(struct dentry *dentry, // IN: Dentry containing link
*----------------------------------------------------------------------
*/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+static void HgfsPutlink(struct dentry *dentry,
+ void *cookie)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
static void
HgfsPutlink(struct dentry *dentry, // dentry
struct nameidata *nd, // lookup name information
@@ -235,11 +249,17 @@ HgfsPutlink(struct dentry *dentry, // dentry
LOG(6, (KERN_DEBUG "VMware hgfs: %s: put for %s\n",
__func__, dentry->d_name.name));
- fileName = nd_get_link(nd);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+ fileName = cookie;
+#else
+ fileName = nd_get_link(nd);
+#endif
if (!IS_ERR(fileName)) {
LOG(6, (KERN_DEBUG "VMware hgfs: %s: putting %s\n",
__func__, fileName));
kfree(fileName);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
nd_set_link(nd, NULL);
+#endif
}
}
--
2.5.0.windows.1

View File

@ -0,0 +1,33 @@
# Tanım: Open Virtual Machine Tools kernel modules
# URL: http://open-vm-tools.sourceforge.net/
# Paketçi: milisarge
# Gerekler: kernel
# Grup:
isim=open-vm-tools-kernel
_isim=open-vm-tools
surum=10.0.0
_altsurum=3000743
_surum="${surum}-${_altsurum}"
_tamisim="${_isim}-${_surum}"
_dkms_surum='2015.01.29'
devir=1
kaynak=(http://downloads.sourceforge.net/open-vm-tools/open-vm-tools-10.0.0-3000743.tar.gz
0001-Fix-vmxnet-module-on-kernels-3.16.patch
0004-Support-backing-dev-info-kernel-4.0.patch
0005-Remove-new_sync-for-Linux-4.1.patch
0006-vmhgfs-support-linux-4.2.x-kernel.patch)
derle() {
patch -d "$SRC/${_tamisim}" -Np2 -i "$SRC/0001-Fix-vmxnet-module-on-kernels-3.16.patch"
patch -d "$SRC/${_tamisim}" -Np2 -i "$SRC/0004-Support-backing-dev-info-kernel-4.0.patch"
patch -d "$SRC/${_tamisim}" -Np2 -i "$SRC/0005-Remove-new_sync-for-Linux-4.1.patch"
patch -d "$SRC/${_tamisim}" -Np2 -i "$SRC/0006-vmhgfs-support-linux-4.2.x-kernel.patch"
cd "$SRC/${_tamisim}"
[ -f /usr/src/linux-$(uname -r)/vmlinux ] && rm /usr/src/linux-$(uname -r)/vmlinux
sed -i "s/${_dkms_surum}/${surum}/g" ./modules/linux/dkms.sh
sh ./modules/linux/dkms.sh ./ "${PKG}/usr/src"
#for _module in {"vmblock","vmci","vmsync","vsock"}; do
# rm -rf "${PKG}/usr/src/${_isim}-${surum}/${_module}"
#done
}

View File

@ -0,0 +1,13 @@
#!/bin/sh
cd /usr/src/vmware-14*
mv /usr/src/linux-$(uname -r)/vmlinux /opt
make KVERSION=$(uname -r) VM_KBUILD=yes -C vmmon-only
cp vmmon-only/vmmon.ko lib/modules/$(uname -r)/extra/
make KVERSION=$(uname -r) VM_KBUILD=yes -C vmnet-only
cp vmnet-only/vmnet.ko lib/modules/$(uname -r)/extra/
mv /opt/vmlinux /usr/src/linux-$(uname -r)/
depmod
modprobe vmmon
modprobe vmnet