xref: /titanic_51/usr/src/uts/common/vm/pvn.h (revision 6bbe05905a1c10a2703f95fb4912eb14b87f6670)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 /*
31  * University Copyright- Copyright (c) 1982, 1986, 1988
32  * The Regents of the University of California
33  * All Rights Reserved
34  *
35  * University Acknowledgment- Portions of this document are derived from
36  * software developed by the University of California, Berkeley, and its
37  * contributors.
38  */
39 
40 #ifndef	_VM_PVN_H
41 #define	_VM_PVN_H
42 
43 #pragma ident	"%Z%%M%	%I%	%E% SMI"
44 
45 #include <sys/buf.h>
46 #include <vm/seg.h>
47 
48 #ifdef	__cplusplus
49 extern "C" {
50 #endif
51 
52 #ifdef	_KERNEL
53 
54 /*
55  * VM - paged vnode.
56  *
57  * The VM system manages memory as a cache of paged vnodes.
58  * This file desribes the interfaces to common subroutines
59  * used to help implement the VM/file system routines.
60  */
61 
62 struct page	*pvn_read_kluster(struct vnode *vp, u_offset_t off,
63 			struct seg *seg, caddr_t addr, u_offset_t *offp,
64 			size_t *lenp, u_offset_t vp_off, size_t vp_len,
65 			int isra);
66 struct page	*pvn_write_kluster(struct vnode *vp, struct page *pp,
67 			u_offset_t *offp, size_t *lenp, u_offset_t vp_off,
68 			size_t vp_len, int flags);
69 void		pvn_read_done(struct page *plist, int flags);
70 void		pvn_write_done(struct page *plist, int flags);
71 void		pvn_io_done(struct page *plist);
72 int		pvn_vplist_dirty(struct vnode *vp, u_offset_t off,
73 			int (*putapage)(vnode_t *, struct page *, u_offset_t *,
74 				size_t *, int, cred_t *),
75 			int flags, struct cred *cred);
76 int		pvn_getdirty(struct page *pp, int flags);
77 void		pvn_vpzero(struct vnode *vp, u_offset_t vplen, size_t zbytes);
78 int		pvn_getpages(
79 			int (*getpage)(vnode_t *, u_offset_t, size_t, uint_t *,
80 				struct page *[], size_t, struct seg *,
81 				caddr_t, enum seg_rw, cred_t *),
82 			struct vnode *vp, u_offset_t off, size_t len,
83 			uint_t *protp, struct page **pl, size_t plsz,
84 			struct seg *seg, caddr_t addr, enum seg_rw rw,
85 			struct cred *cred);
86 void		pvn_plist_init(struct page *pp, struct page **pl, size_t plsz,
87 			u_offset_t off, size_t io_len, enum seg_rw rw);
88 void		pvn_init(void);
89 
90 /*
91  * When requesting pages from the getpage routines, pvn_getpages will
92  * allocate space to return PVN_GETPAGE_NUM pages which map PVN_GETPAGE_SZ
93  * worth of bytes.  These numbers are chosen to be the minimum of the max's
94  * given in terms of bytes and pages.
95  */
96 #define	PVN_MAX_GETPAGE_SZ	0x10000		/* getpage size limit */
97 #define	PVN_MAX_GETPAGE_NUM	0x8		/* getpage page limit */
98 
99 #if PVN_MAX_GETPAGE_SZ > PVN_MAX_GETPAGE_NUM * PAGESIZE
100 
101 #define	PVN_GETPAGE_SZ	ptob(PVN_MAX_GETPAGE_NUM)
102 #define	PVN_GETPAGE_NUM	PVN_MAX_GETPAGE_NUM
103 
104 #else
105 
106 #define	PVN_GETPAGE_SZ	PVN_MAX_GETPAGE_SZ
107 #define	PVN_GETPAGE_NUM	btop(PVN_MAX_GETPAGE_SZ)
108 
109 #endif
110 
111 #endif	/* _KERNEL */
112 
113 #ifdef	__cplusplus
114 }
115 #endif
116 
117 #endif	/* _VM_PVN_H */
118