|
|
|
@@ -1,241 +0,0 @@
|
|
|
|
|
diff -urN open-vm-tools-8.8.1-528969/modules/linux/vmhgfs/file.c open-vm-tools-2011.12.20-562307/modules/linux/vmhgfs/file.c
|
|
|
|
|
--- open-vm-tools-8.8.1-528969/modules/linux/vmhgfs/file.c 2011-11-21 23:27:53.000000000 +0100
|
|
|
|
|
+++ open-vm-tools-2011.12.20-562307/modules/linux/vmhgfs/file.c 2011-12-22 01:56:24.000000000 +0100
|
|
|
|
|
@@ -83,6 +83,9 @@
|
|
|
|
|
static int HgfsFsync(struct file *file,
|
|
|
|
|
#if defined VMW_FSYNC_OLD
|
|
|
|
|
struct dentry *dentry,
|
|
|
|
|
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
|
|
|
|
|
+ loff_t start,
|
|
|
|
|
+ loff_t end,
|
|
|
|
|
#endif
|
|
|
|
|
int datasync);
|
|
|
|
|
static int HgfsMmap(struct file *file,
|
|
|
|
|
@@ -989,6 +992,9 @@
|
|
|
|
|
HgfsFsync(struct file *file, // IN: File we operate on
|
|
|
|
|
#if defined VMW_FSYNC_OLD
|
|
|
|
|
struct dentry *dentry, // IN: Dentry for this file
|
|
|
|
|
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
|
|
|
|
|
+ loff_t start, // IN: start of range to sync
|
|
|
|
|
+ loff_t end, // IN: end of range to sync
|
|
|
|
|
#endif
|
|
|
|
|
int datasync) // IN: fdatasync or fsync
|
|
|
|
|
{
|
|
|
|
|
diff -urN open-vm-tools-8.8.1-528969/modules/linux/vmhgfs/filesystem.c open-vm-tools-2011.12.20-562307/modules/linux/vmhgfs/filesystem.c
|
|
|
|
|
--- open-vm-tools-8.8.1-528969/modules/linux/vmhgfs/filesystem.c 2011-11-21 23:27:53.000000000 +0100
|
|
|
|
|
+++ open-vm-tools-2011.12.20-562307/modules/linux/vmhgfs/filesystem.c 2011-12-22 01:56:24.000000000 +0100
|
|
|
|
|
@@ -83,6 +83,7 @@
|
|
|
|
|
static inline unsigned long HgfsComputeBlockBits(unsigned long blockSize);
|
|
|
|
|
static compat_kmem_cache_ctor HgfsInodeCacheCtor;
|
|
|
|
|
static HgfsSuperInfo *HgfsInitSuperInfo(HgfsMountInfo *mountInfo);
|
|
|
|
|
+static struct dentry *HgfsGetRootDentry(struct super_block *sb);
|
|
|
|
|
static int HgfsReadSuper(struct super_block *sb,
|
|
|
|
|
void *rawData,
|
|
|
|
|
int flags);
|
|
|
|
|
@@ -326,6 +327,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
+ *----------------------------------------------------------------------------
|
|
|
|
|
+ *
|
|
|
|
|
+ * HgfsGetRootDentry --
|
|
|
|
|
+ *
|
|
|
|
|
+ * Gets the root dentry for a given super block.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Results:
|
|
|
|
|
+ * A valid root dentry on success, NULL otherwise.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Side effects:
|
|
|
|
|
+ * None.
|
|
|
|
|
+ *
|
|
|
|
|
+ *----------------------------------------------------------------------------
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+static struct dentry *
|
|
|
|
|
+HgfsGetRootDentry(struct super_block *sb) // IN: Super block object
|
|
|
|
|
+{
|
|
|
|
|
+ struct dentry *rootDentry = NULL;
|
|
|
|
|
+ struct inode *rootInode;
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT(sb);
|
|
|
|
|
+
|
|
|
|
|
+ LOG(6, (KERN_DEBUG "VMware hgfs: %s: entered\n", __func__));
|
|
|
|
|
+
|
|
|
|
|
+ rootInode = HgfsGetInode(sb, HGFS_ROOT_INO);
|
|
|
|
|
+ if (rootInode) {
|
|
|
|
|
+ HgfsInodeInfo *iinfo;
|
|
|
|
|
+ static const HgfsAttrInfo attr = {
|
|
|
|
|
+ .type = HGFS_FILE_TYPE_DIRECTORY,
|
|
|
|
|
+ .size = 4192,
|
|
|
|
|
+ .specialPerms = 0,
|
|
|
|
|
+ .ownerPerms = HGFS_PERM_READ | HGFS_PERM_EXEC,
|
|
|
|
|
+ .groupPerms = HGFS_PERM_READ | HGFS_PERM_EXEC,
|
|
|
|
|
+ .otherPerms = HGFS_PERM_READ | HGFS_PERM_EXEC,
|
|
|
|
|
+ .mask = HGFS_ATTR_VALID_TYPE |
|
|
|
|
|
+ HGFS_ATTR_VALID_SIZE |
|
|
|
|
|
+ HGFS_ATTR_VALID_SPECIAL_PERMS |
|
|
|
|
|
+ HGFS_ATTR_VALID_OWNER_PERMS |
|
|
|
|
|
+ HGFS_ATTR_VALID_GROUP_PERMS |
|
|
|
|
|
+ HGFS_ATTR_VALID_OTHER_PERMS,
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * On an allocation failure in read_super, the inode will have been
|
|
|
|
|
+ * marked "bad". If it was, we certainly don't want to start playing with
|
|
|
|
|
+ * the HgfsInodeInfo. So quietly put the inode back and fail.
|
|
|
|
|
+ */
|
|
|
|
|
+ if (is_bad_inode(rootInode)) {
|
|
|
|
|
+ LOG(6, (KERN_DEBUG "VMware hgfs: %s: encountered bad inode\n",
|
|
|
|
|
+ __func__));
|
|
|
|
|
+ iput(rootInode);
|
|
|
|
|
+ goto exit;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ HgfsChangeFileAttributes(rootInode, &attr);
|
|
|
|
|
+
|
|
|
|
|
+ iinfo = INODE_GET_II_P(rootInode);
|
|
|
|
|
+ iinfo->isFakeInodeNumber = FALSE;
|
|
|
|
|
+ iinfo->isReferencedInode = TRUE;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rootDentry = d_alloc_root(rootInode);
|
|
|
|
|
+ if (rootDentry == NULL) {
|
|
|
|
|
+ LOG(4, (KERN_WARNING "VMware hgfs: %s: Could not get "
|
|
|
|
|
+ "root dentry\n", __func__));
|
|
|
|
|
+ goto exit;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ LOG(6, (KERN_DEBUG "VMware hgfs: %s: finished\n", __func__));
|
|
|
|
|
+exit:
|
|
|
|
|
+ return rootDentry;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+/*
|
|
|
|
|
*-----------------------------------------------------------------------------
|
|
|
|
|
*
|
|
|
|
|
* HgfsReadSuper --
|
|
|
|
|
@@ -354,10 +431,10 @@
|
|
|
|
|
void *rawData, // IN: Fs-specific mount data
|
|
|
|
|
int flags) // IN: Mount flags
|
|
|
|
|
{
|
|
|
|
|
- int result;
|
|
|
|
|
+ int result = 0;
|
|
|
|
|
HgfsSuperInfo *si;
|
|
|
|
|
HgfsMountInfo *mountInfo;
|
|
|
|
|
- struct dentry *rootDentry;
|
|
|
|
|
+ struct dentry *rootDentry = NULL;
|
|
|
|
|
|
|
|
|
|
ASSERT(sb);
|
|
|
|
|
|
|
|
|
|
@@ -401,26 +478,11 @@
|
|
|
|
|
sb->s_blocksize_bits = HgfsComputeBlockBits(HGFS_BLOCKSIZE);
|
|
|
|
|
sb->s_blocksize = 1 << sb->s_blocksize_bits;
|
|
|
|
|
|
|
|
|
|
- /*
|
|
|
|
|
- * We can't use d_alloc_root() here directly because it requires a valid
|
|
|
|
|
- * inode, which only HgfsInstantiate will create. So instead, we'll do the
|
|
|
|
|
- * work in pieces. First we'll allocate the dentry and setup its parent
|
|
|
|
|
- * and superblock. Then HgfsInstantiate will do the rest, issuing a getattr,
|
|
|
|
|
- * getting the inode, and instantiating the dentry with it.
|
|
|
|
|
- */
|
|
|
|
|
- rootDentry = compat_d_alloc_name(NULL, "/");
|
|
|
|
|
+ rootDentry = HgfsGetRootDentry(sb);
|
|
|
|
|
if (rootDentry == NULL) {
|
|
|
|
|
- LOG(4, (KERN_WARNING "VMware hgfs: HgfsReadSuper: Could not allocate "
|
|
|
|
|
- "root dentry\n"));
|
|
|
|
|
- result = -ENOMEM;
|
|
|
|
|
- goto exit;
|
|
|
|
|
- }
|
|
|
|
|
- rootDentry->d_parent = rootDentry;
|
|
|
|
|
- rootDentry->d_sb = sb;
|
|
|
|
|
- result = HgfsInstantiate(rootDentry, HGFS_ROOT_INO, NULL);
|
|
|
|
|
- if (result) {
|
|
|
|
|
LOG(4, (KERN_WARNING "VMware hgfs: HgfsReadSuper: Could not instantiate "
|
|
|
|
|
"root dentry\n"));
|
|
|
|
|
+ result = -ENOMEM;
|
|
|
|
|
goto exit;
|
|
|
|
|
}
|
|
|
|
|
sb->s_root = rootDentry;
|
|
|
|
|
diff -urN open-vm-tools-8.8.1-528969/modules/linux/vmhgfs/fsutil.c open-vm-tools-2011.12.20-562307/modules/linux/vmhgfs/fsutil.c
|
|
|
|
|
--- open-vm-tools-8.8.1-528969/modules/linux/vmhgfs/fsutil.c 2011-11-21 23:27:53.000000000 +0100
|
|
|
|
|
+++ open-vm-tools-2011.12.20-562307/modules/linux/vmhgfs/fsutil.c 2011-12-22 01:56:24.000000000 +0100
|
|
|
|
|
@@ -62,6 +62,31 @@
|
|
|
|
|
* Private function implementations.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
|
|
|
|
|
+/*
|
|
|
|
|
+ *----------------------------------------------------------------------------
|
|
|
|
|
+ *
|
|
|
|
|
+ * set_nlink --
|
|
|
|
|
+ *
|
|
|
|
|
+ * Set an inode's link count.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Results:
|
|
|
|
|
+ * None
|
|
|
|
|
+ *
|
|
|
|
|
+ * Side effects:
|
|
|
|
|
+ * None
|
|
|
|
|
+ *
|
|
|
|
|
+ *----------------------------------------------------------------------------
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+static inline void
|
|
|
|
|
+set_nlink(struct inode *inode, unsigned int nlink)
|
|
|
|
|
+{
|
|
|
|
|
+ inode->i_nlink = nlink;
|
|
|
|
|
+}
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
/*
|
|
|
|
|
*----------------------------------------------------------------------
|
|
|
|
|
*
|
|
|
|
|
@@ -607,7 +632,7 @@
|
|
|
|
|
* account for '.' and ".."), and find printed a hard link error. So until
|
|
|
|
|
* we have getattr support for nlink, everyone gets 1.
|
|
|
|
|
*/
|
|
|
|
|
- inode->i_nlink = 1;
|
|
|
|
|
+ set_nlink(inode, 1);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Use the stored uid and gid if we were given them at mount-time, or if
|
|
|
|
|
diff -urN open-vm-tools-8.8.1-528969/modules/linux/vmhgfs/Makefile open-vm-tools-2011.12.20-562307/modules/linux/vmhgfs/Makefile
|
|
|
|
|
--- open-vm-tools-8.8.1-528969/modules/linux/vmhgfs/Makefile 2011-11-21 23:27:53.000000000 +0100
|
|
|
|
|
+++ open-vm-tools-2011.12.20-562307/modules/linux/vmhgfs/Makefile 2011-12-22 01:56:24.000000000 +0100
|
|
|
|
|
@@ -46,7 +46,11 @@
|
|
|
|
|
VM_UNAME = $(shell uname -r)
|
|
|
|
|
|
|
|
|
|
# Header directory for the running kernel
|
|
|
|
|
+ifdef LINUXINCLUDE
|
|
|
|
|
+HEADER_DIR = $(LINUXINCLUDE)
|
|
|
|
|
+else
|
|
|
|
|
HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
|
|
|
|
|
+endif
|
|
|
|
|
|
|
|
|
|
BUILD_DIR = $(HEADER_DIR)/..
|
|
|
|
|
|
|
|
|
|
@@ -123,9 +127,9 @@
|
|
|
|
|
postbuild:: ;
|
|
|
|
|
|
|
|
|
|
$(DRIVER_KO): prebuild
|
|
|
|
|
- make -C $(BUILD_DIR) SUBDIRS=$$PWD SRCROOT=$$PWD/$(SRCROOT) \
|
|
|
|
|
+ $(MAKE) -C $(BUILD_DIR) SUBDIRS=$$PWD SRCROOT=$$PWD/$(SRCROOT) \
|
|
|
|
|
MODULEBUILDDIR=$(MODULEBUILDDIR) modules
|
|
|
|
|
- make -C $$PWD SRCROOT=$$PWD/$(SRCROOT) \
|
|
|
|
|
+ $(MAKE) -C $$PWD SRCROOT=$$PWD/$(SRCROOT) \
|
|
|
|
|
MODULEBUILDDIR=$(MODULEBUILDDIR) postbuild
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
diff -urN open-vm-tools-8.8.1-528969/modules/linux/vmhgfs/tcp.c open-vm-tools-2011.12.20-562307/modules/linux/vmhgfs/tcp.c
|
|
|
|
|
--- open-vm-tools-8.8.1-528969/modules/linux/vmhgfs/tcp.c 2011-11-21 23:27:53.000000000 +0100
|
|
|
|
|
+++ open-vm-tools-2011.12.20-562307/modules/linux/vmhgfs/tcp.c 2011-12-22 01:56:24.000000000 +0100
|
|
|
|
|
@@ -32,6 +32,7 @@
|
|
|
|
|
#include <linux/in.h>
|
|
|
|
|
#include <linux/net.h>
|
|
|
|
|
#include <linux/inet.h>
|
|
|
|
|
+#include <linux/moduleparam.h>
|
|
|
|
|
#include <linux/errno.h>
|
|
|
|
|
#include <linux/kthread.h>
|
|
|
|
|
|