]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
vmblock: make buildable on kernel 2.6.39-rc0
authorVMware, Inc <>
Tue, 29 Mar 2011 20:23:20 +0000 (13:23 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 29 Mar 2011 20:23:20 +0000 (13:23 -0700)
get_sb() is gone as is path_lookup(). Adapt to the shiny new
APIs so that we can build our module.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/modules/linux/shared/compat_namei.h
open-vm-tools/modules/linux/vmblock/linux/dentry.c
open-vm-tools/modules/linux/vmblock/linux/filesystem.c

index 28d72c8e1219e46776e79be6c492b03f08193299..f82dd49be0b0fc063e793bab5ffd9c98d3b3c319 100644 (file)
@@ -19,9 +19,7 @@
 #ifndef __COMPAT_NAMEI_H__
 #   define __COMPAT_NAMEI_H__
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 18)
 #include <linux/namei.h>
-#endif
 
 /*
  * In 2.6.25-rc2, dentry and mount objects were removed from the nameidata
 #define compat_path_release(nd) path_release(nd)
 #endif
 
-/* path_lookup was exported in 2.4.25 */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
-#define compat_path_lookup(path, flags, nd)     path_lookup(path, flags, nd)
+/* path_lookup was removed in 2.6.39 merge window VFS merge */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
+#define compat_path_lookup(name, flags, nd)     kern_path(name, flags, &((nd)->path))
 #else
-#define compat_path_lookup(path, flags, nd)     \
-         ({                                     \
-            int ret = 0;                        \
-            if (path_init(path, flags, nd)) {   \
-               ret = path_walk(path, nd);       \
-            }                                   \
-            ret;                                \
-         })
+#define compat_path_lookup(name, flags, nd)     path_lookup(name, flags, nd)
 #endif
 
 #endif /* __COMPAT_NAMEI_H__ */
index 66537c8c82bbcbb7aa87254c4d9084d27bd3f70a..05ea95a9fdda68fac0e604a1a77e7684f214025a 100644 (file)
@@ -104,7 +104,7 @@ DentryOpRevalidate(struct dentry *dentry,  // IN: dentry revalidating
       return actualDentry->d_op->d_revalidate(actualDentry, nd);
    }
 
-   if (path_lookup(iinfo->name, 0, &actualNd)) {
+   if (compat_path_lookup(iinfo->name, 0, &actualNd)) {
       LOG(4, "DentryOpRevalidate: [%s] no longer exists\n", iinfo->name);
       return 0;
    }
index 787fe6bf4b823bc30aec08355ceed9a5073abe10..b7c535ecb992c7d6ebcba22e22de9c6be9a6e146 100644 (file)
@@ -43,7 +43,10 @@ static struct inode *GetInode(struct super_block *sb, ino_t ino);
 
 /* File system operations */
 
-#if defined(VMW_GETSB_2618)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
+static struct dentry *FsOpMount(struct file_system_type *fsType, int flags,
+                                const char *devName, void *rawData);
+#elif defined(VMW_GETSB_2618)
 static int FsOpGetSb(struct file_system_type *fsType, int flags,
                      const char *devName, void *rawData, struct vfsmount *mnt);
 #else
@@ -66,7 +69,11 @@ static size_t fsRootLen;
 static struct file_system_type fsType = {
    .owner = THIS_MODULE,
    .name = VMBLOCK_FS_NAME,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
+   .mount = FsOpMount,
+#else
    .get_sb = FsOpGetSb,
+#endif
    .kill_sb = kill_anon_super,
 };
 
@@ -534,7 +541,33 @@ FsOpReadSuper(struct super_block *sb, // OUT: Superblock object
 }
 
 
-#if defined(VMW_GETSB_2618)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * FsOpMount --
+ *
+ *    Invokes generic kernel code to mount a deviceless filesystem.
+ *
+ * Results:
+ *    Mount's root dentry tructure on success
+ *    ERR_PTR()-encoded negative error code on failure
+ *
+ * Side effects:
+ *    None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+struct dentry *
+FsOpMount(struct file_system_type *fs_type, // IN: file system type of mount
+          int flags,                        // IN: mount flags
+          const char *dev_name,             // IN: device mounting on
+          void *rawData)                    // IN: mount arguments
+{
+   return mount_nodev(fs_type, flags, rawData, FsOpReadSuper);
+}
+#elif defined(VMW_GETSB_2618)
 /*
  *-----------------------------------------------------------------------------
  *