kernel/netgraph: Don't grab the tty_token around ldisc_{,de}register().
[dragonfly.git] / sys / netgraph7 / netgraph2.h
1 /*
2  * Copyright (c) 2014 The DragonFly Project.  All rights reserved.
3  * 
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of The DragonFly Project nor the names of its
13  *    contributors may be used to endorse or promote products derived
14  *    from this software without specific, prior written permission.
15  * 
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
20  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
22  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29
30 #ifndef _NETGRAPH_NETGRAPH2_H_
31 #define _NETGRAPH_NETGRAPH2_H_
32
33 #ifndef _KERNEL
34 #error "kernel only header file"
35 #endif
36
37 #ifndef _SYS_THREAD_H_
38 #include <sys/thread.h>
39 #endif
40 #ifndef _NETGRAPH_NETGRAPH_H_
41 #include <netgraph7/netgraph.h>
42 #endif
43
44 extern struct lwkt_port *ng_msgport[MAXCPU];
45
46 /*
47  * Return the message port for the netgraph message servicing
48  * thread for a particular cpu.
49  */
50 static __inline lwkt_port_t
51 ng_cpuport(int cpu)
52 {
53         KKASSERT(cpu >= 0 && cpu < ncpus);
54         return ng_msgport[cpu];
55 }
56
57 #endif  /* _NETGRAPH_NETGRAPH2_H_ */