xref: /illumos-gate/usr/src/uts/common/vm/pvn.h (revision 1702cce751c5cb7ead878d0205a6c90b027e3de8)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved	*/
28 
29 /*
30  * University Copyright- Copyright (c) 1982, 1986, 1988
31  * The Regents of the University of California
32  * All Rights Reserved
33  *
34  * University Acknowledgment- Portions of this document are derived from
35  * software developed by the University of California, Berkeley, and its
36  * contributors.
37  */
38 
39 #ifndef	_VM_PVN_H
40 #define	_VM_PVN_H
41 
42 #include <sys/buf.h>
43 #include <vm/seg.h>
44 
45 #ifdef	__cplusplus
46 extern "C" {
47 #endif
48 
49 #ifdef	_KERNEL
50 
51 /*
52  * VM - paged vnode.
53  *
54  * The VM system manages memory as a cache of paged vnodes.
55  * This file desribes the interfaces to common subroutines
56  * used to help implement the VM/file system routines.
57  */
58 
59 struct page	*pvn_read_kluster(struct vnode *vp, u_offset_t off,
60 			struct seg *seg, caddr_t addr, u_offset_t *offp,
61 			size_t *lenp, u_offset_t vp_off, size_t vp_len,
62 			int isra);
63 struct page	*pvn_write_kluster(struct vnode *vp, struct page *pp,
64 			u_offset_t *offp, size_t *lenp, u_offset_t vp_off,
65 			size_t vp_len, int flags);
66 void		pvn_read_done(struct page *plist, int flags);
67 void		pvn_write_done(struct page *plist, int flags);
68 void		pvn_io_done(struct page *plist);
69 int		pvn_vplist_dirty(struct vnode *vp, u_offset_t off,
70 			int (*putapage)(vnode_t *, struct page *, u_offset_t *,
71 				size_t *, int, cred_t *),
72 			int flags, struct cred *cred);
73 void		pvn_vplist_setdirty(vnode_t *vp, int (*page_check)(page_t *));
74 int		pvn_getdirty(struct page *pp, int flags);
75 void		pvn_vpzero(struct vnode *vp, u_offset_t vplen, size_t zbytes);
76 int		pvn_getpages(
77 			int (*getpage)(vnode_t *, u_offset_t, size_t, uint_t *,
78 				struct page *[], size_t, struct seg *,
79 				caddr_t, enum seg_rw, cred_t *),
80 			struct vnode *vp, u_offset_t off, size_t len,
81 			uint_t *protp, struct page **pl, size_t plsz,
82 			struct seg *seg, caddr_t addr, enum seg_rw rw,
83 			struct cred *cred);
84 void		pvn_plist_init(struct page *pp, struct page **pl, size_t plsz,
85 			u_offset_t off, size_t io_len, enum seg_rw rw);
86 void		pvn_init(void);
87 
88 /*
89  * The value is put in p_hash to identify marker pages. It is safe to
90  * test p_hash ==(!=) PVN_VPLIST_HASH_TAG even without holding p_selock.
91  */
92 #define	PVN_VPLIST_HASH_TAG	((page_t *)-1)
93 
94 #endif	/* _KERNEL */
95 
96 #ifdef	__cplusplus
97 }
98 #endif
99 
100 #endif	/* _VM_PVN_H */
101