From 2ea841feac2de8ade987c18cb7043aacfebe0d83 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Tue, 2 Nov 2010 20:54:20 -0400 Subject: [PATCH] Linux: 2.6.37 - replace get_sb with mount With kernel 2.6.37 the new entry point for mounting a filesystem is the mount() operation instead of get_sb(). Replace afs_get_sb with afs_mount if the new operation is available, and use mount_nodev instead of get_sb_nodev. Note that this is not strictly required for 2.6.37 since the old interfaces are still around, but we might as well switch now. Change-Id: Icc73a552fd53148bdd7b84e6d3266491488d9ed2 Reviewed-on: http://gerrit.openafs.org/3245 Reviewed-by: Marc Dionne Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- acinclude.m4 | 1 + src/afs/LINUX/osi_vfsops.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 7d5d0bf..6031283 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -770,6 +770,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) AC_CHECK_LINUX_STRUCT([inode], [i_security], [fs.h]) AC_CHECK_LINUX_STRUCT([file_operations], [flock], [fs.h]) AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h]) + AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h]) AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h]) AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h]) AC_CHECK_LINUX_STRUCT([super_block], [s_bdi], [fs.h]) diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index 8104dea..22146d7 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -45,7 +45,19 @@ static int afs_root(struct super_block *afsp); int afs_fill_super(struct super_block *sb, void *data, int silent); -#ifdef GET_SB_HAS_STRUCT_VFSMOUNT +/* + * afs_mount (2.6.37+) and afs_get_sb (2.6.36-) are the entry + * points from the vfs when mounting afs. The super block + * structure is setup in the afs_fill_super callback function. + */ + +#if defined(STRUCT_FILE_SYSTEM_TYPE_HAS_MOUNT) +static struct dentry * +afs_mount(struct file_system_type *fs_type, int flags, + const char *dev_name, void *data) { + return mount_nodev(fs_type, flags, data, afs_fill_super); +} +#elif defined(GET_SB_HAS_STRUCT_VFSMOUNT) static int afs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, struct vfsmount *mnt) { @@ -62,7 +74,11 @@ afs_get_sb(struct file_system_type *fs_type, int flags, struct file_system_type afs_fs_type = { .owner = THIS_MODULE, .name = "afs", +#if defined(STRUCT_FILE_SYSTEM_TYPE_HAS_MOUNT) + .mount = afs_mount, +#else .get_sb = afs_get_sb, +#endif .kill_sb = kill_anon_super, .fs_flags = FS_BINARY_MOUNTDATA, }; -- 1.9.4