--- Net2/vm/vm_swap.c 2018/04/24 18:04:47 1.1.1.2 +++ Net2/vm/vm_swap.c 2018/04/24 18:15:13 1.1.1.5 @@ -30,9 +30,9 @@ * 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 */ -static char rcsid[] = "$Header: /var/lib/cvsd/net2/Net2/vm/vm_swap.c,v 1.1.1.2 2018/04/24 18:04:47 root Exp $"; #include "param.h" #include "systm.h" @@ -43,8 +43,8 @@ static char rcsid[] = "$Header: /var/lib #include "dmap.h" /* XXX */ #include "vnode.h" #include "specdev.h" +#include "map.h" #include "file.h" -#include "rlist.h" /* * Indirect driver for multi-controller paging. @@ -59,6 +59,7 @@ int nswap, nswdev; * to buffers, but rather to pages that * are being swapped in and out. */ +void swapinit() { register int i; @@ -86,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"); } /* @@ -166,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; @@ -246,15 +252,23 @@ swfree(p, index) panic("swfree"); if (blk > dmmax) blk = dmmax; - /* - * Don't use the first cluster of the device - * in case it starts with a label or boot block. - */ - if (dvbase == 0) - rlist_free(&swapmap, vsbase + ctod(CLSIZE), - vsbase + blk - 1); - else - rlist_free(&swapmap, vsbase, vsbase + blk - 1); + if (vsbase == 0) { + /* + * 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, blk - ctod(CLSIZE), + vsbase + ctod(CLSIZE), "swap", nswapmap); + } else if (dvbase == 0) { + /* + * Don't use the first cluster of the device + * in case it starts with a label or boot block. + */ + rmfree(swapmap, blk - ctod(CLSIZE), + vsbase + ctod(CLSIZE)); + } else + rmfree(swapmap, blk, vsbase); } return (0); }