Avoid a panic if vn is configured as swapdev. Seems to work fine.

This commit is contained in:
Poul-Henning Kamp 1994-12-06 06:47:32 +00:00
parent 62c83be30c
commit e419848b2c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=5000

View File

@ -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