Whamcloud - gitweb
LU-13456 ldlm: fix reprocessing of locks with more bits
[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  *
31  * lustre/include/lustre_lib.h
32  *
33  * Basic Lustre library routines.
34  */
35
36 #ifndef _LUSTRE_LIB_H
37 #define _LUSTRE_LIB_H
38
39 /** \defgroup lib lib
40  *
41  * @{
42  */
43
44 #ifdef HAVE_SCHED_HEADERS
45 #include <linux/sched/signal.h>
46 #include <linux/sched/mm.h>
47 #endif
48
49 #include <libcfs/libcfs.h>
50 #include <uapi/linux/lustre/lustre_idl.h>
51 #include <uapi/linux/lustre/lustre_ver.h>
52 #include <uapi/linux/lustre/lustre_cfg.h>
53
54 /* target.c */
55 struct ptlrpc_request;
56 struct obd_export;
57 struct lu_target;
58 #include <lustre_ha.h>
59 #include <lustre_net.h>
60
61 #define LI_POISON 0x5a5a5a5a
62 #if BITS_PER_LONG > 32
63 # define LL_POISON 0x5a5a5a5a5a5a5a5aL
64 #else
65 # define LL_POISON 0x5a5a5a5aL
66 #endif
67 #define LP_POISON ((void *)LL_POISON)
68
69 #ifdef HAVE_SERVER_SUPPORT
70 int rev_import_init(struct obd_export *exp);
71 int target_handle_connect(struct ptlrpc_request *req);
72 int target_handle_disconnect(struct ptlrpc_request *req);
73 void target_destroy_export(struct obd_export *exp);
74 void target_committed_to_req(struct ptlrpc_request *req);
75 void target_cancel_recovery_timer(struct obd_device *obd);
76 void target_stop_recovery_thread(struct obd_device *obd);
77 void target_cleanup_recovery(struct obd_device *obd);
78 int target_queue_recovery_request(struct ptlrpc_request *req,
79                                   struct obd_device *obd);
80 int target_bulk_io(struct obd_export *exp, struct ptlrpc_bulk_desc *desc);
81 #endif
82
83 int target_pack_pool_reply(struct ptlrpc_request *req);
84 int do_set_info_async(struct obd_import *imp,
85                       int opcode, int version,
86                       size_t keylen, void *key,
87                       size_t vallen, void *val,
88                       struct ptlrpc_request_set *set);
89
90 void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id);
91
92 #define LL_CDEBUG_PAGE(mask, page, fmt, arg...)                         \
93         CDEBUG(mask, "page %p map %p index %lu flags %lx count %u priv %0lx: " \
94                fmt, page, page->mapping, page->index, (long)page->flags, \
95                page_count(page), page_private(page), ## arg)
96
97 /** @} lib */
98
99 #endif /* _LUSTRE_LIB_H */