GNU Linux-libre 4.14.332-gnu1
[releases.git] / drivers / staging / lustre / include / uapi / linux / lustre / 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, 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 __UAPI_LUSTRE_KERNELCOMM_H__
38 #define __UAPI_LUSTRE_KERNELCOMM_H__
39
40 #include <linux/types.h>
41
42 /* KUC message header.
43  * All current and future KUC messages should use this header.
44  * To avoid having to include Lustre headers from libcfs, define this here.
45  */
46 struct kuc_hdr {
47         __u16 kuc_magic;
48         /* Each new Lustre feature should use a different transport */
49         __u8  kuc_transport;
50         __u8  kuc_flags;
51         /* Message type or opcode, transport-specific */
52         __u16 kuc_msgtype;
53         /* Including header */
54         __u16 kuc_msglen;
55 } __aligned(sizeof(__u64));
56
57 #define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr) + CR_MAXSIZE)
58
59 #define KUC_MAGIC               0x191C /*Lustre9etLinC */
60
61 /* kuc_msgtype values are defined in each transport */
62 enum kuc_transport_type {
63         KUC_TRANSPORT_GENERIC   = 1,
64         KUC_TRANSPORT_HSM       = 2,
65         KUC_TRANSPORT_CHANGELOG = 3,
66 };
67
68 enum kuc_generic_message_type {
69         KUC_MSG_SHUTDOWN        = 1,
70 };
71
72 /* KUC Broadcast Groups. This determines which userspace process hears which
73  * messages.  Mutliple transports may be used within a group, or multiple
74  * groups may use the same transport.  Broadcast
75  * groups need not be used if e.g. a UID is specified instead;
76  * use group 0 to signify unicast.
77  */
78 #define KUC_GRP_HSM     0x02
79 #define KUC_GRP_MAX     KUC_GRP_HSM
80
81 #define LK_FLG_STOP 0x01
82 #define LK_NOFD -1U
83
84 /* kernelcomm control structure, passed from userspace to kernel */
85 struct lustre_kernelcomm {
86         __u32 lk_wfd;
87         __u32 lk_rfd;
88         __u32 lk_uid;
89         __u32 lk_group;
90         __u32 lk_data;
91         __u32 lk_flags;
92 } __packed;
93
94 #endif  /* __UAPI_LUSTRE_KERNELCOMM_H__ */