--- Net2/vm/vm_swap.c 2018/04/24 18:03:57 1.1 +++ Net2/vm/vm_swap.c 2018/04/24 18:15:13 1.1.1.5 @@ -30,7 +30,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)vm_swap.c 7.18 (Berkeley) 5/6/91 + * from: @(#)vm_swap.c 7.18 (Berkeley) 5/6/91 + * vm_swap.c,v 1.9.2.1 1993/07/29 06:01:21 cgd Exp */ #include "param.h" @@ -58,6 +59,7 @@ int nswap, nswdev; * to buffers, but rather to pages that * are being swapped in and out. */ +void swapinit() { register int i; @@ -85,8 +87,11 @@ swapinit() if (bdevvp(swdevt[0].sw_dev, &swdevt[0].sw_vp)) panic("swapvp"); if (error = swfree(&proc0, 0)) { +#ifdef notdef printf("swfree errno %d\n", error); /* XXX */ panic("swapinit swfree 0"); +#endif + printf("WARNING: no swap space present.\n"); } /* @@ -165,12 +170,14 @@ swstrategy(bp) * which must be in the swdevsw. Return EBUSY * if already swapping on this device. */ +struct swapon_args { + char *name; +}; + /* ARGSUSED */ swapon(p, uap, retval) struct proc *p; - struct args { - char *name; - } *uap; + struct swapon_args *uap; int *retval; { register struct vnode *vp; @@ -247,11 +254,12 @@ swfree(p, index) blk = dmmax; if (vsbase == 0) { /* - * First of all chunks... initialize the swapmap - * the second half of the hunk. + * First of all chunks... initialize the swapmap. + * Don't use the first cluster of the device + * in case it starts with a label or boot block. */ - rminit(swapmap, (long)(blk/2), (long)(blk/2), - "swap", nswapmap); + rminit(swapmap, blk - ctod(CLSIZE), + vsbase + ctod(CLSIZE), "swap", nswapmap); } else if (dvbase == 0) { /* * Don't use the first cluster of the device