vm_pager.h revision 9759
1187423Sgonzo/* 2187423Sgonzo * Copyright (c) 1990 University of Utah. 3187423Sgonzo * Copyright (c) 1991, 1993 4187423Sgonzo * The Regents of the University of California. All rights reserved. 5187423Sgonzo * 6187423Sgonzo * This code is derived from software contributed to Berkeley by 7187423Sgonzo * the Systems Programming Group of the University of Utah Computer 8187423Sgonzo * Science Department. 9187423Sgonzo * 10187423Sgonzo * Redistribution and use in source and binary forms, with or without 11187423Sgonzo * modification, are permitted provided that the following conditions 12187423Sgonzo * are met: 13187423Sgonzo * 1. Redistributions of source code must retain the above copyright 14187423Sgonzo * notice, this list of conditions and the following disclaimer. 15187423Sgonzo * 2. Redistributions in binary form must reproduce the above copyright 16187423Sgonzo * notice, this list of conditions and the following disclaimer in the 17187423Sgonzo * documentation and/or other materials provided with the distribution. 18187423Sgonzo * 3. All advertising materials mentioning features or use of this software 19187423Sgonzo * must display the following acknowledgement: 20187423Sgonzo * This product includes software developed by the University of 21187423Sgonzo * California, Berkeley and its contributors. 22187423Sgonzo * 4. Neither the name of the University nor the names of its contributors 23187423Sgonzo * may be used to endorse or promote products derived from this software 24187423Sgonzo * without specific prior written permission. 25187423Sgonzo * 26187423Sgonzo * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27187423Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28187423Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29187423Sgonzo * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30187423Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31187423Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32187423Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33187423Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34187423Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35187423Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36187423Sgonzo * SUCH DAMAGE. 37187423Sgonzo * 38187423Sgonzo * @(#)vm_pager.h 8.4 (Berkeley) 1/12/94 39187423Sgonzo * $Id: vm_pager.h,v 1.8 1995/07/13 08:48:44 davidg Exp $ 40187423Sgonzo */ 41187423Sgonzo 42187423Sgonzo/* 43187423Sgonzo * Pager routine interface definition. 44198562Sthompsa */ 45187423Sgonzo 46187423Sgonzo#ifndef _VM_PAGER_ 47187423Sgonzo#define _VM_PAGER_ 48187423Sgonzo 49192178SgonzoTAILQ_HEAD(pagerlst, vm_object); 50192178Sgonzo 51187423Sgonzostruct pagerops { 52187423Sgonzo void (*pgo_init) __P((void)); /* Initialize pager. */ 53187423Sgonzo vm_object_t (*pgo_alloc) __P((void *, vm_size_t, vm_prot_t, vm_offset_t)); /* Allocate pager. */ 54187423Sgonzo void (*pgo_dealloc) __P((vm_object_t)); /* Disassociate. */ 55187423Sgonzo int (*pgo_getpages) __P((vm_object_t, vm_page_t *, int, int)); /* Get (read) page. */ 56187423Sgonzo int (*pgo_putpages) __P((vm_object_t, vm_page_t *, int, boolean_t, int *)); /* Put (write) page. */ 57187423Sgonzo boolean_t (*pgo_haspage) __P((vm_object_t, vm_offset_t, int *, int *)); /* Does pager have page? */ 58187456Sgonzo void (*pgo_sync) __P((void)); 59187423Sgonzo}; 60187423Sgonzo 61187423Sgonzo/* 62192178Sgonzo * get/put return values 63198562Sthompsa * OK operation was successful 64198562Sthompsa * BAD specified data was out of the accepted range 65198562Sthompsa * FAIL specified data was in range, but doesn't exist 66187423Sgonzo * PEND operations was initiated but not completed 67198562Sthompsa * ERROR error while accessing data that is in range and exists 68198562Sthompsa * AGAIN temporary resource shortage prevented operation from happening 69198562Sthompsa */ 70198562Sthompsa#define VM_PAGER_OK 0 71198562Sthompsa#define VM_PAGER_BAD 1 72198562Sthompsa#define VM_PAGER_FAIL 2 73198562Sthompsa#define VM_PAGER_PEND 3 74198562Sthompsa#define VM_PAGER_ERROR 4 75198562Sthompsa#define VM_PAGER_AGAIN 5 76198562Sthompsa 77198562Sthompsa#ifdef KERNEL 78198562Sthompsaextern vm_map_t pager_map; 79198562Sthompsaextern int pager_map_size; 80198562Sthompsa 81198562Sthompsavm_object_t vm_pager_allocate __P((objtype_t, void *, vm_size_t, vm_prot_t, vm_offset_t)); 82198562Sthompsavm_page_t vm_pager_atop __P((vm_offset_t)); 83198562Sthompsavoid vm_pager_bufferinit __P((void)); 84198562Sthompsavoid vm_pager_deallocate __P((vm_object_t)); 85198562Sthompsaint vm_pager_get_pages __P((vm_object_t, vm_page_t *, int, int)); 86198562Sthompsaboolean_t vm_pager_has_page __P((vm_object_t, vm_offset_t, int *, int *)); 87198562Sthompsavoid vm_pager_init __P((void)); 88198562Sthompsavm_object_t vm_pager_object_lookup __P((struct pagerlst *, void *)); 89198562Sthompsavm_offset_t vm_pager_map_pages __P((vm_page_t *, int, boolean_t)); 90198562Sthompsavm_offset_t vm_pager_map_page __P((vm_page_t)); 91198562Sthompsaint vm_pager_put_pages __P((vm_object_t, vm_page_t *, int, boolean_t, int *)); 92198562Sthompsavoid vm_pager_sync __P((void)); 93198562Sthompsavoid vm_pager_unmap_pages __P((vm_offset_t, int)); 94198562Sthompsavoid vm_pager_unmap_page __P((vm_offset_t)); 95198562Sthompsa#endif 96198562Sthompsa 97198562Sthompsa#endif /* _VM_PAGER_ */ 98198562Sthompsa