Whamcloud - gitweb
LU-13783 libcfs: support __vmalloc with only 2 args.
[fs/lustre-release.git] / lustre / include / lustre_lib.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.gnu.org/licenses/gpl-2.0.html
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Use is subject to license terms.
25  *
26  * Copyright (c) 2011, 2017, Intel Corporation.
27  */
28 /*
29  * This file is part of Lustre, http://www.lustre.org/
30  * Lustre is a trademark of Sun Microsystems, Inc.
31  *
32  * lustre/include/lustre_lib.h
33  *
34  * Basic Lustre library routines.
35  */
36
37 #ifndef _LUSTRE_LIB_H
38 #define _LUSTRE_LIB_H
39
40 /** \defgroup lib lib
41  *
42  * @{
43  */
44
45 #ifdef HAVE_SCHED_HEADERS
46 #include <linux/sched/signal.h>
47 #include <linux/sched/mm.h>
48 #endif
49
50 #include <libcfs/libcfs.h>
51 #include <uapi/linux/lustre/lustre_idl.h>
52 #include <uapi/linux/lustre/lustre_ver.h>
53 #include <uapi/linux/lustre/lustre_cfg.h>
54
55 /* target.c */
56 struct ptlrpc_request;
57 struct obd_export;
58 struct lu_target;
59 #include <lustre_ha.h>
60 #include <lustre_net.h>
61
62 #define LI_POISON 0x5a5a5a5a
63 #if BITS_PER_LONG > 32
64 # define LL_POISON 0x5a5a5a5a5a5a5a5aL
65 #else
66 # define LL_POISON 0x5a5a5a5aL
67 #endif
68 #define LP_POISON ((void *)LL_POISON)
69
70 #ifdef HAVE_SERVER_SUPPORT
71 int rev_import_init(struct obd_export *exp);
72 int target_handle_connect(struct ptlrpc_request *req);
73 int target_handle_disconnect(struct ptlrpc_request *req);
74 void target_destroy_export(struct obd_export *exp);
75 void target_committed_to_req(struct ptlrpc_request *req);
76 void target_cancel_recovery_timer(struct obd_device *obd);
77 void target_stop_recovery_thread(struct obd_device *obd);
78 void target_cleanup_recovery(struct obd_device *obd);
79 int target_queue_recovery_request(struct ptlrpc_request *req,
80                                   struct obd_device *obd);
81 int target_bulk_io(struct obd_export *exp, struct ptlrpc_bulk_desc *desc);
82 #endif
83
84 int target_pack_pool_reply(struct ptlrpc_request *req);
85 int do_set_info_async(struct obd_import *imp,
86                       int opcode, int version,
87                       size_t keylen, void *key,
88                       size_t vallen, void *val,
89                       struct ptlrpc_request_set *set);
90
91 void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id);
92
93 #define LL_CDEBUG_PAGE(mask, page, fmt, arg...)                         \
94         CDEBUG(mask, "page %p map %p index %lu flags %lx count %u priv %0lx: " \
95                fmt, page, page->mapping, page->index, (long)page->flags, \
96                page_count(page), page_private(page), ## arg)
97
98 /** @} lib */
99
100 #endif /* _LUSTRE_LIB_H */