From 4e6586002df89aa5ef4d86d464a8e91a1ce552fa Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Tue, 5 Aug 2003 06:51:26 +0000 Subject: [PATCH] Use sparse struct initializations for struct pagerops. This makes grepping for which pagers implement which methods easier. --- sys/vm/default_pager.c | 12 +++++------- sys/vm/device_pager.c | 13 ++++++------- sys/vm/phys_pager.c | 13 ++++++------- sys/vm/vm_pager.c | 30 +++++------------------------- sys/vm/vnode_pager.c | 13 ++++++------- 5 files changed, 28 insertions(+), 53 deletions(-) diff --git a/sys/vm/default_pager.c b/sys/vm/default_pager.c index b3e6e4436563..113322a971a8 100644 --- a/sys/vm/default_pager.c +++ b/sys/vm/default_pager.c @@ -64,13 +64,11 @@ static boolean_t default_pager_haspage(vm_object_t, vm_pindex_t, int *, * pagerops for OBJT_DEFAULT - "default pager". */ struct pagerops defaultpagerops = { - NULL, - default_pager_alloc, - default_pager_dealloc, - default_pager_getpages, - default_pager_putpages, - default_pager_haspage, - NULL + .pgo_alloc = default_pager_alloc, + .pgo_dealloc = default_pager_dealloc, + .pgo_getpages = default_pager_getpages, + .pgo_putpages = default_pager_putpages, + .pgo_haspage = default_pager_haspage, }; /* diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index 65b268a48f24..85eeed03c165 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -80,13 +80,12 @@ static vm_page_t dev_pager_getfake(vm_paddr_t); static void dev_pager_putfake(vm_page_t); struct pagerops devicepagerops = { - dev_pager_init, - dev_pager_alloc, - dev_pager_dealloc, - dev_pager_getpages, - dev_pager_putpages, - dev_pager_haspage, - NULL + .pgo_init = dev_pager_init, + .pgo_alloc = dev_pager_alloc, + .pgo_dealloc = dev_pager_dealloc, + .pgo_getpages = dev_pager_getpages, + .pgo_putpages = dev_pager_putpages, + .pgo_haspage = dev_pager_haspage, }; static void diff --git a/sys/vm/phys_pager.c b/sys/vm/phys_pager.c index 214315dcc557..6a2e19144202 100644 --- a/sys/vm/phys_pager.c +++ b/sys/vm/phys_pager.c @@ -201,11 +201,10 @@ phys_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, } struct pagerops physpagerops = { - phys_pager_init, - phys_pager_alloc, - phys_pager_dealloc, - phys_pager_getpages, - phys_pager_putpages, - phys_pager_haspage, - NULL + .pgo_init = phys_pager_init, + .pgo_alloc = phys_pager_alloc, + .pgo_dealloc = phys_pager_dealloc, + .pgo_getpages = phys_pager_getpages, + .pgo_putpages = phys_pager_putpages, + .pgo_haspage = phys_pager_haspage, }; diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 9f089b71df5c..e5d6cc771cf6 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -154,13 +154,11 @@ dead_pager_dealloc(object) } static struct pagerops deadpagerops = { - NULL, - dead_pager_alloc, - dead_pager_dealloc, - dead_pager_getpages, - dead_pager_putpages, - dead_pager_haspage, - NULL + .pgo_alloc = dead_pager_alloc, + .pgo_dealloc = dead_pager_dealloc, + .pgo_getpages = dead_pager_getpages, + .pgo_putpages = dead_pager_putpages, + .pgo_haspage = dead_pager_haspage, }; struct pagerops *pagertab[] = { @@ -263,24 +261,6 @@ vm_pager_deallocate(object) (*pagertab[object->type]->pgo_dealloc) (object); } -/* - * vm_pager_strategy: - * - * called with no specific spl - * Execute strategy routine directly to pager. - */ -void -vm_pager_strategy(vm_object_t object, struct bio *bp) -{ - if (pagertab[object->type]->pgo_strategy) { - (*pagertab[object->type]->pgo_strategy)(object, bp); - } else { - bp->bio_flags |= BIO_ERROR; - bp->bio_error = ENXIO; - biodone(bp); - } -} - /* * vm_pager_get_pages() - inline, see vm/vm_pager.h * vm_pager_put_pages() - inline, see vm/vm_pager.h diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 69f4b421a6bc..58f4518107d4 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -83,13 +83,12 @@ static void vnode_pager_putpages(vm_object_t, vm_page_t *, int, boolean_t, int * static boolean_t vnode_pager_haspage(vm_object_t, vm_pindex_t, int *, int *); struct pagerops vnodepagerops = { - vnode_pager_init, - vnode_pager_alloc, - vnode_pager_dealloc, - vnode_pager_getpages, - vnode_pager_putpages, - vnode_pager_haspage, - NULL + .pgo_init = vnode_pager_init, + .pgo_alloc = vnode_pager_alloc, + .pgo_dealloc = vnode_pager_dealloc, + .pgo_getpages = vnode_pager_getpages, + .pgo_putpages = vnode_pager_putpages, + .pgo_haspage = vnode_pager_haspage, }; int vnode_pbuf_freecnt;