1/* $NetBSD: npf_component.c,v 1.2 2016/01/26 23:12:19 pooka Exp $ */ 2 3/* 4 * Public Domain. 5 */ 6 7#include <sys/cdefs.h> 8__KERNEL_RCSID(0, "$NetBSD: npf_component.c,v 1.2 2016/01/26 23:12:19 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-sys/kern.h> 16#include <rump-sys/vfs.h> 17 18extern const struct cdevsw npf_cdevsw; 19 20RUMP_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