Whamcloud - gitweb
LU-15420 build: fixes to support building on Ubuntu 22.04 LTS
[fs/lustre-release.git] / libcfs / include / libcfs / linux / linux-misc.h
index 2309c6d..faec22b 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
 #ifndef __LIBCFS_LINUX_MISC_H__
@@ -41,6 +40,7 @@
 #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
@@ -97,6 +97,10 @@ int cfs_apply_workqueue_attrs(struct workqueue_struct *wq,
 int kstrtobool_from_user(const char __user *s, size_t count, bool *res);
 #endif /* HAVE_KSTRTOBOOL_FROM_USER */
 
+#ifndef HAVE_MATCH_WILDCARD
+bool match_wildcard(const char *pattern, const char *str);
+#endif /* !HAVE_MATCH_WILDCARD */
+
 #ifndef HAVE_KREF_READ
 static inline int kref_read(const struct kref *kref)
 {
@@ -146,4 +150,20 @@ void cfs_arch_init(void);
 #define sizeof_field(type, member)     FIELD_SIZEOF(type, member)
 #endif
 
+#ifndef HAVE_TASK_IS_RUNNING
+#define task_is_running(task)          (task->state == TASK_RUNNING)
+#endif
+
+#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;
+}
+#endif
+
 #endif /* __LIBCFS_LINUX_MISC_H__ */