| @@ -1,714 +1,714 @@ | | | @@ -1,714 +1,714 @@ |
1 | | | 1 | |
2 | /* $NetBSD: vnode.h,v 1.7 2010/12/14 01:21:02 haad Exp $ */ | | 2 | /* $NetBSD: vnode.h,v 1.8 2011/01/21 12:24:24 pooka Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * CDDL HEADER START | | 5 | * CDDL HEADER START |
6 | * | | 6 | * |
7 | * The contents of this file are subject to the terms of the | | 7 | * The contents of this file are subject to the terms of the |
8 | * Common Development and Distribution License (the "License"). | | 8 | * Common Development and Distribution License (the "License"). |
9 | * You may not use this file except in compliance with the License. | | 9 | * You may not use this file except in compliance with the License. |
10 | * | | 10 | * |
11 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | | 11 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
12 | * or http://www.opensolaris.org/os/licensing. | | 12 | * or http://www.opensolaris.org/os/licensing. |
13 | * See the License for the specific language governing permissions | | 13 | * See the License for the specific language governing permissions |
14 | * and limitations under the License. | | 14 | * and limitations under the License. |
15 | * | | 15 | * |
16 | * When distributing Covered Code, include this CDDL HEADER in each | | 16 | * When distributing Covered Code, include this CDDL HEADER in each |
17 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. | | 17 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
18 | * If applicable, add the following below this CDDL HEADER, with the | | 18 | * If applicable, add the following below this CDDL HEADER, with the |
19 | * fields enclosed by brackets "[]" replaced with your own identifying | | 19 | * fields enclosed by brackets "[]" replaced with your own identifying |
20 | * information: Portions Copyright [yyyy] [name of copyright owner] | | 20 | * information: Portions Copyright [yyyy] [name of copyright owner] |
21 | * | | 21 | * |
22 | * CDDL HEADER END | | 22 | * CDDL HEADER END |
23 | */ | | 23 | */ |
24 | /* | | 24 | /* |
25 | * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | | 25 | * Copyright 2008 Sun Microsystems, Inc. All rights reserved. |
26 | * Use is subject to license terms. | | 26 | * Use is subject to license terms. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ | | 29 | /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ |
30 | /* All Rights Reserved */ | | 30 | /* All Rights Reserved */ |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * University Copyright- Copyright (c) 1982, 1986, 1988 | | 33 | * University Copyright- Copyright (c) 1982, 1986, 1988 |
34 | * The Regents of the University of California | | 34 | * The Regents of the University of California |
35 | * All Rights Reserved | | 35 | * All Rights Reserved |
36 | * | | 36 | * |
37 | * University Acknowledgment- Portions of this document are derived from | | 37 | * University Acknowledgment- Portions of this document are derived from |
38 | * software developed by the University of California, Berkeley, and its | | 38 | * software developed by the University of California, Berkeley, and its |
39 | * contributors. | | 39 | * contributors. |
40 | */ | | 40 | */ |
41 | | | 41 | |
42 | /*- | | 42 | /*- |
43 | * Copyright (c) 2009 The NetBSD Foundation, Inc. | | 43 | * Copyright (c) 2009 The NetBSD Foundation, Inc. |
44 | * All rights reserved. | | 44 | * All rights reserved. |
45 | * | | 45 | * |
46 | * This code is derived from software contributed to The NetBSD Foundation | | 46 | * This code is derived from software contributed to The NetBSD Foundation |
47 | * by Andrew Doran. | | 47 | * by Andrew Doran. |
48 | * | | 48 | * |
49 | * Redistribution and use in source and binary forms, with or without | | 49 | * Redistribution and use in source and binary forms, with or without |
50 | * modification, are permitted provided that the following conditions | | 50 | * modification, are permitted provided that the following conditions |
51 | * are met: | | 51 | * are met: |
52 | * 1. Redistributions of source code must retain the above copyright | | 52 | * 1. Redistributions of source code must retain the above copyright |
53 | * notice, this list of conditions and the following disclaimer. | | 53 | * notice, this list of conditions and the following disclaimer. |
54 | * 2. Redistributions in binary form must reproduce the above copyright | | 54 | * 2. Redistributions in binary form must reproduce the above copyright |
55 | * notice, this list of conditions and the following disclaimer in the | | 55 | * notice, this list of conditions and the following disclaimer in the |
56 | * documentation and/or other materials provided with the distribution. | | 56 | * documentation and/or other materials provided with the distribution. |
57 | * | | 57 | * |
58 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 58 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
59 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 59 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
60 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 60 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
61 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 61 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
62 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 62 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
63 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 63 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
64 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 64 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
65 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 65 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
66 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 66 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
67 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 67 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
68 | * POSSIBILITY OF SUCH DAMAGE. | | 68 | * POSSIBILITY OF SUCH DAMAGE. |
69 | */ | | 69 | */ |
70 | | | 70 | |
71 | /*- | | 71 | /*- |
72 | * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> | | 72 | * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> |
73 | * All rights reserved. | | 73 | * All rights reserved. |
74 | * | | 74 | * |
75 | * Redistribution and use in source and binary forms, with or without | | 75 | * Redistribution and use in source and binary forms, with or without |
76 | * modification, are permitted provided that the following conditions | | 76 | * modification, are permitted provided that the following conditions |
77 | * are met: | | 77 | * are met: |
78 | * 1. Redistributions of source code must retain the above copyright | | 78 | * 1. Redistributions of source code must retain the above copyright |
79 | * notice, this list of conditions and the following disclaimer. | | 79 | * notice, this list of conditions and the following disclaimer. |
80 | * 2. Redistributions in binary form must reproduce the above copyright | | 80 | * 2. Redistributions in binary form must reproduce the above copyright |
81 | * notice, this list of conditions and the following disclaimer in the | | 81 | * notice, this list of conditions and the following disclaimer in the |
82 | * documentation and/or other materials provided with the distribution. | | 82 | * documentation and/or other materials provided with the distribution. |
83 | * | | 83 | * |
84 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND | | 84 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND |
85 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 85 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
86 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 86 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
87 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE | | 87 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE |
88 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 88 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
89 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 89 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
90 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 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 | | 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 | | 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 | | 93 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
94 | * SUCH DAMAGE. | | 94 | * SUCH DAMAGE. |
95 | * | | 95 | * |
96 | * $FreeBSD: src/sys/compat/opensolaris/sys/vnode.h,v 1.3 2007/05/31 11:51:49 kib Exp $ | | 96 | * $FreeBSD: src/sys/compat/opensolaris/sys/vnode.h,v 1.3 2007/05/31 11:51:49 kib Exp $ |
97 | */ | | 97 | */ |
98 | | | 98 | |
99 | #include <sys/mount.h> | | 99 | #include <sys/mount.h> |
100 | #include_next <sys/vnode.h> | | 100 | #include_next <sys/vnode.h> |
101 | | | 101 | |
102 | #ifndef _OPENSOLARIS_SYS_VNODE_H_ | | 102 | #ifndef _OPENSOLARIS_SYS_VNODE_H_ |
103 | #define _OPENSOLARIS_SYS_VNODE_H_ | | 103 | #define _OPENSOLARIS_SYS_VNODE_H_ |
104 | | | 104 | |
105 | #include <sys/cred.h> | | 105 | #include <sys/cred.h> |
106 | #include <sys/fcntl.h> | | 106 | #include <sys/fcntl.h> |
107 | #include <sys/namei.h> | | 107 | #include <sys/namei.h> |
108 | #include <sys/proc.h> | | 108 | #include <sys/proc.h> |
109 | #include <sys/filedesc.h> | | 109 | #include <sys/filedesc.h> |
110 | #include <sys/buf.h> | | 110 | #include <sys/buf.h> |
111 | #include <sys/debug.h> | | 111 | #include <sys/debug.h> |
112 | | | 112 | |
113 | | | 113 | |
114 | #ifdef _KERNEL | | 114 | #ifdef _KERNEL |
115 | #include <sys/vfs_syscalls.h> | | 115 | #include <sys/vfs_syscalls.h> |
116 | #endif | | 116 | #endif |
117 | | | 117 | |
118 | typedef struct vattr vattr_t; | | 118 | typedef struct vattr vattr_t; |
119 | typedef enum vtype vtype_t; | | 119 | typedef enum vtype vtype_t; |
120 | typedef void caller_context_t; | | 120 | typedef void caller_context_t; |
121 | | | 121 | |
122 | typedef int (**vnodeops_t)(void *); | | 122 | typedef int (**vnodeops_t)(void *); |
123 | | | 123 | |
124 | #define vop_fid vop_vptofh | | 124 | #define vop_fid vop_vptofh |
125 | #define vop_fid_args vop_vptofh_args | | 125 | #define vop_fid_args vop_vptofh_args |
126 | #define a_fid a_fhp | | 126 | #define a_fid a_fhp |
127 | | | 127 | |
128 | #define v_count v_usecount | | 128 | #define v_count v_usecount |
129 | #define v_object v_uobj | | 129 | #define v_object v_uobj |
130 | | | 130 | |
131 | struct vop_vptofh_args { | | 131 | struct vop_vptofh_args { |
132 | struct vnode *a_vp; | | 132 | struct vnode *a_vp; |
133 | struct fid *a_fid; | | 133 | struct fid *a_fid; |
134 | }; | | 134 | }; |
135 | | | 135 | |
136 | /* | | 136 | /* |
137 | * Structure used on VOP_GETSECATTR and VOP_SETSECATTR operations | | 137 | * Structure used on VOP_GETSECATTR and VOP_SETSECATTR operations |
138 | */ | | 138 | */ |
139 | | | 139 | |
140 | /* | | 140 | /* |
141 | * Flags to VOP_SETATTR/VOP_GETATTR. | | 141 | * Flags to VOP_SETATTR/VOP_GETATTR. |
142 | */ | | 142 | */ |
143 | #define ATTR_UTIME 0x01 /* non-default utime(2) request */ | | 143 | #define ATTR_UTIME 0x01 /* non-default utime(2) request */ |
144 | #define ATTR_EXEC 0x02 /* invocation from exec(2) */ | | 144 | #define ATTR_EXEC 0x02 /* invocation from exec(2) */ |
145 | #define ATTR_COMM 0x04 /* yield common vp attributes */ | | 145 | #define ATTR_COMM 0x04 /* yield common vp attributes */ |
146 | #define ATTR_HINT 0x08 /* information returned will be `hint' */ | | 146 | #define ATTR_HINT 0x08 /* information returned will be `hint' */ |
147 | #define ATTR_REAL 0x10 /* yield attributes of the real vp */ | | 147 | #define ATTR_REAL 0x10 /* yield attributes of the real vp */ |
148 | #define ATTR_NOACLCHECK 0x20 /* Don't check ACL when checking permissions */ | | 148 | #define ATTR_NOACLCHECK 0x20 /* Don't check ACL when checking permissions */ |
149 | #define ATTR_TRIGGER 0x40 /* Mount first if vnode is a trigger mount */ | | 149 | #define ATTR_TRIGGER 0x40 /* Mount first if vnode is a trigger mount */ |
150 | | | 150 | |
151 | typedef struct vsecattr { | | 151 | typedef struct vsecattr { |
152 | uint_t vsa_mask; /* See below */ | | 152 | uint_t vsa_mask; /* See below */ |
153 | int vsa_aclcnt; /* ACL entry count */ | | 153 | int vsa_aclcnt; /* ACL entry count */ |
154 | void *vsa_aclentp; /* pointer to ACL entries */ | | 154 | void *vsa_aclentp; /* pointer to ACL entries */ |
155 | int vsa_dfaclcnt; /* default ACL entry count */ | | 155 | int vsa_dfaclcnt; /* default ACL entry count */ |
156 | void *vsa_dfaclentp; /* pointer to default ACL entries */ | | 156 | void *vsa_dfaclentp; /* pointer to default ACL entries */ |
157 | size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */ | | 157 | size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */ |
158 | uint_t vsa_aclflags; /* ACE ACL flags */ | | 158 | uint_t vsa_aclflags; /* ACE ACL flags */ |
159 | } vsecattr_t; | | 159 | } vsecattr_t; |
160 | | | 160 | |
161 | #define V_XATTRDIR 0x0000 /* attribute unnamed directory */ | | 161 | #define V_XATTRDIR 0x0000 /* attribute unnamed directory */ |
162 | #define IS_XATTRDIR(vp) (0) | | 162 | #define IS_XATTRDIR(vp) (0) |
163 | | | 163 | |
164 | #define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */ | | 164 | #define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */ |
165 | | | 165 | |
166 | /* | | 166 | /* |
167 | * Structure of all optional attributes. | | 167 | * Structure of all optional attributes. |
168 | */ | | 168 | */ |
169 | typedef struct xoptattr { | | 169 | typedef struct xoptattr { |
170 | timestruc_t xoa_createtime; /* Create time of file */ | | 170 | timestruc_t xoa_createtime; /* Create time of file */ |
171 | uint8_t xoa_archive; | | 171 | uint8_t xoa_archive; |
172 | uint8_t xoa_system; | | 172 | uint8_t xoa_system; |
173 | uint8_t xoa_readonly; | | 173 | uint8_t xoa_readonly; |
174 | uint8_t xoa_hidden; | | 174 | uint8_t xoa_hidden; |
175 | uint8_t xoa_nounlink; | | 175 | uint8_t xoa_nounlink; |
176 | uint8_t xoa_immutable; | | 176 | uint8_t xoa_immutable; |
177 | uint8_t xoa_appendonly; | | 177 | uint8_t xoa_appendonly; |
178 | uint8_t xoa_nodump; | | 178 | uint8_t xoa_nodump; |
179 | uint8_t xoa_opaque; | | 179 | uint8_t xoa_opaque; |
180 | uint8_t xoa_av_quarantined; | | 180 | uint8_t xoa_av_quarantined; |
181 | uint8_t xoa_av_modified; | | 181 | uint8_t xoa_av_modified; |
182 | uint8_t xoa_av_scanstamp[AV_SCANSTAMP_SZ]; | | 182 | uint8_t xoa_av_scanstamp[AV_SCANSTAMP_SZ]; |
183 | uint8_t xoa_reparse; | | 183 | uint8_t xoa_reparse; |
184 | } xoptattr_t; | | 184 | } xoptattr_t; |
185 | | | 185 | |
186 | | | 186 | |
187 | /* | | 187 | /* |
188 | * The xvattr structure is really a variable length structure that | | 188 | * The xvattr structure is really a variable length structure that |
189 | * is made up of: | | 189 | * is made up of: |
190 | * - The classic vattr_t (xva_vattr) | | 190 | * - The classic vattr_t (xva_vattr) |
191 | * - a 32 bit quantity (xva_mapsize) that specifies the size of the | | 191 | * - a 32 bit quantity (xva_mapsize) that specifies the size of the |
192 | * attribute bitmaps in 32 bit words. | | 192 | * attribute bitmaps in 32 bit words. |
193 | * - A pointer to the returned attribute bitmap (needed because the | | 193 | * - A pointer to the returned attribute bitmap (needed because the |
194 | * previous element, the requested attribute bitmap) is variable lenth. | | 194 | * previous element, the requested attribute bitmap) is variable lenth. |
195 | * - The requested attribute bitmap, which is an array of 32 bit words. | | 195 | * - The requested attribute bitmap, which is an array of 32 bit words. |
196 | * Callers use the XVA_SET_REQ() macro to set the bits corresponding to | | 196 | * Callers use the XVA_SET_REQ() macro to set the bits corresponding to |
197 | * the attributes that are being requested. | | 197 | * the attributes that are being requested. |
198 | * - The returned attribute bitmap, which is an array of 32 bit words. | | 198 | * - The returned attribute bitmap, which is an array of 32 bit words. |
199 | * File systems that support optional attributes use the XVA_SET_RTN() | | 199 | * File systems that support optional attributes use the XVA_SET_RTN() |
200 | * macro to set the bits corresponding to the attributes that are being | | 200 | * macro to set the bits corresponding to the attributes that are being |
201 | * returned. | | 201 | * returned. |
202 | * - The xoptattr_t structure which contains the attribute values | | 202 | * - The xoptattr_t structure which contains the attribute values |
203 | * | | 203 | * |
204 | * xva_mapsize determines how many words in the attribute bitmaps. | | 204 | * xva_mapsize determines how many words in the attribute bitmaps. |
205 | * Immediately following the attribute bitmaps is the xoptattr_t. | | 205 | * Immediately following the attribute bitmaps is the xoptattr_t. |
206 | * xva_getxoptattr() is used to get the pointer to the xoptattr_t | | 206 | * xva_getxoptattr() is used to get the pointer to the xoptattr_t |
207 | * section. | | 207 | * section. |
208 | */ | | 208 | */ |
209 | | | 209 | |
210 | #define XVA_MAPSIZE 3 /* Size of attr bitmaps */ | | 210 | #define XVA_MAPSIZE 3 /* Size of attr bitmaps */ |
211 | #define XVA_MAGIC 0x78766174 /* Magic # for verification */ | | 211 | #define XVA_MAGIC 0x78766174 /* Magic # for verification */ |
212 | | | 212 | |
213 | /* | | 213 | /* |
214 | * The xvattr structure is an extensible structure which permits optional | | 214 | * The xvattr structure is an extensible structure which permits optional |
215 | * attributes to be requested/returned. File systems may or may not support | | 215 | * attributes to be requested/returned. File systems may or may not support |
216 | * optional attributes. They do so at their own discretion but if they do | | 216 | * optional attributes. They do so at their own discretion but if they do |
217 | * support optional attributes, they must register the VFSFT_XVATTR feature | | 217 | * support optional attributes, they must register the VFSFT_XVATTR feature |
218 | * so that the optional attributes can be set/retrived. | | 218 | * so that the optional attributes can be set/retrived. |
219 | * | | 219 | * |
220 | * The fields of the xvattr structure are: | | 220 | * The fields of the xvattr structure are: |
221 | * | | 221 | * |
222 | * xva_vattr - The first element of an xvattr is a legacy vattr structure | | 222 | * xva_vattr - The first element of an xvattr is a legacy vattr structure |
223 | * which includes the common attributes. If AT_XVATTR is set in the va_mask | | 223 | * which includes the common attributes. If AT_XVATTR is set in the va_mask |
224 | * then the entire structure is treated as an xvattr. If AT_XVATTR is not | | 224 | * then the entire structure is treated as an xvattr. If AT_XVATTR is not |
225 | * set, then only the xva_vattr structure can be used. | | 225 | * set, then only the xva_vattr structure can be used. |
226 | * | | 226 | * |
227 | * xva_magic - 0x78766174 (hex for "xvat"). Magic number for verification. | | 227 | * xva_magic - 0x78766174 (hex for "xvat"). Magic number for verification. |
228 | * | | 228 | * |
229 | * xva_mapsize - Size of requested and returned attribute bitmaps. | | 229 | * xva_mapsize - Size of requested and returned attribute bitmaps. |
230 | * | | 230 | * |
231 | * xva_rtnattrmapp - Pointer to xva_rtnattrmap[]. We need this since the | | 231 | * xva_rtnattrmapp - Pointer to xva_rtnattrmap[]. We need this since the |
232 | * size of the array before it, xva_reqattrmap[], could change which means | | 232 | * size of the array before it, xva_reqattrmap[], could change which means |
233 | * the location of xva_rtnattrmap[] could change. This will allow unbundled | | 233 | * the location of xva_rtnattrmap[] could change. This will allow unbundled |
234 | * file systems to find the location of xva_rtnattrmap[] when the sizes change. | | 234 | * file systems to find the location of xva_rtnattrmap[] when the sizes change. |
235 | * | | 235 | * |
236 | * xva_reqattrmap[] - Array of requested attributes. Attributes are | | 236 | * xva_reqattrmap[] - Array of requested attributes. Attributes are |
237 | * represented by a specific bit in a specific element of the attribute | | 237 | * represented by a specific bit in a specific element of the attribute |
238 | * map array. Callers set the bits corresponding to the attributes | | 238 | * map array. Callers set the bits corresponding to the attributes |
239 | * that the caller wants to get/set. | | 239 | * that the caller wants to get/set. |
240 | * | | 240 | * |
241 | * xva_rtnattrmap[] - Array of attributes that the file system was able to | | 241 | * xva_rtnattrmap[] - Array of attributes that the file system was able to |
242 | * process. Not all file systems support all optional attributes. This map | | 242 | * process. Not all file systems support all optional attributes. This map |
243 | * informs the caller which attributes the underlying file system was able | | 243 | * informs the caller which attributes the underlying file system was able |
244 | * to set/get. (Same structure as the requested attributes array in terms | | 244 | * to set/get. (Same structure as the requested attributes array in terms |
245 | * of each attribute corresponding to specific bits and array elements.) | | 245 | * of each attribute corresponding to specific bits and array elements.) |
246 | * | | 246 | * |
247 | * xva_xoptattrs - Structure containing values of optional attributes. | | 247 | * xva_xoptattrs - Structure containing values of optional attributes. |
248 | * These values are only valid if the corresponding bits in xva_reqattrmap | | 248 | * These values are only valid if the corresponding bits in xva_reqattrmap |
249 | * are set and the underlying file system supports those attributes. | | 249 | * are set and the underlying file system supports those attributes. |
250 | */ | | 250 | */ |
251 | typedef struct xvattr { | | 251 | typedef struct xvattr { |
252 | vattr_t xva_vattr; /* Embedded vattr structure */ | | 252 | vattr_t xva_vattr; /* Embedded vattr structure */ |
253 | uint32_t xva_magic; /* Magic Number */ | | 253 | uint32_t xva_magic; /* Magic Number */ |
254 | uint32_t xva_mapsize; /* Size of attr bitmap (32-bit words) */ | | 254 | uint32_t xva_mapsize; /* Size of attr bitmap (32-bit words) */ |
255 | uint32_t *xva_rtnattrmapp; /* Ptr to xva_rtnattrmap[] */ | | 255 | uint32_t *xva_rtnattrmapp; /* Ptr to xva_rtnattrmap[] */ |
256 | uint32_t xva_reqattrmap[XVA_MAPSIZE]; /* Requested attrs */ | | 256 | uint32_t xva_reqattrmap[XVA_MAPSIZE]; /* Requested attrs */ |
257 | uint32_t xva_rtnattrmap[XVA_MAPSIZE]; /* Returned attrs */ | | 257 | uint32_t xva_rtnattrmap[XVA_MAPSIZE]; /* Returned attrs */ |
258 | xoptattr_t xva_xoptattrs; /* Optional attributes */ | | 258 | xoptattr_t xva_xoptattrs; /* Optional attributes */ |
259 | } xvattr_t; | | 259 | } xvattr_t; |
260 | | | 260 | |
261 | /* vsa_mask values */ | | 261 | /* vsa_mask values */ |
262 | #define VSA_ACL 0x0001 | | 262 | #define VSA_ACL 0x0001 |
263 | #define VSA_ACLCNT 0x0002 | | 263 | #define VSA_ACLCNT 0x0002 |
264 | #define VSA_DFACL 0x0004 | | 264 | #define VSA_DFACL 0x0004 |
265 | #define VSA_DFACLCNT 0x0008 | | 265 | #define VSA_DFACLCNT 0x0008 |
266 | #define VSA_ACE 0x0010 | | 266 | #define VSA_ACE 0x0010 |
267 | #define VSA_ACECNT 0x0020 | | 267 | #define VSA_ACECNT 0x0020 |
268 | #define VSA_ACE_ALLTYPES 0x0040 | | 268 | #define VSA_ACE_ALLTYPES 0x0040 |
269 | #define VSA_ACE_ACLFLAGS 0x0080 /* get/set ACE ACL flags */ | | 269 | #define VSA_ACE_ACLFLAGS 0x0080 /* get/set ACE ACL flags */ |
270 | | | 270 | |
271 | #define v_lock v_interlock | | 271 | #define v_lock v_interlock |
272 | | | 272 | |
273 | /* | | 273 | /* |
274 | * vnode flags. | | 274 | * vnode flags. |
275 | */ | | 275 | */ |
276 | #define VROOT VV_ROOT/* root of its file system */ | | 276 | #define VROOT VV_ROOT/* root of its file system */ |
277 | #define VNOCACHE 0x00/* don't keep cache pages on vnode */ | | 277 | #define VNOCACHE 0x00/* don't keep cache pages on vnode */ |
278 | #define VNOMAP VV_MAPPED/* file cannot be mapped/faulted */ | | 278 | #define VNOMAP VV_MAPPED/* file cannot be mapped/faulted */ |
279 | #define VDUP 0x00/* file should be dup'ed rather then opened */ | | 279 | #define VDUP 0x00/* file should be dup'ed rather then opened */ |
280 | #define VNOSWAP 0x00/* file cannot be used as virtual swap device */ | | 280 | #define VNOSWAP 0x00/* file cannot be used as virtual swap device */ |
281 | #define VNOMOUNT 0x00/* file cannot be covered by mount */ | | 281 | #define VNOMOUNT 0x00/* file cannot be covered by mount */ |
282 | #define VISSWAP 0x00/* vnode is being used for swap */ | | 282 | #define VISSWAP 0x00/* vnode is being used for swap */ |
283 | #define VSWAPLIKE 0x00/* vnode acts like swap (but may not be) */ | | 283 | #define VSWAPLIKE 0x00/* vnode acts like swap (but may not be) */ |
284 | | | 284 | |
285 | int vn_is_readonly(vnode_t *); | | 285 | int vn_is_readonly(vnode_t *); |
286 | | | 286 | |
287 | #define vn_free(vp) vrele((vp)) | | 287 | #define vn_free(vp) vrele((vp)) |
288 | #define vn_setops(vp, ops) (0) | | 288 | #define vn_setops(vp, ops) (0) |
289 | #define vn_vfswlock(vp) (0) | | 289 | #define vn_vfswlock(vp) (0) |
290 | #define vn_vfsunlock(vp) do { } while (0) | | 290 | #define vn_vfsunlock(vp) do { } while (0) |
291 | #define vn_ismntpt(vp) ((vp)->v_type == VDIR && (vp)->v_mountedhere != NULL) | | 291 | #define vn_ismntpt(vp) ((vp)->v_type == VDIR && (vp)->v_mountedhere != NULL) |
292 | #define vn_mountedvfs(vp) ((vp)->v_mountedhere) | | 292 | #define vn_mountedvfs(vp) ((vp)->v_mountedhere) |
293 | #define vn_has_cached_data(vp) ((vp)->v_uobj.uo_npages > 0) | | 293 | #define vn_has_cached_data(vp) ((vp)->v_uobj.uo_npages > 0) |
294 | #define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0) | | 294 | #define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0) |
295 | | | 295 | |
296 | #define VN_HOLD(v) vref(v) | | 296 | #define VN_HOLD(v) vref(v) |
297 | #define VN_RELE(v) vrele(v) | | 297 | #define VN_RELE(v) vrele(v) |
298 | #define VN_URELE(v) vput(v) | | 298 | #define VN_URELE(v) vput(v) |
299 | #define VN_SET_VFS_TYPE_DEV(vp, vfs, type, flag) (0) | | 299 | #define VN_SET_VFS_TYPE_DEV(vp, vfs, type, flag) (0) |
300 | | | 300 | |
301 | #define VI_LOCK(vp) mutex_enter(&(vp)->v_interlock) | | 301 | #define VI_LOCK(vp) mutex_enter(&(vp)->v_interlock) |
302 | #define VI_UNLOCK(vp) mutex_exit(&(vp)->v_interlock) | | 302 | #define VI_UNLOCK(vp) mutex_exit(&(vp)->v_interlock) |
303 | | | 303 | |
304 | #define VOP_REALVP(vp, vpp, ct) (*(vpp) = (vp), 0) | | 304 | #define VOP_REALVP(vp, vpp, ct) (*(vpp) = (vp), 0) |
305 | | | 305 | |
306 | #define vnevent_remove(vp, dvp, name, ct) do { } while (0) | | 306 | #define vnevent_remove(vp, dvp, name, ct) do { } while (0) |
307 | #define vnevent_rmdir(vp, dvp, name, ct) do { } while (0) | | 307 | #define vnevent_rmdir(vp, dvp, name, ct) do { } while (0) |
308 | #define vnevent_rename_src(vp, dvp, name, ct) do { } while (0) | | 308 | #define vnevent_rename_src(vp, dvp, name, ct) do { } while (0) |
309 | #define vnevent_rename_dest(vp, dvp, name, ct) do { } while (0) | | 309 | #define vnevent_rename_dest(vp, dvp, name, ct) do { } while (0) |
310 | #define vnevent_rename_dest_dir(vp, ct) do { } while (0) | | 310 | #define vnevent_rename_dest_dir(vp, ct) do { } while (0) |
311 | #define vnevent_create(vp, ct) do { } while (0) | | 311 | #define vnevent_create(vp, ct) do { } while (0) |
312 | #define vnevent_link(vp, ct) do { } while (0) | | 312 | #define vnevent_link(vp, ct) do { } while (0) |
313 | | | 313 | |
314 | #define IS_DEVVP(vp) \ | | 314 | #define IS_DEVVP(vp) \ |
315 | ((vp)->v_type == VCHR || (vp)->v_type == VBLK || (vp)->v_type == VFIFO) | | 315 | ((vp)->v_type == VCHR || (vp)->v_type == VBLK || (vp)->v_type == VFIFO) |
316 | | | 316 | |
317 | #define MODEMASK ALLPERMS | | 317 | #define MODEMASK ALLPERMS |
318 | | | 318 | |
319 | #define specvp(vp, rdev, type, cr) (VN_HOLD(vp), (vp)) | | 319 | #define specvp(vp, rdev, type, cr) (VN_HOLD(vp), (vp)) |
320 | #define MANDMODE(mode) (0) | | 320 | #define MANDMODE(mode) (0) |
321 | #define chklock(vp, op, offset, size, mode, ct) (0) | | 321 | #define chklock(vp, op, offset, size, mode, ct) (0) |
322 | #define cleanlocks(vp, pid, foo) do { } while (0) | | 322 | #define cleanlocks(vp, pid, foo) do { } while (0) |
323 | #define cleanshares(vp, pid) do { } while (0) | | 323 | #define cleanshares(vp, pid) do { } while (0) |
324 | | | 324 | |
325 | /* | | 325 | /* |
326 | * We will use va_spare is place of Solaris' va_mask. | | 326 | * We will use va_spare is place of Solaris' va_mask. |
327 | * This field is initialized in zfs_setattr(). | | 327 | * This field is initialized in zfs_setattr(). |
328 | */ | | 328 | */ |
329 | #define va_mask va_spare | | 329 | #define va_mask va_spare |
330 | /* TODO: va_fileid is shorter than va_nodeid !!! */ | | 330 | /* TODO: va_fileid is shorter than va_nodeid !!! */ |
331 | #define va_nodeid va_fileid | | 331 | #define va_nodeid va_fileid |
332 | /* TODO: This field needs conversion! */ | | 332 | /* TODO: This field needs conversion! */ |
333 | #define va_nblocks va_bytes | | 333 | #define va_nblocks va_bytes |
334 | #define va_blksize va_blocksize | | 334 | #define va_blksize va_blocksize |
335 | #define va_seq va_gen | | 335 | #define va_seq va_gen |
336 | | | 336 | |
337 | #define EXCL 0 | | 337 | #define EXCL 0 |
338 | | | 338 | |
339 | #define AT_TYPE 0x0001 | | 339 | #define AT_TYPE 0x0001 |
340 | #define AT_MODE 0x0002 | | 340 | #define AT_MODE 0x0002 |
341 | #define AT_UID 0x0004 | | 341 | #define AT_UID 0x0004 |
342 | #define AT_GID 0x0008 | | 342 | #define AT_GID 0x0008 |
343 | #define AT_FSID 0x0010 | | 343 | #define AT_FSID 0x0010 |
344 | #define AT_NODEID 0x0020 | | 344 | #define AT_NODEID 0x0020 |
345 | #define AT_NLINK 0x0040 | | 345 | #define AT_NLINK 0x0040 |
346 | #define AT_SIZE 0x0080 | | 346 | #define AT_SIZE 0x0080 |
347 | #define AT_ATIME 0x0100 | | 347 | #define AT_ATIME 0x0100 |
348 | #define AT_MTIME 0x0200 | | 348 | #define AT_MTIME 0x0200 |
349 | #define AT_CTIME 0x0400 | | 349 | #define AT_CTIME 0x0400 |
350 | #define AT_RDEV 0x0800 | | 350 | #define AT_RDEV 0x0800 |
351 | #define AT_BLKSIZE 0x1000 | | 351 | #define AT_BLKSIZE 0x1000 |
352 | #define AT_NBLOCKS 0x2000 | | 352 | #define AT_NBLOCKS 0x2000 |
353 | #define AT_SEQ 0x4000 | | 353 | #define AT_SEQ 0x4000 |
354 | #define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\ | | 354 | #define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\ |
355 | AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) | | 355 | AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) |
356 | | | 356 | |
357 | #define ACCESSED (AT_ATIME) | | 357 | #define ACCESSED (AT_ATIME) |
358 | #define STATE_CHANGED (AT_CTIME) | | 358 | #define STATE_CHANGED (AT_CTIME) |
359 | #define CONTENT_MODIFIED (AT_MTIME | AT_CTIME) | | 359 | #define CONTENT_MODIFIED (AT_MTIME | AT_CTIME) |
360 | | | 360 | |
361 | /* | | 361 | /* |
362 | * If AT_XVATTR is set then there are additional bits to process in | | 362 | * If AT_XVATTR is set then there are additional bits to process in |
363 | * the xvattr_t's attribute bitmap. If this is not set then the bitmap | | 363 | * the xvattr_t's attribute bitmap. If this is not set then the bitmap |
364 | * MUST be ignored. Note that this bit must be set/cleared explicitly. | | 364 | * MUST be ignored. Note that this bit must be set/cleared explicitly. |
365 | * That is, setting AT_ALL will NOT set AT_XVATTR. | | 365 | * That is, setting AT_ALL will NOT set AT_XVATTR. |
366 | */ | | 366 | */ |
367 | #define AT_XVATTR 0x10000 | | 367 | #define AT_XVATTR 0x10000 |
368 | | | 368 | |
369 | #define AT_ALL (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\ | | 369 | #define AT_ALL (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\ |
370 | AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\ | | 370 | AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\ |
371 | AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) | | 371 | AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) |
372 | | | 372 | |
373 | #define AT_STAT (AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\ | | 373 | #define AT_STAT (AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\ |
374 | AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV|AT_TYPE) | | 374 | AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV|AT_TYPE) |
375 | | | 375 | |
376 | #define AT_TIMES (AT_ATIME|AT_MTIME|AT_CTIME) | | 376 | #define AT_TIMES (AT_ATIME|AT_MTIME|AT_CTIME) |
377 | | | 377 | |
378 | #define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\ | | 378 | #define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\ |
379 | AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) | | 379 | AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) |
380 | | | 380 | |
381 | /* | | 381 | /* |
382 | * Attribute bits used in the extensible attribute's (xva's) attribute | | 382 | * Attribute bits used in the extensible attribute's (xva's) attribute |
383 | * bitmaps. Note that the bitmaps are made up of a variable length number | | 383 | * bitmaps. Note that the bitmaps are made up of a variable length number |
384 | * of 32-bit words. The convention is to use XAT{n}_{attrname} where "n" | | 384 | * of 32-bit words. The convention is to use XAT{n}_{attrname} where "n" |
385 | * is the element in the bitmap (starting at 1). This convention is for | | 385 | * is the element in the bitmap (starting at 1). This convention is for |
386 | * the convenience of the maintainer to keep track of which element each | | 386 | * the convenience of the maintainer to keep track of which element each |
387 | * attribute belongs to. | | 387 | * attribute belongs to. |
388 | * | | 388 | * |
389 | * NOTE THAT CONSUMERS MUST *NOT* USE THE XATn_* DEFINES DIRECTLY. CONSUMERS | | 389 | * NOTE THAT CONSUMERS MUST *NOT* USE THE XATn_* DEFINES DIRECTLY. CONSUMERS |
390 | * MUST USE THE XAT_* DEFINES. | | 390 | * MUST USE THE XAT_* DEFINES. |
391 | */ | | 391 | */ |
392 | #define XAT0_INDEX 0LL /* Index into bitmap for XAT0 attrs */ | | 392 | #define XAT0_INDEX 0LL /* Index into bitmap for XAT0 attrs */ |
393 | #define XAT0_CREATETIME 0x00000001 /* Create time of file */ | | 393 | #define XAT0_CREATETIME 0x00000001 /* Create time of file */ |
394 | #define XAT0_ARCHIVE 0x00000002 /* Archive */ | | 394 | #define XAT0_ARCHIVE 0x00000002 /* Archive */ |
395 | #define XAT0_SYSTEM 0x00000004 /* System */ | | 395 | #define XAT0_SYSTEM 0x00000004 /* System */ |
396 | #define XAT0_READONLY 0x00000008 /* Readonly */ | | 396 | #define XAT0_READONLY 0x00000008 /* Readonly */ |
397 | #define XAT0_HIDDEN 0x00000010 /* Hidden */ | | 397 | #define XAT0_HIDDEN 0x00000010 /* Hidden */ |
398 | #define XAT0_NOUNLINK 0x00000020 /* Nounlink */ | | 398 | #define XAT0_NOUNLINK 0x00000020 /* Nounlink */ |
399 | #define XAT0_IMMUTABLE 0x00000040 /* immutable */ | | 399 | #define XAT0_IMMUTABLE 0x00000040 /* immutable */ |
400 | #define XAT0_APPENDONLY 0x00000080 /* appendonly */ | | 400 | #define XAT0_APPENDONLY 0x00000080 /* appendonly */ |
401 | #define XAT0_NODUMP 0x00000100 /* nodump */ | | 401 | #define XAT0_NODUMP 0x00000100 /* nodump */ |
402 | #define XAT0_OPAQUE 0x00000200 /* opaque */ | | 402 | #define XAT0_OPAQUE 0x00000200 /* opaque */ |
403 | #define XAT0_AV_QUARANTINED 0x00000400 /* anti-virus quarantine */ | | 403 | #define XAT0_AV_QUARANTINED 0x00000400 /* anti-virus quarantine */ |
404 | #define XAT0_AV_MODIFIED 0x00000800 /* anti-virus modified */ | | 404 | #define XAT0_AV_MODIFIED 0x00000800 /* anti-virus modified */ |
405 | #define XAT0_AV_SCANSTAMP 0x00001000 /* anti-virus scanstamp */ | | 405 | #define XAT0_AV_SCANSTAMP 0x00001000 /* anti-virus scanstamp */ |
406 | #define XAT0_REPARSE 0x00002000 /* FS reparse point */ | | 406 | #define XAT0_REPARSE 0x00002000 /* FS reparse point */ |
407 | | | 407 | |
408 | #define XAT0_ALL_ATTRS (XAT0_CREATETIME|XAT0_ARCHIVE|XAT0_SYSTEM| \ | | 408 | #define XAT0_ALL_ATTRS (XAT0_CREATETIME|XAT0_ARCHIVE|XAT0_SYSTEM| \ |
409 | XAT0_READONLY|XAT0_HIDDEN|XAT0_NOUNLINK|XAT0_IMMUTABLE|XAT0_APPENDONLY| \ | | 409 | XAT0_READONLY|XAT0_HIDDEN|XAT0_NOUNLINK|XAT0_IMMUTABLE|XAT0_APPENDONLY| \ |
410 | XAT0_NODUMP|XAT0_OPAQUE|XAT0_AV_QUARANTINED| \ | | 410 | XAT0_NODUMP|XAT0_OPAQUE|XAT0_AV_QUARANTINED| \ |
411 | XAT0_AV_MODIFIED|XAT0_AV_SCANSTAMP) | | 411 | XAT0_AV_MODIFIED|XAT0_AV_SCANSTAMP) |
412 | | | 412 | |
413 | /* Support for XAT_* optional attributes */ | | 413 | /* Support for XAT_* optional attributes */ |
414 | #define XVA_MASK 0xffffffff /* Used to mask off 32 bits */ | | 414 | #define XVA_MASK 0xffffffff /* Used to mask off 32 bits */ |
415 | #define XVA_SHFT 32 /* Used to shift index */ | | 415 | #define XVA_SHFT 32 /* Used to shift index */ |
416 | | | 416 | |
417 | /* | | 417 | /* |
418 | * Used to pry out the index and attribute bits from the XAT_* attributes | | 418 | * Used to pry out the index and attribute bits from the XAT_* attributes |
419 | * defined below. Note that we're masking things down to 32 bits then | | 419 | * defined below. Note that we're masking things down to 32 bits then |
420 | * casting to uint32_t. | | 420 | * casting to uint32_t. |
421 | */ | | 421 | */ |
422 | #define XVA_INDEX(attr) ((uint32_t)(((attr) >> XVA_SHFT) & XVA_MASK)) | | 422 | #define XVA_INDEX(attr) ((uint32_t)(((attr) >> XVA_SHFT) & XVA_MASK)) |
423 | #define XVA_ATTRBIT(attr) ((uint32_t)((attr) & XVA_MASK)) | | 423 | #define XVA_ATTRBIT(attr) ((uint32_t)((attr) & XVA_MASK)) |
424 | | | 424 | |
425 | /* | | 425 | /* |
426 | * The following defines present a "flat namespace" so that consumers don't | | 426 | * The following defines present a "flat namespace" so that consumers don't |
427 | * need to keep track of which element belongs to which bitmap entry. | | 427 | * need to keep track of which element belongs to which bitmap entry. |
428 | * | | 428 | * |
429 | * NOTE THAT THESE MUST NEVER BE OR-ed TOGETHER | | 429 | * NOTE THAT THESE MUST NEVER BE OR-ed TOGETHER |
430 | */ | | 430 | */ |
431 | #define XAT_CREATETIME ((XAT0_INDEX << XVA_SHFT) | XAT0_CREATETIME) | | 431 | #define XAT_CREATETIME ((XAT0_INDEX << XVA_SHFT) | XAT0_CREATETIME) |
432 | #define XAT_ARCHIVE ((XAT0_INDEX << XVA_SHFT) | XAT0_ARCHIVE) | | 432 | #define XAT_ARCHIVE ((XAT0_INDEX << XVA_SHFT) | XAT0_ARCHIVE) |
433 | #define XAT_SYSTEM ((XAT0_INDEX << XVA_SHFT) | XAT0_SYSTEM) | | 433 | #define XAT_SYSTEM ((XAT0_INDEX << XVA_SHFT) | XAT0_SYSTEM) |
434 | #define XAT_READONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_READONLY) | | 434 | #define XAT_READONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_READONLY) |
435 | #define XAT_HIDDEN ((XAT0_INDEX << XVA_SHFT) | XAT0_HIDDEN) | | 435 | #define XAT_HIDDEN ((XAT0_INDEX << XVA_SHFT) | XAT0_HIDDEN) |
436 | #define XAT_NOUNLINK ((XAT0_INDEX << XVA_SHFT) | XAT0_NOUNLINK) | | 436 | #define XAT_NOUNLINK ((XAT0_INDEX << XVA_SHFT) | XAT0_NOUNLINK) |
437 | #define XAT_IMMUTABLE ((XAT0_INDEX << XVA_SHFT) | XAT0_IMMUTABLE) | | 437 | #define XAT_IMMUTABLE ((XAT0_INDEX << XVA_SHFT) | XAT0_IMMUTABLE) |
438 | #define XAT_APPENDONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_APPENDONLY) | | 438 | #define XAT_APPENDONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_APPENDONLY) |
439 | #define XAT_NODUMP ((XAT0_INDEX << XVA_SHFT) | XAT0_NODUMP) | | 439 | #define XAT_NODUMP ((XAT0_INDEX << XVA_SHFT) | XAT0_NODUMP) |
440 | #define XAT_OPAQUE ((XAT0_INDEX << XVA_SHFT) | XAT0_OPAQUE) | | 440 | #define XAT_OPAQUE ((XAT0_INDEX << XVA_SHFT) | XAT0_OPAQUE) |
441 | #define XAT_AV_QUARANTINED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_QUARANTINED) | | 441 | #define XAT_AV_QUARANTINED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_QUARANTINED) |
442 | #define XAT_AV_MODIFIED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_MODIFIED) | | 442 | #define XAT_AV_MODIFIED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_MODIFIED) |
443 | #define XAT_AV_SCANSTAMP ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_SCANSTAMP) | | 443 | #define XAT_AV_SCANSTAMP ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_SCANSTAMP) |
444 | #define XAT_REPARSE ((XAT0_INDEX << XVA_SHFT) | XAT0_REPARSE) | | 444 | #define XAT_REPARSE ((XAT0_INDEX << XVA_SHFT) | XAT0_REPARSE) |
445 | | | 445 | |
446 | /* | | 446 | /* |
447 | * The returned attribute map array (xva_rtnattrmap[]) is located past the | | 447 | * The returned attribute map array (xva_rtnattrmap[]) is located past the |
448 | * requested attribute map array (xva_reqattrmap[]). Its location changes | | 448 | * requested attribute map array (xva_reqattrmap[]). Its location changes |
449 | * when the array sizes change. We use a separate pointer in a known location | | 449 | * when the array sizes change. We use a separate pointer in a known location |
450 | * (xva_rtnattrmapp) to hold the location of xva_rtnattrmap[]. This is | | 450 | * (xva_rtnattrmapp) to hold the location of xva_rtnattrmap[]. This is |
451 | * set in xva_init() | | 451 | * set in xva_init() |
452 | */ | | 452 | */ |
453 | #define XVA_RTNATTRMAP(xvap) ((xvap)->xva_rtnattrmapp) | | 453 | #define XVA_RTNATTRMAP(xvap) ((xvap)->xva_rtnattrmapp) |
454 | | | 454 | |
455 | /* | | 455 | /* |
456 | * XVA_SET_REQ() sets an attribute bit in the proper element in the bitmap | | 456 | * XVA_SET_REQ() sets an attribute bit in the proper element in the bitmap |
457 | * of requested attributes (xva_reqattrmap[]). | | 457 | * of requested attributes (xva_reqattrmap[]). |
458 | */ | | 458 | */ |
459 | #define XVA_SET_REQ(xvap, attr) \ | | 459 | #define XVA_SET_REQ(xvap, attr) \ |
460 | ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ | | 460 | ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ |
461 | ASSERT((xvap)->xva_magic == XVA_MAGIC); \ | | 461 | ASSERT((xvap)->xva_magic == XVA_MAGIC); \ |
462 | (xvap)->xva_reqattrmap[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr) | | 462 | (xvap)->xva_reqattrmap[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr) |
463 | | | 463 | |
464 | /* | | 464 | /* |
465 | * XVA_CLR_REQ() clears an attribute bit in the proper element in the bitmap | | 465 | * XVA_CLR_REQ() clears an attribute bit in the proper element in the bitmap |
466 | * of requested attributes (xva_reqattrmap[]). | | 466 | * of requested attributes (xva_reqattrmap[]). |
467 | */ | | 467 | */ |
468 | #define XVA_CLR_REQ(xvap, attr) \ | | 468 | #define XVA_CLR_REQ(xvap, attr) \ |
469 | ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ | | 469 | ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ |
470 | ASSERT((xvap)->xva_magic == XVA_MAGIC); \ | | 470 | ASSERT((xvap)->xva_magic == XVA_MAGIC); \ |
471 | (xvap)->xva_reqattrmap[XVA_INDEX(attr)] &= ~XVA_ATTRBIT(attr) | | 471 | (xvap)->xva_reqattrmap[XVA_INDEX(attr)] &= ~XVA_ATTRBIT(attr) |
472 | /* | | 472 | /* |
473 | * XVA_SET_RTN() sets an attribute bit in the proper element in the bitmap | | 473 | * XVA_SET_RTN() sets an attribute bit in the proper element in the bitmap |
474 | * of returned attributes (xva_rtnattrmap[]). | | 474 | * of returned attributes (xva_rtnattrmap[]). |
475 | */ | | 475 | */ |
476 | #define XVA_SET_RTN(xvap, attr) \ | | 476 | #define XVA_SET_RTN(xvap, attr) \ |
477 | ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ | | 477 | ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ |
478 | ASSERT((xvap)->xva_magic == XVA_MAGIC); \ | | 478 | ASSERT((xvap)->xva_magic == XVA_MAGIC); \ |
479 | (XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr) | | 479 | (XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr) |
480 | | | 480 | |
481 | /* | | 481 | /* |
482 | * XVA_ISSET_REQ() checks the requested attribute bitmap (xva_reqattrmap[]) | | 482 | * XVA_ISSET_REQ() checks the requested attribute bitmap (xva_reqattrmap[]) |
483 | * to see of the corresponding attribute bit is set. If so, returns non-zero. | | 483 | * to see of the corresponding attribute bit is set. If so, returns non-zero. |
484 | */ | | 484 | */ |
485 | #define XVA_ISSET_REQ(xvap, attr) \ | | 485 | #define XVA_ISSET_REQ(xvap, attr) \ |
486 | ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \ | | 486 | ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \ |
487 | ((xvap)->xva_magic == XVA_MAGIC) && \ | | 487 | ((xvap)->xva_magic == XVA_MAGIC) && \ |
488 | ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \ | | 488 | ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \ |
489 | ((xvap)->xva_reqattrmap[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0) | | 489 | ((xvap)->xva_reqattrmap[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0) |
490 | | | 490 | |
491 | /* | | 491 | /* |
492 | * XVA_ISSET_RTN() checks the returned attribute bitmap (xva_rtnattrmap[]) | | 492 | * XVA_ISSET_RTN() checks the returned attribute bitmap (xva_rtnattrmap[]) |
493 | * to see of the corresponding attribute bit is set. If so, returns non-zero. | | 493 | * to see of the corresponding attribute bit is set. If so, returns non-zero. |
494 | */ | | 494 | */ |
495 | #define XVA_ISSET_RTN(xvap, attr) \ | | 495 | #define XVA_ISSET_RTN(xvap, attr) \ |
496 | ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \ | | 496 | ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \ |
497 | ((xvap)->xva_magic == XVA_MAGIC) && \ | | 497 | ((xvap)->xva_magic == XVA_MAGIC) && \ |
498 | ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \ | | 498 | ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \ |
499 | ((XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0) | | 499 | ((XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0) |
500 | | | 500 | |
501 | static __inline void | | 501 | static __inline void |
502 | vattr_init_mask(vattr_t *vap) | | 502 | vattr_init_mask(vattr_t *vap) |
503 | { | | 503 | { |
504 | | | 504 | |
505 | vap->va_mask = 0; | | 505 | vap->va_mask = 0; |
506 | | | 506 | |
507 | if (vap->va_type != VNON) | | 507 | if (vap->va_type != VNON) |
508 | vap->va_mask |= AT_TYPE; | | 508 | vap->va_mask |= AT_TYPE; |
509 | if (vap->va_uid != (uid_t)VNOVAL) | | 509 | if (vap->va_uid != (uid_t)VNOVAL) |
510 | vap->va_mask |= AT_UID; | | 510 | vap->va_mask |= AT_UID; |
511 | if (vap->va_gid != (gid_t)VNOVAL) | | 511 | if (vap->va_gid != (gid_t)VNOVAL) |
512 | vap->va_mask |= AT_GID; | | 512 | vap->va_mask |= AT_GID; |
513 | if (vap->va_size != (u_quad_t)VNOVAL) | | 513 | if (vap->va_size != (u_quad_t)VNOVAL) |
514 | vap->va_mask |= AT_SIZE; | | 514 | vap->va_mask |= AT_SIZE; |
515 | if (vap->va_atime.tv_sec != VNOVAL) | | 515 | if (vap->va_atime.tv_sec != VNOVAL) |
516 | vap->va_mask |= AT_ATIME; | | 516 | vap->va_mask |= AT_ATIME; |
517 | if (vap->va_mtime.tv_sec != VNOVAL) | | 517 | if (vap->va_mtime.tv_sec != VNOVAL) |
518 | vap->va_mask |= AT_MTIME; | | 518 | vap->va_mask |= AT_MTIME; |
519 | if (vap->va_mode != (u_short)VNOVAL) | | 519 | if (vap->va_mode != (u_short)VNOVAL) |
520 | vap->va_mask |= AT_MODE; | | 520 | vap->va_mask |= AT_MODE; |
521 | } | | 521 | } |
522 | | | 522 | |
523 | #define FCREAT O_CREAT | | 523 | #define FCREAT O_CREAT |
524 | #define FTRUNC O_TRUNC | | 524 | #define FTRUNC O_TRUNC |
525 | #define FSYNC FFSYNC | | 525 | #define FSYNC FFSYNC |
526 | #define FOFFMAX 0x00 | | 526 | #define FOFFMAX 0x00 |
527 | | | 527 | |
528 | enum create { CRCREAT }; | | 528 | enum create { CRCREAT }; |
529 | | | 529 | |
530 | static __inline int | | 530 | static __inline int |
531 | zfs_vn_open(const char *pnamep, enum uio_seg seg, int filemode, int createmode, | | 531 | zfs_vn_open(const char *pnamep, enum uio_seg seg, int filemode, int createmode, |
532 | vnode_t **vpp, enum create crwhy, mode_t umask) | | 532 | vnode_t **vpp, enum create crwhy, mode_t umask) |
533 | { | | 533 | { |
534 | struct pathbuf *pb; | | 534 | struct pathbuf *pb; |
535 | struct nameidata nd; | | 535 | struct nameidata nd; |
536 | int error; | | 536 | int error; |
537 | | | 537 | |
538 | ASSERT(seg == UIO_SYSSPACE); | | 538 | ASSERT(seg == UIO_SYSSPACE); |
539 | ASSERT(filemode == (FWRITE | FCREAT | FTRUNC | FOFFMAX)); | | 539 | ASSERT((filemode & (FWRITE | FCREAT | FTRUNC | FOFFMAX)) != 0); |
540 | ASSERT(crwhy == CRCREAT); | | 540 | ASSERT(crwhy == CRCREAT); |
541 | ASSERT(umask == 0); | | 541 | ASSERT(umask == 0); |
542 | | | 542 | |
543 | pb = pathbuf_create(pnamep); | | 543 | pb = pathbuf_create(pnamep); |
544 | if (pb == NULL) { | | 544 | if (pb == NULL) { |
545 | return ENOMEM; | | 545 | return ENOMEM; |
546 | } | | 546 | } |
547 | NDINIT(&nd, LOOKUP, NOFOLLOW, pb); | | 547 | NDINIT(&nd, LOOKUP, NOFOLLOW, pb); |
548 | error = vn_open(&nd, filemode, createmode); | | 548 | error = vn_open(&nd, filemode, createmode); |
549 | if (error == 0) { | | 549 | if (error == 0) { |
550 | VOP_UNLOCK(nd.ni_vp); | | 550 | VOP_UNLOCK(nd.ni_vp); |
551 | *vpp = nd.ni_vp; | | 551 | *vpp = nd.ni_vp; |
552 | } | | 552 | } |
553 | pathbuf_destroy(pb); | | 553 | pathbuf_destroy(pb); |
554 | return (error); | | 554 | return (error); |
555 | } | | 555 | } |
556 | #define vn_open(pnamep, seg, filemode, createmode, vpp, crwhy, umask) \ | | 556 | #define vn_open(pnamep, seg, filemode, createmode, vpp, crwhy, umask) \ |
557 | zfs_vn_open((pnamep), (seg), (filemode), (createmode), (vpp), (crwhy), (umask)) | | 557 | zfs_vn_open((pnamep), (seg), (filemode), (createmode), (vpp), (crwhy), (umask)) |
558 | | | 558 | |
559 | #define vn_openat(pnamep, seg, filemode, createmode, vpp, crwhy, umask, rootvn, unk) \ | | 559 | #define vn_openat(pnamep, seg, filemode, createmode, vpp, crwhy, umask, rootvn, unk) \ |
560 | zfs_vn_open((pnamep), (seg), (filemode), (createmode), (vpp), (crwhy), (umask)) | | 560 | zfs_vn_open((pnamep), (seg), (filemode), (createmode), (vpp), (crwhy), (umask)) |
561 | | | 561 | |
562 | #define RLIM64_INFINITY 0 | | 562 | #define RLIM64_INFINITY 0 |
563 | static __inline int | | 563 | static __inline int |
564 | zfs_vn_rdwr(enum uio_rw rw, vnode_t *vp, caddr_t base, ssize_t len, | | 564 | zfs_vn_rdwr(enum uio_rw rw, vnode_t *vp, caddr_t base, ssize_t len, |
565 | offset_t offset, enum uio_seg seg, int ioflag, uint64_t ulimit, cred_t *cr, | | 565 | offset_t offset, enum uio_seg seg, int ioflag, uint64_t ulimit, cred_t *cr, |
566 | ssize_t *residp) | | 566 | ssize_t *residp) |
567 | { | | 567 | { |
568 | int error; | | 568 | int error; |
569 | size_t resid; | | 569 | size_t resid; |
570 | | | 570 | |
571 | ASSERT(rw == UIO_WRITE); | | 571 | ASSERT(rw == UIO_WRITE); |
572 | ASSERT(ioflag == 0); | | 572 | ASSERT(ioflag == 0); |
573 | ASSERT(ulimit == RLIM64_INFINITY); | | 573 | ASSERT(ulimit == RLIM64_INFINITY); |
574 | | | 574 | |
575 | ioflag = IO_APPEND | IO_UNIT; | | 575 | ioflag = IO_APPEND | IO_UNIT; |
576 | | | 576 | |
577 | error = vn_rdwr(rw, vp, base, len, offset, seg, ioflag, cr, | | 577 | error = vn_rdwr(rw, vp, base, len, offset, seg, ioflag, cr, |
578 | &resid, curlwp); | | 578 | &resid, curlwp); |
579 | if (residp != NULL) | | 579 | if (residp != NULL) |
580 | *residp = (ssize_t)resid; | | 580 | *residp = (ssize_t)resid; |
581 | return (error); | | 581 | return (error); |
582 | } | | 582 | } |
583 | #define vn_rdwr(rw, vp, base, len, offset, seg, ioflag, ulimit, cr, residp) \ | | 583 | #define vn_rdwr(rw, vp, base, len, offset, seg, ioflag, ulimit, cr, residp) \ |
584 | zfs_vn_rdwr((rw), (vp), (base), (len), (offset), (seg), (ioflag), (ulimit), (cr), (residp)) | | 584 | zfs_vn_rdwr((rw), (vp), (base), (len), (offset), (seg), (ioflag), (ulimit), (cr), (residp)) |
585 | | | 585 | |
586 | static __inline int | | 586 | static __inline int |
587 | zfs_vop_fsync(vnode_t *vp, int flag, cred_t *cr) | | 587 | zfs_vop_fsync(vnode_t *vp, int flag, cred_t *cr) |
588 | { | | 588 | { |
589 | int error; | | 589 | int error; |
590 | | | 590 | |
591 | ASSERT(flag == FSYNC); | | 591 | ASSERT(flag == FSYNC); |
592 | | | 592 | |
593 | vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); | | 593 | vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); |
594 | error = VOP_FSYNC(vp, cr, FSYNC_WAIT, 0, 0); | | 594 | error = VOP_FSYNC(vp, cr, FSYNC_WAIT, 0, 0); |
595 | VOP_UNLOCK(vp); | | 595 | VOP_UNLOCK(vp); |
596 | return (error); | | 596 | return (error); |
597 | } | | 597 | } |
598 | #define VOP_FSYNC(vp, flag, cr, unk) zfs_vop_fsync((vp), (flag), (cr)) | | 598 | #define VOP_FSYNC(vp, flag, cr, unk) zfs_vop_fsync((vp), (flag), (cr)) |
599 | | | 599 | |
600 | static __inline int | | 600 | static __inline int |
601 | zfs_vop_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr) | | 601 | zfs_vop_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr) |
602 | { | | 602 | { |
603 | | | 603 | |
604 | ASSERT(flag == (FWRITE | FCREAT | FTRUNC | FOFFMAX)); | | 604 | ASSERT(flag == (FWRITE | FCREAT | FTRUNC | FOFFMAX)); |
605 | ASSERT(count == 1); | | 605 | ASSERT(count == 1); |
606 | ASSERT(offset == 0); | | 606 | ASSERT(offset == 0); |
607 | | | 607 | |
608 | return (vn_close(vp, flag, cr)); | | 608 | return (vn_close(vp, flag, cr)); |
609 | } | | 609 | } |
610 | #define VOP_CLOSE(vp, oflags, count, offset, cr, unk) \ | | 610 | #define VOP_CLOSE(vp, oflags, count, offset, cr, unk) \ |
611 | zfs_vop_close((vp), (oflags), (count), (offset), (cr)) | | 611 | zfs_vop_close((vp), (oflags), (count), (offset), (cr)) |
612 | | | 612 | |
613 | static __inline int | | 613 | static __inline int |
614 | zfs_vop_getattr(vnode_t *vp, vattr_t *ap, int flag, cred_t *cr) | | 614 | zfs_vop_getattr(vnode_t *vp, vattr_t *ap, int flag, cred_t *cr) |
615 | { | | 615 | { |
616 | int error; | | 616 | int error; |
617 | | | 617 | |
618 | vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); | | 618 | vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); |
619 | error = VOP_GETATTR(vp, ap, cr); | | 619 | error = VOP_GETATTR(vp, ap, cr); |
620 | VOP_UNLOCK(vp); | | 620 | VOP_UNLOCK(vp); |
621 | return (error); | | 621 | return (error); |
622 | } | | 622 | } |
623 | #define VOP_GETATTR(vp, ap, flag, cr, unk) zfs_vop_getattr((vp), (ap), (flag), (cr)) | | 623 | #define VOP_GETATTR(vp, ap, flag, cr, unk) zfs_vop_getattr((vp), (ap), (flag), (cr)) |
624 | | | 624 | |
625 | static __inline int | | 625 | static __inline int |
626 | zfs_vop_seek(vnode_t *vp, off_t off, off_t *offp) | | 626 | zfs_vop_seek(vnode_t *vp, off_t off, off_t *offp) |
627 | { | | 627 | { |
628 | int error; | | 628 | int error; |
629 | | | 629 | |
630 | vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); | | 630 | vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); |
631 | error = VOP_SEEK(vp, off, *offp, kauth_cred_get()); | | 631 | error = VOP_SEEK(vp, off, *offp, kauth_cred_get()); |
632 | VOP_UNLOCK(vp); | | 632 | VOP_UNLOCK(vp); |
633 | return (error); | | 633 | return (error); |
634 | } | | 634 | } |
635 | #define VOP_SEEK(vp, off, offp, unk) zfs_vop_seek(vp, off, offp) | | 635 | #define VOP_SEEK(vp, off, offp, unk) zfs_vop_seek(vp, off, offp) |
636 | | | 636 | |
637 | #define B_INVAL BC_INVAL | | 637 | #define B_INVAL BC_INVAL |
638 | | | 638 | |
639 | static __inline int | | 639 | static __inline int |
640 | zfs_vop_putpage(vnode_t *vp, off_t off, size_t len, int flag) | | 640 | zfs_vop_putpage(vnode_t *vp, off_t off, size_t len, int flag) |
641 | { | | 641 | { |
642 | int nbflag; | | 642 | int nbflag; |
643 | | | 643 | |
644 | nbflag = 0; | | 644 | nbflag = 0; |
645 | if (len == 0) { | | 645 | if (len == 0) { |
646 | nbflag |= PGO_ALLPAGES; | | 646 | nbflag |= PGO_ALLPAGES; |
647 | } | | 647 | } |
648 | if ((flag & B_ASYNC) == 0) { | | 648 | if ((flag & B_ASYNC) == 0) { |
649 | nbflag |= PGO_SYNCIO; | | 649 | nbflag |= PGO_SYNCIO; |
650 | } | | 650 | } |
651 | if ((flag & B_INVAL) != 0) { | | 651 | if ((flag & B_INVAL) != 0) { |
652 | nbflag |= PGO_FREE; | | 652 | nbflag |= PGO_FREE; |
653 | } else { | | 653 | } else { |
654 | nbflag |= PGO_CLEANIT; | | 654 | nbflag |= PGO_CLEANIT; |
655 | } | | 655 | } |
656 | | | 656 | |
657 | mutex_enter(&vp->v_interlock); | | 657 | mutex_enter(&vp->v_interlock); |
658 | return VOP_PUTPAGES(vp, off, len, nbflag); | | 658 | return VOP_PUTPAGES(vp, off, len, nbflag); |
659 | } | | 659 | } |
660 | #define VOP_PUTPAGE(vp, off, len, flag, cr, ct) zfs_vop_putpage((vp), (off), (len), (flag)) | | 660 | #define VOP_PUTPAGE(vp, off, len, flag, cr, ct) zfs_vop_putpage((vp), (off), (len), (flag)) |
661 | | | 661 | |
662 | static __inline int | | 662 | static __inline int |
663 | vn_rename(char *from, char *to, enum uio_seg seg) | | 663 | vn_rename(char *from, char *to, enum uio_seg seg) |
664 | { | | 664 | { |
665 | | | 665 | |
666 | ASSERT(seg == UIO_SYSSPACE); | | 666 | ASSERT(seg == UIO_SYSSPACE); |
667 | | | 667 | |
668 | return (do_sys_rename(from, to, seg, 0)); | | 668 | return (do_sys_rename(from, to, seg, 0)); |
669 | } | | 669 | } |
670 | | | 670 | |
671 | enum rm { RMFILE }; | | 671 | enum rm { RMFILE }; |
672 | static __inline int | | 672 | static __inline int |
673 | vn_remove(char *fnamep, enum uio_seg seg, enum rm dirflag) | | 673 | vn_remove(char *fnamep, enum uio_seg seg, enum rm dirflag) |
674 | { | | 674 | { |
675 | | | 675 | |
676 | ASSERT(seg == UIO_SYSSPACE); | | 676 | ASSERT(seg == UIO_SYSSPACE); |
677 | ASSERT(dirflag == RMFILE); | | 677 | ASSERT(dirflag == RMFILE); |
678 | | | 678 | |
679 | return (do_sys_unlink(fnamep, seg)); | | 679 | return (do_sys_unlink(fnamep, seg)); |
680 | } | | 680 | } |
681 | | | 681 | |
682 | #define VN_RELE_ASYNC(vp, taskq) vrele_async((vp)) | | 682 | #define VN_RELE_ASYNC(vp, taskq) vrele_async((vp)) |
683 | #define vn_exists(a) do { } while(0) | | 683 | #define vn_exists(a) do { } while(0) |
684 | #define vn_reinit(a) vclean((a), 0) | | 684 | #define vn_reinit(a) vclean((a), 0) |
685 | | | 685 | |
686 | /* | | 686 | /* |
687 | * Flags for VOP_LOOKUP | | 687 | * Flags for VOP_LOOKUP |
688 | * | | 688 | * |
689 | * Defined in file.h, but also possible, FIGNORECASE | | 689 | * Defined in file.h, but also possible, FIGNORECASE |
690 | * | | 690 | * |
691 | */ | | 691 | */ |
692 | #define LOOKUP_XATTR 0x02 /* lookup up extended attr dir */ | | 692 | #define LOOKUP_XATTR 0x02 /* lookup up extended attr dir */ |
693 | | | 693 | |
694 | /* | | 694 | /* |
695 | * Flags for VOP_READDIR | | 695 | * Flags for VOP_READDIR |
696 | */ | | 696 | */ |
697 | #define V_RDDIR_ENTFLAGS 0x01 /* request dirent flags */ | | 697 | #define V_RDDIR_ENTFLAGS 0x01 /* request dirent flags */ |
698 | #define V_RDDIR_ACCFILTER 0x02 /* filter out inaccessible dirents */ | | 698 | #define V_RDDIR_ACCFILTER 0x02 /* filter out inaccessible dirents */ |
699 | | | 699 | |
700 | /* | | 700 | /* |
701 | * Extensible vnode attribute (xva) routines: | | 701 | * Extensible vnode attribute (xva) routines: |
702 | * xva_init() initializes an xvattr_t (zero struct, init mapsize, set AT_XATTR) | | 702 | * xva_init() initializes an xvattr_t (zero struct, init mapsize, set AT_XATTR) |
703 | * xva_getxoptattr() returns a ponter to the xoptattr_t section of xvattr_t | | 703 | * xva_getxoptattr() returns a ponter to the xoptattr_t section of xvattr_t |
704 | */ | | 704 | */ |
705 | void xva_init(xvattr_t *); | | 705 | void xva_init(xvattr_t *); |
706 | xoptattr_t *xva_getxoptattr(xvattr_t *); | | 706 | xoptattr_t *xva_getxoptattr(xvattr_t *); |
707 | | | 707 | |
708 | /* | | 708 | /* |
709 | * VOP_ACCESS flags | | 709 | * VOP_ACCESS flags |
710 | */ | | 710 | */ |
711 | #define V_ACE_MASK 0x1 /* mask represents NFSv4 ACE permissions */ | | 711 | #define V_ACE_MASK 0x1 /* mask represents NFSv4 ACE permissions */ |
712 | #define V_APPEND 0x2 /* want to do append only check */ | | 712 | #define V_APPEND 0x2 /* want to do append only check */ |
713 | | | 713 | |
714 | #endif /* _OPENSOLARIS_SYS_VNODE_H_ */ | | 714 | #endif /* _OPENSOLARIS_SYS_VNODE_H_ */ |