Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/filemon Although not recommended, it is possible to ...
details: https://anonhg.NetBSD.org/src/rev/96c8d3c2d20a
branches: trunk
changeset: 342685:96c8d3c2d20a
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Tue Jan 05 09:37:11 2016 +0000
description:
Although not recommended, it is possible to include filemon(4) as a
built-in module. If we do this, don't try to call devsw_attach() as
our device structures will already have been included via ioconf.[ch].
This avoids calling the init routine twice (once for CLASS_DRIVER and
then later for CLASS_ANY), which in turn avoids trying to initialize
an already initialized lock.
diffstat:
sys/dev/filemon/filemon.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (49 lines):
diff -r 81797500ae78 -r 96c8d3c2d20a sys/dev/filemon/filemon.c
--- a/sys/dev/filemon/filemon.c Tue Jan 05 09:07:19 2016 +0000
+++ b/sys/dev/filemon/filemon.c Tue Jan 05 09:37:11 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: filemon.c,v 1.22 2015/11/25 07:34:49 pgoyette Exp $ */
+/* $NetBSD: filemon.c,v 1.23 2016/01/05 09:37:11 pgoyette Exp $ */
/*
* Copyright (c) 2010, Juniper Networks, Inc.
*
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.22 2015/11/25 07:34:49 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.23 2016/01/05 09:37:11 pgoyette Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -391,8 +391,10 @@
filemon_modcmd(modcmd_t cmd, void *data)
{
int error = 0;
+#ifdef _MODULE
int bmajor = -1;
int cmajor = -1;
+#endif
switch (cmd) {
case MODULE_CMD_INIT:
@@ -401,15 +403,19 @@
#endif
error = filemon_load(data);
+#ifdef _MODULE
if (!error)
error = devsw_attach("filemon", NULL, &bmajor,
&filemon_cdevsw, &cmajor);
+#endif
break;
case MODULE_CMD_FINI:
error = filemon_unload();
+#ifdef _MODULE
if (!error)
error = devsw_detach(NULL, &filemon_cdevsw);
+#endif
break;
case MODULE_CMD_STAT:
Home |
Main Index |
Thread Index |
Old Index