vm_pager.h revision 9759
11541Srgrimes/* 21541Srgrimes * Copyright (c) 1990 University of Utah. 31541Srgrimes * Copyright (c) 1991, 1993 41541Srgrimes * The Regents of the University of California. All rights reserved. 51541Srgrimes * 61541Srgrimes * This code is derived from software contributed to Berkeley by 71541Srgrimes * the Systems Programming Group of the University of Utah Computer 81541Srgrimes * Science Department. 91541Srgrimes * 101541Srgrimes * Redistribution and use in source and binary forms, with or without 111541Srgrimes * modification, are permitted provided that the following conditions 121541Srgrimes * are met: 131541Srgrimes * 1. Redistributions of source code must retain the above copyright 141541Srgrimes * notice, this list of conditions and the following disclaimer. 151541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 161541Srgrimes * notice, this list of conditions and the following disclaimer in the 171541Srgrimes * documentation and/or other materials provided with the distribution. 181541Srgrimes * 3. All advertising materials mentioning features or use of this software 191541Srgrimes * must display the following acknowledgement: 201541Srgrimes * This product includes software developed by the University of 211541Srgrimes * California, Berkeley and its contributors. 221541Srgrimes * 4. Neither the name of the University nor the names of its contributors 231541Srgrimes * may be used to endorse or promote products derived from this software 241541Srgrimes * without specific prior written permission. 251541Srgrimes * 261541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 271541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 281541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 291541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 301541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 311541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 321541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 331541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 341541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 351541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 361541Srgrimes * SUCH DAMAGE. 371541Srgrimes * 381541Srgrimes * @(#)vm_pager.h 8.4 (Berkeley) 1/12/94 399759Sbde * $Id: vm_pager.h,v 1.8 1995/07/13 08:48:44 davidg Exp $ 401541Srgrimes */ 411541Srgrimes 421541Srgrimes/* 431541Srgrimes * Pager routine interface definition. 441541Srgrimes */ 451541Srgrimes 461541Srgrimes#ifndef _VM_PAGER_ 471541Srgrimes#define _VM_PAGER_ 481541Srgrimes 499507SdgTAILQ_HEAD(pagerlst, vm_object); 501541Srgrimes 515455Sdgstruct pagerops { 525455Sdg void (*pgo_init) __P((void)); /* Initialize pager. */ 539507Sdg vm_object_t (*pgo_alloc) __P((void *, vm_size_t, vm_prot_t, vm_offset_t)); /* Allocate pager. */ 549507Sdg void (*pgo_dealloc) __P((vm_object_t)); /* Disassociate. */ 559507Sdg int (*pgo_getpages) __P((vm_object_t, vm_page_t *, int, int)); /* Get (read) page. */ 569507Sdg int (*pgo_putpages) __P((vm_object_t, vm_page_t *, int, boolean_t, int *)); /* Put (write) page. */ 579507Sdg boolean_t (*pgo_haspage) __P((vm_object_t, vm_offset_t, int *, int *)); /* Does pager have page? */ 589507Sdg void (*pgo_sync) __P((void)); 591541Srgrimes}; 601541Srgrimes 611541Srgrimes/* 621541Srgrimes * get/put return values 631541Srgrimes * OK operation was successful 641541Srgrimes * BAD specified data was out of the accepted range 651541Srgrimes * FAIL specified data was in range, but doesn't exist 661541Srgrimes * PEND operations was initiated but not completed 671541Srgrimes * ERROR error while accessing data that is in range and exists 681541Srgrimes * AGAIN temporary resource shortage prevented operation from happening 691541Srgrimes */ 701541Srgrimes#define VM_PAGER_OK 0 711541Srgrimes#define VM_PAGER_BAD 1 721541Srgrimes#define VM_PAGER_FAIL 2 731541Srgrimes#define VM_PAGER_PEND 3 741541Srgrimes#define VM_PAGER_ERROR 4 751541Srgrimes#define VM_PAGER_AGAIN 5 761541Srgrimes 771541Srgrimes#ifdef KERNEL 789759Sbdeextern vm_map_t pager_map; 799759Sbdeextern int pager_map_size; 809759Sbde 819507Sdgvm_object_t vm_pager_allocate __P((objtype_t, void *, vm_size_t, vm_prot_t, vm_offset_t)); 825455Sdgvm_page_t vm_pager_atop __P((vm_offset_t)); 837090Sbdevoid vm_pager_bufferinit __P((void)); 849507Sdgvoid vm_pager_deallocate __P((vm_object_t)); 859507Sdgint vm_pager_get_pages __P((vm_object_t, vm_page_t *, int, int)); 869507Sdgboolean_t vm_pager_has_page __P((vm_object_t, vm_offset_t, int *, int *)); 875455Sdgvoid vm_pager_init __P((void)); 889507Sdgvm_object_t vm_pager_object_lookup __P((struct pagerlst *, void *)); 895455Sdgvm_offset_t vm_pager_map_pages __P((vm_page_t *, int, boolean_t)); 905455Sdgvm_offset_t vm_pager_map_page __P((vm_page_t)); 919507Sdgint vm_pager_put_pages __P((vm_object_t, vm_page_t *, int, boolean_t, int *)); 925455Sdgvoid vm_pager_sync __P((void)); 935455Sdgvoid vm_pager_unmap_pages __P((vm_offset_t, int)); 945455Sdgvoid vm_pager_unmap_page __P((vm_offset_t)); 951541Srgrimes#endif 961541Srgrimes 975455Sdg#endif /* _VM_PAGER_ */ 98