Print this page
const-ify make segment ops structures
There is no reason to keep the segment ops structures writable.
patch lower-case-segops
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/vm/seg_dev.h
+++ new/usr/src/uts/common/vm/seg_dev.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 27 /* All Rights Reserved */
28 28
29 29 /*
30 30 * University Copyright- Copyright (c) 1982, 1986, 1988
31 31 * The Regents of the University of California
32 32 * All Rights Reserved
33 33 *
34 34 * University Acknowledgment- Portions of this document are derived from
35 35 * software developed by the University of California, Berkeley, and its
36 36 * contributors.
37 37 */
38 38
39 39 #ifndef _VM_SEG_DEV_H
40 40 #define _VM_SEG_DEV_H
41 41
42 42 #ifdef __cplusplus
43 43 extern "C" {
44 44 #endif
45 45
46 46 struct proc;
47 47
48 48 /*
49 49 * Structure whose pointer is passed to the segdev_create routine
50 50 */
51 51 struct segdev_crargs {
52 52 offset_t offset; /* starting offset */
53 53 int (*mapfunc)(dev_t dev, off_t off, int prot); /* map function */
54 54 dev_t dev; /* device number */
55 55 uchar_t type; /* type of sharing done */
56 56 uchar_t prot; /* protection */
57 57 uchar_t maxprot; /* maximum protection */
58 58 uint_t hat_attr; /* hat attr */
59 59 uint_t hat_flags; /* currently, hat_flags is used ONLY for */
60 60 /* HAT_LOAD_NOCONSIST; in future, it can be */
61 61 /* expanded to include any flags that are */
62 62 /* not already part of hat_attr */
63 63 void *devmap_data; /* devmap_handle private data */
64 64 };
65 65
66 66 /*
67 67 * (Semi) private data maintained by the seg_dev driver per segment mapping
68 68 *
69 69 * The segment lock is necessary to protect fields that are modified
70 70 * when the "read" version of the address space lock is held. This lock
71 71 * is not needed when the segment operation has the "write" version of
72 72 * the address space lock (it would be redundant).
73 73 *
74 74 * The following fields in segdev_data are read-only when the address
75 75 * space is "read" locked, and don't require the segment lock:
76 76 *
77 77 * vp
78 78 * offset
79 79 * mapfunc
80 80 * maxprot
81 81 */
82 82 struct segdev_data {
83 83 offset_t offset; /* device offset for start of mapping */
84 84 krwlock_t lock; /* protects segdev_data */
85 85 int (*mapfunc)(dev_t dev, off_t off, int prot);
86 86 struct vnode *vp; /* vnode associated with device */
87 87 uchar_t pageprot; /* true if per page protections present */
88 88 uchar_t prot; /* current segment prot if pageprot == 0 */
89 89 uchar_t maxprot; /* maximum segment protections */
90 90 uchar_t type; /* type of sharing done */
91 91 struct vpage *vpage; /* per-page information, if needed */
92 92 uint_t hat_attr; /* hat attr - pass to attr in hat_devload */
93 93 uint_t hat_flags; /* set HAT_LOAD_NOCONSIST flag in hat_devload */
94 94 /* see comments above in segdev_crargs */
95 95 size_t softlockcnt; /* # of SOFTLOCKED in seg */
96 96 void *devmap_data; /* devmap_handle private data */
97 97 };
98 98
99 99 /* Direct physical-userland mapping, without occupying kernel address space */
100 100 #define DEVMAP_PMEM_COOKIE ((ddi_umem_cookie_t)0x2)
101 101
102 102 /*
103 103 * pmem_cookie:
104 104 * Records physical memory pages to be exported to userland.
105 105 */
106 106 struct devmap_pmem_cookie {
107 107 pgcnt_t dp_npages; /* number of allocated mem pages */
108 108 page_t **dp_pparray; /* pages allocated for this cookie */
109 109 vnode_t *dp_vnp; /* vnode associated with this cookie */
110 110 proc_t *dp_proc; /* proc ptr for resource control */
↓ open down ↓ |
110 lines elided |
↑ open up ↑ |
111 111 };
112 112
113 113 #ifdef _KERNEL
114 114
115 115 /*
116 116 * Mappings of /dev/null come from segdev and have no mapping type.
117 117 */
118 118
119 119 #define SEG_IS_DEVNULL_MAPPING(seg) \
120 120 ((seg)->s_ops == &segdev_ops && \
121 - ((SEGOP_GETTYPE(seg, (seg)->s_base) & (MAP_SHARED | MAP_PRIVATE)) == 0))
121 + ((segop_gettype((seg), (seg)->s_base) & (MAP_SHARED | MAP_PRIVATE)) == 0))
122 122
123 123 extern void segdev_init(void);
124 124
125 125 extern int segdev_create(struct seg *, void *);
126 126
127 127 extern int segdev_copyto(struct seg *, caddr_t, const void *, void *, size_t);
128 128 extern int segdev_copyfrom(struct seg *, caddr_t, const void *, void *, size_t);
129 -extern struct seg_ops segdev_ops;
129 +extern const struct seg_ops segdev_ops;
130 130
131 131 #endif /* _KERNEL */
132 132
133 133 #ifdef __cplusplus
134 134 }
135 135 #endif
136 136
137 137 #endif /* _VM_SEG_DEV_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX