vm_pager.h revision 30354
160894Smsmith/* 260894Smsmith * Copyright (c) 1990 University of Utah. 3123103Sps * Copyright (c) 1991, 1993 4123103Sps * The Regents of the University of California. All rights reserved. 560894Smsmith * 660894Smsmith * This code is derived from software contributed to Berkeley by 760894Smsmith * the Systems Programming Group of the University of Utah Computer 860894Smsmith * Science Department. 960894Smsmith * 1060894Smsmith * Redistribution and use in source and binary forms, with or without 1160894Smsmith * modification, are permitted provided that the following conditions 1260894Smsmith * are met: 1360894Smsmith * 1. Redistributions of source code must retain the above copyright 1460894Smsmith * notice, this list of conditions and the following disclaimer. 1560894Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1660894Smsmith * notice, this list of conditions and the following disclaimer in the 1760894Smsmith * documentation and/or other materials provided with the distribution. 1860894Smsmith * 3. All advertising materials mentioning features or use of this software 1960894Smsmith * must display the following acknowledgement: 2060894Smsmith * This product includes software developed by the University of 2160894Smsmith * California, Berkeley and its contributors. 2260894Smsmith * 4. Neither the name of the University nor the names of its contributors 2360894Smsmith * may be used to endorse or promote products derived from this software 2460894Smsmith * without specific prior written permission. 2560894Smsmith * 2660894Smsmith * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2760894Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2860894Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2960894Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 3060894Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3160894Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3260894Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3360894Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3460894Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3560894Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3667555Smsmith * SUCH DAMAGE. 3760894Smsmith * 3867555Smsmith * @(#)vm_pager.h 8.4 (Berkeley) 1/12/94 3960894Smsmith * $Id: vm_pager.h,v 1.13 1997/02/22 09:48:37 peter Exp $ 4067555Smsmith */ 4167555Smsmith 4260894Smsmith/* 4360894Smsmith * Pager routine interface definition. 4460894Smsmith */ 4560894Smsmith 4667555Smsmith#ifndef _VM_PAGER_ 4767555Smsmith#define _VM_PAGER_ 4867555Smsmith 4967555SmsmithTAILQ_HEAD(pagerlst, vm_object); 5060894Smsmith 5191449Speterstruct pagerops { 5267555Smsmith void (*pgo_init) __P((void)); /* Initialize pager. */ 5391449Speter vm_object_t (*pgo_alloc) __P((void *, vm_size_t, vm_prot_t, vm_ooffset_t)); /* Allocate pager. */ 5491449Speter void (*pgo_dealloc) __P((vm_object_t)); /* Disassociate. */ 5567555Smsmith int (*pgo_getpages) __P((vm_object_t, vm_page_t *, int, int)); /* Get (read) page. */ 5667555Smsmith int (*pgo_putpages) __P((vm_object_t, vm_page_t *, int, boolean_t, int *)); /* Put (write) page. */ 5791449Speter boolean_t (*pgo_haspage) __P((vm_object_t, vm_pindex_t, int *, int *)); /* Does pager have page? */ 5867555Smsmith void (*pgo_sync) __P((void)); 5967555Smsmith}; 6067555Smsmith 6167555Smsmith/* 62141492Sscottl * get/put return values 6367555Smsmith * OK operation was successful 6467555Smsmith * BAD specified data was out of the accepted range 65123103Sps * FAIL specified data was in range, but doesn't exist 66123103Sps * PEND operations was initiated but not completed 6760894Smsmith * ERROR error while accessing data that is in range and exists 6860894Smsmith * AGAIN temporary resource shortage prevented operation from happening 6960894Smsmith */ 7060894Smsmith#define VM_PAGER_OK 0 71240137Sjhb#define VM_PAGER_BAD 1 7267555Smsmith#define VM_PAGER_FAIL 2 7367555Smsmith#define VM_PAGER_PEND 3 7467555Smsmith#define VM_PAGER_ERROR 4 7567555Smsmith#define VM_PAGER_AGAIN 5 7667555Smsmith 7760894Smsmith#ifdef KERNEL 7860894Smsmith 7960894Smsmith#ifdef MALLOC_DECLARE 8060894SmsmithMALLOC_DECLARE(M_VMPGDATA); 8167555Smsmith#endif 8267555Smsmith 8367555Smsmithextern vm_map_t pager_map; 8460894Smsmithextern int pager_map_size; 8560894Smsmith 8660894Smsmithvm_object_t vm_pager_allocate __P((objtype_t, void *, vm_size_t, vm_prot_t, vm_ooffset_t)); 8760894Smsmithvoid vm_pager_bufferinit __P((void)); 8867555Smsmithvoid vm_pager_deallocate __P((vm_object_t)); 8967555Smsmithint vm_pager_get_pages __P((vm_object_t, vm_page_t *, int, int)); 9067555Smsmithboolean_t vm_pager_has_page __P((vm_object_t, vm_pindex_t, int *, int *)); 91123103Spsvoid vm_pager_init __P((void)); 9267555Smsmithvm_object_t vm_pager_object_lookup __P((struct pagerlst *, void *)); 9367555Smsmithvm_offset_t vm_pager_map_pages __P((vm_page_t *, int, boolean_t)); 9460894Smsmithvm_offset_t vm_pager_map_page __P((vm_page_t)); 9560894Smsmithint vm_pager_put_pages __P((vm_object_t, vm_page_t *, int, boolean_t, int *)); 9660894Smsmithvoid vm_pager_sync __P((void)); 9760894Smsmithvoid vm_pager_unmap_pages __P((vm_offset_t, int)); 9867555Smsmithvoid vm_pager_unmap_page __P((vm_offset_t)); 9967555Smsmith#endif 10060894Smsmith 10160894Smsmith#endif /* _VM_PAGER_ */ 10260894Smsmith