The inline kallsyms_lookup_name() added by
commit
d7249d9d70a caused the following failures:
libcfs/include/libcfs/linux/linux-misc.h:150:21:
error: conflicting types for ‘kallsyms_lookup_name’
150 | static inline void *kallsyms_lookup_name(char *func)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/kallsyms.h:76:15:
note: previous declaration of ‘kallsyms_lookup_name’ was here
76 | unsigned long kallsyms_lookup_name(const char *name);
| ^~~~~~~~~~~~~~~~~~~~
This patch removes the inline kallsyms_lookup_name() definition
from linux-misc.h and adds cfs_kallsyms_lookup_name() to wrap
kallsyms_lookup_name() if it is exported or return NULL in case of
kallsyms_lookup_name() is not exported.
Fixes:
d7249d9d70a ("LU-13783 libcfs: provide fallback kallsyms_lookup_name()")
Change-Id: I4b2d4499948a8586b48db68484491ec76c3a609d
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/43296
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
#include <linux/mutex.h>
#include <linux/user_namespace.h>
#include <linux/uio.h>
+#include <linux/kallsyms.h>
#ifndef HAVE_IOV_ITER_TYPE
#ifdef HAVE_IOV_ITER_HAS_TYPE_MEMBER
#define sizeof_field(type, member) FIELD_SIZEOF(type, member)
#endif
-#ifndef HAVE_KALLSYMS_LOOKUP_NAME
-static inline void *kallsyms_lookup_name(char *func)
+#ifdef HAVE_KALLSYMS_LOOKUP_NAME
+static inline void *cfs_kallsyms_lookup_name(const char *name)
+{
+ return (void *)kallsyms_lookup_name(name);
+}
+#else
+static inline void *cfs_kallsyms_lookup_name(const char *name)
{
return NULL;
}
{
#ifdef CONFIG_ARCH_STACKWALK
task_dump_stack = (void *)
- kallsyms_lookup_name("stack_trace_save_tsk");
+ cfs_kallsyms_lookup_name("stack_trace_save_tsk");
#endif
}
#define DEBUG_SUBSYSTEM S_LNET
-#include <linux/kallsyms.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <libcfs/linux/linux-time.h>
#include <libcfs/linux/linux-wait.h>
+#include <libcfs/linux/linux-misc.h>
#ifndef HAVE_KTIME_GET_TS64
void ktime_get_ts64(struct timespec64 *ts)
wait_bit_init();
#endif
cfs_apply_workqueue_attrs_t =
- (void *)kallsyms_lookup_name("apply_workqueue_attrs");
+ (void *)cfs_kallsyms_lookup_name("apply_workqueue_attrs");
#ifndef HAVE_XARRAY_SUPPORT
radix_tree_node_cachep =
- (void *)kallsyms_lookup_name("radix_tree_node_cachep");
+ (void *)cfs_kallsyms_lookup_name("radix_tree_node_cachep");
#endif
}
* Kernel v5.2-5678-gac1c3e4 no longer exports account_page_dirtied
*/
vvp_account_page_dirtied = (void *)
- kallsyms_lookup_name("account_page_dirtied");
- BUG_ON(!vvp_account_page_dirtied);
+ cfs_kallsyms_lookup_name("account_page_dirtied");
#endif
return 0;
#elif defined(HAVE_ACCOUNT_PAGE_DIRTIED_EXPORT)
account_page_dirtied(page, mapping);
#else
- vvp_account_page_dirtied(page, mapping);
+ if (vvp_account_page_dirtied)
+ vvp_account_page_dirtied(page, mapping);
#endif
}
#ifdef CONFIG_KALLSYMS
priv_security_file_alloc =
- (void *)kallsyms_lookup_name("security_file_alloc");
+ (void *)cfs_kallsyms_lookup_name("security_file_alloc");
#endif
rc = class_register_type(&osd_obd_device_ops, NULL, true,