mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 03:19:35 +03:00
Drop support for 3 argument version of set_fs_pwd
This was a suggestion that Brian Behlendorf made when reviewing an early pull request for Linux 3.9 support. This commit was made intentionally easy to revert should we ever have a reason to reintroduce support for older kernels. Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
parent
a54718cfe0
commit
8274ed5988
@ -63,7 +63,6 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
|
|||||||
SPL_AC_GET_ZONE_COUNTS
|
SPL_AC_GET_ZONE_COUNTS
|
||||||
SPL_AC_USER_PATH_DIR
|
SPL_AC_USER_PATH_DIR
|
||||||
SPL_AC_SET_FS_PWD
|
SPL_AC_SET_FS_PWD
|
||||||
SPL_AC_2ARGS_SET_FS_PWD
|
|
||||||
SPL_AC_SET_FS_PWD_WITH_CONST
|
SPL_AC_SET_FS_PWD_WITH_CONST
|
||||||
SPL_AC_2ARGS_VFS_UNLINK
|
SPL_AC_2ARGS_VFS_UNLINK
|
||||||
SPL_AC_4ARGS_VFS_RENAME
|
SPL_AC_4ARGS_VFS_RENAME
|
||||||
@ -1672,33 +1671,11 @@ AC_DEFUN([SPL_AC_SET_FS_PWD],
|
|||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
|
||||||
dnl # 2.6.25 API change,
|
|
||||||
dnl # Simplied API by replacing mnt+dentry args with a single path arg.
|
|
||||||
dnl #
|
|
||||||
AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
|
|
||||||
[AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args])
|
|
||||||
SPL_LINUX_TRY_COMPILE([
|
|
||||||
#include <linux/sched.h>
|
|
||||||
#include <linux/fs_struct.h>
|
|
||||||
],[
|
|
||||||
set_fs_pwd(NULL, NULL);
|
|
||||||
],[
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
|
|
||||||
[set_fs_pwd() wants 2 args])
|
|
||||||
HAVE_2ARGS_SET_FS_PWD=yes
|
|
||||||
],[
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 3.9 API change
|
dnl # 3.9 API change
|
||||||
dnl # set_fs_pwd takes const struct path *
|
dnl # set_fs_pwd takes const struct path *
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
|
AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
|
||||||
if test "x$HAVE_2ARGS_SET_FS_PWD" = xyes; then
|
|
||||||
tmp_flags="$EXTRA_KCFLAGS"
|
tmp_flags="$EXTRA_KCFLAGS"
|
||||||
EXTRA_KCFLAGS="-Werror"
|
EXTRA_KCFLAGS="-Werror"
|
||||||
[AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *])
|
[AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *])
|
||||||
@ -1732,7 +1709,6 @@ if test "x$HAVE_2ARGS_SET_FS_PWD" = xyes; then
|
|||||||
])
|
])
|
||||||
])
|
])
|
||||||
EXTRA_KCFLAGS="$tmp_flags"
|
EXTRA_KCFLAGS="$tmp_flags"
|
||||||
fi
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -837,8 +837,6 @@ vn_releasef(int fd)
|
|||||||
EXPORT_SYMBOL(releasef);
|
EXPORT_SYMBOL(releasef);
|
||||||
|
|
||||||
#ifndef HAVE_SET_FS_PWD
|
#ifndef HAVE_SET_FS_PWD
|
||||||
# ifdef HAVE_2ARGS_SET_FS_PWD
|
|
||||||
/* Used from 2.6.25 - 2.6.31+ */
|
|
||||||
void
|
void
|
||||||
# ifdef HAVE_SET_FS_PWD_WITH_CONST
|
# ifdef HAVE_SET_FS_PWD_WITH_CONST
|
||||||
set_fs_pwd(struct fs_struct *fs, const struct path *path)
|
set_fs_pwd(struct fs_struct *fs, const struct path *path)
|
||||||
@ -865,37 +863,16 @@ set_fs_pwd(struct fs_struct *fs, struct path *path)
|
|||||||
if (old_pwd.dentry)
|
if (old_pwd.dentry)
|
||||||
path_put(&old_pwd);
|
path_put(&old_pwd);
|
||||||
}
|
}
|
||||||
# else
|
|
||||||
/* Used from 2.6.11 - 2.6.24 */
|
|
||||||
void
|
|
||||||
set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt, struct dentry *dentry)
|
|
||||||
{
|
|
||||||
struct dentry *old_pwd;
|
|
||||||
struct vfsmount *old_pwdmnt;
|
|
||||||
|
|
||||||
write_lock(&fs->lock);
|
|
||||||
old_pwd = fs->pwd;
|
|
||||||
old_pwdmnt = fs->pwdmnt;
|
|
||||||
fs->pwdmnt = mntget(mnt);
|
|
||||||
fs->pwd = dget(dentry);
|
|
||||||
write_unlock(&fs->lock);
|
|
||||||
|
|
||||||
if (old_pwd) {
|
|
||||||
dput(old_pwd);
|
|
||||||
mntput(old_pwdmnt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# endif /* HAVE_2ARGS_SET_FS_PWD */
|
|
||||||
#endif /* HAVE_SET_FS_PWD */
|
#endif /* HAVE_SET_FS_PWD */
|
||||||
|
|
||||||
int
|
int
|
||||||
vn_set_pwd(const char *filename)
|
vn_set_pwd(const char *filename)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_2ARGS_SET_FS_PWD) && defined(HAVE_USER_PATH_DIR)
|
#ifdef HAVE_USER_PATH_DIR
|
||||||
struct path path;
|
struct path path;
|
||||||
#else
|
#else
|
||||||
struct nameidata nd;
|
struct nameidata nd;
|
||||||
#endif /* HAVE_2ARGS_SET_FS_PWD */
|
#endif /* HAVE_USER_PATH_DIR */
|
||||||
mm_segment_t saved_fs;
|
mm_segment_t saved_fs;
|
||||||
int rc;
|
int rc;
|
||||||
SENTRY;
|
SENTRY;
|
||||||
@ -908,7 +885,6 @@ vn_set_pwd(const char *filename)
|
|||||||
saved_fs = get_fs();
|
saved_fs = get_fs();
|
||||||
set_fs(get_ds());
|
set_fs(get_ds());
|
||||||
|
|
||||||
#ifdef HAVE_2ARGS_SET_FS_PWD
|
|
||||||
# ifdef HAVE_USER_PATH_DIR
|
# ifdef HAVE_USER_PATH_DIR
|
||||||
rc = user_path_dir(filename, &path);
|
rc = user_path_dir(filename, &path);
|
||||||
if (rc)
|
if (rc)
|
||||||
@ -937,21 +913,6 @@ dput_and_out:
|
|||||||
dput_and_out:
|
dput_and_out:
|
||||||
path_put(&nd.path);
|
path_put(&nd.path);
|
||||||
# endif /* HAVE_USER_PATH_DIR */
|
# endif /* HAVE_USER_PATH_DIR */
|
||||||
#else
|
|
||||||
rc = __user_walk(filename,
|
|
||||||
LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd);
|
|
||||||
if (rc)
|
|
||||||
SGOTO(out, rc);
|
|
||||||
|
|
||||||
rc = vfs_permission(&nd, MAY_EXEC);
|
|
||||||
if (rc)
|
|
||||||
SGOTO(dput_and_out, rc);
|
|
||||||
|
|
||||||
set_fs_pwd(current->fs, nd.nd_mnt, nd.nd_dentry);
|
|
||||||
|
|
||||||
dput_and_out:
|
|
||||||
vn_path_release(&nd);
|
|
||||||
#endif /* HAVE_2ARGS_SET_FS_PWD */
|
|
||||||
out:
|
out:
|
||||||
set_fs(saved_fs);
|
set_fs(saved_fs);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user