From: VMware, Inc <> Date: Tue, 29 Mar 2011 20:23:20 +0000 (-0700) Subject: vmblock: make buildable on kernel 2.6.39-rc0 X-Git-Tag: 2011.03.28-387002~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bf748718b997349b1724b49607384bbf9fb00ca4;p=thirdparty%2Fopen-vm-tools.git vmblock: make buildable on kernel 2.6.39-rc0 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 --- diff --git a/open-vm-tools/modules/linux/shared/compat_namei.h b/open-vm-tools/modules/linux/shared/compat_namei.h index 28d72c8e1..f82dd49be 100644 --- a/open-vm-tools/modules/linux/shared/compat_namei.h +++ b/open-vm-tools/modules/linux/shared/compat_namei.h @@ -19,9 +19,7 @@ #ifndef __COMPAT_NAMEI_H__ # define __COMPAT_NAMEI_H__ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 18) #include -#endif /* * In 2.6.25-rc2, dentry and mount objects were removed from the nameidata @@ -40,18 +38,11 @@ #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__ */ diff --git a/open-vm-tools/modules/linux/vmblock/linux/dentry.c b/open-vm-tools/modules/linux/vmblock/linux/dentry.c index 66537c8c8..05ea95a9f 100644 --- a/open-vm-tools/modules/linux/vmblock/linux/dentry.c +++ b/open-vm-tools/modules/linux/vmblock/linux/dentry.c @@ -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; } diff --git a/open-vm-tools/modules/linux/vmblock/linux/filesystem.c b/open-vm-tools/modules/linux/vmblock/linux/filesystem.c index 787fe6bf4..b7c535ecb 100644 --- a/open-vm-tools/modules/linux/vmblock/linux/filesystem.c +++ b/open-vm-tools/modules/linux/vmblock/linux/filesystem.c @@ -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) /* *----------------------------------------------------------------------------- *