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 /* 23 * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. 24 * Copyright (c) 2013, Joyent, Inc. All rights reserved. 25 * Copyright 2017 Nexenta Systems, Inc. All rights reserved. 26 */ 27 28 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 29 /* All Rights Reserved */ 30 31 /* 32 * University Copyright- Copyright (c) 1982, 1986, 1988 33 * The Regents of the University of California 34 * All Rights Reserved 35 * 36 * University Acknowledgment- Portions of this document are derived from 37 * software developed by the University of California, Berkeley, and its 38 * contributors. 39 */ 40 41 #ifndef _SYS_VNODE_H 42 #define _SYS_VNODE_H 43 44 #include <sys/types.h> 45 #include <sys/t_lock.h> 46 #include <sys/time_impl.h> 47 #include <sys/cred.h> 48 #include <sys/uio.h> 49 #include <sys/resource.h> 50 #include <vm/seg_enum.h> 51 #include <sys/kstat.h> 52 #include <sys/kmem.h> 53 #include <sys/list.h> 54 #include <sys/avl.h> 55 #ifdef _KERNEL 56 #include <sys/rwstlock.h> 57 #include <sys/buf.h> 58 #endif /* _KERNEL */ 59 60 #ifdef __cplusplus 61 extern "C" { 62 #endif 63 64 #if defined(_KERNEL) || defined(_FAKE_KERNEL) 65 66 /* 67 * Statistics for all vnode operations. 68 * All operations record number of ops (since boot/mount/zero'ed). 69 * Certain I/O operations (read, write, readdir) also record number 70 * of bytes transferred. 71 * This appears in two places in the system: one is embedded in each 72 * vfs_t. There is also an array of vopstats_t structures allocated 73 * on a per-fstype basis. 74 */ 75 76 #define VOPSTATS_STR "vopstats_" /* Initial string for vopstat kstats */ 77 78 typedef struct vopstats { 79 kstat_named_t nopen; /* VOP_OPEN */ 80 kstat_named_t nclose; /* VOP_CLOSE */ 81 kstat_named_t nread; /* VOP_READ */ 82 kstat_named_t read_bytes; 83 kstat_named_t nwrite; /* VOP_WRITE */ 84 kstat_named_t write_bytes; 85 kstat_named_t nioctl; /* VOP_IOCTL */ 86 kstat_named_t nsetfl; /* VOP_SETFL */ 87 kstat_named_t ngetattr; /* VOP_GETATTR */ 88 kstat_named_t nsetattr; /* VOP_SETATTR */ 89 kstat_named_t naccess; /* VOP_ACCESS */ 90 kstat_named_t nlookup; /* VOP_LOOKUP */ 91 kstat_named_t ncreate; /* VOP_CREATE */ 92 kstat_named_t nremove; /* VOP_REMOVE */ 93 kstat_named_t nlink; /* VOP_LINK */ 94 kstat_named_t nrename; /* VOP_RENAME */ 95 kstat_named_t nmkdir; /* VOP_MKDIR */ 96 kstat_named_t nrmdir; /* VOP_RMDIR */ 97 kstat_named_t nreaddir; /* VOP_READDIR */ 98 kstat_named_t readdir_bytes; 99 kstat_named_t nsymlink; /* VOP_SYMLINK */ 100 kstat_named_t nreadlink; /* VOP_READLINK */ 101 kstat_named_t nfsync; /* VOP_FSYNC */ 102 kstat_named_t ninactive; /* VOP_INACTIVE */ 103 kstat_named_t nfid; /* VOP_FID */ 104 kstat_named_t nrwlock; /* VOP_RWLOCK */ 105 kstat_named_t nrwunlock; /* VOP_RWUNLOCK */ 106 kstat_named_t nseek; /* VOP_SEEK */ 107 kstat_named_t ncmp; /* VOP_CMP */ 108 kstat_named_t nfrlock; /* VOP_FRLOCK */ 109 kstat_named_t nspace; /* VOP_SPACE */ 110 kstat_named_t nrealvp; /* VOP_REALVP */ 111 kstat_named_t ngetpage; /* VOP_GETPAGE */ 112 kstat_named_t nputpage; /* VOP_PUTPAGE */ 113 kstat_named_t nmap; /* VOP_MAP */ 114 kstat_named_t naddmap; /* VOP_ADDMAP */ 115 kstat_named_t ndelmap; /* VOP_DELMAP */ 116 kstat_named_t npoll; /* VOP_POLL */ 117 kstat_named_t ndump; /* VOP_DUMP */ 118 kstat_named_t npathconf; /* VOP_PATHCONF */ 119 kstat_named_t npageio; /* VOP_PAGEIO */ 120 kstat_named_t ndumpctl; /* VOP_DUMPCTL */ 121 kstat_named_t ndispose; /* VOP_DISPOSE */ 122 kstat_named_t nsetsecattr; /* VOP_SETSECATTR */ 123 kstat_named_t ngetsecattr; /* VOP_GETSECATTR */ 124 kstat_named_t nshrlock; /* VOP_SHRLOCK */ 125 kstat_named_t nvnevent; /* VOP_VNEVENT */ 126 kstat_named_t nreqzcbuf; /* VOP_REQZCBUF */ 127 kstat_named_t nretzcbuf; /* VOP_RETZCBUF */ 128 } vopstats_t; 129 #endif // defined(_KERNEL) || defined(_FAKE_KERNEL) 130 131 /* 132 * The vnode is the focus of all file activity in UNIX. 133 * A vnode is allocated for each active file, each current 134 * directory, each mounted-on file, and the root. 135 * 136 * Each vnode is usually associated with a file-system-specific node (for 137 * UFS, this is the in-memory inode). Generally, a vnode and an fs-node 138 * should be created and destroyed together as a pair. 139 * 140 * If a vnode is reused for a new file, it should be reinitialized by calling 141 * either vn_reinit() or vn_recycle(). 142 * 143 * vn_reinit() resets the entire vnode as if it was returned by vn_alloc(). 144 * The caller is responsible for setting up the entire vnode after calling 145 * vn_reinit(). This is important when using kmem caching where the vnode is 146 * allocated by a constructor, for instance. 147 * 148 * vn_recycle() is used when the file system keeps some state around in both 149 * the vnode and the associated FS-node. In UFS, for example, the inode of 150 * a deleted file can be reused immediately. The v_data, v_vfsp, v_op, etc. 151 * remains the same but certain fields related to the previous instance need 152 * to be reset. In particular: 153 * v_femhead 154 * v_path 155 * v_rdcnt, v_wrcnt 156 * v_mmap_read, v_mmap_write 157 */ 158 159 /* 160 * vnode types. VNON means no type. These values are unrelated to 161 * values in on-disk inodes. 162 */ 163 typedef enum vtype { 164 VNON = 0, 165 VREG = 1, 166 VDIR = 2, 167 VBLK = 3, 168 VCHR = 4, 169 VLNK = 5, 170 VFIFO = 6, 171 VDOOR = 7, 172 VPROC = 8, 173 VSOCK = 9, 174 VPORT = 10, 175 VBAD = 11 176 } vtype_t; 177 178 #if defined(_KERNEL) || defined(_FAKE_KERNEL) 179 180 /* 181 * VSD - Vnode Specific Data 182 * Used to associate additional private data with a vnode. 183 */ 184 struct vsd_node { 185 list_node_t vs_nodes; /* list of all VSD nodes */ 186 uint_t vs_nkeys; /* entries in value array */ 187 void **vs_value; /* array of value/key */ 188 }; 189 190 /* 191 * Many of the fields in the vnode are read-only once they are initialized 192 * at vnode creation time. Other fields are protected by locks. 193 * 194 * IMPORTANT: vnodes should be created ONLY by calls to vn_alloc(). They 195 * may not be embedded into the file-system specific node (inode). The 196 * size of vnodes may change. 197 * 198 * The v_lock protects: 199 * v_flag 200 * v_stream 201 * v_count 202 * v_shrlocks 203 * v_path 204 * v_vsd 205 * v_xattrdir 206 * 207 * A special lock (implemented by vn_vfswlock in vnode.c) protects: 208 * v_vfsmountedhere 209 * 210 * The global flock_lock mutex (in flock.c) protects: 211 * v_filocks 212 * 213 * IMPORTANT NOTE: 214 * 215 * The following vnode fields are considered public and may safely be 216 * accessed by file systems or other consumers: 217 * 218 * v_lock 219 * v_flag 220 * v_count 221 * v_data 222 * v_vfsp 223 * v_stream 224 * v_type 225 * v_rdev 226 * 227 * ALL OTHER FIELDS SHOULD BE ACCESSED ONLY BY THE OWNER OF THAT FIELD. 228 * In particular, file systems should not access other fields; they may 229 * change or even be removed. The functionality which was once provided 230 * by these fields is available through vn_* functions. 231 */ 232 233 struct fem_head; /* from fem.h */ 234 235 typedef struct vnode { 236 kmutex_t v_lock; /* protects vnode fields */ 237 uint_t v_flag; /* vnode flags (see below) */ 238 uint_t v_count; /* reference count */ 239 void *v_data; /* private data for fs */ 240 struct vfs *v_vfsp; /* ptr to containing VFS */ 241 struct stdata *v_stream; /* associated stream */ 242 enum vtype v_type; /* vnode type */ 243 dev_t v_rdev; /* device (VCHR, VBLK) */ 244 245 /* PRIVATE FIELDS BELOW - DO NOT USE */ 246 247 struct vfs *v_vfsmountedhere; /* ptr to vfs mounted here */ 248 struct vnodeops *v_op; /* vnode operations */ 249 krwlock_t v_nbllock; /* sync for NBMAND locks */ 250 char *v_path; /* cached path */ 251 uint_t v_rdcnt; /* open for read count (VREG only) */ 252 uint_t v_wrcnt; /* open for write count (VREG only) */ 253 struct vnode *v_xattrdir; /* unnamed extended attr dir (GFS) */ 254 255 /* Private to the fake vnode impl. */ 256 257 int v_fd; 258 dev_t v_st_dev; 259 ino_t v_st_ino; 260 avl_node_t v_avl_node; 261 int v_vfsrlocks; 262 } vnode_t; 263 264 #define IS_DEVVP(vp) \ 265 ((vp)->v_type == VCHR || (vp)->v_type == VBLK || (vp)->v_type == VFIFO) 266 267 #define VNODE_ALIGN 16 268 269 /* 270 * vnode flags. 271 */ 272 #define VROOT 0x01 /* root of its file system */ 273 #define VNOCACHE 0x02 /* don't keep cache pages on vnode */ 274 #define VNOMAP 0x04 /* file cannot be mapped/faulted */ 275 #define VDUP 0x08 /* file should be dup'ed rather then opened */ 276 #define VNOSWAP 0x10 /* file cannot be used as virtual swap device */ 277 #define VNOMOUNT 0x20 /* file cannot be covered by mount */ 278 #define VISSWAP 0x40 /* vnode is being used for swap */ 279 #define VSWAPLIKE 0x80 /* vnode acts like swap (but may not be) */ 280 281 #define IS_SWAPVP(vp) (((vp)->v_flag & (VISSWAP | VSWAPLIKE)) != 0) 282 283 #else // defined(_KERNEL) || defined(_FAKE_KERNEL) 284 typedef struct vnode vnode_t; 285 #endif // defined(_KERNEL) || defined(_FAKE_KERNEL) 286 287 #if defined(_KERNEL) 288 typedef struct vn_vfslocks_entry { 289 rwstlock_t ve_lock; 290 void *ve_vpvfs; 291 struct vn_vfslocks_entry *ve_next; 292 uint32_t ve_refcnt; 293 char pad[64 - sizeof (rwstlock_t) - 2 * sizeof (void *) - \ 294 sizeof (uint32_t)]; 295 } vn_vfslocks_entry_t; 296 #endif /* _KERNEL */ 297 298 /* 299 * The following two flags are used to lock the v_vfsmountedhere field 300 */ 301 #define VVFSLOCK 0x100 302 #define VVFSWAIT 0x200 303 304 /* 305 * Used to serialize VM operations on a vnode 306 */ 307 #define VVMLOCK 0x400 308 309 /* 310 * Tell vn_open() not to fail a directory open for writing but 311 * to go ahead and call VOP_OPEN() to let the filesystem check. 312 */ 313 #define VDIROPEN 0x800 314 315 /* 316 * Flag to let the VM system know that this file is most likely a binary 317 * or shared library since it has been mmap()ed EXEC at some time. 318 */ 319 #define VVMEXEC 0x1000 320 321 #define VPXFS 0x2000 /* clustering: global fs proxy vnode */ 322 323 #define IS_PXFSVP(vp) ((vp)->v_flag & VPXFS) 324 325 #define V_XATTRDIR 0x4000 /* attribute unnamed directory */ 326 327 #define IS_XATTRDIR(vp) ((vp)->v_flag & V_XATTRDIR) 328 329 #define V_LOCALITY 0x8000 /* whether locality aware */ 330 331 /* 332 * Flag that indicates the VM should maintain the v_pages list with all modified 333 * pages on one end and unmodified pages at the other. This makes finding dirty 334 * pages to write back to disk much faster at the expense of taking a minor 335 * fault on the first store instruction which touches a writable page. 336 */ 337 #define VMODSORT (0x10000) 338 #define IS_VMODSORT(vp) \ 339 (pvn_vmodsort_supported != 0 && ((vp)->v_flag & VMODSORT) != 0) 340 341 #define VISSWAPFS 0x20000 /* vnode is being used for swapfs */ 342 343 /* 344 * The mdb memstat command assumes that IS_SWAPFSVP only uses the 345 * vnode's v_flag field. If this changes, cache the additional 346 * fields in mdb; see vn_get in mdb/common/modules/genunix/memory.c 347 */ 348 #define IS_SWAPFSVP(vp) (((vp)->v_flag & VISSWAPFS) != 0) 349 350 #define V_SYSATTR 0x40000 /* vnode is a GFS system attribute */ 351 352 /* 353 * Vnode attributes. A bit-mask is supplied as part of the 354 * structure to indicate the attributes the caller wants to 355 * set (setattr) or extract (getattr). 356 */ 357 358 /* 359 * Note that va_nodeid and va_nblocks are 64bit data type. 360 * We support large files over NFSV3. With Solaris client and 361 * Server that generates 64bit ino's and sizes these fields 362 * will overflow if they are 32 bit sizes. 363 */ 364 365 typedef struct vattr { 366 uint_t va_mask; /* bit-mask of attributes */ 367 vtype_t va_type; /* vnode type (for create) */ 368 mode_t va_mode; /* file access mode */ 369 uid_t va_uid; /* owner user id */ 370 gid_t va_gid; /* owner group id */ 371 dev_t va_fsid; /* file system id (dev for now) */ 372 u_longlong_t va_nodeid; /* node id */ 373 nlink_t va_nlink; /* number of references to file */ 374 u_offset_t va_size; /* file size in bytes */ 375 timestruc_t va_atime; /* time of last access */ 376 timestruc_t va_mtime; /* time of last modification */ 377 timestruc_t va_ctime; /* time of last status change */ 378 dev_t va_rdev; /* device the file represents */ 379 uint_t va_blksize; /* fundamental block size */ 380 u_longlong_t va_nblocks; /* # of blocks allocated */ 381 uint_t va_seq; /* sequence number */ 382 } vattr_t; 383 384 #define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */ 385 386 /* 387 * Structure of all optional attributes. 388 */ 389 typedef struct xoptattr { 390 timestruc_t xoa_createtime; /* Create time of file */ 391 uint8_t xoa_archive; 392 uint8_t xoa_system; 393 uint8_t xoa_readonly; 394 uint8_t xoa_hidden; 395 uint8_t xoa_nounlink; 396 uint8_t xoa_immutable; 397 uint8_t xoa_appendonly; 398 uint8_t xoa_nodump; 399 uint8_t xoa_opaque; 400 uint8_t xoa_av_quarantined; 401 uint8_t xoa_av_modified; 402 uint8_t xoa_av_scanstamp[AV_SCANSTAMP_SZ]; 403 uint8_t xoa_reparse; 404 uint64_t xoa_generation; 405 uint8_t xoa_offline; 406 uint8_t xoa_sparse; 407 } xoptattr_t; 408 409 /* 410 * The xvattr structure is really a variable length structure that 411 * is made up of: 412 * - The classic vattr_t (xva_vattr) 413 * - a 32 bit quantity (xva_mapsize) that specifies the size of the 414 * attribute bitmaps in 32 bit words. 415 * - A pointer to the returned attribute bitmap (needed because the 416 * previous element, the requested attribute bitmap) is variable lenth. 417 * - The requested attribute bitmap, which is an array of 32 bit words. 418 * Callers use the XVA_SET_REQ() macro to set the bits corresponding to 419 * the attributes that are being requested. 420 * - The returned attribute bitmap, which is an array of 32 bit words. 421 * File systems that support optional attributes use the XVA_SET_RTN() 422 * macro to set the bits corresponding to the attributes that are being 423 * returned. 424 * - The xoptattr_t structure which contains the attribute values 425 * 426 * xva_mapsize determines how many words in the attribute bitmaps. 427 * Immediately following the attribute bitmaps is the xoptattr_t. 428 * xva_getxoptattr() is used to get the pointer to the xoptattr_t 429 * section. 430 */ 431 432 #define XVA_MAPSIZE 3 /* Size of attr bitmaps */ 433 #define XVA_MAGIC 0x78766174 /* Magic # for verification */ 434 435 /* 436 * The xvattr structure is an extensible structure which permits optional 437 * attributes to be requested/returned. File systems may or may not support 438 * optional attributes. They do so at their own discretion but if they do 439 * support optional attributes, they must register the VFSFT_XVATTR feature 440 * so that the optional attributes can be set/retrived. 441 * 442 * The fields of the xvattr structure are: 443 * 444 * xva_vattr - The first element of an xvattr is a legacy vattr structure 445 * which includes the common attributes. If AT_XVATTR is set in the va_mask 446 * then the entire structure is treated as an xvattr. If AT_XVATTR is not 447 * set, then only the xva_vattr structure can be used. 448 * 449 * xva_magic - 0x78766174 (hex for "xvat"). Magic number for verification. 450 * 451 * xva_mapsize - Size of requested and returned attribute bitmaps. 452 * 453 * xva_rtnattrmapp - Pointer to xva_rtnattrmap[]. We need this since the 454 * size of the array before it, xva_reqattrmap[], could change which means 455 * the location of xva_rtnattrmap[] could change. This will allow unbundled 456 * file systems to find the location of xva_rtnattrmap[] when the sizes change. 457 * 458 * xva_reqattrmap[] - Array of requested attributes. Attributes are 459 * represented by a specific bit in a specific element of the attribute 460 * map array. Callers set the bits corresponding to the attributes 461 * that the caller wants to get/set. 462 * 463 * xva_rtnattrmap[] - Array of attributes that the file system was able to 464 * process. Not all file systems support all optional attributes. This map 465 * informs the caller which attributes the underlying file system was able 466 * to set/get. (Same structure as the requested attributes array in terms 467 * of each attribute corresponding to specific bits and array elements.) 468 * 469 * xva_xoptattrs - Structure containing values of optional attributes. 470 * These values are only valid if the corresponding bits in xva_reqattrmap 471 * are set and the underlying file system supports those attributes. 472 */ 473 typedef struct xvattr { 474 vattr_t xva_vattr; /* Embedded vattr structure */ 475 uint32_t xva_magic; /* Magic Number */ 476 uint32_t xva_mapsize; /* Size of attr bitmap (32-bit words) */ 477 uint32_t *xva_rtnattrmapp; /* Ptr to xva_rtnattrmap[] */ 478 uint32_t xva_reqattrmap[XVA_MAPSIZE]; /* Requested attrs */ 479 uint32_t xva_rtnattrmap[XVA_MAPSIZE]; /* Returned attrs */ 480 xoptattr_t xva_xoptattrs; /* Optional attributes */ 481 } xvattr_t; 482 483 #ifdef _SYSCALL32 484 /* 485 * For bigtypes time_t changed to 64 bit on the 64-bit kernel. 486 * Define an old version for user/kernel interface 487 */ 488 489 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 490 #pragma pack(4) 491 #endif 492 493 typedef struct vattr32 { 494 uint32_t va_mask; /* bit-mask of attributes */ 495 vtype_t va_type; /* vnode type (for create) */ 496 mode32_t va_mode; /* file access mode */ 497 uid32_t va_uid; /* owner user id */ 498 gid32_t va_gid; /* owner group id */ 499 dev32_t va_fsid; /* file system id (dev for now) */ 500 u_longlong_t va_nodeid; /* node id */ 501 nlink_t va_nlink; /* number of references to file */ 502 u_offset_t va_size; /* file size in bytes */ 503 timestruc32_t va_atime; /* time of last access */ 504 timestruc32_t va_mtime; /* time of last modification */ 505 timestruc32_t va_ctime; /* time of last status change */ 506 dev32_t va_rdev; /* device the file represents */ 507 uint32_t va_blksize; /* fundamental block size */ 508 u_longlong_t va_nblocks; /* # of blocks allocated */ 509 uint32_t va_seq; /* sequence number */ 510 } vattr32_t; 511 512 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 513 #pragma pack() 514 #endif 515 516 #else /* not _SYSCALL32 */ 517 #define vattr32 vattr 518 typedef vattr_t vattr32_t; 519 #endif /* _SYSCALL32 */ 520 521 /* 522 * Attributes of interest to the caller of setattr or getattr. 523 */ 524 #define AT_TYPE 0x00001 525 #define AT_MODE 0x00002 526 #define AT_UID 0x00004 527 #define AT_GID 0x00008 528 #define AT_FSID 0x00010 529 #define AT_NODEID 0x00020 530 #define AT_NLINK 0x00040 531 #define AT_SIZE 0x00080 532 #define AT_ATIME 0x00100 533 #define AT_MTIME 0x00200 534 #define AT_CTIME 0x00400 535 #define AT_RDEV 0x00800 536 #define AT_BLKSIZE 0x01000 537 #define AT_NBLOCKS 0x02000 538 /* 0x04000 */ /* unused */ 539 #define AT_SEQ 0x08000 540 /* 541 * If AT_XVATTR is set then there are additional bits to process in 542 * the xvattr_t's attribute bitmap. If this is not set then the bitmap 543 * MUST be ignored. Note that this bit must be set/cleared explicitly. 544 * That is, setting AT_ALL will NOT set AT_XVATTR. 545 */ 546 #define AT_XVATTR 0x10000 547 548 #define AT_ALL (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\ 549 AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\ 550 AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) 551 552 #define AT_STAT (AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\ 553 AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV|AT_TYPE) 554 555 #define AT_TIMES (AT_ATIME|AT_MTIME|AT_CTIME) 556 557 #define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\ 558 AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) 559 560 /* 561 * Attribute bits used in the extensible attribute's (xva's) attribute 562 * bitmaps. Note that the bitmaps are made up of a variable length number 563 * of 32-bit words. The convention is to use XAT{n}_{attrname} where "n" 564 * is the element in the bitmap (starting at 1). This convention is for 565 * the convenience of the maintainer to keep track of which element each 566 * attribute belongs to. 567 * 568 * NOTE THAT CONSUMERS MUST *NOT* USE THE XATn_* DEFINES DIRECTLY. CONSUMERS 569 * MUST USE THE XAT_* DEFINES. 570 */ 571 #define XAT0_INDEX 0LL /* Index into bitmap for XAT0 attrs */ 572 #define XAT0_CREATETIME 0x00000001 /* Create time of file */ 573 #define XAT0_ARCHIVE 0x00000002 /* Archive */ 574 #define XAT0_SYSTEM 0x00000004 /* System */ 575 #define XAT0_READONLY 0x00000008 /* Readonly */ 576 #define XAT0_HIDDEN 0x00000010 /* Hidden */ 577 #define XAT0_NOUNLINK 0x00000020 /* Nounlink */ 578 #define XAT0_IMMUTABLE 0x00000040 /* immutable */ 579 #define XAT0_APPENDONLY 0x00000080 /* appendonly */ 580 #define XAT0_NODUMP 0x00000100 /* nodump */ 581 #define XAT0_OPAQUE 0x00000200 /* opaque */ 582 #define XAT0_AV_QUARANTINED 0x00000400 /* anti-virus quarantine */ 583 #define XAT0_AV_MODIFIED 0x00000800 /* anti-virus modified */ 584 #define XAT0_AV_SCANSTAMP 0x00001000 /* anti-virus scanstamp */ 585 #define XAT0_REPARSE 0x00002000 /* FS reparse point */ 586 #define XAT0_GEN 0x00004000 /* object generation number */ 587 #define XAT0_OFFLINE 0x00008000 /* offline */ 588 #define XAT0_SPARSE 0x00010000 /* sparse */ 589 590 #define XAT0_ALL_ATTRS (XAT0_CREATETIME|XAT0_ARCHIVE|XAT0_SYSTEM| \ 591 XAT0_READONLY|XAT0_HIDDEN|XAT0_NOUNLINK|XAT0_IMMUTABLE|XAT0_APPENDONLY| \ 592 XAT0_NODUMP|XAT0_OPAQUE|XAT0_AV_QUARANTINED| XAT0_AV_MODIFIED| \ 593 XAT0_AV_SCANSTAMP|XAT0_REPARSE|XATO_GEN|XAT0_OFFLINE|XAT0_SPARSE) 594 595 /* Support for XAT_* optional attributes */ 596 #define XVA_MASK 0xffffffff /* Used to mask off 32 bits */ 597 #define XVA_SHFT 32 /* Used to shift index */ 598 599 /* 600 * Used to pry out the index and attribute bits from the XAT_* attributes 601 * defined below. Note that we're masking things down to 32 bits then 602 * casting to uint32_t. 603 */ 604 #define XVA_INDEX(attr) ((uint32_t)(((attr) >> XVA_SHFT) & XVA_MASK)) 605 #define XVA_ATTRBIT(attr) ((uint32_t)((attr) & XVA_MASK)) 606 607 /* 608 * The following defines present a "flat namespace" so that consumers don't 609 * need to keep track of which element belongs to which bitmap entry. 610 * 611 * NOTE THAT THESE MUST NEVER BE OR-ed TOGETHER 612 */ 613 #define XAT_CREATETIME ((XAT0_INDEX << XVA_SHFT) | XAT0_CREATETIME) 614 #define XAT_ARCHIVE ((XAT0_INDEX << XVA_SHFT) | XAT0_ARCHIVE) 615 #define XAT_SYSTEM ((XAT0_INDEX << XVA_SHFT) | XAT0_SYSTEM) 616 #define XAT_READONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_READONLY) 617 #define XAT_HIDDEN ((XAT0_INDEX << XVA_SHFT) | XAT0_HIDDEN) 618 #define XAT_NOUNLINK ((XAT0_INDEX << XVA_SHFT) | XAT0_NOUNLINK) 619 #define XAT_IMMUTABLE ((XAT0_INDEX << XVA_SHFT) | XAT0_IMMUTABLE) 620 #define XAT_APPENDONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_APPENDONLY) 621 #define XAT_NODUMP ((XAT0_INDEX << XVA_SHFT) | XAT0_NODUMP) 622 #define XAT_OPAQUE ((XAT0_INDEX << XVA_SHFT) | XAT0_OPAQUE) 623 #define XAT_AV_QUARANTINED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_QUARANTINED) 624 #define XAT_AV_MODIFIED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_MODIFIED) 625 #define XAT_AV_SCANSTAMP ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_SCANSTAMP) 626 #define XAT_REPARSE ((XAT0_INDEX << XVA_SHFT) | XAT0_REPARSE) 627 #define XAT_GEN ((XAT0_INDEX << XVA_SHFT) | XAT0_GEN) 628 #define XAT_OFFLINE ((XAT0_INDEX << XVA_SHFT) | XAT0_OFFLINE) 629 #define XAT_SPARSE ((XAT0_INDEX << XVA_SHFT) | XAT0_SPARSE) 630 631 /* 632 * The returned attribute map array (xva_rtnattrmap[]) is located past the 633 * requested attribute map array (xva_reqattrmap[]). Its location changes 634 * when the array sizes change. We use a separate pointer in a known location 635 * (xva_rtnattrmapp) to hold the location of xva_rtnattrmap[]. This is 636 * set in xva_init() 637 */ 638 #define XVA_RTNATTRMAP(xvap) ((xvap)->xva_rtnattrmapp) 639 640 /* 641 * XVA_SET_REQ() sets an attribute bit in the proper element in the bitmap 642 * of requested attributes (xva_reqattrmap[]). 643 */ 644 #define XVA_SET_REQ(xvap, attr) \ 645 ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ 646 ASSERT((xvap)->xva_magic == XVA_MAGIC); \ 647 (xvap)->xva_reqattrmap[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr) 648 /* 649 * XVA_CLR_REQ() clears an attribute bit in the proper element in the bitmap 650 * of requested attributes (xva_reqattrmap[]). 651 */ 652 #define XVA_CLR_REQ(xvap, attr) \ 653 ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ 654 ASSERT((xvap)->xva_magic == XVA_MAGIC); \ 655 (xvap)->xva_reqattrmap[XVA_INDEX(attr)] &= ~XVA_ATTRBIT(attr) 656 657 /* 658 * XVA_SET_RTN() sets an attribute bit in the proper element in the bitmap 659 * of returned attributes (xva_rtnattrmap[]). 660 */ 661 #define XVA_SET_RTN(xvap, attr) \ 662 ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ 663 ASSERT((xvap)->xva_magic == XVA_MAGIC); \ 664 (XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr) 665 666 /* 667 * XVA_ISSET_REQ() checks the requested attribute bitmap (xva_reqattrmap[]) 668 * to see of the corresponding attribute bit is set. If so, returns non-zero. 669 */ 670 #define XVA_ISSET_REQ(xvap, attr) \ 671 ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \ 672 ((xvap)->xva_magic == XVA_MAGIC) && \ 673 ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \ 674 ((xvap)->xva_reqattrmap[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0) 675 676 /* 677 * XVA_ISSET_RTN() checks the returned attribute bitmap (xva_rtnattrmap[]) 678 * to see of the corresponding attribute bit is set. If so, returns non-zero. 679 */ 680 #define XVA_ISSET_RTN(xvap, attr) \ 681 ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \ 682 ((xvap)->xva_magic == XVA_MAGIC) && \ 683 ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \ 684 ((XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0) 685 686 /* 687 * Modes. Some values same as S_xxx entries from stat.h for convenience. 688 */ 689 #define VSUID 04000 /* set user id on execution */ 690 #define VSGID 02000 /* set group id on execution */ 691 #define VSVTX 01000 /* save swapped text even after use */ 692 693 /* 694 * Permissions. 695 */ 696 #define VREAD 00400 697 #define VWRITE 00200 698 #define VEXEC 00100 699 700 #define MODEMASK 07777 /* mode bits plus permission bits */ 701 #define PERMMASK 00777 /* permission bits */ 702 703 /* 704 * VOP_ACCESS flags 705 */ 706 #define V_ACE_MASK 0x1 /* mask represents NFSv4 ACE permissions */ 707 #define V_APPEND 0x2 /* want to do append only check */ 708 709 /* 710 * Check whether mandatory file locking is enabled. 711 */ 712 713 #define MANDMODE(mode) (((mode) & (VSGID|(VEXEC>>3))) == VSGID) 714 #define MANDLOCK(vp, mode) ((vp)->v_type == VREG && MANDMODE(mode)) 715 716 /* 717 * Flags for vnode operations. 718 */ 719 enum rm { RMFILE, RMDIRECTORY }; /* rm or rmdir (remove) */ 720 enum symfollow { NO_FOLLOW, FOLLOW }; /* follow symlinks (or not) */ 721 enum vcexcl { NONEXCL, EXCL }; /* (non)excl create */ 722 enum create { CRCREAT, CRMKNOD, CRMKDIR }; /* reason for create */ 723 724 typedef enum rm rm_t; 725 typedef enum symfollow symfollow_t; 726 typedef enum vcexcl vcexcl_t; 727 typedef enum create create_t; 728 729 /* Vnode Events - Used by VOP_VNEVENT */ 730 typedef enum vnevent { 731 VE_SUPPORT = 0, /* Query */ 732 VE_RENAME_SRC = 1, /* Rename, with vnode as source */ 733 VE_RENAME_DEST = 2, /* Rename, with vnode as target/destination */ 734 VE_REMOVE = 3, /* Remove of vnode's name */ 735 VE_RMDIR = 4, /* Remove of directory vnode's name */ 736 VE_CREATE = 5, /* Create with vnode's name which exists */ 737 VE_LINK = 6, /* Link with vnode's name as source */ 738 VE_RENAME_DEST_DIR = 7, /* Rename with vnode as target dir */ 739 VE_MOUNTEDOVER = 8, /* File or Filesystem got mounted over vnode */ 740 VE_TRUNCATE = 9 /* Truncate */ 741 } vnevent_t; 742 743 /* 744 * Values for checking vnode open and map counts 745 */ 746 enum v_mode { V_READ, V_WRITE, V_RDORWR, V_RDANDWR }; 747 748 typedef enum v_mode v_mode_t; 749 750 #define V_TRUE 1 751 #define V_FALSE 0 752 753 /* 754 * Structure used on VOP_GETSECATTR and VOP_SETSECATTR operations 755 */ 756 757 typedef struct vsecattr { 758 uint_t vsa_mask; /* See below */ 759 int vsa_aclcnt; /* ACL entry count */ 760 void *vsa_aclentp; /* pointer to ACL entries */ 761 int vsa_dfaclcnt; /* default ACL entry count */ 762 void *vsa_dfaclentp; /* pointer to default ACL entries */ 763 size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */ 764 uint_t vsa_aclflags; /* ACE ACL flags */ 765 } vsecattr_t; 766 767 /* vsa_mask values */ 768 #define VSA_ACL 0x0001 769 #define VSA_ACLCNT 0x0002 770 #define VSA_DFACL 0x0004 771 #define VSA_DFACLCNT 0x0008 772 #define VSA_ACE 0x0010 773 #define VSA_ACECNT 0x0020 774 #define VSA_ACE_ALLTYPES 0x0040 775 #define VSA_ACE_ACLFLAGS 0x0080 /* get/set ACE ACL flags */ 776 777 /* 778 * Structure used by various vnode operations to determine 779 * the context (pid, host, identity) of a caller. 780 * 781 * The cc_caller_id is used to identify one or more callers who invoke 782 * operations, possibly on behalf of others. For example, the NFS 783 * server could have it's own cc_caller_id which can be detected by 784 * vnode/vfs operations or (FEM) monitors on those operations. New 785 * caller IDs are generated by fs_new_caller_id(). 786 */ 787 typedef struct caller_context { 788 pid_t cc_pid; /* Process ID of the caller */ 789 int cc_sysid; /* System ID, used for remote calls */ 790 u_longlong_t cc_caller_id; /* Identifier for (set of) caller(s) */ 791 ulong_t cc_flags; 792 } caller_context_t; 793 794 /* 795 * Flags for caller context. The caller sets CC_DONTBLOCK if it does not 796 * want to block inside of a FEM monitor. The monitor will set CC_WOULDBLOCK 797 * and return EAGAIN if the operation would have blocked. 798 */ 799 #define CC_WOULDBLOCK 0x01 800 #define CC_DONTBLOCK 0x02 801 802 /* 803 * Structure tags for function prototypes, defined elsewhere. 804 */ 805 struct pathname; 806 struct fid; 807 struct flock64; 808 struct flk_callback; 809 struct shrlock; 810 struct page; 811 struct seg; 812 struct as; 813 struct pollhead; 814 struct taskq; 815 816 #if defined(_KERNEL) || defined(_FAKE_KERNEL) 817 818 /* 819 * VNODE_OPS defines all the vnode operations. It is used to define 820 * the vnodeops structure (below) and the fs_func_p union (vfs_opreg.h). 821 */ 822 #define VNODE_OPS \ 823 int (*vop_open)(vnode_t **, int, cred_t *, \ 824 caller_context_t *); \ 825 int (*vop_close)(vnode_t *, int, int, offset_t, cred_t *, \ 826 caller_context_t *); \ 827 int (*vop_read)(vnode_t *, uio_t *, int, cred_t *, \ 828 caller_context_t *); \ 829 int (*vop_write)(vnode_t *, uio_t *, int, cred_t *, \ 830 caller_context_t *); \ 831 int (*vop_ioctl)(vnode_t *, int, intptr_t, int, cred_t *, \ 832 int *, caller_context_t *); \ 833 int (*vop_setfl)(vnode_t *, int, int, cred_t *, \ 834 caller_context_t *); \ 835 int (*vop_getattr)(vnode_t *, vattr_t *, int, cred_t *, \ 836 caller_context_t *); \ 837 int (*vop_setattr)(vnode_t *, vattr_t *, int, cred_t *, \ 838 caller_context_t *); \ 839 int (*vop_access)(vnode_t *, int, int, cred_t *, \ 840 caller_context_t *); \ 841 int (*vop_lookup)(vnode_t *, char *, vnode_t **, \ 842 struct pathname *, \ 843 int, vnode_t *, cred_t *, \ 844 caller_context_t *, int *, \ 845 struct pathname *); \ 846 int (*vop_create)(vnode_t *, char *, vattr_t *, vcexcl_t, \ 847 int, vnode_t **, cred_t *, int, \ 848 caller_context_t *, vsecattr_t *); \ 849 int (*vop_remove)(vnode_t *, char *, cred_t *, \ 850 caller_context_t *, int); \ 851 int (*vop_link)(vnode_t *, vnode_t *, char *, cred_t *, \ 852 caller_context_t *, int); \ 853 int (*vop_rename)(vnode_t *, char *, vnode_t *, char *, \ 854 cred_t *, caller_context_t *, int); \ 855 int (*vop_mkdir)(vnode_t *, char *, vattr_t *, vnode_t **, \ 856 cred_t *, caller_context_t *, int, \ 857 vsecattr_t *); \ 858 int (*vop_rmdir)(vnode_t *, char *, vnode_t *, cred_t *, \ 859 caller_context_t *, int); \ 860 int (*vop_readdir)(vnode_t *, uio_t *, cred_t *, int *, \ 861 caller_context_t *, int); \ 862 int (*vop_symlink)(vnode_t *, char *, vattr_t *, char *, \ 863 cred_t *, caller_context_t *, int); \ 864 int (*vop_readlink)(vnode_t *, uio_t *, cred_t *, \ 865 caller_context_t *); \ 866 int (*vop_fsync)(vnode_t *, int, cred_t *, \ 867 caller_context_t *); \ 868 void (*vop_inactive)(vnode_t *, cred_t *, \ 869 caller_context_t *); \ 870 int (*vop_fid)(vnode_t *, struct fid *, \ 871 caller_context_t *); \ 872 int (*vop_rwlock)(vnode_t *, int, caller_context_t *); \ 873 void (*vop_rwunlock)(vnode_t *, int, caller_context_t *); \ 874 int (*vop_seek)(vnode_t *, offset_t, offset_t *, \ 875 caller_context_t *); \ 876 int (*vop_cmp)(vnode_t *, vnode_t *, caller_context_t *); \ 877 int (*vop_frlock)(vnode_t *, int, struct flock64 *, \ 878 int, offset_t, \ 879 struct flk_callback *, cred_t *, \ 880 caller_context_t *); \ 881 int (*vop_space)(vnode_t *, int, struct flock64 *, \ 882 int, offset_t, \ 883 cred_t *, caller_context_t *); \ 884 int (*vop_realvp)(vnode_t *, vnode_t **, \ 885 caller_context_t *); \ 886 int (*vop_getpage)(vnode_t *, offset_t, size_t, uint_t *, \ 887 struct page **, size_t, struct seg *, \ 888 caddr_t, enum seg_rw, cred_t *, \ 889 caller_context_t *); \ 890 int (*vop_putpage)(vnode_t *, offset_t, size_t, \ 891 int, cred_t *, caller_context_t *); \ 892 int (*vop_map)(vnode_t *, offset_t, struct as *, \ 893 caddr_t *, size_t, \ 894 uchar_t, uchar_t, uint_t, cred_t *, \ 895 caller_context_t *); \ 896 int (*vop_addmap)(vnode_t *, offset_t, struct as *, \ 897 caddr_t, size_t, \ 898 uchar_t, uchar_t, uint_t, cred_t *, \ 899 caller_context_t *); \ 900 int (*vop_delmap)(vnode_t *, offset_t, struct as *, \ 901 caddr_t, size_t, \ 902 uint_t, uint_t, uint_t, cred_t *, \ 903 caller_context_t *); \ 904 int (*vop_poll)(vnode_t *, short, int, short *, \ 905 struct pollhead **, \ 906 caller_context_t *); \ 907 int (*vop_dump)(vnode_t *, caddr_t, offset_t, offset_t, \ 908 caller_context_t *); \ 909 int (*vop_pathconf)(vnode_t *, int, ulong_t *, cred_t *, \ 910 caller_context_t *); \ 911 int (*vop_pageio)(vnode_t *, struct page *, \ 912 u_offset_t, size_t, int, cred_t *, \ 913 caller_context_t *); \ 914 int (*vop_dumpctl)(vnode_t *, int, offset_t *, \ 915 caller_context_t *); \ 916 void (*vop_dispose)(vnode_t *, struct page *, \ 917 int, int, cred_t *, \ 918 caller_context_t *); \ 919 int (*vop_setsecattr)(vnode_t *, vsecattr_t *, \ 920 int, cred_t *, caller_context_t *); \ 921 int (*vop_getsecattr)(vnode_t *, vsecattr_t *, \ 922 int, cred_t *, caller_context_t *); \ 923 int (*vop_shrlock)(vnode_t *, int, struct shrlock *, \ 924 int, cred_t *, caller_context_t *); \ 925 int (*vop_vnevent)(vnode_t *, vnevent_t, vnode_t *, \ 926 char *, caller_context_t *); \ 927 int (*vop_reqzcbuf)(vnode_t *, enum uio_rw, xuio_t *, \ 928 cred_t *, caller_context_t *); \ 929 int (*vop_retzcbuf)(vnode_t *, xuio_t *, cred_t *, \ 930 caller_context_t *) 931 /* NB: No ";" */ 932 933 /* 934 * Operations on vnodes. Note: File systems must never operate directly 935 * on a 'vnodeops' structure -- it WILL change in future releases! They 936 * must use vn_make_ops() to create the structure. 937 */ 938 typedef struct vnodeops { 939 const char *vnop_name; 940 VNODE_OPS; /* Signatures of all vnode operations (vops) */ 941 } vnodeops_t; 942 943 typedef int (*fs_generic_func_p) (); /* Generic vop/vfsop/femop/fsemop ptr */ 944 945 extern int fop_open(vnode_t **, int, cred_t *, caller_context_t *); 946 extern int fop_close(vnode_t *, int, int, offset_t, cred_t *, 947 caller_context_t *); 948 extern int fop_read(vnode_t *, uio_t *, int, cred_t *, caller_context_t *); 949 extern int fop_write(vnode_t *, uio_t *, int, cred_t *, 950 caller_context_t *); 951 extern int fop_ioctl(vnode_t *, int, intptr_t, int, cred_t *, int *, 952 caller_context_t *); 953 extern int fop_setfl(vnode_t *, int, int, cred_t *, caller_context_t *); 954 extern int fop_getattr(vnode_t *, vattr_t *, int, cred_t *, 955 caller_context_t *); 956 extern int fop_setattr(vnode_t *, vattr_t *, int, cred_t *, 957 caller_context_t *); 958 extern int fop_access(vnode_t *, int, int, cred_t *, caller_context_t *); 959 extern int fop_lookup(vnode_t *, char *, vnode_t **, struct pathname *, 960 int, vnode_t *, cred_t *, caller_context_t *, 961 int *, struct pathname *); 962 extern int fop_create(vnode_t *, char *, vattr_t *, vcexcl_t, int, 963 vnode_t **, cred_t *, int, caller_context_t *, 964 vsecattr_t *); 965 extern int fop_remove(vnode_t *vp, char *, cred_t *, caller_context_t *, 966 int); 967 extern int fop_link(vnode_t *, vnode_t *, char *, cred_t *, 968 caller_context_t *, int); 969 extern int fop_rename(vnode_t *, char *, vnode_t *, char *, cred_t *, 970 caller_context_t *, int); 971 extern int fop_mkdir(vnode_t *, char *, vattr_t *, vnode_t **, cred_t *, 972 caller_context_t *, int, vsecattr_t *); 973 extern int fop_rmdir(vnode_t *, char *, vnode_t *, cred_t *, 974 caller_context_t *, int); 975 extern int fop_readdir(vnode_t *, uio_t *, cred_t *, int *, 976 caller_context_t *, int); 977 extern int fop_symlink(vnode_t *, char *, vattr_t *, char *, cred_t *, 978 caller_context_t *, int); 979 extern int fop_readlink(vnode_t *, uio_t *, cred_t *, caller_context_t *); 980 extern int fop_fsync(vnode_t *, int, cred_t *, caller_context_t *); 981 extern void fop_inactive(vnode_t *, cred_t *, caller_context_t *); 982 extern int fop_fid(vnode_t *, struct fid *, caller_context_t *); 983 extern int fop_rwlock(vnode_t *, int, caller_context_t *); 984 extern void fop_rwunlock(vnode_t *, int, caller_context_t *); 985 extern int fop_seek(vnode_t *, offset_t, offset_t *, caller_context_t *); 986 extern int fop_cmp(vnode_t *, vnode_t *, caller_context_t *); 987 extern int fop_frlock(vnode_t *, int, struct flock64 *, int, offset_t, 988 struct flk_callback *, cred_t *, 989 caller_context_t *); 990 extern int fop_space(vnode_t *, int, struct flock64 *, int, offset_t, 991 cred_t *, caller_context_t *); 992 extern int fop_realvp(vnode_t *, vnode_t **, caller_context_t *); 993 extern int fop_getpage(vnode_t *, offset_t, size_t, uint_t *, 994 struct page **, size_t, struct seg *, 995 caddr_t, enum seg_rw, cred_t *, 996 caller_context_t *); 997 extern int fop_putpage(vnode_t *, offset_t, size_t, int, cred_t *, 998 caller_context_t *); 999 extern int fop_map(vnode_t *, offset_t, struct as *, caddr_t *, size_t, 1000 uchar_t, uchar_t, uint_t, cred_t *cr, 1001 caller_context_t *); 1002 extern int fop_addmap(vnode_t *, offset_t, struct as *, caddr_t, size_t, 1003 uchar_t, uchar_t, uint_t, cred_t *, 1004 caller_context_t *); 1005 extern int fop_delmap(vnode_t *, offset_t, struct as *, caddr_t, size_t, 1006 uint_t, uint_t, uint_t, cred_t *, 1007 caller_context_t *); 1008 extern int fop_poll(vnode_t *, short, int, short *, struct pollhead **, 1009 caller_context_t *); 1010 extern int fop_dump(vnode_t *, caddr_t, offset_t, offset_t, 1011 caller_context_t *); 1012 extern int fop_pathconf(vnode_t *, int, ulong_t *, cred_t *, 1013 caller_context_t *); 1014 extern int fop_pageio(vnode_t *, struct page *, u_offset_t, size_t, int, 1015 cred_t *, caller_context_t *); 1016 extern int fop_dumpctl(vnode_t *, int, offset_t *, caller_context_t *); 1017 extern void fop_dispose(vnode_t *, struct page *, int, int, cred_t *, 1018 caller_context_t *); 1019 extern int fop_setsecattr(vnode_t *, vsecattr_t *, int, cred_t *, 1020 caller_context_t *); 1021 extern int fop_getsecattr(vnode_t *, vsecattr_t *, int, cred_t *, 1022 caller_context_t *); 1023 extern int fop_shrlock(vnode_t *, int, struct shrlock *, int, cred_t *, 1024 caller_context_t *); 1025 extern int fop_vnevent(vnode_t *, vnevent_t, vnode_t *, char *, 1026 caller_context_t *); 1027 extern int fop_reqzcbuf(vnode_t *, enum uio_rw, xuio_t *, cred_t *, 1028 caller_context_t *); 1029 extern int fop_retzcbuf(vnode_t *, xuio_t *, cred_t *, caller_context_t *); 1030 1031 #endif /* _KERNEL */ 1032 1033 #define VOP_OPEN(vpp, mode, cr, ct) \ 1034 fop_open(vpp, mode, cr, ct) 1035 #define VOP_CLOSE(vp, f, c, o, cr, ct) \ 1036 fop_close(vp, f, c, o, cr, ct) 1037 #define VOP_READ(vp, uiop, iof, cr, ct) \ 1038 fop_read(vp, uiop, iof, cr, ct) 1039 #define VOP_WRITE(vp, uiop, iof, cr, ct) \ 1040 fop_write(vp, uiop, iof, cr, ct) 1041 #define VOP_IOCTL(vp, cmd, a, f, cr, rvp, ct) \ 1042 fop_ioctl(vp, cmd, a, f, cr, rvp, ct) 1043 #define VOP_SETFL(vp, f, a, cr, ct) \ 1044 fop_setfl(vp, f, a, cr, ct) 1045 #define VOP_GETATTR(vp, vap, f, cr, ct) \ 1046 fop_getattr(vp, vap, f, cr, ct) 1047 #define VOP_SETATTR(vp, vap, f, cr, ct) \ 1048 fop_setattr(vp, vap, f, cr, ct) 1049 #define VOP_ACCESS(vp, mode, f, cr, ct) \ 1050 fop_access(vp, mode, f, cr, ct) 1051 #define VOP_LOOKUP(vp, cp, vpp, pnp, f, rdir, cr, ct, defp, rpnp) \ 1052 fop_lookup(vp, cp, vpp, pnp, f, rdir, cr, ct, defp, rpnp) 1053 #define VOP_CREATE(dvp, p, vap, ex, mode, vpp, cr, flag, ct, vsap) \ 1054 fop_create(dvp, p, vap, ex, mode, vpp, cr, flag, ct, vsap) 1055 #define VOP_REMOVE(dvp, p, cr, ct, f) \ 1056 fop_remove(dvp, p, cr, ct, f) 1057 #define VOP_LINK(tdvp, fvp, p, cr, ct, f) \ 1058 fop_link(tdvp, fvp, p, cr, ct, f) 1059 #define VOP_RENAME(fvp, fnm, tdvp, tnm, cr, ct, f) \ 1060 fop_rename(fvp, fnm, tdvp, tnm, cr, ct, f) 1061 #define VOP_MKDIR(dp, p, vap, vpp, cr, ct, f, vsap) \ 1062 fop_mkdir(dp, p, vap, vpp, cr, ct, f, vsap) 1063 #define VOP_RMDIR(dp, p, cdir, cr, ct, f) \ 1064 fop_rmdir(dp, p, cdir, cr, ct, f) 1065 #define VOP_READDIR(vp, uiop, cr, eofp, ct, f) \ 1066 fop_readdir(vp, uiop, cr, eofp, ct, f) 1067 #define VOP_SYMLINK(dvp, lnm, vap, tnm, cr, ct, f) \ 1068 fop_symlink(dvp, lnm, vap, tnm, cr, ct, f) 1069 #define VOP_READLINK(vp, uiop, cr, ct) \ 1070 fop_readlink(vp, uiop, cr, ct) 1071 #define VOP_FSYNC(vp, syncflag, cr, ct) \ 1072 fop_fsync(vp, syncflag, cr, ct) 1073 #define VOP_INACTIVE(vp, cr, ct) \ 1074 fop_inactive(vp, cr, ct) 1075 #define VOP_FID(vp, fidp, ct) \ 1076 fop_fid(vp, fidp, ct) 1077 #define VOP_RWLOCK(vp, w, ct) \ 1078 fop_rwlock(vp, w, ct) 1079 #define VOP_RWUNLOCK(vp, w, ct) \ 1080 fop_rwunlock(vp, w, ct) 1081 #define VOP_SEEK(vp, ooff, noffp, ct) \ 1082 fop_seek(vp, ooff, noffp, ct) 1083 #define VOP_CMP(vp1, vp2, ct) \ 1084 fop_cmp(vp1, vp2, ct) 1085 #define VOP_FRLOCK(vp, cmd, a, f, o, cb, cr, ct) \ 1086 fop_frlock(vp, cmd, a, f, o, cb, cr, ct) 1087 #define VOP_SPACE(vp, cmd, a, f, o, cr, ct) \ 1088 fop_space(vp, cmd, a, f, o, cr, ct) 1089 #define VOP_REALVP(vp1, vp2, ct) \ 1090 fop_realvp(vp1, vp2, ct) 1091 #define VOP_GETPAGE(vp, of, sz, pr, pl, ps, sg, a, rw, cr, ct) \ 1092 fop_getpage(vp, of, sz, pr, pl, ps, sg, a, rw, cr, ct) 1093 #define VOP_PUTPAGE(vp, of, sz, fl, cr, ct) \ 1094 fop_putpage(vp, of, sz, fl, cr, ct) 1095 #define VOP_MAP(vp, of, as, a, sz, p, mp, fl, cr, ct) \ 1096 fop_map(vp, of, as, a, sz, p, mp, fl, cr, ct) 1097 #define VOP_ADDMAP(vp, of, as, a, sz, p, mp, fl, cr, ct) \ 1098 fop_addmap(vp, of, as, a, sz, p, mp, fl, cr, ct) 1099 #define VOP_DELMAP(vp, of, as, a, sz, p, mp, fl, cr, ct) \ 1100 fop_delmap(vp, of, as, a, sz, p, mp, fl, cr, ct) 1101 #define VOP_POLL(vp, events, anyyet, reventsp, phpp, ct) \ 1102 fop_poll(vp, events, anyyet, reventsp, phpp, ct) 1103 #define VOP_DUMP(vp, addr, bn, count, ct) \ 1104 fop_dump(vp, addr, bn, count, ct) 1105 #define VOP_PATHCONF(vp, cmd, valp, cr, ct) \ 1106 fop_pathconf(vp, cmd, valp, cr, ct) 1107 #define VOP_PAGEIO(vp, pp, io_off, io_len, flags, cr, ct) \ 1108 fop_pageio(vp, pp, io_off, io_len, flags, cr, ct) 1109 #define VOP_DUMPCTL(vp, action, blkp, ct) \ 1110 fop_dumpctl(vp, action, blkp, ct) 1111 #define VOP_DISPOSE(vp, pp, flag, dn, cr, ct) \ 1112 fop_dispose(vp, pp, flag, dn, cr, ct) 1113 #define VOP_GETSECATTR(vp, vsap, f, cr, ct) \ 1114 fop_getsecattr(vp, vsap, f, cr, ct) 1115 #define VOP_SETSECATTR(vp, vsap, f, cr, ct) \ 1116 fop_setsecattr(vp, vsap, f, cr, ct) 1117 #define VOP_SHRLOCK(vp, cmd, shr, f, cr, ct) \ 1118 fop_shrlock(vp, cmd, shr, f, cr, ct) 1119 #define VOP_VNEVENT(vp, vnevent, dvp, fnm, ct) \ 1120 fop_vnevent(vp, vnevent, dvp, fnm, ct) 1121 #define VOP_REQZCBUF(vp, rwflag, xuiop, cr, ct) \ 1122 fop_reqzcbuf(vp, rwflag, xuiop, cr, ct) 1123 #define VOP_RETZCBUF(vp, xuiop, cr, ct) \ 1124 fop_retzcbuf(vp, xuiop, cr, ct) 1125 1126 #define VOPNAME_OPEN "open" 1127 #define VOPNAME_CLOSE "close" 1128 #define VOPNAME_READ "read" 1129 #define VOPNAME_WRITE "write" 1130 #define VOPNAME_IOCTL "ioctl" 1131 #define VOPNAME_SETFL "setfl" 1132 #define VOPNAME_GETATTR "getattr" 1133 #define VOPNAME_SETATTR "setattr" 1134 #define VOPNAME_ACCESS "access" 1135 #define VOPNAME_LOOKUP "lookup" 1136 #define VOPNAME_CREATE "create" 1137 #define VOPNAME_REMOVE "remove" 1138 #define VOPNAME_LINK "link" 1139 #define VOPNAME_RENAME "rename" 1140 #define VOPNAME_MKDIR "mkdir" 1141 #define VOPNAME_RMDIR "rmdir" 1142 #define VOPNAME_READDIR "readdir" 1143 #define VOPNAME_SYMLINK "symlink" 1144 #define VOPNAME_READLINK "readlink" 1145 #define VOPNAME_FSYNC "fsync" 1146 #define VOPNAME_INACTIVE "inactive" 1147 #define VOPNAME_FID "fid" 1148 #define VOPNAME_RWLOCK "rwlock" 1149 #define VOPNAME_RWUNLOCK "rwunlock" 1150 #define VOPNAME_SEEK "seek" 1151 #define VOPNAME_CMP "cmp" 1152 #define VOPNAME_FRLOCK "frlock" 1153 #define VOPNAME_SPACE "space" 1154 #define VOPNAME_REALVP "realvp" 1155 #define VOPNAME_GETPAGE "getpage" 1156 #define VOPNAME_PUTPAGE "putpage" 1157 #define VOPNAME_MAP "map" 1158 #define VOPNAME_ADDMAP "addmap" 1159 #define VOPNAME_DELMAP "delmap" 1160 #define VOPNAME_POLL "poll" 1161 #define VOPNAME_DUMP "dump" 1162 #define VOPNAME_PATHCONF "pathconf" 1163 #define VOPNAME_PAGEIO "pageio" 1164 #define VOPNAME_DUMPCTL "dumpctl" 1165 #define VOPNAME_DISPOSE "dispose" 1166 #define VOPNAME_GETSECATTR "getsecattr" 1167 #define VOPNAME_SETSECATTR "setsecattr" 1168 #define VOPNAME_SHRLOCK "shrlock" 1169 #define VOPNAME_VNEVENT "vnevent" 1170 #define VOPNAME_REQZCBUF "reqzcbuf" 1171 #define VOPNAME_RETZCBUF "retzcbuf" 1172 1173 /* 1174 * Flags for VOP_LOOKUP 1175 * 1176 * Defined in file.h, but also possible, FIGNORECASE and FSEARCH 1177 * 1178 */ 1179 #define LOOKUP_DIR 0x01 /* want parent dir vp */ 1180 #define LOOKUP_XATTR 0x02 /* lookup up extended attr dir */ 1181 #define CREATE_XATTR_DIR 0x04 /* Create extended attr dir */ 1182 #define LOOKUP_HAVE_SYSATTR_DIR 0x08 /* Already created virtual GFS dir */ 1183 1184 /* 1185 * Flags for VOP_READDIR 1186 */ 1187 #define V_RDDIR_ENTFLAGS 0x01 /* request dirent flags */ 1188 #define V_RDDIR_ACCFILTER 0x02 /* filter out inaccessible dirents */ 1189 1190 /* 1191 * Flags for VOP_RWLOCK/VOP_RWUNLOCK 1192 * VOP_RWLOCK will return the flag that was actually set, or -1 if none. 1193 */ 1194 #define V_WRITELOCK_TRUE (1) /* Request write-lock on the vnode */ 1195 #define V_WRITELOCK_FALSE (0) /* Request read-lock on the vnode */ 1196 1197 /* 1198 * Flags for VOP_DUMPCTL 1199 */ 1200 #define DUMP_ALLOC 0 1201 #define DUMP_FREE 1 1202 #define DUMP_SCAN 2 1203 1204 /* 1205 * Public vnode manipulation functions. 1206 */ 1207 #if defined(_KERNEL) || defined(_FAKE_KERNEL) 1208 1209 vnode_t *vn_alloc(int); 1210 void vn_reinit(vnode_t *); 1211 void vn_recycle(vnode_t *); 1212 void vn_free(vnode_t *); 1213 1214 int vn_is_readonly(vnode_t *); 1215 int vn_is_opened(vnode_t *, v_mode_t); 1216 int vn_is_mapped(vnode_t *, v_mode_t); 1217 int vn_has_other_opens(vnode_t *, v_mode_t); 1218 void vn_open_upgrade(vnode_t *, int); 1219 void vn_open_downgrade(vnode_t *, int); 1220 1221 int vn_can_change_zones(vnode_t *vp); 1222 1223 int vn_has_flocks(vnode_t *); 1224 int vn_has_mandatory_locks(vnode_t *, int); 1225 int vn_has_cached_data(vnode_t *); 1226 1227 void vn_setops(vnode_t *, vnodeops_t *); 1228 vnodeops_t *vn_getops(vnode_t *); 1229 int vn_matchops(vnode_t *, vnodeops_t *); 1230 int vn_matchopval(vnode_t *, char *, fs_generic_func_p); 1231 int vn_ismntpt(vnode_t *); 1232 1233 struct vfs *vn_mountedvfs(vnode_t *); 1234 1235 int vn_in_dnlc(vnode_t *); 1236 1237 void vn_create_cache(void); 1238 void vn_destroy_cache(void); 1239 1240 void vn_freevnodeops(vnodeops_t *); 1241 1242 int vn_open(char *pnamep, enum uio_seg seg, int filemode, int createmode, 1243 struct vnode **vpp, enum create crwhy, mode_t umask); 1244 int vn_openat(char *pnamep, enum uio_seg seg, int filemode, int createmode, 1245 struct vnode **vpp, enum create crwhy, 1246 mode_t umask, struct vnode *startvp, int fd); 1247 int vn_create(char *pnamep, enum uio_seg seg, struct vattr *vap, 1248 enum vcexcl excl, int mode, struct vnode **vpp, 1249 enum create why, int flag, mode_t umask); 1250 int vn_createat(char *pnamep, enum uio_seg seg, struct vattr *vap, 1251 enum vcexcl excl, int mode, struct vnode **vpp, 1252 enum create why, int flag, mode_t umask, struct vnode *startvp); 1253 int vn_rdwr(enum uio_rw rw, struct vnode *vp, caddr_t base, ssize_t len, 1254 offset_t offset, enum uio_seg seg, int ioflag, rlim64_t ulimit, 1255 cred_t *cr, ssize_t *residp); 1256 1257 void vn_hold(struct vnode *vp); 1258 void vn_rele(struct vnode *vp); 1259 void vn_rele_async(struct vnode *vp, struct taskq *taskq); 1260 void vn_rele_dnlc(struct vnode *vp); 1261 void vn_rele_stream(struct vnode *vp); 1262 int vn_link(char *from, char *to, enum uio_seg seg); 1263 int vn_linkat(vnode_t *fstartvp, char *from, enum symfollow follow, 1264 vnode_t *tstartvp, char *to, enum uio_seg seg); 1265 int vn_rename(char *from, char *to, enum uio_seg seg); 1266 int vn_renameat(vnode_t *fdvp, char *fname, vnode_t *tdvp, char *tname, 1267 enum uio_seg seg); 1268 int vn_remove(char *fnamep, enum uio_seg seg, enum rm dirflag); 1269 int vn_removeat(vnode_t *startvp, char *fnamep, enum uio_seg seg, 1270 enum rm dirflag); 1271 int vn_compare(vnode_t *vp1, vnode_t *vp2); 1272 int vn_vfswlock(struct vnode *vp); 1273 int vn_vfswlock_wait(struct vnode *vp); 1274 int vn_vfsrlock(struct vnode *vp); 1275 int vn_vfsrlock_wait(struct vnode *vp); 1276 void vn_vfsunlock(struct vnode *vp); 1277 int vn_vfswlock_held(struct vnode *vp); 1278 vnode_t *specvp(struct vnode *vp, dev_t dev, vtype_t type, struct cred *cr); 1279 vnode_t *makespecvp(dev_t dev, vtype_t type); 1280 1281 #if defined(_KERNEL) 1282 vn_vfslocks_entry_t *vn_vfslocks_getlock(void *); 1283 void vn_vfslocks_rele(vn_vfslocks_entry_t *); 1284 #endif 1285 1286 boolean_t vn_is_reparse(vnode_t *, cred_t *, caller_context_t *); 1287 1288 void vn_copypath(struct vnode *src, struct vnode *dst); 1289 void vn_setpath_str(struct vnode *vp, const char *str, size_t len); 1290 void vn_setpath(vnode_t *rootvp, struct vnode *startvp, struct vnode *vp, 1291 const char *path, size_t plen); 1292 void vn_renamepath(vnode_t *dvp, vnode_t *vp, const char *nm, size_t len); 1293 1294 /* Vnode event notification */ 1295 void vnevent_rename_src(vnode_t *, vnode_t *, char *, caller_context_t *); 1296 void vnevent_rename_dest(vnode_t *, vnode_t *, char *, caller_context_t *); 1297 void vnevent_remove(vnode_t *, vnode_t *, char *, caller_context_t *); 1298 void vnevent_rmdir(vnode_t *, vnode_t *, char *, caller_context_t *); 1299 void vnevent_create(vnode_t *, caller_context_t *); 1300 void vnevent_link(vnode_t *, caller_context_t *); 1301 void vnevent_rename_dest_dir(vnode_t *, caller_context_t *ct); 1302 void vnevent_mountedover(vnode_t *, caller_context_t *); 1303 void vnevent_truncate(vnode_t *, caller_context_t *); 1304 int vnevent_support(vnode_t *, caller_context_t *); 1305 1306 /* Vnode specific data */ 1307 void vsd_create(uint_t *, void (*)(void *)); 1308 void vsd_destroy(uint_t *); 1309 void *vsd_get(vnode_t *, uint_t); 1310 int vsd_set(vnode_t *, uint_t, void *); 1311 void vsd_free(vnode_t *); 1312 1313 /* 1314 * Extensible vnode attribute (xva) routines: 1315 * xva_init() initializes an xvattr_t (zero struct, init mapsize, set AT_XATTR) 1316 * xva_getxoptattr() returns a ponter to the xoptattr_t section of xvattr_t 1317 */ 1318 void xva_init(xvattr_t *); 1319 xoptattr_t *xva_getxoptattr(xvattr_t *); /* Get ptr to xoptattr_t */ 1320 1321 void xattr_init(void); /* Initialize vnodeops for xattrs */ 1322 1323 /* GFS tunnel for xattrs */ 1324 int xattr_dir_lookup(vnode_t *, vnode_t **, int, cred_t *); 1325 1326 /* Reparse Point */ 1327 void reparse_point_init(void); 1328 1329 /* Context identification */ 1330 u_longlong_t fs_new_caller_id(); 1331 1332 int vn_vmpss_usepageio(vnode_t *); 1333 1334 /* Empty v_path placeholder */ 1335 extern char *vn_vpath_empty; 1336 1337 /* 1338 * Needed for use of IS_VMODSORT() in kernel. 1339 */ 1340 extern uint_t pvn_vmodsort_supported; 1341 1342 #define VN_HOLD(vp) { \ 1343 vn_hold(vp); \ 1344 } 1345 1346 #define VN_RELE(vp) { \ 1347 vn_rele(vp); \ 1348 } 1349 1350 #define VN_RELE_ASYNC(vp, taskq) { \ 1351 vn_rele_async(vp, taskq); \ 1352 } 1353 1354 #define VN_RELE_LOCKED(vp) { \ 1355 (vp)->v_count--; \ 1356 } 1357 1358 #define VN_SET_VFS_TYPE_DEV(vp, vfsp, type, dev) { \ 1359 (vp)->v_vfsp = (vfsp); \ 1360 (vp)->v_type = (type); \ 1361 (vp)->v_rdev = (dev); \ 1362 } 1363 1364 /* 1365 * Compare two vnodes for equality. In general this macro should be used 1366 * in preference to calling VOP_CMP directly. 1367 */ 1368 #if defined(_FAKE_KERNEL) 1369 #define VN_CMP(VP1, VP2) \ 1370 (((VP1) == (VP2)) ? 1 : VOP_CMP(VP1, VP2, NULL)) 1371 #else 1372 #define VN_CMP(VP1, VP2) ((VP1) == (VP2) ? 1 : \ 1373 ((VP1) && (VP2) && (vn_getops(VP1) == vn_getops(VP2)) ? \ 1374 VOP_CMP(VP1, VP2, NULL) : 0)) 1375 #endif 1376 1377 /* 1378 * Some well-known global vnodes used by the VM system to name pages. 1379 */ 1380 extern struct vnode kvps[]; 1381 1382 typedef enum { 1383 KV_KVP, /* vnode for all segkmem pages */ 1384 KV_ZVP, /* vnode for all ZFS pages */ 1385 #if defined(__sparc) 1386 KV_MPVP, /* vnode for all page_t meta-pages */ 1387 KV_PROMVP, /* vnode for all PROM pages */ 1388 #endif /* __sparc */ 1389 KV_MAX /* total number of vnodes in kvps[] */ 1390 } kvps_index_t; 1391 1392 #define VN_ISKAS(vp) ((vp) >= &kvps[0] && (vp) < &kvps[KV_MAX]) 1393 1394 #endif /* _KERNEL */ 1395 1396 /* 1397 * Flags to VOP_SETATTR/VOP_GETATTR. 1398 */ 1399 #define ATTR_UTIME 0x01 /* non-default utime(2) request */ 1400 #define ATTR_EXEC 0x02 /* invocation from exec(2) */ 1401 #define ATTR_COMM 0x04 /* yield common vp attributes */ 1402 #define ATTR_HINT 0x08 /* information returned will be `hint' */ 1403 #define ATTR_REAL 0x10 /* yield attributes of the real vp */ 1404 #define ATTR_NOACLCHECK 0x20 /* Don't check ACL when checking permissions */ 1405 #define ATTR_TRIGGER 0x40 /* Mount first if vnode is a trigger mount */ 1406 /* 1407 * Generally useful macros. 1408 */ 1409 #define VBSIZE(vp) ((vp)->v_vfsp->vfs_bsize) 1410 1411 #define VTOZONE(vp) ((vp)->v_vfsp->vfs_zone) 1412 1413 #define NULLVP ((struct vnode *)0) 1414 #define NULLVPP ((struct vnode **)0) 1415 1416 #ifdef _KERNEL 1417 1418 /* 1419 * Structure used while handling asynchronous VOP_PUTPAGE operations. 1420 */ 1421 struct async_reqs { 1422 struct async_reqs *a_next; /* pointer to next arg struct */ 1423 struct vnode *a_vp; /* vnode pointer */ 1424 u_offset_t a_off; /* offset in file */ 1425 uint_t a_len; /* size of i/o request */ 1426 int a_flags; /* flags to indicate operation type */ 1427 struct cred *a_cred; /* cred pointer */ 1428 ushort_t a_prealloced; /* set if struct is pre-allocated */ 1429 }; 1430 1431 /* 1432 * VN_DISPOSE() -- given a page pointer, safely invoke VOP_DISPOSE(). 1433 * Note that there is no guarantee that the page passed in will be 1434 * freed. If that is required, then a check after calling VN_DISPOSE would 1435 * be necessary to ensure the page was freed. 1436 */ 1437 #define VN_DISPOSE(pp, flag, dn, cr) { \ 1438 if ((pp)->p_vnode != NULL && !VN_ISKAS((pp)->p_vnode)) \ 1439 VOP_DISPOSE((pp)->p_vnode, (pp), (flag), (dn), (cr), NULL); \ 1440 else if ((flag) == B_FREE) \ 1441 page_free((pp), (dn)); \ 1442 else \ 1443 page_destroy((pp), (dn)); \ 1444 } 1445 1446 #endif /* _KERNEL */ 1447 1448 #ifdef __cplusplus 1449 } 1450 #endif 1451 1452 #endif /* _SYS_VNODE_H */ 1453