From b1cbc4610c8b5a9b5de80cb850a6eb58bb811a1d Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 20 Apr 2011 12:25:59 -0700 Subject: [PATCH] Linux 2.6.39 compat, kern_path_parent() The path_lookup() function has been renamed to kern_path_parent() and the flags argument has been removed. The only behavior now offered is that of LOOKUP_PARENT. The spl already always passed this flag so dropping the flag does not impact us. --- config/spl-build.m4 | 17 ++++++++ configure | 82 +++++++++++++++++++++++++++++++++++++ include/linux/file_compat.h | 6 +++ module/spl/spl-vnode.c | 6 +-- spl_config.h.in | 3 ++ 5 files changed, 111 insertions(+), 3 deletions(-) diff --git a/config/spl-build.m4 b/config/spl-build.m4 index 1a7512c..13c6835 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -79,6 +79,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ SPL_AC_KERNEL_2ARGS_INVALIDATE_INODES SPL_AC_SHRINK_DCACHE_MEMORY SPL_AC_SHRINK_ICACHE_MEMORY + SPL_AC_KERN_PATH_PARENT ]) AC_DEFUN([SPL_AC_MODULE_SYMVERS], [ @@ -1785,3 +1786,19 @@ AC_DEFUN([SPL_AC_SHRINK_ICACHE_MEMORY], [ [shrink_icache_memory() is available])], []) ]) + +dnl # +dnl # 2.6.39 API compat, +dnl # The path_lookup() function has been renamed to kern_path_parent() +dnl # and the flags argument has been removed. The only behavior now +dnl # offered is that of LOOKUP_PARENT. The spl already always passed +dnl # this flag so dropping the flag does not impact us. +dnl # +AC_DEFUN([SPL_AC_KERN_PATH_PARENT], [ + SPL_CHECK_SYMBOL_EXPORT( + [kern_path_parent], + [fs/namei.c], + [AC_DEFINE(HAVE_KERN_PATH_PARENT, 1, + [kern_path_parent() is available])], + []) +]) diff --git a/configure b/configure index 6a322ce..4761001 100755 --- a/configure +++ b/configure @@ -15613,6 +15613,47 @@ _ACEOF fi + + { $as_echo "$as_me:$LINENO: checking whether symbol kern_path_parent is exported" >&5 +$as_echo_n "checking whether symbol kern_path_parent is exported... " >&6; } + grep -q -E '[[:space:]]kern_path_parent[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in fs/namei.c; do + grep -q -E "EXPORT_SYMBOL.*(kern_path_parent)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + + else + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_KERN_PATH_PARENT 1 +_ACEOF + + fi + else + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_KERN_PATH_PARENT 1 +_ACEOF + + fi + + ;; user) @@ -19587,6 +19628,47 @@ _ACEOF + { $as_echo "$as_me:$LINENO: checking whether symbol kern_path_parent is exported" >&5 +$as_echo_n "checking whether symbol kern_path_parent is exported... " >&6; } + grep -q -E '[[:space:]]kern_path_parent[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in fs/namei.c; do + grep -q -E "EXPORT_SYMBOL.*(kern_path_parent)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + + else + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_KERN_PATH_PARENT 1 +_ACEOF + + fi + else + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_KERN_PATH_PARENT 1 +_ACEOF + + fi + + + if test "x$AWK" != xgawk; then diff --git a/include/linux/file_compat.h b/include/linux/file_compat.h index 0bef014..97bd763 100644 --- a/include/linux/file_compat.h +++ b/include/linux/file_compat.h @@ -67,5 +67,11 @@ spl_filp_open(const char *name, int flags, int mode, int *err) #define spl_inode_unlock(ip) (up(&(ip)->i_sem)) #endif /* HAVE_INODE_I_MUTEX */ +#ifdef HAVE_KERN_PATH_PARENT +#define spl_kern_path_parent(path, nd) kern_path_parent(path, nd) +#else +#define spl_kern_path_parent(path, nd) path_lookup(path, LOOKUP_PARENT, nd) +#endif /* HAVE_KERN_PATH_PARENT */ + #endif /* SPL_FILE_COMPAT_H */ diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index 1af9b29..c466431 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -316,7 +316,7 @@ vn_remove(const char *path, uio_seg_t seg, int flags) ASSERT(seg == UIO_SYSSPACE); ASSERT(flags == RMFILE); - rc = path_lookup(path, LOOKUP_PARENT, &nd); + rc = spl_kern_path_parent(path, &nd); if (rc) SGOTO(exit, rc); @@ -370,11 +370,11 @@ vn_rename(const char *oldname, const char *newname, int x1) int rc = 0; SENTRY; - rc = path_lookup(oldname, LOOKUP_PARENT, &oldnd); + rc = spl_kern_path_parent(oldname, &oldnd); if (rc) SGOTO(exit, rc); - rc = path_lookup(newname, LOOKUP_PARENT, &newnd); + rc = spl_kern_path_parent(newname, &newnd); if (rc) SGOTO(exit1, rc); diff --git a/spl_config.h.in b/spl_config.h.in index afa1535..7f084f5 100644 --- a/spl_config.h.in +++ b/spl_config.h.in @@ -111,6 +111,9 @@ /* kallsyms_lookup_name() is available */ #undef HAVE_KALLSYMS_LOOKUP_NAME +/* kern_path_parent() is available */ +#undef HAVE_KERN_PATH_PARENT + /* kmalloc_node() is available */ #undef HAVE_KMALLOC_NODE -- 2.39.2