swap_pager.h revision 224582
1139825Simp/*- 21541Srgrimes * Copyright (c) 1990 University of Utah. 31549Srgrimes * Copyright (c) 1991 The Regents of the University of California. 41549Srgrimes * 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 * 4. Neither the name of the University nor the names of its contributors 191541Srgrimes * may be used to endorse or promote products derived from this software 201541Srgrimes * without specific prior written permission. 211541Srgrimes * 221541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321541Srgrimes * SUCH DAMAGE. 331541Srgrimes * 341549Srgrimes * from: @(#)swap_pager.h 7.1 (Berkeley) 12/5/90 3550477Speter * $FreeBSD: head/sys/vm/swap_pager.h 224582 2011-08-01 19:12:15Z kib $ 361541Srgrimes */ 371541Srgrimes 38108599Sphk#ifndef _VM_SWAP_PAGER_H_ 39108599Sphk#define _VM_SWAP_PAGER_H_ 1 401541Srgrimes 41166550Sjhbtypedef int32_t swblk_t; /* 42166550Sjhb * swap offset. This is the type used to 43166550Sjhb * address the "virtual swap device" and 44166550Sjhb * therefore the maximum swap space is 45166550Sjhb * 2^32 pages. 46166550Sjhb */ 47166550Sjhb 48166550Sjhbstruct buf; 49166550Sjhbstruct swdevt; 50166550Sjhbtypedef void sw_strategy_t(struct buf *, struct swdevt *); 51166550Sjhbtypedef void sw_close_t(struct thread *, struct swdevt *); 52166550Sjhb 53166550Sjhb/* 54166550Sjhb * Swap device table 55166550Sjhb */ 56166550Sjhbstruct swdevt { 57166550Sjhb int sw_flags; 58166550Sjhb int sw_nblks; 59166550Sjhb int sw_used; 60166550Sjhb dev_t sw_dev; 61166550Sjhb struct vnode *sw_vp; 62166550Sjhb void *sw_id; 63166550Sjhb swblk_t sw_first; 64166550Sjhb swblk_t sw_end; 65166550Sjhb struct blist *sw_blist; 66166550Sjhb TAILQ_ENTRY(swdevt) sw_list; 67166550Sjhb sw_strategy_t *sw_strategy; 68166550Sjhb sw_close_t *sw_close; 69166550Sjhb}; 70166550Sjhb 71166550Sjhb#define SW_CLOSING 0x04 72166550Sjhb 73108602Sphk#ifdef _KERNEL 74108602Sphk 7511317Sdgextern int swap_pager_full; 76118390Sphkextern int swap_pager_avail; 7710080Sbde 78224582Skibstruct xswdev; 79224582Skibint swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len); 8092727Salfredvoid swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int); 8192727Salfredvoid swap_pager_freespace(vm_object_t, vm_pindex_t, vm_size_t); 8292727Salfredvoid swap_pager_swap_init(void); 83118390Sphkint swap_pager_isswapped(vm_object_t, struct swdevt *); 8492727Salfredint swap_pager_reserve(vm_object_t, vm_pindex_t, vm_size_t); 85117723Sphkvoid swap_pager_status(int *total, int *used); 86157628Spjdvoid swapoff_all(void); 8742957Sdillon 8892029Seivind#endif /* _KERNEL */ 89108599Sphk#endif /* _VM_SWAP_PAGER_H_ */ 90