Whamcloud - gitweb
LU-8585 llite: add special fid handling for fhandle API
[fs/lustre-release.git] / lustre / include / uapi / linux / lustre / lustre_kernelcomm.h
1 /*
2  * LGPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library.
18  *
19  * LGPL HEADER END
20  */
21 /*
22  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
23  * Use is subject to license terms.
24  *
25  * Copyright (c) 2013, Intel Corporation.
26  */
27 /*
28  * This file is part of Lustre, http://www.lustre.org/
29  *
30  * Author: Nathan Rutman <nathan.rutman@seagate.com>
31  *
32  * Kernel <-> userspace communication routines.
33  * The definitions below are used in the kernel and userspace.
34  */
35
36 #ifndef __UAPI_KERNELCOMM_H__
37 #define __UAPI_KERNELCOMM_H__
38
39 #include <linux/types.h>
40
41 #define LUSTRE_GENL_NAME                "lustre"
42 #define LUSTRE_GENL_VERSION             0x1
43
44 /*
45  * enum lustre_commands               - Supported Lustre Netlink commands
46  *
47  * @LUSTRE_CMD_UNSPEC:                  unspecified command to catch errors
48  * @LUSTRE_CMD_DEVICES:                 command to manage the Lustre devices
49  */
50 enum lustre_commands {
51         LUSTRE_CMD_UNSPEC       = 0,
52         LUSTRE_CMD_DEVICES      = 1,
53
54         __LUSTRE_CMD_MAX_PLUS_ONE
55 };
56
57 #define LUSTRE_CMD_MAX  (__LUSTRE_CMD_MAX_PLUS_ONE - 1)
58
59 /* KUC message header.
60  * All current and future KUC messages should use this header.
61  * To avoid having to include Lustre headers from libcfs, define this here.
62  */
63 struct kuc_hdr {
64         __u16 kuc_magic;
65         __u8  kuc_transport;  /* Each new Lustre feature should use a different
66                                  transport */
67         __u8  kuc_flags;
68         __u16 kuc_msgtype;    /* Message type or opcode, transport-specific */
69         __u16 kuc_msglen;     /* Including header */
70 } __attribute__((aligned(sizeof(__u64))));
71
72
73 #define KUC_MAGIC  0x191C /*Lustre9etLinC */
74
75 /* kuc_msgtype values are defined in each transport */
76 enum kuc_transport_type {
77         KUC_TRANSPORT_GENERIC   = 1,
78         KUC_TRANSPORT_HSM       = 2,
79 };
80
81 enum kuc_generic_message_type {
82         KUC_MSG_SHUTDOWN = 1,
83 };
84
85 /* KUC Broadcast Groups. This determines which userspace process hears which
86  * messages.  Mutliple transports may be used within a group, or multiple
87  * groups may use the same transport.  Broadcast
88  * groups need not be used if e.g. a UID is specified instead;
89  * use group 0 to signify unicast.
90  */
91 #define KUC_GRP_HSM     0x02
92 #define KUC_GRP_MAX     KUC_GRP_HSM
93
94 enum lk_flags {
95         LK_FLG_STOP     = 0x0001,
96         LK_FLG_DATANR   = 0x0002,
97 };
98 #define LK_NOFD -1U
99
100 /* kernelcomm control structure, passed from userspace to kernel.
101  * For compatibility with old copytools, users who pass ARCHIVE_IDs
102  * to kernel using lk_data_count and lk_data should fill lk_flags with
103  * LK_FLG_DATANR. Otherwise kernel will take lk_data_count as bitmap of
104  * ARCHIVE IDs.
105  */
106 struct lustre_kernelcomm {
107         __u32 lk_wfd;
108         __u32 lk_rfd;
109         __u32 lk_uid;
110         __u32 lk_group;
111         __u32 lk_data_count;
112         __u32 lk_flags;
113         __u32 lk_data[0];
114 } __attribute__((packed));
115
116 #endif  /* __UAPI_KERNELCOMM_H__ */