Whamcloud - gitweb
LU-13783 libcfs: provide fallback kallsyms_lookup_name()
[fs/lustre-release.git] / libcfs / libcfs / linux / linux-prim.c
index 3018a71..0940c80 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
-#include <linux/fs_struct.h>
 #include <linux/sched.h>
 #ifdef HAVE_SCHED_HEADERS
 #include <linux/sched/mm.h>
@@ -110,11 +109,15 @@ static int (*cfs_apply_workqueue_attrs_t)(struct workqueue_struct *wq,
 int cfs_apply_workqueue_attrs(struct workqueue_struct *wq,
                              const struct workqueue_attrs *attrs)
 {
-       return cfs_apply_workqueue_attrs_t(wq, attrs);
+       if (cfs_apply_workqueue_attrs_t)
+               return cfs_apply_workqueue_attrs_t(wq, attrs);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(cfs_apply_workqueue_attrs);
 
-struct kmem_cache (*cfs_radix_tree_node_cachep);
+#ifndef HAVE_XARRAY_SUPPORT
+struct kmem_cache (*radix_tree_node_cachep);
+#endif
 
 void __init cfs_arch_init(void)
 {
@@ -123,6 +126,10 @@ void __init cfs_arch_init(void)
 #endif
        cfs_apply_workqueue_attrs_t =
                (void *)kallsyms_lookup_name("apply_workqueue_attrs");
+#ifndef HAVE_XARRAY_SUPPORT
+       radix_tree_node_cachep =
+               (void *)kallsyms_lookup_name("radix_tree_node_cachep");
+#endif
 }
 
 int cfs_kernel_write(struct file *filp, const void *buf, size_t count,