uvm_pager.h revision 1.9.4.5 1 1.9.4.5 chs /* $NetBSD: uvm_pager.h,v 1.9.4.5 1999/08/09 00:05:56 chs Exp $ */
2 1.1 mrg
3 1.1 mrg /*
4 1.1 mrg *
5 1.1 mrg * Copyright (c) 1997 Charles D. Cranor and Washington University.
6 1.1 mrg * All rights reserved.
7 1.1 mrg *
8 1.1 mrg * Redistribution and use in source and binary forms, with or without
9 1.1 mrg * modification, are permitted provided that the following conditions
10 1.1 mrg * are met:
11 1.1 mrg * 1. Redistributions of source code must retain the above copyright
12 1.1 mrg * notice, this list of conditions and the following disclaimer.
13 1.1 mrg * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 mrg * notice, this list of conditions and the following disclaimer in the
15 1.1 mrg * documentation and/or other materials provided with the distribution.
16 1.1 mrg * 3. All advertising materials mentioning features or use of this software
17 1.1 mrg * must display the following acknowledgement:
18 1.1 mrg * This product includes software developed by Charles D. Cranor and
19 1.1 mrg * Washington University.
20 1.1 mrg * 4. The name of the author may not be used to endorse or promote products
21 1.1 mrg * derived from this software without specific prior written permission.
22 1.1 mrg *
23 1.1 mrg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 1.1 mrg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 1.1 mrg * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 1.1 mrg * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 1.1 mrg * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 1.1 mrg * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 1.1 mrg * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 1.1 mrg * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 1.1 mrg * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 1.1 mrg * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 1.3 mrg *
34 1.3 mrg * from: Id: uvm_pager.h,v 1.1.2.14 1998/01/13 19:00:50 chuck Exp
35 1.1 mrg */
36 1.1 mrg
37 1.4 perry #ifndef _UVM_UVM_PAGER_H_
38 1.4 perry #define _UVM_UVM_PAGER_H_
39 1.4 perry
40 1.9.4.1 chs #include <sys/buf.h>
41 1.9.4.1 chs
42 1.1 mrg /*
43 1.1 mrg * uvm_pager.h
44 1.1 mrg */
45 1.1 mrg
46 1.1 mrg /*
47 1.1 mrg * pager ops
48 1.1 mrg */
49 1.1 mrg
50 1.1 mrg struct uvm_pagerops {
51 1.6 mrg void (*pgo_init) __P((void));/* init pager */
52 1.6 mrg void (*pgo_reference) /* add reference to obj */
53 1.6 mrg __P((struct uvm_object *));
54 1.6 mrg void (*pgo_detach) /* drop reference to obj */
55 1.6 mrg __P((struct uvm_object *));
56 1.6 mrg int (*pgo_fault) /* special nonstd fault fn */
57 1.7 eeh __P((struct uvm_faultinfo *, vaddr_t,
58 1.1 mrg vm_page_t *, int, int, vm_fault_t,
59 1.1 mrg vm_prot_t, int));
60 1.6 mrg boolean_t (*pgo_flush) /* flush pages out of obj */
61 1.9.4.5 chs __P((struct uvm_object *, voff_t, voff_t, int));
62 1.6 mrg int (*pgo_get) /* get/read page */
63 1.9.4.5 chs __P((struct uvm_object *, voff_t,
64 1.1 mrg vm_page_t *, int *, int, vm_prot_t, int, int));
65 1.6 mrg int (*pgo_put) /* put/write page */
66 1.6 mrg __P((struct uvm_object *, vm_page_t *,
67 1.1 mrg int, boolean_t));
68 1.6 mrg void (*pgo_cluster) /* return range of cluster */
69 1.9.4.5 chs __P((struct uvm_object *, voff_t, voff_t *,
70 1.9.4.5 chs voff_t *));
71 1.6 mrg struct vm_page ** (*pgo_mk_pcluster) /* make "put" cluster */
72 1.6 mrg __P((struct uvm_object *, struct vm_page **,
73 1.9.4.5 chs int *, struct vm_page *, int, voff_t,
74 1.9.4.5 chs voff_t));
75 1.6 mrg void (*pgo_shareprot) /* share protect */
76 1.6 mrg __P((vm_map_entry_t, vm_prot_t));
77 1.6 mrg void (*pgo_aiodone) /* async iodone */
78 1.6 mrg __P((struct uvm_aiodesc *));
79 1.6 mrg boolean_t (*pgo_releasepg) /* release page */
80 1.6 mrg __P((struct vm_page *, struct vm_page **));
81 1.1 mrg };
82 1.1 mrg
83 1.1 mrg /* pager flags [mostly for flush] */
84 1.1 mrg
85 1.1 mrg #define PGO_CLEANIT 0x001 /* write dirty pages to backing store */
86 1.1 mrg #define PGO_SYNCIO 0x002 /* if PGO_CLEAN: use sync I/O? */
87 1.1 mrg /*
88 1.9.4.3 chs * if neither PGO_INVALIDATE or PGO_FREE are set then the pages
89 1.1 mrg * stay where they are.
90 1.1 mrg */
91 1.1 mrg #define PGO_DEACTIVATE 0x004 /* deactivate flushed pages */
92 1.1 mrg #define PGO_FREE 0x008 /* free flushed pages */
93 1.1 mrg
94 1.1 mrg #define PGO_ALLPAGES 0x010 /* flush whole object/get all pages */
95 1.1 mrg #define PGO_DOACTCLUST 0x020 /* flag to mk_pcluster to include active */
96 1.1 mrg #define PGO_LOCKED 0x040 /* fault data structures are locked [get] */
97 1.1 mrg #define PGO_PDFREECLUST 0x080 /* daemon's free cluster flag [uvm_pager_put] */
98 1.1 mrg #define PGO_REALLOCSWAP 0x100 /* reallocate swap area [pager_dropcluster] */
99 1.9.4.1 chs #define PGO_OVERWRITE 0x200 /* page will be overwritten immediately */
100 1.1 mrg
101 1.1 mrg /* page we are not interested in getting */
102 1.9.4.3 chs #define PGO_DONTCARE ((struct vm_page *) -1L) /* [get only] */
103 1.1 mrg
104 1.9.4.2 thorpej #ifdef _KERNEL
105 1.9.4.2 thorpej
106 1.1 mrg /*
107 1.1 mrg * handle inline options
108 1.1 mrg */
109 1.1 mrg
110 1.1 mrg #ifdef UVM_PAGER_INLINE
111 1.1 mrg #define PAGER_INLINE static __inline
112 1.1 mrg #else
113 1.1 mrg #define PAGER_INLINE /* nothing */
114 1.1 mrg #endif /* UVM_PAGER_INLINE */
115 1.1 mrg
116 1.1 mrg /*
117 1.1 mrg * prototypes
118 1.1 mrg */
119 1.1 mrg
120 1.1 mrg void uvm_pager_dropcluster __P((struct uvm_object *,
121 1.1 mrg struct vm_page *, struct vm_page **,
122 1.1 mrg int *, int, int));
123 1.1 mrg void uvm_pager_init __P((void));
124 1.1 mrg int uvm_pager_put __P((struct uvm_object *, struct vm_page *,
125 1.1 mrg struct vm_page ***, int *, int,
126 1.9.4.5 chs voff_t, voff_t));
127 1.1 mrg
128 1.7 eeh PAGER_INLINE struct vm_page *uvm_pageratop __P((vaddr_t));
129 1.1 mrg
130 1.9.4.3 chs vaddr_t uvm_pagermapin __P((struct vm_page **, int, int));
131 1.7 eeh void uvm_pagermapout __P((vaddr_t, int));
132 1.1 mrg struct vm_page **uvm_mk_pcluster __P((struct uvm_object *, struct vm_page **,
133 1.1 mrg int *, struct vm_page *, int,
134 1.9.4.5 chs voff_t, voff_t));
135 1.1 mrg void uvm_shareprot __P((vm_map_entry_t, vm_prot_t));
136 1.9.4.4 chs int uvm_errno2vmerror __P((int));
137 1.1 mrg
138 1.9.4.2 thorpej #endif /* _KERNEL */
139 1.4 perry
140 1.4 perry #endif /* _UVM_UVM_PAGER_H_ */
141