Skip to content

Commit

Permalink
vmware-4.1: Add patch for Linux Kernel 4.1.
Browse files Browse the repository at this point in the history
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackware-id.org>
  • Loading branch information
willysr committed Aug 22, 2015
1 parent 5cf132f commit a031991
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 0 deletions.
Binary file modified SlackBuilds/SLACKBUILDS.TXT.gz
Binary file not shown.
58 changes: 58 additions & 0 deletions vmware/vmware-4.1/patch-modules_4.1.sh
@@ -0,0 +1,58 @@
#! /bin/bash
# VMWare Workstation/Player _host kernel modules_ patcher by Willy Sudiarto Raharjo
# Updated for VMware 10.0.6 on kernel 4.1
# Use at your own risk.
# Credit goes to ArchLinux
# https://wiki.archlinux.org/index.php/VMware

vmnet=vmnet-4.1.patch
vmreqver=10.0.6
plreqver=7.1.2


error()
{
echo "$*. Exiting"
exit
}

curdir=`pwd`
bdate=`date "+%F-%H:%M:%S"` || error "date utility didn't quite work. Hm"
vmver=`vmware-installer -l 2>/dev/null | awk '/vmware-/{print $1substr($2,1,6)}'`
vmver="${vmver#vmware-}"
basedir=/usr/lib/vmware/modules/source
ptoken="$basedir/.patched"
bkupdir="$basedir-$vmver-$bdate-backup"

unset product
[ -z "$vmver" ] && error "VMWare is not installed (properly) on this PC"
[ "$vmver" == "workstation$vmreqver" ] && product="VMWare WorkStation"
[ "$vmver" == "player$plreqver" ] && product="VMWare Player"
[ -z "$product" ] && error "Sorry, this script is only for VMWare WorkStation $vmreqver or VMWare Player $plreqver"

[ "`id -u`" != "0" ] && error "You must be root to run this script"
[ -f "$ptoken" ] && error "$ptoken found. You have already patched your sources"
[ ! -d "$basedir" ] && error "Source '$basedir' directory not found, reinstall $product"
[ ! -f "$vmnet" ] && error "'$vmnet' not found. Please, copy it to the current '$curdir' directory"

tmpdir=`mktemp -d` || exit 1
cp -an "$basedir" "$bkupdir" || exit 2

cd "$tmpdir" || exit 3
find "$basedir" -name "*.tar" -exec tar xf '{}' \; || exit 4

cd vmnet-only
patch -p1 < "$curdir/$vmnet" || exit 5
cd ..
tar cf vmnet.tar vmnet-only || exit 6

cp -a *.tar "$basedir" || exit 20
rm -rf "$tmpdir" || exit 21
touch "$ptoken" || exit 22
cd "$curdir" || exit 23

vmware-modconfig --console --install-all

echo -e "\n"
echo "All done, you can now run $product."
echo "Modules sources backup can be found in the '$bkupdir' directory"
58 changes: 58 additions & 0 deletions vmware/vmware-4.1/vmnet-4.1.patch
@@ -0,0 +1,58 @@
diff -ur vmnet-only.a/driver.c vmnet-only/driver.c
--- vmnet-only.a/driver.c 2014-11-20 20:13:56.000000000 -0500
+++ vmnet-only/driver.c 2015-02-09 15:40:10.916640592 -0500
@@ -265,10 +265,17 @@
{
int ret = -ENOTTY;

+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
if (filp && filp->f_op && filp->f_op->ioctl == VNetFileOpIoctl) {
ret = VNetFileOpIoctl(filp->f_dentry->d_inode, filp, iocmd, ioarg);
}
return ret;
+#else
+ if (filp && filp->f_op && filp->f_op->ioctl == VNetFileOpIoctl) {
+ ret = VNetFileOpIoctl(filp->f_path.dentry->d_inode, filp, iocmd, ioarg);
+ }
+ return ret;
+#endif
}


@@ -1191,11 +1198,19 @@
struct inode *inode = NULL;
long err;

+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
if (filp && filp->f_dentry) {
inode = filp->f_dentry->d_inode;
}
err = VNetFileOpIoctl(inode, filp, iocmd, ioarg);
return err;
+#else
+ if (filp && filp->f_path.dentry) {
+ inode = filp->f_path.dentry->d_inode;
+ }
+ err = VNetFileOpIoctl(inode, filp, iocmd, ioarg);
+ return err;
+#endif
}
#endif

diff -ur vmnet-only.a/userif.c vmnet-only/userif.c
--- vmnet-only.a/userif.c 2014-11-20 20:13:56.000000000 -0500
+++ vmnet-only/userif.c 2015-02-09 15:41:02.150847338 -0500
@@ -523,7 +523,13 @@
.iov_base = buf,
.iov_len = len,
};
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
return skb_copy_datagram_iovec(skb, 0, &iov, len);
+#else
+ struct iov_iter to;
+ iov_iter_init(&to, READ, &iov, 1, len);
+ return skb_copy_datagram_iter(skb, 0, &to, len);
+#endif
}


0 comments on commit a031991

Please sign in to comment.