FreeBSD/Linux Kernel Cross Reference
sys/uvm/uvm_pager.h
1 /* $NetBSD: uvm_pager.h,v 1.49 2020/05/19 22:22:15 ad Exp $ */
2
3 /*
4 * Copyright (c) 1997 Charles D. Cranor and Washington University.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * from: Id: uvm_pager.h,v 1.1.2.14 1998/01/13 19:00:50 chuck Exp
28 */
29
30 /*
31 * Copyright (c) 1991, 1993
32 * The Regents of the University of California. All rights reserved.
33 *
34 * This code is derived from software contributed to Berkeley by
35 * the Systems Programming Group of the University of Utah Computer
36 * Science Department.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. Neither the name of the University nor the names of its contributors
47 * may be used to endorse or promote products derived from this software
48 * without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE.
61 *
62 * @(#)vm_pager.h 8.5 (Berkeley) 7/7/94
63 */
64
65 /*
66 * Copyright (c) 1990 University of Utah.
67 *
68 * This code is derived from software contributed to Berkeley by
69 * the Systems Programming Group of the University of Utah Computer
70 * Science Department.
71 *
72 * Redistribution and use in source and binary forms, with or without
73 * modification, are permitted provided that the following conditions
74 * are met:
75 * 1. Redistributions of source code must retain the above copyright
76 * notice, this list of conditions and the following disclaimer.
77 * 2. Redistributions in binary form must reproduce the above copyright
78 * notice, this list of conditions and the following disclaimer in the
79 * documentation and/or other materials provided with the distribution.
80 * 3. Neither the name of the University nor the names of its contributors
81 * may be used to endorse or promote products derived from this software
82 * without specific prior written permission.
83 *
84 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
85 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
86 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
87 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
88 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
89 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
90 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
91 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
92 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
93 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
94 * SUCH DAMAGE.
95 *
96 * @(#)vm_pager.h 8.5 (Berkeley) 7/7/94
97 */
98
99 #ifndef _UVM_UVM_PAGER_H_
100 #define _UVM_UVM_PAGER_H_
101
102 /*
103 * uvm_pager.h
104 */
105
106 /*
107 * forward structure declarations
108 */
109
110 struct uvm_faultinfo;
111 struct uvm_object;
112
113 /*
114 * pager ops
115 */
116
117 struct uvm_pagerops {
118
119 /* init pager */
120 void (*pgo_init)(void);
121
122 /* add reference to obj */
123 void (*pgo_reference)(struct uvm_object *);
124
125 /* drop reference to obj */
126 void (*pgo_detach)(struct uvm_object *);
127
128 /* special non-standard fault processing */
129 int (*pgo_fault)(struct uvm_faultinfo *, vaddr_t, struct vm_page **,
130 int, int, vm_prot_t, int);
131
132 /* get/read pages */
133 int (*pgo_get)(struct uvm_object *, voff_t, struct vm_page **,
134 int *, int, vm_prot_t, int, int);
135
136 /* put/write pages */
137 int (*pgo_put)(struct uvm_object *, voff_t, voff_t, int);
138
139 /* mark object dirty */
140 void (*pgo_markdirty)(struct uvm_object *);
141 };
142
143 /* pager flags [mostly for flush] */
144
145 #define PGO_CLEANIT 0x001 /* write dirty pages to backing store */
146 #define PGO_SYNCIO 0x002 /* use sync I/O */
147 #define PGO_DEACTIVATE 0x004 /* deactivate flushed pages */
148 #define PGO_FREE 0x008 /* free flushed pages */
149 /* if PGO_FREE is not set then the pages stay where they are. */
150
151 #define PGO_ALLPAGES 0x010 /* flush whole object [put] */
152 #define PGO_JOURNALLOCKED 0x020 /* journal is already locked [get/put] */
153 #define PGO_LOCKED 0x040 /* fault data structures are locked [get] */
154 #define PGO_BUSYFAIL 0x080 /* fail if a page is busy [put] */
155 #define PGO_OVERWRITE 0x200 /* pages will be overwritten before unlocked */
156 #define PGO_PASTEOF 0x400 /* allow allocation of pages past EOF */
157 #define PGO_NOBLOCKALLOC 0x800 /* backing block allocation is not needed */
158 #define PGO_NOTIMESTAMP 0x1000 /* don't mark object accessed/modified */
159 #define PGO_RECLAIM 0x2000 /* object is being reclaimed */
160 #define PGO_GLOCKHELD 0x4000 /* genfs_node's lock is already held */
161 #define PGO_LAZY 0x8000 /* equivalent of MNT_LAZY / FSYNC_LAZY */
162
163 /* page we are not interested in getting */
164 #define PGO_DONTCARE ((struct vm_page *) -1L) /* [get only] */
165
166 #ifdef _KERNEL
167
168 /*
169 * prototypes
170 */
171
172 void uvm_pager_init(void);
173 void uvm_pager_realloc_emerg(void);
174 struct vm_page *uvm_pageratop(vaddr_t);
175 vaddr_t uvm_pagermapin(struct vm_page **, int, int);
176 void uvm_pagermapout(vaddr_t, int);
177
178 extern size_t pager_map_size;
179
180 /* Flags to uvm_pagermapin() */
181 #define UVMPAGER_MAPIN_WAITOK 0x01 /* it's okay to wait */
182 #define UVMPAGER_MAPIN_READ 0x02 /* device -> host */
183 #define UVMPAGER_MAPIN_WRITE 0x00 /* host -> device (pseudo flag) */
184
185 #endif /* _KERNEL */
186
187 #endif /* _UVM_UVM_PAGER_H_ */
Cache object: 7a2c7f7cdc89b18bb1b534e6538007f9
|