Ansify vm/vm_pager.c. Style.
Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
d35974ba4a
commit
03302b1380
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310982
@ -109,43 +109,35 @@ static vm_object_t
|
|||||||
dead_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
|
dead_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
|
||||||
vm_ooffset_t off, struct ucred *cred)
|
vm_ooffset_t off, struct ucred *cred)
|
||||||
{
|
{
|
||||||
return NULL;
|
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dead_pager_putpages(object, m, count, flags, rtvals)
|
dead_pager_putpages(vm_object_t object, vm_page_t *m, int count,
|
||||||
vm_object_t object;
|
int flags, int *rtvals)
|
||||||
vm_page_t *m;
|
|
||||||
int count;
|
|
||||||
int flags;
|
|
||||||
int *rtvals;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++)
|
||||||
rtvals[i] = VM_PAGER_AGAIN;
|
rtvals[i] = VM_PAGER_AGAIN;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dead_pager_haspage(object, pindex, prev, next)
|
dead_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *prev, int *next)
|
||||||
vm_object_t object;
|
|
||||||
vm_pindex_t pindex;
|
|
||||||
int *prev;
|
|
||||||
int *next;
|
|
||||||
{
|
{
|
||||||
if (prev)
|
|
||||||
|
if (prev != NULL)
|
||||||
*prev = 0;
|
*prev = 0;
|
||||||
if (next)
|
if (next != NULL)
|
||||||
*next = 0;
|
*next = 0;
|
||||||
return FALSE;
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dead_pager_dealloc(object)
|
dead_pager_dealloc(vm_object_t object)
|
||||||
vm_object_t object;
|
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pagerops deadpagerops = {
|
static struct pagerops deadpagerops = {
|
||||||
@ -181,7 +173,7 @@ static int bswneeded;
|
|||||||
vm_offset_t swapbkva; /* swap buffers kva */
|
vm_offset_t swapbkva; /* swap buffers kva */
|
||||||
|
|
||||||
void
|
void
|
||||||
vm_pager_init()
|
vm_pager_init(void)
|
||||||
{
|
{
|
||||||
struct pagerops **pgops;
|
struct pagerops **pgops;
|
||||||
|
|
||||||
@ -191,11 +183,11 @@ vm_pager_init()
|
|||||||
*/
|
*/
|
||||||
for (pgops = pagertab; pgops < &pagertab[nitems(pagertab)]; pgops++)
|
for (pgops = pagertab; pgops < &pagertab[nitems(pagertab)]; pgops++)
|
||||||
if ((*pgops)->pgo_init != NULL)
|
if ((*pgops)->pgo_init != NULL)
|
||||||
(*(*pgops)->pgo_init) ();
|
(*(*pgops)->pgo_init)();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vm_pager_bufferinit()
|
vm_pager_bufferinit(void)
|
||||||
{
|
{
|
||||||
struct buf *bp;
|
struct buf *bp;
|
||||||
int i;
|
int i;
|
||||||
@ -232,7 +224,7 @@ vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size,
|
|||||||
|
|
||||||
ops = pagertab[type];
|
ops = pagertab[type];
|
||||||
if (ops)
|
if (ops)
|
||||||
ret = (*ops->pgo_alloc) (handle, size, prot, off, cred);
|
ret = (*ops->pgo_alloc)(handle, size, prot, off, cred);
|
||||||
else
|
else
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -242,8 +234,7 @@ vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size,
|
|||||||
* The object must be locked.
|
* The object must be locked.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
vm_pager_deallocate(object)
|
vm_pager_deallocate(vm_object_t object)
|
||||||
vm_object_t object;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
VM_OBJECT_ASSERT_WLOCKED(object);
|
VM_OBJECT_ASSERT_WLOCKED(object);
|
||||||
@ -366,12 +357,13 @@ vm_pager_object_lookup(struct pagerlst *pg_list, void *handle)
|
|||||||
static void
|
static void
|
||||||
initpbuf(struct buf *bp)
|
initpbuf(struct buf *bp)
|
||||||
{
|
{
|
||||||
|
|
||||||
KASSERT(bp->b_bufobj == NULL, ("initpbuf with bufobj"));
|
KASSERT(bp->b_bufobj == NULL, ("initpbuf with bufobj"));
|
||||||
KASSERT(bp->b_vp == NULL, ("initpbuf with vp"));
|
KASSERT(bp->b_vp == NULL, ("initpbuf with vp"));
|
||||||
bp->b_rcred = NOCRED;
|
bp->b_rcred = NOCRED;
|
||||||
bp->b_wcred = NOCRED;
|
bp->b_wcred = NOCRED;
|
||||||
bp->b_qindex = 0; /* On no queue (QUEUE_NONE) */
|
bp->b_qindex = 0; /* On no queue (QUEUE_NONE) */
|
||||||
bp->b_kvabase = (caddr_t) (MAXPHYS * (bp - swbuf)) + swapbkva;
|
bp->b_kvabase = (caddr_t)(MAXPHYS * (bp - swbuf)) + swapbkva;
|
||||||
bp->b_data = bp->b_kvabase;
|
bp->b_data = bp->b_kvabase;
|
||||||
bp->b_kvasize = MAXPHYS;
|
bp->b_kvasize = MAXPHYS;
|
||||||
bp->b_flags = 0;
|
bp->b_flags = 0;
|
||||||
@ -404,9 +396,8 @@ getpbuf(int *pfreecnt)
|
|||||||
struct buf *bp;
|
struct buf *bp;
|
||||||
|
|
||||||
mtx_lock(&pbuf_mtx);
|
mtx_lock(&pbuf_mtx);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (pfreecnt) {
|
if (pfreecnt != NULL) {
|
||||||
while (*pfreecnt == 0) {
|
while (*pfreecnt == 0) {
|
||||||
msleep(pfreecnt, &pbuf_mtx, PVM, "wswbuf0", 0);
|
msleep(pfreecnt, &pbuf_mtx, PVM, "wswbuf0", 0);
|
||||||
}
|
}
|
||||||
@ -424,9 +415,8 @@ getpbuf(int *pfreecnt)
|
|||||||
if (pfreecnt)
|
if (pfreecnt)
|
||||||
--*pfreecnt;
|
--*pfreecnt;
|
||||||
mtx_unlock(&pbuf_mtx);
|
mtx_unlock(&pbuf_mtx);
|
||||||
|
|
||||||
initpbuf(bp);
|
initpbuf(bp);
|
||||||
return bp;
|
return (bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -446,14 +436,10 @@ trypbuf(int *pfreecnt)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
TAILQ_REMOVE(&bswlist, bp, b_freelist);
|
TAILQ_REMOVE(&bswlist, bp, b_freelist);
|
||||||
|
|
||||||
--*pfreecnt;
|
--*pfreecnt;
|
||||||
|
|
||||||
mtx_unlock(&pbuf_mtx);
|
mtx_unlock(&pbuf_mtx);
|
||||||
|
|
||||||
initpbuf(bp);
|
initpbuf(bp);
|
||||||
|
return (bp);
|
||||||
return bp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user