PERFORCE change 146544 for review
Ed Schouten
ed at FreeBSD.org
Sun Aug 3 17:37:20 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=146544
Change 146544 by ed at ed_flippo on 2008/08/03 17:36:53
Add a counter to store the number of null modem devices.
Affected files ...
.. //depot/projects/mpsafetty/sys/dev/nmdm/nmdm.c#4 edit
Differences ...
==== //depot/projects/mpsafetty/sys/dev/nmdm/nmdm.c#4 (text+ko) ====
@@ -93,12 +93,16 @@
struct mtx ns_mtx;
};
+static int nmdm_count = 0;
+
static struct nmdmsoftc *
nmdm_alloc(unsigned long unit, struct ucred *cr)
{
struct nmdmsoftc *ns;
struct tty *tp;
+ atomic_add_acq_int(&nmdm_count, 1);
+
ns = malloc(sizeof(*ns), M_NMDM, M_WAITOK|M_ZERO);
mtx_init(&ns->ns_mtx, "nmdm", NULL, MTX_DEF);
@@ -344,8 +348,9 @@
break;
case MOD_UNLOAD:
+ if (nmdm_count != 0)
+ return (EBUSY);
EVENTHANDLER_DEREGISTER(dev_clone, tag);
- /* XXX: track counter! */
break;
default:
More information about the p4-projects
mailing list