vm_pager.h revision 34206
1224133Sdim/* 2224133Sdim * Copyright (c) 1990 University of Utah. 3224133Sdim * Copyright (c) 1991, 1993 4224133Sdim * The Regents of the University of California. All rights reserved. 5224133Sdim * 6224133Sdim * This code is derived from software contributed to Berkeley by 7224133Sdim * the Systems Programming Group of the University of Utah Computer 8224133Sdim * Science Department. 9224133Sdim * 10224133Sdim * Redistribution and use in source and binary forms, with or without 11252723Sdim * modification, are permitted provided that the following conditions 12252723Sdim * are met: 13224133Sdim * 1. Redistributions of source code must retain the above copyright 14224133Sdim * notice, this list of conditions and the following disclaimer. 15224133Sdim * 2. Redistributions in binary form must reproduce the above copyright 16224133Sdim * notice, this list of conditions and the following disclaimer in the 17224133Sdim * documentation and/or other materials provided with the distribution. 18224133Sdim * 3. All advertising materials mentioning features or use of this software 19224133Sdim * must display the following acknowledgement: 20245431Sdim * This product includes software developed by the University of 21245431Sdim * California, Berkeley and its contributors. 22245431Sdim * 4. Neither the name of the University nor the names of its contributors 23245431Sdim * may be used to endorse or promote products derived from this software 24224133Sdim * without specific prior written permission. 25245431Sdim * 26245431Sdim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27245431Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28245431Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29245431Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30263509Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31263509Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32263509Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33263509Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34263509Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35245431Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36245431Sdim * SUCH DAMAGE. 37245431Sdim * 38245431Sdim * @(#)vm_pager.h 8.4 (Berkeley) 1/12/94 39245431Sdim * $Id: vm_pager.h,v 1.15 1998/02/03 22:19:35 bde Exp $ 40245431Sdim */ 41245431Sdim 42224133Sdim/* 43224133Sdim * Pager routine interface definition. 44224133Sdim */ 45245431Sdim 46245431Sdim#ifndef _VM_PAGER_ 47245431Sdim#define _VM_PAGER_ 48245431Sdim 49224133Sdim#include <sys/queue.h> 50224133Sdim 51224133SdimTAILQ_HEAD(pagerlst, vm_object); 52224133Sdim 53224133Sdimstruct pagerops { 54224133Sdim void (*pgo_init) __P((void)); /* Initialize pager. */ 55224133Sdim vm_object_t (*pgo_alloc) __P((void *, vm_size_t, vm_prot_t, vm_ooffset_t)); /* Allocate pager. */ 56245431Sdim void (*pgo_dealloc) __P((vm_object_t)); /* Disassociate. */ 57245431Sdim int (*pgo_getpages) __P((vm_object_t, vm_page_t *, int, int)); /* Get (read) page. */ 58245431Sdim int (*pgo_putpages) __P((vm_object_t, vm_page_t *, int, int, int *)); /* Put (write) page. */ 59245431Sdim boolean_t (*pgo_haspage) __P((vm_object_t, vm_pindex_t, int *, int *)); /* Does pager have page? */ 60245431Sdim void (*pgo_sync) __P((void)); 61224133Sdim}; 62224133Sdim 63245431Sdim/* 64224133Sdim * get/put return values 65224133Sdim * OK operation was successful 66224133Sdim * BAD specified data was out of the accepted range 67245431Sdim * FAIL specified data was in range, but doesn't exist 68224133Sdim * PEND operations was initiated but not completed 69224133Sdim * ERROR error while accessing data that is in range and exists 70224133Sdim * AGAIN temporary resource shortage prevented operation from happening 71224133Sdim */ 72224133Sdim#define VM_PAGER_OK 0 73224133Sdim#define VM_PAGER_BAD 1 74224133Sdim#define VM_PAGER_FAIL 2 75224133Sdim#define VM_PAGER_PEND 3 76224133Sdim#define VM_PAGER_ERROR 4 77224133Sdim#define VM_PAGER_AGAIN 5 78224133Sdim 79224133Sdim#define VM_PAGER_PUT_SYNC 0x1 80224133Sdim#define VM_PAGER_PUT_INVAL 0x2 81224133Sdim 82224133Sdim#ifdef KERNEL 83224133Sdim 84224133Sdim#ifdef MALLOC_DECLARE 85224133SdimMALLOC_DECLARE(M_VMPGDATA); 86224133Sdim#endif 87245431Sdim 88245431Sdimextern vm_map_t pager_map; 89245431Sdimextern int pager_map_size; 90224133Sdim 91224133Sdimvm_object_t vm_pager_allocate __P((objtype_t, void *, vm_size_t, vm_prot_t, vm_ooffset_t)); 92224133Sdimvoid vm_pager_bufferinit __P((void)); 93245431Sdimvoid vm_pager_deallocate __P((vm_object_t)); 94245431Sdimint vm_pager_get_pages __P((vm_object_t, vm_page_t *, int, int)); 95224133Sdimboolean_t vm_pager_has_page __P((vm_object_t, vm_pindex_t, int *, int *)); 96224133Sdimvoid vm_pager_init __P((void)); 97224133Sdimvm_object_t vm_pager_object_lookup __P((struct pagerlst *, void *)); 98224133Sdimvm_offset_t vm_pager_map_pages __P((vm_page_t *, int, boolean_t)); 99224133Sdimvm_offset_t vm_pager_map_page __P((vm_page_t)); 100263509Sdimint vm_pager_put_pages __P((vm_object_t, vm_page_t *, int, boolean_t, int *)); 101245431Sdimvoid vm_pager_sync __P((void)); 102224133Sdimvoid vm_pager_unmap_pages __P((vm_offset_t, int)); 103224133Sdimvoid vm_pager_unmap_page __P((vm_offset_t)); 104224133Sdim#endif 105245431Sdim 106224133Sdim#endif /* _VM_PAGER_ */ 107245431Sdim