From owner-svn-src-all@freebsd.org Sat Dec 31 19:30:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EA5DC990CC; Sat, 31 Dec 2016 19:30:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5727E17B3; Sat, 31 Dec 2016 19:30:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVJUMml053330; Sat, 31 Dec 2016 19:30:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVJUM9g053329; Sat, 31 Dec 2016 19:30:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612311930.uBVJUM9g053329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 31 Dec 2016 19:30:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310982 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 19:30:23 -0000 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); } /*