X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=wrapper%2Fkallsyms.h;h=7f4d8300c53eb591bd7e55b84529bd2ab634e288;hb=3b4aafcbbef722c5d04f2fe06a47c47d4d23eda0;hp=8200018a38e59b5959c51d5952b3052ecaed74f5;hpb=43a2a0fa96e8de4c67e5c6af1d2f34e850529fa7;p=lttng-modules.git diff --git a/wrapper/kallsyms.h b/wrapper/kallsyms.h index 8200018a..7f4d8300 100644 --- a/wrapper/kallsyms.h +++ b/wrapper/kallsyms.h @@ -1,7 +1,5 @@ -#ifndef _LTTNG_WRAPPER_KALLSYMS_H -#define _LTTNG_WRAPPER_KALLSYMS_H - -/* +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) + * * wrapper/kallsyms.h * * wrapper around kallsyms_lookup_name. Implements arch-dependent code for @@ -10,23 +8,13 @@ * * Copyright (C) 2011 Avik Sil (avik.sil@linaro.org) * Copyright (C) 2011-2012 Mathieu Desnoyers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; only - * version 2.1 of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef _LTTNG_WRAPPER_KALLSYMS_H +#define _LTTNG_WRAPPER_KALLSYMS_H + #include +#include /* * PowerPC ABIv1 needs KALLSYMS_ALL to get the function descriptor, @@ -38,12 +26,26 @@ # endif #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) + +unsigned long wrapper_kallsyms_lookup_name(const char *name); + +#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */ + +static inline +unsigned long wrapper_kallsyms_lookup_name(const char *name) +{ + return kallsyms_lookup_name(name); +} + +#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */ + static inline unsigned long kallsyms_lookup_funcptr(const char *name) { unsigned long addr; - addr = kallsyms_lookup_name(name); + addr = wrapper_kallsyms_lookup_name(name); #ifdef CONFIG_ARM #ifdef CONFIG_THUMB2_KERNEL if (addr) @@ -56,6 +58,7 @@ unsigned long kallsyms_lookup_funcptr(const char *name) static inline unsigned long kallsyms_lookup_dataptr(const char *name) { - return kallsyms_lookup_name(name); + return wrapper_kallsyms_lookup_name(name); } + #endif /* _LTTNG_WRAPPER_KALLSYMS_H */