summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-05-03 21:01:54 +0000
committerphk <phk@FreeBSD.org>1996-05-03 21:01:54 +0000
commit5d01dc3d502f27448cc5a6c62c8f103d25ac3df0 (patch)
tree6e409b4bdf1f55b895a65877ef5486cfc5442060 /sys/kern
parent6ed0fd2b8bab9bd3b84ab82f273df31ce328c87d (diff)
downloadFreeBSD-src-5d01dc3d502f27448cc5a6c62c8f103d25ac3df0.zip
FreeBSD-src-5d01dc3d502f27448cc5a6c62c8f103d25ac3df0.tar.gz
Another sweep over the pmap/vm macros, this time with more focus on
the usage. I'm not satisfied with the naming, but now at least there is less bogus stuff around.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/sysv_shm.c10
-rw-r--r--sys/kern/vfs_bio.c18
2 files changed, 13 insertions, 15 deletions
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index 12cef8a..1736070 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $Id: sysv_shm.c,v 1.18 1996/02/23 18:49:18 peter Exp $ */
+/* $Id: sysv_shm.c,v 1.19 1996/05/02 14:20:26 phk Exp $ */
/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */
/*
@@ -141,7 +141,7 @@ shm_deallocate_segment(shmseg)
size_t size;
shm_handle = shmseg->shm_internal;
- size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1);
+ size = round_page(shmseg->shm_segsz);
(void) vm_map_remove(sysvshm_map, shm_handle->kva, shm_handle->kva + size);
free((caddr_t)shm_handle, M_SHM);
shmseg->shm_internal = NULL;
@@ -161,7 +161,7 @@ shm_delete_mapping(p, shmmap_s)
segnum = IPCID_TO_IX(shmmap_s->shmid);
shmseg = &shmsegs[segnum];
- size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1);
+ size = round_page(shmseg->shm_segsz);
result = vm_map_remove(&p->p_vmspace->vm_map, shmmap_s->va, shmmap_s->va + size);
if (result != KERN_SUCCESS)
return EINVAL;
@@ -246,7 +246,7 @@ shmat(p, uap, retval)
}
if (i >= shminfo.shmseg)
return EMFILE;
- size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1);
+ size = round_page(shmseg->shm_segsz);
prot = VM_PROT_READ;
if ((uap->shmflg & SHM_RDONLY) == 0)
prot |= VM_PROT_WRITE;
@@ -463,7 +463,7 @@ shmget_allocate_segment(p, uap, mode, retval)
return EINVAL;
if (shm_nused >= shminfo.shmmni) /* any shmids left? */
return ENOSPC;
- size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1);
+ size = round_page(shmseg->shm_segsz);
if (shm_committed + btoc(size) > shminfo.shmall)
return ENOMEM;
if (shm_last_free < 0) {
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 1128cbe..d449b94 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -18,7 +18,7 @@
* 5. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: vfs_bio.c,v 1.87 1996/03/03 01:04:28 dyson Exp $
+ * $Id: vfs_bio.c,v 1.88 1996/03/09 06:46:51 dyson Exp $
*/
/*
@@ -735,7 +735,6 @@ static struct buf *
getnewbuf(int slpflag, int slptimeo, int doingvmio)
{
struct buf *bp;
- int s;
int nbyteswritten = 0;
start:
@@ -858,7 +857,6 @@ struct buf *
incore(struct vnode * vp, daddr_t blkno)
{
struct buf *bp;
- struct bufhashhdr *bh;
int s = splbio();
bp = gbincore(vp, blkno);
@@ -1255,7 +1253,7 @@ allocbuf(struct buf * bp, int size)
bytesinpage = newbsize - toff;
if ((bp->b_flags & B_CACHE) &&
!vm_page_is_valid(m,
- (vm_offset_t) ((toff + off) & (PAGE_SIZE - 1)),
+ (vm_offset_t) ((toff + off) & PAGE_MASK),
bytesinpage)) {
bp->b_flags &= ~B_CACHE;
}
@@ -1296,7 +1294,7 @@ allocbuf(struct buf * bp, int size)
bytesinpage = newbsize - toff;
if ((bp->b_flags & B_CACHE) &&
!vm_page_is_valid(m,
- (vm_offset_t) ((toff + off) & (PAGE_SIZE - 1)),
+ (vm_offset_t) ((toff + off) & PAGE_MASK),
bytesinpage)) {
bp->b_flags &= ~B_CACHE;
}
@@ -1309,7 +1307,7 @@ allocbuf(struct buf * bp, int size)
bp->b_npages = curbpnpages;
pmap_qenter((vm_offset_t) bp->b_data,
bp->b_pages, bp->b_npages);
- ((vm_offset_t) bp->b_data) |= off & (PAGE_SIZE - 1);
+ ((vm_offset_t) bp->b_data) |= off & PAGE_MASK;
}
}
}
@@ -1434,7 +1432,7 @@ biodone(register struct buf * bp)
*/
if ((bp->b_flags & B_READ) && !bogusflag && resid > 0) {
vm_page_set_validclean(m,
- (vm_offset_t) (foff & (PAGE_SIZE-1)), resid);
+ (vm_offset_t) (foff & PAGE_MASK), resid);
}
/*
@@ -1449,7 +1447,7 @@ biodone(register struct buf * bp)
(int) m->pindex, (int)(foff >> 32),
(int) foff & 0xffffffff, resid, i);
if (vp->v_type != VBLK)
- printf(" iosize: %d, lblkno: %d, flags: 0x%lx, npages: %d\n",
+ printf(" iosize: %ld, lblkno: %d, flags: 0x%lx, npages: %d\n",
bp->b_vp->v_mount->mnt_stat.f_iosize,
(int) bp->b_lblkno,
bp->b_flags, bp->b_npages);
@@ -1614,7 +1612,7 @@ vfs_busy_pages(struct buf * bp, int clear_modify)
if (clear_modify) {
vm_page_protect(m, VM_PROT_READ);
vm_page_set_validclean(m,
- (vm_offset_t) (foff & (PAGE_SIZE-1)), resid);
+ (vm_offset_t) (foff & PAGE_MASK), resid);
} else if (bp->b_bcount >= PAGE_SIZE) {
if (m->valid && (bp->b_flags & B_CACHE) == 0) {
bp->b_pages[i] = bogus_page;
@@ -1654,7 +1652,7 @@ vfs_clean_pages(struct buf * bp)
resid = iocount;
if (resid > 0) {
vm_page_set_validclean(m,
- ((vm_offset_t) foff & (PAGE_SIZE-1)), resid);
+ ((vm_offset_t) foff & PAGE_MASK), resid);
}
foff += resid;
iocount -= resid;
OpenPOWER on IntegriCloud