1 // SPDX-License-Identifier: GPL-2.0
5 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 only,
9 * as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License version 2 for more details (a copy is included
15 * in the LICENSE file that accompanied this code).
17 * You should have received a copy of the GNU General Public License
18 * version 2 along with this program; If not, see
19 * http://www.gnu.org/licenses/gpl-2.0.html
24 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
25 * Use is subject to license terms.
27 * Copyright (c) 2011, 2015, Intel Corporation.
30 * This file is part of Lustre, http://www.lustre.org/
31 * Lustre is a trademark of Sun Microsystems, Inc.
34 #ifndef __LIBCFS_LIBCFS_H__
35 #define __LIBCFS_LIBCFS_H__
37 #include <linux/gfp.h>
38 #include <linux/list.h>
40 #include <uapi/linux/lnet/libcfs_ioctl.h>
41 #include <linux/bitops.h>
42 #include <linux/compiler.h>
43 #include <linux/ctype.h>
44 #include <linux/errno.h>
45 #include <linux/file.h>
47 #include <linux/highmem.h>
48 #include <linux/interrupt.h>
49 #include <linux/kallsyms.h>
50 #include <linux/kernel.h>
51 #include <linux/kmod.h>
52 #include <linux/kthread.h>
54 #include <linux/mm_inline.h>
55 #include <linux/module.h>
56 #include <linux/moduleparam.h>
57 #include <linux/mutex.h>
58 #include <linux/notifier.h>
59 #include <linux/pagemap.h>
60 #include <linux/random.h>
61 #include <linux/rbtree.h>
62 #include <linux/rwsem.h>
63 #include <linux/scatterlist.h>
64 #include <linux/sched.h>
65 #include <linux/signal.h>
66 #include <linux/slab.h>
67 #include <linux/smp.h>
68 #include <linux/stat.h>
69 #include <linux/string.h>
70 #include <linux/time.h>
71 #include <linux/timer.h>
72 #include <linux/types.h>
73 #include <linux/unistd.h>
74 #include <linux/vmalloc.h>
76 #include <linux/atomic.h>
77 #include <asm/div64.h>
78 #include <linux/timex.h>
79 #include <linux/uaccess.h>
82 #include <linux/libcfs/libcfs_debug.h>
83 #include <linux/libcfs/libcfs_private.h>
84 #include <linux/libcfs/libcfs_cpu.h>
85 #include <linux/libcfs/libcfs_string.h>
86 #include <linux/libcfs/libcfs_hash.h>
87 #include <linux/libcfs/libcfs_fail.h>
89 #define LIBCFS_VERSION "0.7.0"
91 extern struct blocking_notifier_head libcfs_ioctl_list;
92 static inline int notifier_from_ioctl_errno(int err)
96 return notifier_from_errno(err) | NOTIFY_STOP_MASK;
99 int libcfs_setup(void);
101 extern struct workqueue_struct *cfs_rehash_wq;
103 void lustre_insert_debugfs(struct ctl_table *table);
104 int lprocfs_call_handler(void *data, int write, loff_t *ppos,
105 void __user *buffer, size_t *lenp,
106 int (*handler)(void *data, int write, loff_t pos,
107 void __user *buffer, int len));
112 #if BITS_PER_LONG == 32
113 /* limit to lowmem on 32-bit systems */
114 #define NUM_CACHEPAGES \
115 min(totalram_pages, 1UL << (30 - PAGE_SHIFT) * 3 / 4)
117 #define NUM_CACHEPAGES totalram_pages
120 #endif /* __LIBCFS_LIBCFS_H__ */