diff options
-rw-r--r-- | sys/vm/swap_pager.c | 17 | ||||
-rw-r--r-- | sys/vm/swap_pager.h | 4 | ||||
-rw-r--r-- | sys/vm/vm_fault.c | 19 | ||||
-rw-r--r-- | sys/vm/vm_glue.c | 16 | ||||
-rw-r--r-- | sys/vm/vm_init.c | 3 | ||||
-rw-r--r-- | sys/vm/vm_map.c | 25 | ||||
-rw-r--r-- | sys/vm/vm_mmap.c | 117 | ||||
-rw-r--r-- | sys/vm/vm_object.c | 15 | ||||
-rw-r--r-- | sys/vm/vm_page.c | 3 | ||||
-rw-r--r-- | sys/vm/vm_pageout.c | 3 | ||||
-rw-r--r-- | sys/vm/vm_pageout.h | 3 | ||||
-rw-r--r-- | sys/vm/vm_pager.c | 4 | ||||
-rw-r--r-- | sys/vm/vm_pager.h | 4 | ||||
-rw-r--r-- | sys/vm/vm_swap.c | 25 | ||||
-rw-r--r-- | sys/vm/vnode_pager.c | 25 |
15 files changed, 145 insertions, 138 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 54aa0df..e9a0a27 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -39,7 +39,7 @@ * from: Utah $Hdr: swap_pager.c 1.4 91/04/30$ * * @(#)swap_pager.c 8.9 (Berkeley) 3/21/94 - * $Id: swap_pager.c,v 1.8 1994/08/29 06:23:18 davidg Exp $ + * $Id: swap_pager.c,v 1.9 1994/09/25 04:02:10 davidg Exp $ */ /* @@ -69,6 +69,9 @@ #define NPENDINGIO 16 #endif +int swap_pager_input __P((sw_pager_t, vm_page_t *, int, int)); +int swap_pager_output __P((sw_pager_t, vm_page_t *, int, int, int *)); + int nswiodone; extern int vm_pageout_rate_limit; static int cleandone; @@ -380,9 +383,9 @@ swap_pager_getswapspace( unsigned amount, unsigned *rtval) { */ void swap_pager_freeswapspace( unsigned from, unsigned to) { +#ifdef EXP unsigned nblocksfrag = btodb(SWB_NPAGES*PAGE_SIZE); unsigned tmpalloc; -#ifdef EXP if( ((to + 1) - from) >= nblocksfrag) { #endif rlist_free(&swapmap, from, to); @@ -1538,7 +1541,7 @@ swap_pager_clean() * Look up and removal from done list must be done * at splbio() to avoid conflicts with swap_pager_iodone. */ - while (spc = swap_pager_done.tqh_first) { + while ((spc = swap_pager_done.tqh_first) != 0) { pmap_qremove( spc->spc_kva, spc->spc_count); swap_pager_finish(spc); TAILQ_REMOVE(&swap_pager_done, spc, spc_list); @@ -1590,8 +1593,8 @@ swap_pager_finish(spc) */ if (spc->spc_flags & SPC_ERROR) { for(i=0;i<spc->spc_count;i++) { - printf("swap_pager_finish: clean of page %x failed\n", - VM_PAGE_TO_PHYS(spc->spc_m[i])); + printf("swap_pager_finish: clean of page %lx failed\n", + (u_long)VM_PAGE_TO_PHYS(spc->spc_m[i])); spc->spc_m[i]->flags |= PG_LAUNDRY; } } else { @@ -1630,8 +1633,8 @@ swap_pager_iodone(bp) TAILQ_INSERT_TAIL(&swap_pager_done, spc, spc_list); if (bp->b_flags & B_ERROR) { spc->spc_flags |= SPC_ERROR; - printf("error %d blkno %d sz %d ", - bp->b_error, bp->b_blkno, bp->b_bcount); + printf("error %d blkno %lu sz %ld ", + bp->b_error, (u_long)bp->b_blkno, bp->b_bcount); } /* diff --git a/sys/vm/swap_pager.h b/sys/vm/swap_pager.h index 853edd5..848039c 100644 --- a/sys/vm/swap_pager.h +++ b/sys/vm/swap_pager.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)swap_pager.h 7.1 (Berkeley) 12/5/90 - * $Id: swap_pager.h,v 1.9 1994/03/14 21:54:23 davidg Exp $ + * $Id: swap_pager.h,v 1.2 1994/05/25 09:18:39 rgrimes Exp $ */ /* @@ -91,6 +91,8 @@ boolean_t swap_pager_haspage(vm_pager_t, vm_offset_t); int swap_pager_io(sw_pager_t, vm_page_t *, int, int, int); void swap_pager_iodone(struct buf *); boolean_t swap_pager_clean(); +void swap_pager_copy __P((vm_pager_t, vm_offset_t, vm_pager_t, vm_offset_t, vm_offset_t)); +void swap_pager_freespace __P((vm_pager_t, vm_offset_t, vm_offset_t)); extern struct pagerops swappagerops; diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 92d8ef4..353890e 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -66,7 +66,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_fault.c,v 1.5 1994/10/05 09:48:42 davidg Exp $ + * $Id: vm_fault.c,v 1.6 1994/10/09 00:18:22 davidg Exp $ */ /* @@ -76,12 +76,15 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> +#include <sys/resource.h> +#include <sys/signalvar.h> #include <sys/resourcevar.h> #include <vm/vm.h> #include <vm/vm_page.h> #include <vm/vm_pageout.h> +int vm_fault_additional_pages __P((vm_object_t, vm_offset_t, vm_page_t, int, int, vm_page_t *, int *)); #define VM_FAULT_READ_AHEAD 4 #define VM_FAULT_READ_AHEAD_MIN 1 @@ -131,7 +134,6 @@ vm_fault(map, vaddr, fault_type, change_wiring) vm_page_t old_m; vm_object_t next_object; vm_page_t marray[VM_FAULT_READ]; - int reqpage; int spl; int hardfault=0; @@ -326,7 +328,7 @@ vm_fault(map, vaddr, fault_type, change_wiring) (object->pager && object->pager->pg_type == PG_SWAP && !vm_pager_has_page(object->pager, offset+object->paging_offset)))) { if (vaddr < VM_MAXUSER_ADDRESS && curproc && curproc->p_pid >= 48) /* XXX */ { - printf("Process %d killed by vm_fault -- out of swap\n", curproc->p_pid); + printf("Process %lu killed by vm_fault -- out of swap\n", (u_long)curproc->p_pid); psignal(curproc, SIGKILL); curproc->p_estcpu = 0; curproc->p_nice = PRIO_MIN; @@ -370,8 +372,10 @@ vm_fault(map, vaddr, fault_type, change_wiring) * marray for the vm_page_t passed to the routine. */ cnt.v_pageins++; - faultcount = vm_fault_additional_pages(first_object, first_offset, - m, VM_FAULT_READ_BEHIND, VM_FAULT_READ_AHEAD, marray, &reqpage); + faultcount = vm_fault_additional_pages( + first_object, first_offset, + m, VM_FAULT_READ_BEHIND, VM_FAULT_READ_AHEAD, + marray, &reqpage); /* * Call the pager to retrieve the data, if any, @@ -642,7 +646,8 @@ vm_fault(map, vaddr, fault_type, change_wiring) copy_offset = first_offset - copy_object->shadow_offset; copy_m = vm_page_lookup(copy_object, copy_offset); - if (page_exists = (copy_m != NULL)) { + page_exists = (copy_m != NULL); + if (page_exists) { if (copy_m->flags & (PG_BUSY|PG_VMIO)) { /* * If the page is being brought @@ -1116,7 +1121,6 @@ vm_fault_page_lookup(object, offset, rtobject, rtoffset, rtm) vm_page_t *rtm; { vm_page_t m; - vm_object_t first_object = object; *rtm = 0; *rtobject = 0; @@ -1169,7 +1173,6 @@ vm_fault_additional_pages(first_object, first_offset, m, rbehind, raheada, marra int *reqpage; { int i; - vm_page_t tmpm; vm_object_t object; vm_offset_t offset, startoffset, endoffset, toffset, size; vm_object_t rtobject; diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 668b7f9..e709dcf 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -59,7 +59,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_glue.c,v 1.6 1994/08/18 22:36:01 wollman Exp $ + * $Id: vm_glue.c,v 1.7 1994/09/12 15:06:12 davidg Exp $ */ #include <sys/param.h> @@ -78,6 +78,7 @@ #include <vm/vm_kern.h> #include <machine/stdarg.h> +#include <machine/cpu.h> extern char kstack[]; int avefree = 0; /* XXX */ @@ -306,14 +307,10 @@ faultin(p) struct proc *p; { vm_offset_t i; - vm_offset_t vaddr, ptaddr; - vm_offset_t v, v1; - struct user *up; + vm_offset_t ptaddr; int s; - int opflag; if ((p->p_flag & P_INMEM) == 0) { - int rv0, rv1; vm_map_t map; ++p->p_lock; @@ -370,7 +367,6 @@ scheduler() register int pri; struct proc *pp; int ppri; - vm_offset_t addr; int lastidle, lastrun; int curidle, currun; int forceload; @@ -487,9 +483,7 @@ swapout_threads() int swapneeded = swapinreq; extern int maxslp; int runnablenow; - int s; -swapmore: runnablenow = 0; outp = outp2 = NULL; outpri = outpri2 = INT_MIN; @@ -577,11 +571,7 @@ void swapout(p) register struct proc *p; { - vm_offset_t addr; - struct pmap *pmap = &p->p_vmspace->vm_pmap; vm_map_t map = &p->p_vmspace->vm_map; - vm_offset_t ptaddr; - int i; ++p->p_stats->p_ru.ru_nswap; /* diff --git a/sys/vm/vm_init.c b/sys/vm/vm_init.c index 3b62144..34ae573 100644 --- a/sys/vm/vm_init.c +++ b/sys/vm/vm_init.c @@ -62,7 +62,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id$ + * $Id: vm_init.c,v 1.3 1994/08/02 07:55:21 davidg Exp $ */ /* @@ -70,6 +70,7 @@ */ #include <sys/param.h> +#include <sys/systm.h> #include <vm/vm.h> #include <vm/vm_page.h> diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 48c6129..69d3164 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_map.c,v 1.4 1994/08/04 19:40:47 davidg Exp $ + * $Id: vm_map.c,v 1.5 1994/08/18 22:36:04 wollman Exp $ */ /* @@ -296,7 +296,6 @@ vm_map_entry_create(map) vm_map_t map; { vm_map_entry_t entry; - int s; int i; #define KENTRY_LOW_WATER 64 #define MAPENTRY_LOW_WATER 64 @@ -307,7 +306,9 @@ vm_map_entry_create(map) if (kentry_count < KENTRY_LOW_WATER) { if (mapvmpgcnt && mapvm) { vm_page_t m; - if (m = vm_page_alloc(kmem_object, mapvm-vm_map_min(kmem_map))) { + m = vm_page_alloc(kmem_object, + mapvm-vm_map_min(kmem_map)); + if (m) { int newentries; newentries = (NBPG/sizeof (struct vm_map_entry)); vm_page_wire(m); @@ -329,20 +330,23 @@ vm_map_entry_create(map) if (map == kernel_map || map == kmem_map || map == pager_map) { - if (entry = kentry_free) { + entry = kentry_free; + if (entry) { kentry_free = entry->next; --kentry_count; return entry; } - if (entry = mappool) { + entry = mappool; + if (entry) { mappool = entry->next; --mappoolcnt; return entry; } } else { - if (entry = mappool) { + entry = mappool; + if (entry) { mappool = entry->next; --mappoolcnt; return entry; @@ -351,7 +355,6 @@ vm_map_entry_create(map) MALLOC(entry, vm_map_entry_t, sizeof(struct vm_map_entry), M_VMMAPENT, M_WAITOK); } -dopanic: if (entry == NULL) panic("vm_map_entry_create: out of map entries"); @@ -368,8 +371,6 @@ vm_map_entry_dispose(map, entry) vm_map_t map; vm_map_entry_t entry; { - int s; - if (map == kernel_map || map == kmem_map || map == pager_map || kentry_count < KENTRY_LOW_WATER) { entry->next = kentry_free; @@ -2407,7 +2408,8 @@ vm_map_lookup(var_map, vaddr, fault_type, out_entry, * it for all possible accesses. */ - if (*wired = (entry->wired_count != 0)) + *wired = (entry->wired_count != 0); + if (*wired) prot = fault_type = entry->protection; /* @@ -2415,7 +2417,8 @@ vm_map_lookup(var_map, vaddr, fault_type, out_entry, * it down. */ - if (su = !entry->is_a_map) { + su = !entry->is_a_map; + if (su) { share_map = map; share_offset = vaddr; } diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 3923a10..5afece8 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -38,7 +38,7 @@ * from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$ * * @(#)vm_mmap.c 8.4 (Berkeley) 1/12/94 - * $Id: vm_mmap.c,v 1.5 1994/08/06 09:00:50 davidg Exp $ + * $Id: vm_mmap.c,v 1.6 1994/09/02 15:06:51 davidg Exp $ */ /* @@ -127,60 +127,6 @@ struct mmap_args { off_t pos; }; -#ifdef COMPAT_43 -struct ommap_args { - caddr_t addr; - int len; - int prot; - int flags; - int fd; - long pos; -}; -int -ommap(p, uap, retval) - struct proc *p; - register struct ommap_args *uap; - int *retval; -{ - struct mmap_args nargs; - static const char cvtbsdprot[8] = { - 0, - PROT_EXEC, - PROT_WRITE, - PROT_EXEC|PROT_WRITE, - PROT_READ, - PROT_EXEC|PROT_READ, - PROT_WRITE|PROT_READ, - PROT_EXEC|PROT_WRITE|PROT_READ, - }; -#define OMAP_ANON 0x0002 -#define OMAP_COPY 0x0020 -#define OMAP_SHARED 0x0010 -#define OMAP_FIXED 0x0100 -#define OMAP_INHERIT 0x0800 - - nargs.addr = uap->addr; - nargs.len = uap->len; - nargs.prot = cvtbsdprot[uap->prot&0x7]; - nargs.flags = 0; - if (uap->flags & OMAP_ANON) - nargs.flags |= MAP_ANON; - if (uap->flags & OMAP_COPY) - nargs.flags |= MAP_COPY; - if (uap->flags & OMAP_SHARED) - nargs.flags |= MAP_SHARED; - else - nargs.flags |= MAP_PRIVATE; - if (uap->flags & OMAP_FIXED) - nargs.flags |= MAP_FIXED; - if (uap->flags & OMAP_INHERIT) - nargs.flags |= MAP_INHERIT; - nargs.fd = uap->fd; - nargs.pos = uap->pos; - return (mmap(p, &nargs, retval)); -} -#endif - int mmap(p, uap, retval) struct proc *p; @@ -295,6 +241,61 @@ mmap(p, uap, retval) return (error); } +#ifdef COMPAT_43 +struct ommap_args { + caddr_t addr; + int len; + int prot; + int flags; + int fd; + long pos; +}; +int +ommap(p, uap, retval) + struct proc *p; + register struct ommap_args *uap; + int *retval; +{ + struct mmap_args nargs; + static const char cvtbsdprot[8] = { + 0, + PROT_EXEC, + PROT_WRITE, + PROT_EXEC|PROT_WRITE, + PROT_READ, + PROT_EXEC|PROT_READ, + PROT_WRITE|PROT_READ, + PROT_EXEC|PROT_WRITE|PROT_READ, + }; +#define OMAP_ANON 0x0002 +#define OMAP_COPY 0x0020 +#define OMAP_SHARED 0x0010 +#define OMAP_FIXED 0x0100 +#define OMAP_INHERIT 0x0800 + + nargs.addr = uap->addr; + nargs.len = uap->len; + nargs.prot = cvtbsdprot[uap->prot&0x7]; + nargs.flags = 0; + if (uap->flags & OMAP_ANON) + nargs.flags |= MAP_ANON; + if (uap->flags & OMAP_COPY) + nargs.flags |= MAP_COPY; + if (uap->flags & OMAP_SHARED) + nargs.flags |= MAP_SHARED; + else + nargs.flags |= MAP_PRIVATE; + if (uap->flags & OMAP_FIXED) + nargs.flags |= MAP_FIXED; + if (uap->flags & OMAP_INHERIT) + nargs.flags |= MAP_INHERIT; + nargs.fd = uap->fd; + nargs.pos = uap->pos; + return (mmap(p, &nargs, retval)); +} +#endif /* COMPAT_43 */ + + struct msync_args { caddr_t addr; int len; @@ -540,7 +541,8 @@ mlock(p, uap, retval) p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur) return (EAGAIN); #else - if (error = suser(p->p_ucred, &p->p_acflag)) + error = suser(p->p_ucred, &p->p_acflag); + if (error) return (error); #endif @@ -571,7 +573,8 @@ munlock(p, uap, retval) if ((addr & PAGE_MASK) || uap->addr + uap->len < uap->addr) return (EINVAL); #ifndef pmap_wired_count - if (error = suser(p->p_ucred, &p->p_acflag)) + error = suser(p->p_ucred, &p->p_acflag); + if (error) return (error); #endif size = round_page((vm_size_t)uap->len); diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 49849ca..67a824f 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_object.c,v 1.6 1994/08/27 16:14:39 davidg Exp $ + * $Id: vm_object.c,v 1.7 1994/10/05 09:48:43 davidg Exp $ */ /* @@ -77,6 +77,7 @@ #include <vm/vm.h> #include <vm/vm_page.h> #include <vm/vm_pageout.h> +#include <vm/swap_pager.h> static void _vm_object_allocate(vm_size_t, vm_object_t); @@ -188,7 +189,6 @@ vm_object_allocate(size) vm_size_t size; { register vm_object_t result; - int s; result = (vm_object_t) malloc((u_long)sizeof *result, M_VMOBJ, M_WAITOK); @@ -437,7 +437,6 @@ vm_object_page_clean(object, start, end, syncio, de_queue) boolean_t de_queue; { register vm_page_t p, nextp; - int s; int size; if (object->pager == NULL) @@ -1234,7 +1233,7 @@ vm_object_collapse(object) * pages that shadow them. */ - while (p = backing_object->memq.tqh_first) { + while ((p = backing_object->memq.tqh_first) != 0) { new_offset = (p->offset - backing_offset); @@ -1444,7 +1443,6 @@ vm_object_page_remove(object, start, end) { register vm_page_t p, next; vm_offset_t size; - int cnt; int s; if (object == NULL) @@ -1475,7 +1473,7 @@ again: } } else { while (size > 0) { - while (p = vm_page_lookup(object, start)) { + while ((p = vm_page_lookup(object, start)) != 0) { s = splhigh(); if (p->flags & PG_BUSY) { p->flags |= PG_WANTED; @@ -1627,7 +1625,7 @@ void vm_object_print(object, full) printf("pager=0x%x+0x%x, shadow=(0x%x)+0x%x\n", (int) object->pager, (int) object->paging_offset, (int) object->shadow, (int) object->shadow_offset); - printf("cache: next=0x%x, prev=0x%x\n", + printf("cache: next=%p, prev=%p\n", object->cached_list.tqe_next, object->cached_list.tqe_prev); if (!full) @@ -1646,7 +1644,8 @@ void vm_object_print(object, full) printf(","); count++; - printf("(off=0x%x,page=0x%x)", p->offset, VM_PAGE_TO_PHYS(p)); + printf("(off=0x%lx,page=0x%lx)", + (u_long)p->offset, (u_long)VM_PAGE_TO_PHYS(p)); } if (count != 0) printf("\n"); diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 9b52c3f..b800dae 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91 - * $Id: vm_page.c,v 1.8 1994/09/27 20:45:24 davidg Exp $ + * $Id: vm_page.c,v 1.9 1994/09/27 20:49:02 davidg Exp $ */ /* @@ -151,7 +151,6 @@ vm_page_startup(starta, enda, vaddr) vm_offset_t pa; int nblocks; vm_offset_t first_managed_page; - int size; extern vm_offset_t kentry_data; extern vm_size_t kentry_data_size; diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 3e944bf..cd6f675 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -65,7 +65,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_pageout.c,v 1.14 1994/10/05 09:02:53 davidg Exp $ + * $Id: vm_pageout.c,v 1.15 1994/10/07 07:23:04 phk Exp $ */ /* @@ -81,6 +81,7 @@ #include <vm/vm.h> #include <vm/vm_page.h> #include <vm/vm_pageout.h> +#include <vm/swap_pager.h> extern vm_map_t kmem_map; int vm_pages_needed; /* Event on which pageout daemon sleeps */ diff --git a/sys/vm/vm_pageout.h b/sys/vm/vm_pageout.h index 461a791..77c4373 100644 --- a/sys/vm/vm_pageout.h +++ b/sys/vm/vm_pageout.h @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_pageout.h,v 1.4 1994/08/18 22:36:08 wollman Exp $ + * $Id: vm_pageout.h,v 1.5 1994/08/21 07:19:45 paul Exp $ */ #ifndef _VM_VM_PAGEOUT_H_ @@ -112,6 +112,7 @@ inline static void vm_wait() { int vm_pageout_scan __P((void)); void vm_pageout_page __P((vm_page_t, vm_object_t)); void vm_pageout_cluster __P((vm_page_t, vm_object_t)); +int vm_pageout_clean __P((vm_page_t, int)); #endif #endif diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index b080263..caf1306 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_pager.c,v 1.6 1994/08/07 14:53:27 davidg Exp $ + * $Id: vm_pager.c,v 1.7 1994/08/18 22:36:09 wollman Exp $ */ /* @@ -71,6 +71,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/proc.h> #include <sys/malloc.h> #include <sys/buf.h> #include <sys/ucred.h> @@ -187,7 +188,6 @@ vm_pager_get_pages(pager, m, count, reqpage, sync) int reqpage; boolean_t sync; { - extern int vm_pageout_count; int i; if (pager == NULL) { diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index a6cef9f..ea204a1 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * @(#)vm_pager.h 8.4 (Berkeley) 1/12/94 - * $Id$ + * $Id: vm_pager.h,v 1.3 1994/08/02 07:55:36 davidg Exp $ */ /* @@ -125,10 +125,12 @@ boolean_t vm_pager_has_page __P((vm_pager_t, vm_offset_t)); void vm_pager_init __P((void)); vm_pager_t vm_pager_lookup __P((struct pagerlst *, caddr_t)); vm_offset_t vm_pager_map_pages __P((vm_page_t *, int, boolean_t)); +vm_offset_t vm_pager_map_page __P((vm_page_t)); int vm_pager_put_pages __P((vm_pager_t, vm_page_t *, int, boolean_t, int *)); void vm_pager_sync __P((void)); void vm_pager_unmap_pages __P((vm_offset_t, int)); +void vm_pager_unmap_page __P((vm_offset_t)); #define vm_pager_cancluster(p, b) ((p)->pg_flags & (b)) diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index fd53263..69747a8 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)vm_swap.c 8.5 (Berkeley) 2/17/94 - * $Id: vm_swap.c,v 1.5 1994/09/11 03:55:39 davidg Exp $ + * $Id: vm_swap.c,v 1.6 1994/09/25 22:31:11 davidg Exp $ */ #include <sys/param.h> @@ -70,8 +70,6 @@ vm_offset_t swapbkva; /* swap buffers kva */ void swapinit() { - register int i; - register struct buf *sp = swbuf; register struct proc *p = &proc0; /* XXX */ struct swdevt *swp; int error; @@ -144,8 +142,10 @@ swapinit() */ if (nswap == 0) printf("WARNING: no swap space found\n"); - else if (error = swfree(p, 0)) { - printf("WARNING: no swap on boot device - use swapon\n"); + else { + error = swfree(p, 0); + if (error) + printf("WARNING: no swap on boot device - use swapon\n"); } } @@ -238,7 +238,8 @@ swstrategy(bp) } VHOLD(sp->sw_vp); if ((bp->b_flags & B_READ) == 0) { - if (vp = bp->b_vp) { + vp = bp->b_vp; + if (vp) { vp->v_numoutput--; if ((vp->v_flag & VBWAIT) && vp->v_numoutput <= 0) { vp->v_flag &= ~VBWAIT; @@ -274,10 +275,12 @@ swapon(p, uap, retval) int error; struct nameidata nd; - if (error = suser(p->p_ucred, &p->p_acflag)) + error = suser(p->p_ucred, &p->p_acflag); + if (error) return (error); NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->name, p); - if (error = namei(&nd)) + error = namei(&nd); + if (error) return (error); vp = nd.ni_vp; if (vp->v_type != VBLK) { @@ -296,7 +299,8 @@ swapon(p, uap, retval) return (EBUSY); } sp->sw_vp = vp; - if (error = swfree(p, sp - swdevt)) { + error = swfree(p, sp - swdevt); + if (error) { vrele(vp); return (error); } @@ -338,7 +342,8 @@ swfree(p, index) sp = &swdevt[index]; vp = sp->sw_vp; - if (error = VOP_OPEN(vp, FREAD|FWRITE, p->p_ucred, p)) + error = VOP_OPEN(vp, FREAD|FWRITE, p->p_ucred, p); + if (error) return (error); sp->sw_flags |= SW_FREED; nblks = sp->sw_nblks; diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 05ac568..3b1b0af 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91 - * $Id: vnode_pager.c,v 1.8 1994/09/06 17:53:24 davidg Exp $ + * $Id: vnode_pager.c,v 1.9 1994/10/05 09:48:45 davidg Exp $ */ /* @@ -212,9 +212,9 @@ vnode_pager_dealloc(pager) { register vn_pager_t vnp = (vn_pager_t) pager->pg_data; register struct vnode *vp; - struct proc *p = curproc; /* XXX */ - if (vp = vnp->vnp_vp) { + vp = vnp->vnp_vp; + if (vp) { vp->v_vmdata = NULL; vp->v_flag &= ~(VTEXT|VVMIO); vrele(vp); @@ -243,7 +243,6 @@ vnode_pager_getpage(pager, m, sync) boolean_t sync; { - int err; vm_page_t marray[1]; if (pager == NULL) @@ -259,7 +258,6 @@ vnode_pager_putpage(pager, m, sync) vm_page_t m; boolean_t sync; { - int err; vm_page_t marray[1]; int rtvals[1]; @@ -609,7 +607,7 @@ vnode_pager_input_smlfs(vnp, m) */ block = foff / bsize + i; s = splbio(); - while (bp = incore(vp, block)) { + while ((bp = incore(vp, block)) != 0) { int amount; /* @@ -710,7 +708,6 @@ vnode_pager_input_old(vnp, m) vn_pager_t vnp; vm_page_t m; { - int i; struct uio auio; struct iovec aiov; int error; @@ -771,10 +768,9 @@ vnode_pager_input(vnp, m, count, reqpage) vm_page_t *m; int count, reqpage; { - int i, j; + int i; vm_offset_t kva, foff; int size, sizea; - struct proc *p = curproc; /* XXX */ vm_object_t object; vm_offset_t paging_offset; struct vnode *dp, *vp; @@ -784,7 +780,6 @@ vnode_pager_input(vnp, m, count, reqpage) int reqaddr, firstaddr; int block, offset; - int nbp; struct buf *bp, *bpa; int counta; int s; @@ -861,7 +856,7 @@ vnode_pager_input(vnp, m, count, reqpage) /* * if we have a buffer in core, then try to use it */ - while (bp = incore(vp, block)) { + while ((bp = incore(vp, block)) != 0) { int amount; /* @@ -1214,7 +1209,6 @@ vnode_pager_output_smlfs(vnp, m) vm_offset_t foff; vm_offset_t kva; int fileaddr; - int block; vm_offset_t bsize; int error = 0; @@ -1233,7 +1227,8 @@ vnode_pager_output_smlfs(vnp, m) fileaddr = vnode_pager_addr(vp, foff + i * bsize); if (fileaddr != -1) { s = splbio(); - if (bp = incore(vp, (foff / bsize) + i)) { + bp = incore(vp, (foff / bsize) + i); + if (bp) { bp = getblk(vp, (foff / bsize) + i, bp->b_bufsize, 0, 0); bp->b_flags |= B_INVAL; brelse(bp); @@ -1302,7 +1297,6 @@ vnode_pager_output(vnp, m, count, rtvals) int i, j; vm_offset_t kva, foff; int size; - struct proc *p = curproc; /* XXX */ vm_object_t object; vm_offset_t paging_offset; struct vnode *dp, *vp; @@ -1416,7 +1410,8 @@ retryoutput: struct buf *fbp; s = splbio(); - if (fbp = incore(vp, filblock)) { + fbp = incore(vp, filblock); + if (fbp) { fbp = getblk(vp, filblock, fbp->b_bufsize, 0, 0); if (fbp->b_flags & B_DELWRI) { if (fbp->b_bufsize <= PAGE_SIZE) |