summaryrefslogtreecommitdiffstats
path: root/sys/dev/vn
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1994-12-06 06:47:32 +0000
committerphk <phk@FreeBSD.org>1994-12-06 06:47:32 +0000
commit3bfd4a6175afe48f38c2ac13602c66bb61be16a1 (patch)
tree86e9bc7227397cc42a7004a67e145e2fd48abe2a /sys/dev/vn
parenteade49e148c4d4fdb249fd663bb143ea0c12aa6b (diff)
downloadFreeBSD-src-3bfd4a6175afe48f38c2ac13602c66bb61be16a1.zip
FreeBSD-src-3bfd4a6175afe48f38c2ac13602c66bb61be16a1.tar.gz
Avoid a panic if vn is configured as swapdev. Seems to work fine.
Diffstat (limited to 'sys/dev/vn')
-rw-r--r--sys/dev/vn/vn.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c
index 63d0359..f74f2b3 100644
--- a/sys/dev/vn/vn.c
+++ b/sys/dev/vn/vn.c
@@ -64,6 +64,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/kernel.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/errno.h>
@@ -509,6 +510,7 @@ vnshutdown()
if (vn_softc[i] && vn_softc[i]->sc_flags & VNF_INITED)
vnclear(vn_softc[i]);
}
+
TEXT_SET(cleanup_set,vnshutdown);
void
@@ -535,11 +537,12 @@ size_t
vnsize(dev_t dev)
{
int unit = vnunit(dev);
- register struct vn_softc *vn = vn_softc[unit];
- if (unit >= numvnd || (vn->sc_flags & VNF_INITED) == 0)
+ if (!vn_softc ||
+ unit >= numvnd ||
+ (vn_softc[unit]->sc_flags & VNF_INITED) == 0)
return(-1);
- return(vn->sc_size);
+ return(vn_softc[unit]->sc_size);
}
int
OpenPOWER on IntegriCloud