1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2009 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * Author: Nathan Rutman <nathan.rutman@sun.com>
38 * libcfs/include/libcfs/libcfs_kernelcomm.h
40 * Kernel <-> userspace communication routines. We'll use a shorthand term
41 * "lnl" (Lustre NetLink) for this interface name for all arches, even though
42 * an implemtation may not use NetLink.
43 * The definitions below are used in the kernel and userspace.
47 #ifndef __LIBCFS_KERNELCOMM_H__
48 #define __LIBCFS_KERNELCOMM_H__
50 #ifndef __LIBCFS_LIBCFS_H__
51 #error Do not #include this file directly. #include <libcfs/libcfs.h> instead
54 /* LNL message header.
55 * All current and future LNL messages should use this header.
56 * To avoid having to include Lustre headers from libcfs, define this here.
60 __u8 lnl_transport; /* Each new Lustre feature should use a different
63 __u16 lnl_msgtype; /* Message type or opcode, transport-specific */
65 } __attribute__((aligned(sizeof(__u64))));
67 #define LNL_MAGIC 0x191C /*Lustre9etLinC */
68 #define LNL_FL_BLOCK 0x01 /* Wait for send */
70 /* lnl_msgtype values are defined in each transport */
71 enum lnl_transport_type {
72 LNL_TRANSPORT_GENERIC = 1,
73 LNL_TRANSPORT_HSM = 2,
74 LNL_TRANSPORT_CHANGELOG = 3,
77 enum lnl_generic_message_type {
81 /* LNL Broadcast Groups. This determines which userspace process hears which
82 * messages. Mutliple transports may be used within a group, or multiple
83 * groups may use the same transport. Broadcast
84 * groups need not be used if e.g. a PID is specified instead;
85 * use group 0 to signify unicast.
87 #define LNL_GRP_HSM 0x02
91 #if defined(HAVE_NETLINK) && defined (__KERNEL__)
92 extern int libcfs_klnl_start(int transport);
93 extern int libcfs_klnl_stop(int transport, int group);
94 extern int libcfs_klnl_msg_put(int pid, int group, void *payload);
96 static inline int libcfs_klnl_start(int transport) {
99 static inline int libcfs_klnl_stop(int transport, int group) {
102 static inline int libcfs_klnl_msg_put(int pid, int group, void *payload) {
108 * NetLink socket number, see include/linux/netlink.h
109 * All LNL users share a single netlink socket. This actually is NetLink
110 * specific, but is not to be used outside of the Linux implementation
111 * (linux-kernelcomm.c and posix-kernelcomm.c).
113 #define LNL_SOCKET 26
116 #endif /* __LIBCFS_KERNELCOMM_H__ */