Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 2016 19:30:22 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r310982 - head/sys/vm
Message-ID:  <201612311930.uBVJUM9g053329@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Dec 31 19:30:22 2016
New Revision: 310982
URL: https://svnweb.freebsd.org/changeset/base/310982

Log:
  Ansify vm/vm_pager.c.  Style.
  
  Reviewed by:	alc
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/vm/vm_pager.c

Modified: head/sys/vm/vm_pager.c
==============================================================================
--- head/sys/vm/vm_pager.c	Sat Dec 31 17:05:09 2016	(r310981)
+++ head/sys/vm/vm_pager.c	Sat Dec 31 19:30:22 2016	(r310982)
@@ -109,43 +109,35 @@ static vm_object_t
 dead_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
     vm_ooffset_t off, struct ucred *cred)
 {
-	return NULL;
+
+	return (NULL);
 }
 
 static void
-dead_pager_putpages(object, m, count, flags, rtvals)
-	vm_object_t object;
-	vm_page_t *m;
-	int count;
-	int flags;
-	int *rtvals;
+dead_pager_putpages(vm_object_t object, vm_page_t *m, int count,
+    int flags, int *rtvals)
 {
 	int i;
 
-	for (i = 0; i < count; i++) {
+	for (i = 0; i < count; i++)
 		rtvals[i] = VM_PAGER_AGAIN;
-	}
 }
 
 static int
-dead_pager_haspage(object, pindex, prev, next)
-	vm_object_t object;
-	vm_pindex_t pindex;
-	int *prev;
-	int *next;
+dead_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *prev, int *next)
 {
-	if (prev)
+
+	if (prev != NULL)
 		*prev = 0;
-	if (next)
+	if (next != NULL)
 		*next = 0;
-	return FALSE;
+	return (FALSE);
 }
 
 static void
-dead_pager_dealloc(object)
-	vm_object_t object;
+dead_pager_dealloc(vm_object_t object)
 {
-	return;
+
 }
 
 static struct pagerops deadpagerops = {
@@ -181,7 +173,7 @@ static int bswneeded;
 vm_offset_t swapbkva;		/* swap buffers kva */
 
 void
-vm_pager_init()
+vm_pager_init(void)
 {
 	struct pagerops **pgops;
 
@@ -191,11 +183,11 @@ vm_pager_init()
 	 */
 	for (pgops = pagertab; pgops < &pagertab[nitems(pagertab)]; pgops++)
 		if ((*pgops)->pgo_init != NULL)
-			(*(*pgops)->pgo_init) ();
+			(*(*pgops)->pgo_init)();
 }
 
 void
-vm_pager_bufferinit()
+vm_pager_bufferinit(void)
 {
 	struct buf *bp;
 	int i;
@@ -232,7 +224,7 @@ vm_pager_allocate(objtype_t type, void *
 
 	ops = pagertab[type];
 	if (ops)
-		ret = (*ops->pgo_alloc) (handle, size, prot, off, cred);
+		ret = (*ops->pgo_alloc)(handle, size, prot, off, cred);
 	else
 		ret = NULL;
 	return (ret);
@@ -242,8 +234,7 @@ vm_pager_allocate(objtype_t type, void *
  *	The object must be locked.
  */
 void
-vm_pager_deallocate(object)
-	vm_object_t object;
+vm_pager_deallocate(vm_object_t object)
 {
 
 	VM_OBJECT_ASSERT_WLOCKED(object);
@@ -366,12 +357,13 @@ vm_pager_object_lookup(struct pagerlst *
 static void
 initpbuf(struct buf *bp)
 {
+
 	KASSERT(bp->b_bufobj == NULL, ("initpbuf with bufobj"));
 	KASSERT(bp->b_vp == NULL, ("initpbuf with vp"));
 	bp->b_rcred = NOCRED;
 	bp->b_wcred = NOCRED;
 	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_kvasize = MAXPHYS;
 	bp->b_flags = 0;
@@ -404,9 +396,8 @@ getpbuf(int *pfreecnt)
 	struct buf *bp;
 
 	mtx_lock(&pbuf_mtx);
-
 	for (;;) {
-		if (pfreecnt) {
+		if (pfreecnt != NULL) {
 			while (*pfreecnt == 0) {
 				msleep(pfreecnt, &pbuf_mtx, PVM, "wswbuf0", 0);
 			}
@@ -424,9 +415,8 @@ getpbuf(int *pfreecnt)
 	if (pfreecnt)
 		--*pfreecnt;
 	mtx_unlock(&pbuf_mtx);
-
 	initpbuf(bp);
-	return bp;
+	return (bp);
 }
 
 /*
@@ -446,14 +436,10 @@ trypbuf(int *pfreecnt)
 		return NULL;
 	}
 	TAILQ_REMOVE(&bswlist, bp, b_freelist);
-
 	--*pfreecnt;
-
 	mtx_unlock(&pbuf_mtx);
-
 	initpbuf(bp);
-
-	return bp;
+	return (bp);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612311930.uBVJUM9g053329>