xref: /netbsd-src/sys/rump/net/lib/libnpf/npf_component.c (revision aad9773e38ed2370a628a6416e098f9008fc10a7)
1 /*	$NetBSD: npf_component.c,v 1.1 2014/03/13 02:07:24 pooka Exp $	*/
2 
3 /*
4  * Public Domain.
5  */
6 
7 #include <sys/cdefs.h>
8 __KERNEL_RCSID(0, "$NetBSD: npf_component.c,v 1.1 2014/03/13 02:07:24 pooka Exp $");
9 
10 #include <sys/param.h>
11 #include <sys/conf.h>
12 #include <sys/device.h>
13 #include <sys/stat.h>
14 
15 #include "rump_private.h"
16 #include "rump_vfs_private.h"
17 
18 extern const struct cdevsw npf_cdevsw;
19 
20 RUMP_COMPONENT(RUMP_COMPONENT_NET)
21 {
22 	devmajor_t bmajor = NODEVMAJOR, cmajor = NODEVMAJOR;
23 	int error;
24 
25 	error = devsw_attach("npf", NULL, &bmajor, &npf_cdevsw, &cmajor);
26 	if (error) {
27 		panic("npf attach failed: %d", error);
28 	}
29 
30 	error = rump_vfs_makeonedevnode(S_IFCHR, "/dev/npf", cmajor, 0);
31 	if (error) {
32 		panic("npf device node creation failed: %d", error);
33 	}
34 	devsw_detach(NULL, &npf_cdevsw);
35 }
36