#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/workqueue.h>
+#include <linux/sched.h>
+#ifdef HAVE_SCHED_HEADERS
+#include <linux/sched/signal.h>
+#endif
#include <libcfs/linux/linux-misc.h>
+#include <libcfs/linux/linux-mem.h>
#include <libcfs/linux/linux-time.h>
#include <libcfs/linux/linux-wait.h>
#include <libcfs/libcfs_private.h>
#include <libcfs/bitmap.h>
#include <libcfs/libcfs_cpu.h>
-#include <libcfs/libcfs_prim.h>
#include <libcfs/libcfs_string.h>
#include <libcfs/libcfs_workitem.h>
#include <libcfs/libcfs_hash.h>
-#include <libcfs/libcfs_heap.h>
#include <libcfs/libcfs_fail.h>
#include "curproc.h"
#define LIBCFS_VERSION "0.7.1"
-#define PO2_ROUNDUP_TYPED(x, po2, type) (-(-(type)(x) & -(type)(po2)))
-#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
-
/* Sparse annotations */
#if !defined(__must_hold)
# ifdef __CHECKER__
# endif /* !__CHECKER__ */
#endif /* !__must_hold */
-#ifdef HAVE_TOTALRAM_PAGES_AS_FUNC
- #ifndef cfs_totalram_pages
- #define cfs_totalram_pages() totalram_pages()
- #endif
-#else
- #ifndef cfs_totalram_pages
- #define cfs_totalram_pages() totalram_pages
- #endif
-#endif
-
-#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
+typedef s32 timeout_t;
/* need both kernel and user-land acceptor */
#define LNET_ACCEPTOR_MIN_RESERVED_PORT 512
return notifier_from_errno(err) | NOTIFY_STOP_MASK;
}
-/*
- * Defined by platform
- */
-int unshare_fs_struct(void);
-void cfs_block_sigsinv(unsigned long sigs, sigset_t *sigset);
-void cfs_restore_sigs(sigset_t *sigset);
-
int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data);
-#define container_of0(ptr, type, member) container_of_safe(ptr, type, member)
-
extern struct workqueue_struct *cfs_rehash_wq;
struct lnet_debugfs_symlink_def {
int (*handler)(void *data, int write, loff_t pos,
void __user *buffer, int len));
+/*
+ * Memory
+ */
+#if BITS_PER_LONG == 32
+/* limit to lowmem on 32-bit systems */
+#define NUM_CACHEPAGES \
+ min(cfs_totalram_pages(), 1UL << (30 - PAGE_SHIFT) * 3 / 4)
+#else
+#define NUM_CACHEPAGES cfs_totalram_pages()
+#endif
#define wait_var_event_warning(var, condition, format, ...) \
do { \
); \
} while (0)
+/* atomic-context safe vfree */
+void libcfs_vfree_atomic(const void *addr);
+
#endif /* _LIBCFS_LIBCFS_H_ */