fedora 11 vmware
VM到了2.6.29.6-217.2.3.fc11.i686.PAE终于可以顺利安装了。 以前的内核都要补丁。
补丁:vm.sh
#!/bin/sh
# VMWare modules source patch "installer" script
# krellan
# Change these if desired
VMMODDIR="/usr/lib/vmware/modules"
PATCHFILE="vmware-6.5.2-modules-2.6.29-fix.patch"
# Take inventory
OLDDIR=`pwd`
MODSOURCEDIR="${VMMODDIR}/source"
PATCHPATH="${OLDDIR}/${PATCHFILE}"
if [ ! -r "$PATCHPATH" ]; then
echo "Sorry, patch file $PATCHPATH not found"
exit 1
fi
cd "$MODSOURCEDIR"
TARS=`find . -maxdepth 1 -name '*.tar'`
if [ ! "$TARS" ]; then
echo "Sorry, no tar files found in $MODSOURCEDIR"
exit 1
fi
BASES=""
for TARFILE in $TARS
do
BASE=`basename "$TARFILE" | rev | cut -c5- | rev`
BASES="$BASES $BASE"
echo "Found tar file for $BASE module"
done
# Back up existing tarballs if not already done
BACKDIR="${VMMODDIR}/source-backup"
echo "Using patch file: $PATCHPATH"
echo "Using module directory: $MODSOURCEDIR"
echo "Using backup directory: $BACKDIR"
mkdir -p "$BACKDIR"
for TARFILE in $TARS
do
BACKFILE="${BACKDIR}/${TARFILE}"
if [ ! -r "$BACKFILE" ]; then
echo "Backing up $TARFILE to $BACKFILE"
cp -a -f "$TARFILE" "$BACKFILE"
if [ ! -r "$BACKFILE" ]; then
echo "Sorry, unable to write backup file"
echo "Did you remember to become root before running this script?"
exit 1
fi
fi
done
# Untar all
for BASE in $BASES
do
TARFILE="${BASE}.tar"
MODDIR="${BASE}-only"
echo "Untarring $TARFILE"
tar -xf "$TARFILE"
if [ ! -d "$MODDIR" ]; then
echo "Sorry, $TARFILE tarball failed to extract the directory $MODDIR"
exit 1
fi
done
# Test patch first, so we can exit cleanly if any error
echo "Testing patch"
patch --dry-run -N -p1 RESULT=$?
if [ "0" != "$RESULT" ]; then
echo "Sorry, problem with the patch, I can't apply it"
exit 1
fi
# Apply patch
echo "Applying patch!"
patch -N -p1 RESULT=$?
if [ "0" != "$RESULT" ]; then
echo "Sorry, problem with the patch while in the middle of applying it"
echo "You must restore from this backup directory:"
echo "$BACKDIR"
exit 1
fi
# Repack tarballs immediately after applying patch, into temporary files
for BASE in $BASES
do
TEMPFILE="${BASE}-temp.tar"
MODDIR="${BASE}-only"
echo "Preparing new tar file for $BASE module"
rm -f "$TEMPFILE"
tar -cf "$TEMPFILE" "$MODDIR"
done
# Make sure it makes
for BASE in $BASES
do
# Skip checking vmppuser module because it's badly broken dead code
if [ "vmppuser" != "$BASE" ]; then
MODDIR="${BASE}-only"
cd "$MODDIR"
echo "Trying to compile $BASE module to see if it works"
make
RESULT=$?
if [ "0" != "$RESULT" ]; then
echo "Sorry, problem compiling the $BASE module after it was patched"
echo "You must restore from this backup directory:"
echo "$BACKDIR"
exit 1
fi
cd "$MODSOURCEDIR"
fi
done
# It made cleanly, so now replace original tarballs
for BASE in $BASES
do
TEMPFILE="${BASE}-temp.tar"
TARFILE="${BASE}.tar"
echo "Replacing original file $TARFILE with patched file"
rm -f "$TARFILE"
mv -f "$TEMPFILE" "$TARFILE"
done
# All appears good, remind user about next step
echo "Done!"
echo
echo "I have changed the files in here:"
echo "$MODSOURCEDIR"
echo
echo "I have placed a backup of the original files in here:"
echo "$BACKDIR"
echo
BINDIR="${VMMODDIR}/binary"
if [ -d "$BINDIR" ]; then
echo "The original VMware modules directory is still in the way."
echo "Please move this directory somewhere else, because it confuses VMware:"
echo "$BINDIR"
echo
fi
echo "This command should work now, to install the modules:"
echo "vmware-modconfig --console --install-all"
exit 0
补丁:vmware-6.5.2-modules-2.6.29-fix.patch
diff -urN source-OLD/vmblock-only/Makefile source-NEW/vmblock-only/Makefile
--- source-OLD/vmblock-only/Makefile 2009-03-26 22:05:21.000000000 -0700
+++ source-NEW/vmblock-only/Makefile 2009-04-04 02:17:17.000000000 -0700
@@ -122,7 +122,7 @@
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
- $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+ $(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
-DKBUILD_BASENAME=\"$(DRIVER)\" \
-Werror -S -o /dev/null -xc $(1) \
> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
diff -urN source-OLD/vmci-only/Makefile source-NEW/vmci-only/Makefile
--- source-OLD/vmci-only/Makefile 2009-03-26 22:05:22.000000000 -0700
+++ source-NEW/vmci-only/Makefile 2009-04-04 02:17:17.000000000 -0700
@@ -122,7 +122,7 @@
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
- $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+ $(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
-DKBUILD_BASENAME=\"$(DRIVER)\" \
-Werror -S -o /dev/null -xc $(1) \
> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
diff -urN source-OLD/vmmon-only/include/x86apic.h source-NEW/vmmon-only/include/x86apic.h
--- source-OLD/vmmon-only/include/x86apic.h 2009-03-26 22:05:19.000000000 -0700
+++ source-NEW/vmmon-only/include/x86apic.h 2009-04-04 02:18:58.000000000 -0700
@@ -94,6 +94,10 @@
#define APIC_LVT_DELVMODE(_lvt) (_lvt & 0x700)
#define APIC_LVT_RESET_VALUE 0x00010000
+#if LINUX_VERSION_CODE +#define APIC_BASE_MSR 0x1b
+#endif
+
#define APIC_MSR_BASEMASK QWORD(0x0000000f,0xfffff000)
#define APIC_MSR_ENABLED 0x00000800
#define APIC_MSR_BSP 0x00000100
diff -urN source-OLD/vmmon-only/linux/driver.c source-NEW/vmmon-only/linux/driver.c
--- source-OLD/vmmon-only/linux/driver.c 2009-03-26 22:05:19.000000000 -0700
+++ source-NEW/vmmon-only/linux/driver.c 2009-04-04 02:17:17.000000000 -0700
@@ -1984,10 +1984,17 @@
}
case IOCTL_VMX86_ALLOW_CORE_DUMP:
+#if LINUX_VERSION_CODE if (current->euid == current->uid &&
current->fsuid == current->uid &&
current->egid == current->gid &&
current->fsgid == current->gid) {
+#else
+ if (current_euid() == current_uid() &&
+ current_fsuid() == current_uid() &&
+ current_egid() == current_gid() &&
+ current_fsgid() == current_gid()) {
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) || defined(MMF_DUMPABLE)
/* Dump core, readable by user. */
set_bit(MMF_DUMPABLE, ¤t->mm->flags);
diff -urN source-OLD/vmmon-only/linux/hostif.c source-NEW/vmmon-only/linux/hostif.c
--- source-OLD/vmmon-only/linux/hostif.c 2009-03-26 22:05:18.000000000 -0700
+++ source-NEW/vmmon-only/linux/hostif.c 2009-04-04 02:17:17.000000000 -0700
@@ -3424,6 +3424,88 @@
}
+/* krellan: Linux 2.6.29 compatibility functions for capabilities */
+/* Errors are logged but otherwise ignored */
+
+void compat_cap_raise(int cap)
+{
+#if LINUX_VERSION_CODE + cap_raise(current->cap_effective, cap);
+#else
+ struct cred *new_cred;
+
+ new_cred = prepare_creds();
+ if (new_cred != NULL)
+ {
+ cap_raise(new_cred->cap_effective, cap);
+ commit_creds(new_cred);
+ }
+ else
+ {
+ Log("compat_cap_raise(%d) prepare_creds(): Out of memory\n", cap);
+ }
+#endif
+}
+
+void compat_cap_lower(int cap)
+{
+#if LINUX_VERSION_CODE + cap_lower(current->cap_effective, cap);
+#else
+ struct cred *new_cred;
+
+ new_cred = prepare_creds();
+ if (new_cred != NULL)
+ {
+ cap_lower(new_cred->cap_effective, cap);
+ commit_creds(new_cred);
+ }
+ else
+ {
+ Log("compat_cap_lower(%d) prepare_creds(): Out of memory\n", cap);
+ }
+#endif
+}
+
+int compat_cap_raised(int cap)
+{
+#if LINUX_VERSION_CODE + return cap_raised(current->cap_effective, cap);
+#else
+ return cap_raised(current_cap(), cap);
+#endif
+}
+
+int compat_get_fsuid(void)
+{
+#if LINUX_VERSION_CODE + return current->fsuid;
+#else
+ return current_fsuid();
+#endif
+}
+
+void compat_set_fsuid(int fsuid)
+{
+#if LINUX_VERSION_CODE + current->fsuid = fsuid;
+#else
+ struct cred *new_cred;
+
+ new_cred = prepare_creds();
+ if (new_cred != NULL)
+ {
+ new_cred->fsuid = fsuid;
+ commit_creds(new_cred);
+ }
+ else
+ {
+ Log("compat_set_fsuid(%d) prepare_creds(): Out of memory\n", fsuid);
+ }
+#endif
+}
+
+
/*
*----------------------------------------------------------------------
*
@@ -3456,7 +3538,7 @@
oldFS = get_fs();
set_fs(KERNEL_DS);
compat_allow_signal(SIGKILL);
- cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+ compat_cap_raise(CAP_SYS_RESOURCE);
compat_set_user_nice(current, linuxState.fastClockPriority);
while (linuxState.fastClockRate > HZ + HZ/16) {
@@ -3580,19 +3662,19 @@
Bool cap;
long pid;
- fsuid = current->fsuid;
- current->fsuid = 0;
+ fsuid = compat_get_fsuid();
+ compat_set_fsuid(0);
filp = filp_open("/dev/rtc", O_RDONLY, 0);
- current->fsuid = fsuid;
+ compat_set_fsuid(fsuid);
if (IS_ERR(filp)) {
Warning("/dev/rtc open failed: %d\n", (int)(VA)filp);
return -(int)(VA)filp;
}
- cap = cap_raised(current->cap_effective, CAP_SYS_RESOURCE);
- cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+ cap = compat_cap_raised(CAP_SYS_RESOURCE);
+ compat_cap_raise(CAP_SYS_RESOURCE);
res = HostIFDoIoctl(filp, RTC_PIE_ON, 0);
if (!cap) {
- cap_lower(current->cap_effective, CAP_SYS_RESOURCE);
+ compat_cap_lower(CAP_SYS_RESOURCE);
}
if (res Warning("/dev/rtc enable interrupt failed: %d\n", res);
diff -urN source-OLD/vmmon-only/Makefile source-NEW/vmmon-only/Makefile
--- source-OLD/vmmon-only/Makefile 2009-03-26 22:05:19.000000000 -0700
+++ source-NEW/vmmon-only/Makefile 2009-04-04 02:17:17.000000000 -0700
@@ -122,7 +122,7 @@
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
- $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+ $(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
-DKBUILD_BASENAME=\"$(DRIVER)\" \
-Werror -S -o /dev/null -xc $(1) \
> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
diff -urN source-OLD/vmnet-only/Makefile source-NEW/vmnet-only/Makefile
--- source-OLD/vmnet-only/Makefile 2009-03-26 22:05:20.000000000 -0700
+++ source-NEW/vmnet-only/Makefile 2009-04-04 02:17:17.000000000 -0700
@@ -122,7 +122,7 @@
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
- $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+ $(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
-DKBUILD_BASENAME=\"$(DRIVER)\" \
-Werror -S -o /dev/null -xc $(1) \
> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
diff -urN source-OLD/vmnet-only/netif.c source-NEW/vmnet-only/netif.c
--- source-OLD/vmnet-only/netif.c 2009-03-26 22:05:20.000000000 -0700
+++ source-NEW/vmnet-only/netif.c 2009-04-04 02:17:17.000000000 -0700
@@ -324,7 +324,11 @@
goto out;
}
+#if LINUX_VERSION_CODE dev->priv = netIf;
+#else
+ dev->ml_priv = netIf;
+#endif
netIf->dev = dev;
memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
@@ -566,7 +570,11 @@
VNetNetifStartXmit(struct sk_buff *skb, // IN:
struct net_device *dev) // IN:
{
+#if LINUX_VERSION_CODE VNetNetIF *netIf = (VNetNetIF*)dev->priv;
+#else
+ VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv;
+#endif
if(skb == NULL) {
return 0;
@@ -618,7 +626,11 @@
VNetNetifSetMAC(struct net_device *dev, // IN:
void *p) // IN:
{
+#if LINUX_VERSION_CODE VNetNetIF *netIf = (VNetNetIF*)dev->priv;
+#else
+ VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv;
+#endif
struct sockaddr const *addr = p;
if (!VMX86_IS_STATIC_MAC(addr->sa_data)) {
return -EINVAL;
@@ -675,7 +687,11 @@
struct net_device_stats *
VNetNetifGetStats(struct net_device *dev) // IN:
{
+#if LINUX_VERSION_CODE VNetNetIF *netIf = (VNetNetIF*)dev->priv;
+#else
+ VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv;
+#endif
return &(netIf->stats);
}
diff -urN source-OLD/vsock-only/Makefile source-NEW/vsock-only/Makefile
--- source-OLD/vsock-only/Makefile 2009-03-26 22:05:23.000000000 -0700
+++ source-NEW/vsock-only/Makefile 2009-04-04 02:17:17.000000000 -0700
@@ -122,7 +122,7 @@
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
- $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+ $(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
-DKBUILD_BASENAME=\"$(DRIVER)\" \
-Werror -S -o /dev/null -xc $(1) \
> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
补丁:vm.sh
#!/bin/sh
# VMWare modules source patch "installer" script
# krellan
# Change these if desired
VMMODDIR="/usr/lib/vmware/modules"
PATCHFILE="vmware-6.5.2-modules-2.6.29-fix.patch"
# Take inventory
OLDDIR=`pwd`
MODSOURCEDIR="${VMMODDIR}/source"
PATCHPATH="${OLDDIR}/${PATCHFILE}"
if [ ! -r "$PATCHPATH" ]; then
echo "Sorry, patch file $PATCHPATH not found"
exit 1
fi
cd "$MODSOURCEDIR"
TARS=`find . -maxdepth 1 -name '*.tar'`
if [ ! "$TARS" ]; then
echo "Sorry, no tar files found in $MODSOURCEDIR"
exit 1
fi
BASES=""
for TARFILE in $TARS
do
BASE=`basename "$TARFILE" | rev | cut -c5- | rev`
BASES="$BASES $BASE"
echo "Found tar file for $BASE module"
done
# Back up existing tarballs if not already done
BACKDIR="${VMMODDIR}/source-backup"
echo "Using patch file: $PATCHPATH"
echo "Using module directory: $MODSOURCEDIR"
echo "Using backup directory: $BACKDIR"
mkdir -p "$BACKDIR"
for TARFILE in $TARS
do
BACKFILE="${BACKDIR}/${TARFILE}"
if [ ! -r "$BACKFILE" ]; then
echo "Backing up $TARFILE to $BACKFILE"
cp -a -f "$TARFILE" "$BACKFILE"
if [ ! -r "$BACKFILE" ]; then
echo "Sorry, unable to write backup file"
echo "Did you remember to become root before running this script?"
exit 1
fi
fi
done
# Untar all
for BASE in $BASES
do
TARFILE="${BASE}.tar"
MODDIR="${BASE}-only"
echo "Untarring $TARFILE"
tar -xf "$TARFILE"
if [ ! -d "$MODDIR" ]; then
echo "Sorry, $TARFILE tarball failed to extract the directory $MODDIR"
exit 1
fi
done
# Test patch first, so we can exit cleanly if any error
echo "Testing patch"
patch --dry-run -N -p1 RESULT=$?
if [ "0" != "$RESULT" ]; then
echo "Sorry, problem with the patch, I can't apply it"
exit 1
fi
# Apply patch
echo "Applying patch!"
patch -N -p1 RESULT=$?
if [ "0" != "$RESULT" ]; then
echo "Sorry, problem with the patch while in the middle of applying it"
echo "You must restore from this backup directory:"
echo "$BACKDIR"
exit 1
fi
# Repack tarballs immediately after applying patch, into temporary files
for BASE in $BASES
do
TEMPFILE="${BASE}-temp.tar"
MODDIR="${BASE}-only"
echo "Preparing new tar file for $BASE module"
rm -f "$TEMPFILE"
tar -cf "$TEMPFILE" "$MODDIR"
done
# Make sure it makes
for BASE in $BASES
do
# Skip checking vmppuser module because it's badly broken dead code
if [ "vmppuser" != "$BASE" ]; then
MODDIR="${BASE}-only"
cd "$MODDIR"
echo "Trying to compile $BASE module to see if it works"
make
RESULT=$?
if [ "0" != "$RESULT" ]; then
echo "Sorry, problem compiling the $BASE module after it was patched"
echo "You must restore from this backup directory:"
echo "$BACKDIR"
exit 1
fi
cd "$MODSOURCEDIR"
fi
done
# It made cleanly, so now replace original tarballs
for BASE in $BASES
do
TEMPFILE="${BASE}-temp.tar"
TARFILE="${BASE}.tar"
echo "Replacing original file $TARFILE with patched file"
rm -f "$TARFILE"
mv -f "$TEMPFILE" "$TARFILE"
done
# All appears good, remind user about next step
echo "Done!"
echo
echo "I have changed the files in here:"
echo "$MODSOURCEDIR"
echo
echo "I have placed a backup of the original files in here:"
echo "$BACKDIR"
echo
BINDIR="${VMMODDIR}/binary"
if [ -d "$BINDIR" ]; then
echo "The original VMware modules directory is still in the way."
echo "Please move this directory somewhere else, because it confuses VMware:"
echo "$BINDIR"
echo
fi
echo "This command should work now, to install the modules:"
echo "vmware-modconfig --console --install-all"
exit 0
补丁:vmware-6.5.2-modules-2.6.29-fix.patch
diff -urN source-OLD/vmblock-only/Makefile source-NEW/vmblock-only/Makefile
--- source-OLD/vmblock-only/Makefile 2009-03-26 22:05:21.000000000 -0700
+++ source-NEW/vmblock-only/Makefile 2009-04-04 02:17:17.000000000 -0700
@@ -122,7 +122,7 @@
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
- $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+ $(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
-DKBUILD_BASENAME=\"$(DRIVER)\" \
-Werror -S -o /dev/null -xc $(1) \
> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
diff -urN source-OLD/vmci-only/Makefile source-NEW/vmci-only/Makefile
--- source-OLD/vmci-only/Makefile 2009-03-26 22:05:22.000000000 -0700
+++ source-NEW/vmci-only/Makefile 2009-04-04 02:17:17.000000000 -0700
@@ -122,7 +122,7 @@
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
- $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+ $(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
-DKBUILD_BASENAME=\"$(DRIVER)\" \
-Werror -S -o /dev/null -xc $(1) \
> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
diff -urN source-OLD/vmmon-only/include/x86apic.h source-NEW/vmmon-only/include/x86apic.h
--- source-OLD/vmmon-only/include/x86apic.h 2009-03-26 22:05:19.000000000 -0700
+++ source-NEW/vmmon-only/include/x86apic.h 2009-04-04 02:18:58.000000000 -0700
@@ -94,6 +94,10 @@
#define APIC_LVT_DELVMODE(_lvt) (_lvt & 0x700)
#define APIC_LVT_RESET_VALUE 0x00010000
+#if LINUX_VERSION_CODE +#define APIC_BASE_MSR 0x1b
+#endif
+
#define APIC_MSR_BASEMASK QWORD(0x0000000f,0xfffff000)
#define APIC_MSR_ENABLED 0x00000800
#define APIC_MSR_BSP 0x00000100
diff -urN source-OLD/vmmon-only/linux/driver.c source-NEW/vmmon-only/linux/driver.c
--- source-OLD/vmmon-only/linux/driver.c 2009-03-26 22:05:19.000000000 -0700
+++ source-NEW/vmmon-only/linux/driver.c 2009-04-04 02:17:17.000000000 -0700
@@ -1984,10 +1984,17 @@
}
case IOCTL_VMX86_ALLOW_CORE_DUMP:
+#if LINUX_VERSION_CODE if (current->euid == current->uid &&
current->fsuid == current->uid &&
current->egid == current->gid &&
current->fsgid == current->gid) {
+#else
+ if (current_euid() == current_uid() &&
+ current_fsuid() == current_uid() &&
+ current_egid() == current_gid() &&
+ current_fsgid() == current_gid()) {
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) || defined(MMF_DUMPABLE)
/* Dump core, readable by user. */
set_bit(MMF_DUMPABLE, ¤t->mm->flags);
diff -urN source-OLD/vmmon-only/linux/hostif.c source-NEW/vmmon-only/linux/hostif.c
--- source-OLD/vmmon-only/linux/hostif.c 2009-03-26 22:05:18.000000000 -0700
+++ source-NEW/vmmon-only/linux/hostif.c 2009-04-04 02:17:17.000000000 -0700
@@ -3424,6 +3424,88 @@
}
+/* krellan: Linux 2.6.29 compatibility functions for capabilities */
+/* Errors are logged but otherwise ignored */
+
+void compat_cap_raise(int cap)
+{
+#if LINUX_VERSION_CODE + cap_raise(current->cap_effective, cap);
+#else
+ struct cred *new_cred;
+
+ new_cred = prepare_creds();
+ if (new_cred != NULL)
+ {
+ cap_raise(new_cred->cap_effective, cap);
+ commit_creds(new_cred);
+ }
+ else
+ {
+ Log("compat_cap_raise(%d) prepare_creds(): Out of memory\n", cap);
+ }
+#endif
+}
+
+void compat_cap_lower(int cap)
+{
+#if LINUX_VERSION_CODE + cap_lower(current->cap_effective, cap);
+#else
+ struct cred *new_cred;
+
+ new_cred = prepare_creds();
+ if (new_cred != NULL)
+ {
+ cap_lower(new_cred->cap_effective, cap);
+ commit_creds(new_cred);
+ }
+ else
+ {
+ Log("compat_cap_lower(%d) prepare_creds(): Out of memory\n", cap);
+ }
+#endif
+}
+
+int compat_cap_raised(int cap)
+{
+#if LINUX_VERSION_CODE + return cap_raised(current->cap_effective, cap);
+#else
+ return cap_raised(current_cap(), cap);
+#endif
+}
+
+int compat_get_fsuid(void)
+{
+#if LINUX_VERSION_CODE + return current->fsuid;
+#else
+ return current_fsuid();
+#endif
+}
+
+void compat_set_fsuid(int fsuid)
+{
+#if LINUX_VERSION_CODE + current->fsuid = fsuid;
+#else
+ struct cred *new_cred;
+
+ new_cred = prepare_creds();
+ if (new_cred != NULL)
+ {
+ new_cred->fsuid = fsuid;
+ commit_creds(new_cred);
+ }
+ else
+ {
+ Log("compat_set_fsuid(%d) prepare_creds(): Out of memory\n", fsuid);
+ }
+#endif
+}
+
+
/*
*----------------------------------------------------------------------
*
@@ -3456,7 +3538,7 @@
oldFS = get_fs();
set_fs(KERNEL_DS);
compat_allow_signal(SIGKILL);
- cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+ compat_cap_raise(CAP_SYS_RESOURCE);
compat_set_user_nice(current, linuxState.fastClockPriority);
while (linuxState.fastClockRate > HZ + HZ/16) {
@@ -3580,19 +3662,19 @@
Bool cap;
long pid;
- fsuid = current->fsuid;
- current->fsuid = 0;
+ fsuid = compat_get_fsuid();
+ compat_set_fsuid(0);
filp = filp_open("/dev/rtc", O_RDONLY, 0);
- current->fsuid = fsuid;
+ compat_set_fsuid(fsuid);
if (IS_ERR(filp)) {
Warning("/dev/rtc open failed: %d\n", (int)(VA)filp);
return -(int)(VA)filp;
}
- cap = cap_raised(current->cap_effective, CAP_SYS_RESOURCE);
- cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+ cap = compat_cap_raised(CAP_SYS_RESOURCE);
+ compat_cap_raise(CAP_SYS_RESOURCE);
res = HostIFDoIoctl(filp, RTC_PIE_ON, 0);
if (!cap) {
- cap_lower(current->cap_effective, CAP_SYS_RESOURCE);
+ compat_cap_lower(CAP_SYS_RESOURCE);
}
if (res Warning("/dev/rtc enable interrupt failed: %d\n", res);
diff -urN source-OLD/vmmon-only/Makefile source-NEW/vmmon-only/Makefile
--- source-OLD/vmmon-only/Makefile 2009-03-26 22:05:19.000000000 -0700
+++ source-NEW/vmmon-only/Makefile 2009-04-04 02:17:17.000000000 -0700
@@ -122,7 +122,7 @@
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
- $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+ $(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
-DKBUILD_BASENAME=\"$(DRIVER)\" \
-Werror -S -o /dev/null -xc $(1) \
> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
diff -urN source-OLD/vmnet-only/Makefile source-NEW/vmnet-only/Makefile
--- source-OLD/vmnet-only/Makefile 2009-03-26 22:05:20.000000000 -0700
+++ source-NEW/vmnet-only/Makefile 2009-04-04 02:17:17.000000000 -0700
@@ -122,7 +122,7 @@
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
- $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+ $(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
-DKBUILD_BASENAME=\"$(DRIVER)\" \
-Werror -S -o /dev/null -xc $(1) \
> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
diff -urN source-OLD/vmnet-only/netif.c source-NEW/vmnet-only/netif.c
--- source-OLD/vmnet-only/netif.c 2009-03-26 22:05:20.000000000 -0700
+++ source-NEW/vmnet-only/netif.c 2009-04-04 02:17:17.000000000 -0700
@@ -324,7 +324,11 @@
goto out;
}
+#if LINUX_VERSION_CODE dev->priv = netIf;
+#else
+ dev->ml_priv = netIf;
+#endif
netIf->dev = dev;
memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
@@ -566,7 +570,11 @@
VNetNetifStartXmit(struct sk_buff *skb, // IN:
struct net_device *dev) // IN:
{
+#if LINUX_VERSION_CODE VNetNetIF *netIf = (VNetNetIF*)dev->priv;
+#else
+ VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv;
+#endif
if(skb == NULL) {
return 0;
@@ -618,7 +626,11 @@
VNetNetifSetMAC(struct net_device *dev, // IN:
void *p) // IN:
{
+#if LINUX_VERSION_CODE VNetNetIF *netIf = (VNetNetIF*)dev->priv;
+#else
+ VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv;
+#endif
struct sockaddr const *addr = p;
if (!VMX86_IS_STATIC_MAC(addr->sa_data)) {
return -EINVAL;
@@ -675,7 +687,11 @@
struct net_device_stats *
VNetNetifGetStats(struct net_device *dev) // IN:
{
+#if LINUX_VERSION_CODE VNetNetIF *netIf = (VNetNetIF*)dev->priv;
+#else
+ VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv;
+#endif
return &(netIf->stats);
}
diff -urN source-OLD/vsock-only/Makefile source-NEW/vsock-only/Makefile
--- source-OLD/vsock-only/Makefile 2009-03-26 22:05:23.000000000 -0700
+++ source-NEW/vsock-only/Makefile 2009-04-04 02:17:17.000000000 -0700
@@ -122,7 +122,7 @@
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
- $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+ $(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
-DKBUILD_BASENAME=\"$(DRIVER)\" \
-Werror -S -o /dev/null -xc $(1) \
> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)