Whamcloud - gitweb
LU-16271 ptlrpc: fix eviction right after recovery
[fs/lustre-release.git] / lustre / include / lustre_kernelcomm.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) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Use is subject to license terms.
25  *
26  * Copyright (c) 2013, 2017, Intel Corporation.
27  */
28 /*
29  * This file is part of Lustre, http://www.lustre.org/
30  *
31  * Author: Nathan Rutman <nathan.rutman@sun.com>
32  *
33  * Kernel <-> userspace communication routines.
34  * The definitions below are used in the kernel and userspace.
35  */
36
37 #ifndef __LUSTRE_KERNELCOMM_H__
38 #define __LUSTRE_KERNELCOMM_H__
39
40 /* For declarations shared with userspace */
41 #include <uapi/linux/lustre/lustre_kernelcomm.h>
42
43 /**
44  * enum lustre_device_attrs           - Lustre general top-level netlink
45  *                                      attributes that describe lustre
46  *                                      'devices'. These values are used
47  *                                      to piece togther messages for
48  *                                      sending and receiving.
49  *
50  * @LUSTRE_DEVICE_ATTR_UNSPEC:          unspecified attribute to catch errors
51  *
52  * @LUSTRE_DEVICE_ATTR_HDR:             Netlink group this data is for
53  *                                      (NLA_NUL_STRING)
54  * @LUSTRE_DEVICE_ATTR_INDEX:           device number used as an index (NLA_U16)
55  * @LUSTRE_DEVICE_ATTR_STATUS:          status of the device (NLA_STRING)
56  * @LUSTRE_DEVICE_ATTR_CLASS:           class the device belongs to (NLA_STRING)
57  * @LUSTRE_DEVICE_ATTR_NAME:            name of the device (NLA_STRING)
58  * @LUSTRE_DEVICE_ATTR_UUID:            UUID of the device (NLA_STRING)
59  * @LUSTRE_DEVICE_ATTR_REFCOUNT:        refcount of the device (NLA_U32)
60  */
61 enum lustre_device_attrs {
62         LUSTRE_DEVICE_ATTR_UNSPEC = 0,
63
64         LUSTRE_DEVICE_ATTR_HDR,
65         LUSTRE_DEVICE_ATTR_INDEX,
66         LUSTRE_DEVICE_ATTR_STATUS,
67         LUSTRE_DEVICE_ATTR_CLASS,
68         LUSTRE_DEVICE_ATTR_NAME,
69         LUSTRE_DEVICE_ATTR_UUID,
70         LUSTRE_DEVICE_ATTR_REFCOUNT,
71
72         __LUSTRE_DEVICE_ATTR_MAX_PLUS_ONE
73 };
74
75 #define LUSTRE_DEVICE_ATTR_MAX (__LUSTRE_DEVICE_ATTR_MAX_PLUS_ONE - 1)
76
77 /* prototype for callback function on kuc groups */
78 typedef int (*libcfs_kkuc_cb_t)(void *data, void *cb_arg);
79
80 /* Kernel methods */
81 int libcfs_kkuc_init(void);
82 void libcfs_kkuc_fini(void);
83 int libcfs_kkuc_msg_put(struct file *fp, void *payload);
84 int libcfs_kkuc_group_put(const struct obd_uuid *uuid, int group, void *data);
85 int libcfs_kkuc_group_add(struct file *fp, const struct obd_uuid *uuid, int uid,
86                           int group, void *data, size_t data_len);
87 int libcfs_kkuc_group_rem(const struct obd_uuid *uuid, int uid, int group);
88 int libcfs_kkuc_group_foreach(const struct obd_uuid *uuid, int group,
89                               libcfs_kkuc_cb_t cb_func, void *cb_arg);
90
91 #endif /* __LUSTRE_KERNELCOMM_H__ */
92