summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2004-03-15 06:43:51 +0000
committertruckman <truckman@FreeBSD.org>2004-03-15 06:43:51 +0000
commit87ef1d02227c2f095e7257fc0bc32e6a410c8b4d (patch)
tree4d4ca8f545f7e149698fc1b6033164b1e829525f /sys/vm
parentb7a6af3cc97ed702243c417b87a32b192556f1ca (diff)
downloadFreeBSD-src-87ef1d02227c2f095e7257fc0bc32e6a410c8b4d.zip
FreeBSD-src-87ef1d02227c2f095e7257fc0bc32e6a410c8b4d.tar.gz
Style(9) changes.
Pointed out by: bde
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_glue.c28
-rw-r--r--sys/vm/vm_mmap.c23
2 files changed, 11 insertions, 40 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index 8ed5bdc..29855e9 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -183,29 +183,19 @@ useracc(addr, len, rw)
return (rv == TRUE);
}
-/*
- * MPSAFE
- */
int
-vslock(addr, len)
- void *addr;
- size_t len;
+vslock(void *addr, size_t len)
{
- vm_offset_t start, end;
+ vm_offset_t end, start;
int error, npages;
start = trunc_page((vm_offset_t)addr);
end = round_page((vm_offset_t)addr + len);
-
- /* disable wrap around */
if (end <= start)
return (EINVAL);
-
npages = atop(end - start);
-
if (npages > vm_page_max_wired)
return (ENOMEM);
-
PROC_LOCK(curproc);
if (npages + pmap_wired_count(vm_map_pmap(&curproc->p_vmspace->vm_map)) >
atop(lim_cur(curproc, RLIMIT_MEMLOCK))) {
@@ -213,7 +203,6 @@ vslock(addr, len)
return (ENOMEM);
}
PROC_UNLOCK(curproc);
-
#if 0
/*
* XXX - not yet
@@ -227,10 +216,8 @@ vslock(addr, len)
if (npages + cnt.v_wire_count > vm_page_max_wired)
return (EAGAIN);
#endif
-
error = vm_map_wire(&curproc->p_vmspace->vm_map, start, end,
- VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES);
-
+ VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES);
/*
* Return EFAULT on error to match copy{in,out}() behaviour
* rather than returning ENOMEM like mlock() would.
@@ -238,19 +225,14 @@ vslock(addr, len)
return (error == KERN_SUCCESS ? 0 : EFAULT);
}
-/*
- * MPSAFE
- */
void
-vsunlock(addr, len)
- void *addr;
- size_t len;
+vsunlock(void *addr, size_t len)
{
/* Rely on the parameter sanity checks performed by vslock(). */
(void)vm_map_unwire(&curproc->p_vmspace->vm_map,
trunc_page((vm_offset_t)addr), round_page((vm_offset_t)addr + len),
- VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES);
+ VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES);
}
/*
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 0dd0343..11a9179 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -893,29 +893,24 @@ mlock(td, uap)
struct thread *td;
struct mlock_args *uap;
{
- struct proc *proc = td->td_proc;
- vm_offset_t addr, start, end;
+ struct proc *proc;
+ vm_offset_t addr, end, start;
vm_size_t size;
int error, npages;
error = suser(td);
if (error)
return (error);
-
addr = (vm_offset_t)uap->addr;
size = uap->len;
start = trunc_page(addr);
end = round_page(addr + size);
-
- /* disable wrap around */
if (end <= start)
return (EINVAL);
-
npages = atop(end - start);
-
if (npages > vm_page_max_wired)
return (ENOMEM);
-
+ proc = td->td_proc;
PROC_LOCK(proc);
if (npages + pmap_wired_count(vm_map_pmap(&proc->p_vmspace->vm_map)) >
atop(lim_cur(proc, RLIMIT_MEMLOCK))) {
@@ -923,12 +918,10 @@ mlock(td, uap)
return (ENOMEM);
}
PROC_UNLOCK(proc);
-
if (npages + cnt.v_wire_count > vm_page_max_wired)
return (EAGAIN);
-
error = vm_map_wire(&proc->p_vmspace->vm_map, start, end,
- VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES);
+ VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES);
return (error == KERN_SUCCESS ? 0 : ENOMEM);
}
@@ -1043,25 +1036,21 @@ munlock(td, uap)
struct thread *td;
struct munlock_args *uap;
{
- vm_offset_t addr, start, end;
+ vm_offset_t addr, end, start;
vm_size_t size;
int error;
error = suser(td);
if (error)
return (error);
-
addr = (vm_offset_t)uap->addr;
size = uap->len;
start = trunc_page(addr);
end = round_page(addr + size);
-
- /* disable wrap around */
if (end <= start)
return (EINVAL);
-
error = vm_map_unwire(&td->td_proc->p_vmspace->vm_map, start, end,
- VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES);
+ VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES);
return (error == KERN_SUCCESS ? 0 : ENOMEM);
}
OpenPOWER on IntegriCloud