Whamcloud - gitweb
LU-12931 libcfs: skip cfs_time_seconds() indirection
[fs/lustre-release.git] / libcfs / include / libcfs / linux / linux-misc.h
index 87bfda1..3a8f71b 100644 (file)
@@ -99,6 +99,27 @@ 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_KREF_READ
+static inline int kref_read(const struct kref *kref)
+{
+       return atomic_read(&kref->refcount);
+}
+#endif /* HAVE_KREF_READ */
+
+#ifdef HAVE_FORCE_SIG_WITH_TASK
+#define cfs_force_sig(sig, task)       force_sig((sig), (task))
+#else
+#define cfs_force_sig(sig, task)                                       \
+do {                                                                   \
+       unsigned long flags;                                            \
+                                                                       \
+       spin_lock_irqsave(&task->sighand->siglock, flags);              \
+       task->sighand->action[sig - 1].sa.sa_handler = SIG_DFL;         \
+       send_sig(sig, task, 1);                                         \
+       spin_unlock_irqrestore(&task->sighand->siglock, flags);         \
+} while (0)
+#endif
+
 void cfs_arch_init(void);
 
 #ifndef container_of_safe