diff options
| author | cgd <cgd@NetBSD.org> | 1994-04-11 19:53:29 +0000 |
|---|---|---|
| committer | cgd <cgd@NetBSD.org> | 1994-04-11 19:53:29 +0000 |
| commit | 34ac381d05057c1ba0646dbbf3ca57dcc98d308f (patch) | |
| tree | 89d866607a46272ac9f047c4d9fa88eadcfac031 /sys/dev | |
| parent | e7eb2d483159111d2d62c64cd79d8b085bf028f9 (diff) | |
don't cdevvp() if a vnode for the dev already exists. Note that that's
conceptually icky; you end up ref'ing a 'real' vnode, and hence perhaps
tying down a file system; should be able to reference a 'fake' one,
but i doesn't appear save to cdevvp() if vnode for same dev is already
around... also, mark vfinddev()s XXX (for later).
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/cons.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/dev/cons.c b/sys/dev/cons.c index 497baa881ca..c5dd34af751 100644 --- a/sys/dev/cons.c +++ b/sys/dev/cons.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.13 1994/04/10 01:11:28 cgd Exp $ + * $Id: cons.c,v 1.14 1994/04/11 19:53:29 cgd Exp $ */ #include <sys/param.h> @@ -101,8 +101,14 @@ cnopen(dev, flag, mode, p) */ dev = cn_tab->cn_dev; if (cn_devvp == NULLVP) { - /* try to get a reference on its vnode, but fail silently */ - cdevvp(dev, &cn_devvp); + /* + * try to get a reference on its vnode, but fail silently + * vfinddev XXX + */ + if (vfinddev(dev, VCHR, &cn_devvp) == 0 && vcount(cn_devvp)) + vref(cn_devvp); + else + cdevvp(dev, &cn_devvp); } return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p)); } @@ -129,7 +135,7 @@ cnclose(dev, flag, mode, p) vrele(cn_devvp); cn_devvp = NULLVP; } - if ((vfinddev(dev, VCHR, &vp) == 0) && vcount(vp)) + if ((vfinddev(dev, VCHR, &vp) == 0) && vcount(vp)) /* XXX */ return (0); return ((*cdevsw[major(dev)].d_close)(dev, flag, mode, p)); } |
