1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 27 /* All Rights Reserved */ 28 29 /* 30 * University Copyright- Copyright (c) 1982, 1986, 1988 31 * The Regents of the University of California 32 * All Rights Reserved 33 * 34 * University Acknowledgment- Portions of this document are derived from 35 * software developed by the University of California, Berkeley, and its 36 * contributors. 37 */ 38 39 #ifndef _SYS_VNODE_H 40 #define _SYS_VNODE_H 41 42 #pragma ident "%Z%%M% %I% %E% SMI" 43 44 #include <sys/types.h> 45 #include <sys/t_lock.h> 46 #include <sys/rwstlock.h> 47 #include <sys/time_impl.h> 48 #include <sys/cred.h> 49 #include <sys/uio.h> 50 #include <sys/resource.h> 51 #include <vm/seg_enum.h> 52 #include <sys/kstat.h> 53 #include <sys/kmem.h> 54 #ifdef _KERNEL 55 #include <sys/buf.h> 56 #endif /* _KERNEL */ 57 58 #ifdef __cplusplus 59 extern "C" { 60 #endif 61 62 63 typedef int (*fs_generic_func_p) (); 64 65 /* 66 * File systems use arrays of fs_operation_def structures to form 67 * name/value pairs of operations. These arrays get passed to: 68 * 69 * - vn_make_ops() to create vnodeops 70 * - vfs_makefsops()/vfs_setfsops() to create vfsops. 71 */ 72 typedef struct fs_operation_def { 73 char *name; /* name of operation (NULL at end) */ 74 fs_generic_func_p func; /* function implementing operation */ 75 } fs_operation_def_t; 76 77 /* 78 * The operation registration mechanism uses two master tables of operations: 79 * one for vnode operations (vn_ops_table[]) and one for vfs operations 80 * (vfs_ops_table[]). These tables are arrays of fs_operation_trans_def 81 * structures. They contain all of the information necessary for the system 82 * to populate an operations structure (e.g., vnodeops, vfsops). 83 * 84 * File systems call registration routines (vfs_setfsops(), vfs_makefsops(), 85 * and vn_make_ops()) and pass in their operations specification tables 86 * (arrays of fs_operation_def structures). These routines use the master 87 * table(s) of operations to build a vnodeops or vfsops structure. 88 */ 89 typedef struct fs_operation_trans_def { 90 char *name; /* name of operation (NULL at end) */ 91 int offset; /* byte offset within ops vector */ 92 fs_generic_func_p defaultFunc; /* default function */ 93 fs_generic_func_p errorFunc; /* error function */ 94 } fs_operation_trans_def_t; 95 96 97 /* 98 * Statistics for all vnode operations. 99 * All operations record number of ops (since boot/mount/zero'ed). 100 * Certain I/O operations (read, write, readdir) also record number 101 * of bytes transferred. 102 * This appears in two places in the system: one is embedded in each 103 * vfs_t. There is also an array of vopstats_t structures allocated 104 * on a per-fstype basis. 105 */ 106 107 #define VOPSTATS_STR "vopstats_" /* Initial string for vopstat kstats */ 108 109 typedef struct vopstats { 110 kstat_named_t nopen; /* VOP_OPEN */ 111 kstat_named_t nclose; /* VOP_CLOSE */ 112 kstat_named_t nread; /* VOP_READ */ 113 kstat_named_t read_bytes; 114 kstat_named_t nwrite; /* VOP_WRITE */ 115 kstat_named_t write_bytes; 116 kstat_named_t nioctl; /* VOP_IOCTL */ 117 kstat_named_t nsetfl; /* VOP_SETFL */ 118 kstat_named_t ngetattr; /* VOP_GETATTR */ 119 kstat_named_t nsetattr; /* VOP_SETATTR */ 120 kstat_named_t naccess; /* VOP_ACCESS */ 121 kstat_named_t nlookup; /* VOP_LOOKUP */ 122 kstat_named_t ncreate; /* VOP_CREATE */ 123 kstat_named_t nremove; /* VOP_REMOVE */ 124 kstat_named_t nlink; /* VOP_LINK */ 125 kstat_named_t nrename; /* VOP_RENAME */ 126 kstat_named_t nmkdir; /* VOP_MKDIR */ 127 kstat_named_t nrmdir; /* VOP_RMDIR */ 128 kstat_named_t nreaddir; /* VOP_READDIR */ 129 kstat_named_t readdir_bytes; 130 kstat_named_t nsymlink; /* VOP_SYMLINK */ 131 kstat_named_t nreadlink; /* VOP_READLINK */ 132 kstat_named_t nfsync; /* VOP_FSYNC */ 133 kstat_named_t ninactive; /* VOP_INACTIVE */ 134 kstat_named_t nfid; /* VOP_FID */ 135 kstat_named_t nrwlock; /* VOP_RWLOCK */ 136 kstat_named_t nrwunlock; /* VOP_RWUNLOCK */ 137 kstat_named_t nseek; /* VOP_SEEK */ 138 kstat_named_t ncmp; /* VOP_CMP */ 139 kstat_named_t nfrlock; /* VOP_FRLOCK */ 140 kstat_named_t nspace; /* VOP_SPACE */ 141 kstat_named_t nrealvp; /* VOP_REALVP */ 142 kstat_named_t ngetpage; /* VOP_GETPAGE */ 143 kstat_named_t nputpage; /* VOP_PUTPAGE */ 144 kstat_named_t nmap; /* VOP_MAP */ 145 kstat_named_t naddmap; /* VOP_ADDMAP */ 146 kstat_named_t ndelmap; /* VOP_DELMAP */ 147 kstat_named_t npoll; /* VOP_POLL */ 148 kstat_named_t ndump; /* VOP_DUMP */ 149 kstat_named_t npathconf; /* VOP_PATHCONF */ 150 kstat_named_t npageio; /* VOP_PAGEIO */ 151 kstat_named_t ndumpctl; /* VOP_DUMPCTL */ 152 kstat_named_t ndispose; /* VOP_DISPOSE */ 153 kstat_named_t nsetsecattr; /* VOP_SETSECATTR */ 154 kstat_named_t ngetsecattr; /* VOP_GETSECATTR */ 155 kstat_named_t nshrlock; /* VOP_SHRLOCK */ 156 kstat_named_t nvnevent; /* VOP_VNEVENT */ 157 } vopstats_t; 158 159 /* 160 * The vnode is the focus of all file activity in UNIX. 161 * A vnode is allocated for each active file, each current 162 * directory, each mounted-on file, and the root. 163 * 164 * Each vnode is usually associated with a file-system-specific node (for 165 * UFS, this is the in-memory inode). Generally, a vnode and an fs-node 166 * should be created and destroyed together as a pair. 167 * 168 * If a vnode is reused for a new file, it should be reinitialized by calling 169 * either vn_reinit() or vn_recycle(). 170 * 171 * vn_reinit() resets the entire vnode as if it was returned by vn_alloc(). 172 * The caller is responsible for setting up the entire vnode after calling 173 * vn_reinit(). This is important when using kmem caching where the vnode is 174 * allocated by a constructor, for instance. 175 * 176 * vn_recycle() is used when the file system keeps some state around in both 177 * the vnode and the associated FS-node. In UFS, for example, the inode of 178 * a deleted file can be reused immediately. The v_data, v_vfsp, v_op, etc. 179 * remains the same but certain fields related to the previous instance need 180 * to be reset. In particular: 181 * v_femhead 182 * v_path 183 * v_rdcnt, v_wrcnt 184 * v_mmap_read, v_mmap_write 185 */ 186 187 /* 188 * vnode types. VNON means no type. These values are unrelated to 189 * values in on-disk inodes. 190 */ 191 typedef enum vtype { 192 VNON = 0, 193 VREG = 1, 194 VDIR = 2, 195 VBLK = 3, 196 VCHR = 4, 197 VLNK = 5, 198 VFIFO = 6, 199 VDOOR = 7, 200 VPROC = 8, 201 VSOCK = 9, 202 VPORT = 10, 203 VBAD = 11 204 } vtype_t; 205 206 /* 207 * Many of the fields in the vnode are read-only once they are initialized 208 * at vnode creation time. Other fields are protected by locks. 209 * 210 * IMPORTANT: vnodes should be created ONLY by calls to vn_alloc(). They 211 * may not be embedded into the file-system specific node (inode). The 212 * size of vnodes may change. 213 * 214 * The v_lock protects: 215 * v_flag 216 * v_stream 217 * v_count 218 * v_shrlocks 219 * v_path 220 * 221 * A special lock (implemented by vn_vfswlock in vnode.c) protects: 222 * v_vfsmountedhere 223 * 224 * The global flock_lock mutex (in flock.c) protects: 225 * v_filocks 226 * 227 * IMPORTANT NOTE: 228 * 229 * The following vnode fields are considered public and may safely be 230 * accessed by file systems or other consumers: 231 * 232 * v_lock 233 * v_flag 234 * v_count 235 * v_data 236 * v_vfsp 237 * v_stream 238 * v_type 239 * v_rdev 240 * 241 * ALL OTHER FIELDS SHOULD BE ACCESSED ONLY BY THE OWNER OF THAT FIELD. 242 * In particular, file systems should not access other fields; they may 243 * change or even be removed. The functionality which was once provided 244 * by these fields is available through vn_* functions. 245 */ 246 247 struct fem_head; /* from fem.h */ 248 249 typedef struct vnode { 250 kmutex_t v_lock; /* protects vnode fields */ 251 uint_t v_flag; /* vnode flags (see below) */ 252 uint_t v_count; /* reference count */ 253 void *v_data; /* private data for fs */ 254 struct vfs *v_vfsp; /* ptr to containing VFS */ 255 struct stdata *v_stream; /* associated stream */ 256 enum vtype v_type; /* vnode type */ 257 dev_t v_rdev; /* device (VCHR, VBLK) */ 258 259 /* PRIVATE FIELDS BELOW - DO NOT USE */ 260 261 struct vfs *v_vfsmountedhere; /* ptr to vfs mounted here */ 262 struct vnodeops *v_op; /* vnode operations */ 263 struct page *v_pages; /* vnode pages list */ 264 pgcnt_t v_npages; /* # pages on this vnode */ 265 pgcnt_t v_msnpages; /* # pages charged to v_mset */ 266 struct page *v_scanfront; /* scanner front hand */ 267 struct page *v_scanback; /* scanner back hand */ 268 struct filock *v_filocks; /* ptr to filock list */ 269 struct shrlocklist *v_shrlocks; /* ptr to shrlock list */ 270 krwlock_t v_nbllock; /* sync for NBMAND locks */ 271 kcondvar_t v_cv; /* synchronize locking */ 272 void *v_locality; /* hook for locality info */ 273 struct fem_head *v_femhead; /* fs monitoring */ 274 char *v_path; /* cached path */ 275 uint_t v_rdcnt; /* open for read count (VREG only) */ 276 uint_t v_wrcnt; /* open for write count (VREG only) */ 277 u_longlong_t v_mmap_read; /* mmap read count */ 278 u_longlong_t v_mmap_write; /* mmap write count */ 279 void *v_mpssdata; /* info for large page mappings */ 280 hrtime_t v_scantime; /* last time this vnode was scanned */ 281 ushort_t v_mset; /* memory set ID */ 282 uint_t v_msflags; /* memory set flags */ 283 struct vnode *v_msnext; /* list of vnodes on an mset */ 284 struct vnode *v_msprev; /* list of vnodes on an mset */ 285 krwlock_t v_mslock; /* protects v_mset */ 286 } vnode_t; 287 288 #define IS_DEVVP(vp) \ 289 ((vp)->v_type == VCHR || (vp)->v_type == VBLK || (vp)->v_type == VFIFO) 290 291 /* 292 * vnode flags. 293 */ 294 #define VROOT 0x01 /* root of its file system */ 295 #define VNOCACHE 0x02 /* don't keep cache pages on vnode */ 296 #define VNOMAP 0x04 /* file cannot be mapped/faulted */ 297 #define VDUP 0x08 /* file should be dup'ed rather then opened */ 298 #define VNOSWAP 0x10 /* file cannot be used as virtual swap device */ 299 #define VNOMOUNT 0x20 /* file cannot be covered by mount */ 300 #define VISSWAP 0x40 /* vnode is being used for swap */ 301 #define VSWAPLIKE 0x80 /* vnode acts like swap (but may not be) */ 302 303 #define IS_SWAPVP(vp) (((vp)->v_flag & (VISSWAP | VSWAPLIKE)) != 0) 304 305 typedef struct vn_vfslocks_entry { 306 rwstlock_t ve_lock; 307 void *ve_vpvfs; 308 struct vn_vfslocks_entry *ve_next; 309 uint32_t ve_refcnt; 310 char pad[64 - sizeof (rwstlock_t) - 2 * sizeof (void *) - \ 311 sizeof (uint32_t)]; 312 } vn_vfslocks_entry_t; 313 314 /* 315 * The following two flags are used to lock the v_vfsmountedhere field 316 */ 317 #define VVFSLOCK 0x100 318 #define VVFSWAIT 0x200 319 320 /* 321 * Used to serialize VM operations on a vnode 322 */ 323 #define VVMLOCK 0x400 324 325 /* 326 * Tell vn_open() not to fail a directory open for writing but 327 * to go ahead and call VOP_OPEN() to let the filesystem check. 328 */ 329 #define VDIROPEN 0x800 330 331 /* 332 * Flag to let the VM system know that this file is most likely a binary 333 * or shared library since it has been mmap()ed EXEC at some time. 334 */ 335 #define VVMEXEC 0x1000 336 337 #define VPXFS 0x2000 /* clustering: global fs proxy vnode */ 338 339 #define IS_PXFSVP(vp) ((vp)->v_flag & VPXFS) 340 341 #define V_XATTRDIR 0x4000 /* attribute unnamed directory */ 342 343 #define V_LOCALITY 0x8000 /* whether locality aware */ 344 345 /* 346 * Flag that indicates the VM should maintain the v_pages list with all modified 347 * pages on one end and unmodified pages at the other. This makes finding dirty 348 * pages to write back to disk much faster at the expense of taking a minor 349 * fault on the first store instruction which touches a writable page. 350 */ 351 #define VMODSORT (0x10000) 352 #define IS_VMODSORT(vp) \ 353 (pvn_vmodsort_supported != 0 && ((vp)->v_flag & VMODSORT) != 0) 354 355 #define VISSWAPFS 0x20000 /* vnode is being used for swapfs */ 356 #define IS_SWAPFSVP(vp) (((vp)->v_flag & VISSWAPFS) != 0) 357 358 /* 359 * Vnode attributes. A bit-mask is supplied as part of the 360 * structure to indicate the attributes the caller wants to 361 * set (setattr) or extract (getattr). 362 */ 363 364 /* 365 * Note that va_nodeid and va_nblocks are 64bit data type. 366 * We support large files over NFSV3. With Solaris client and 367 * Server that generates 64bit ino's and sizes these fields 368 * will overflow if they are 32 bit sizes. 369 */ 370 371 typedef struct vattr { 372 uint_t va_mask; /* bit-mask of attributes */ 373 vtype_t va_type; /* vnode type (for create) */ 374 mode_t va_mode; /* file access mode */ 375 uid_t va_uid; /* owner user id */ 376 gid_t va_gid; /* owner group id */ 377 dev_t va_fsid; /* file system id (dev for now) */ 378 u_longlong_t va_nodeid; /* node id */ 379 nlink_t va_nlink; /* number of references to file */ 380 u_offset_t va_size; /* file size in bytes */ 381 timestruc_t va_atime; /* time of last access */ 382 timestruc_t va_mtime; /* time of last modification */ 383 timestruc_t va_ctime; /* time of last status change */ 384 dev_t va_rdev; /* device the file represents */ 385 uint_t va_blksize; /* fundamental block size */ 386 u_longlong_t va_nblocks; /* # of blocks allocated */ 387 uint_t va_seq; /* sequence number */ 388 } vattr_t; 389 390 #ifdef _SYSCALL32 391 /* 392 * For bigtypes time_t changed to 64 bit on the 64-bit kernel. 393 * Define an old version for user/kernel interface 394 */ 395 396 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 397 #pragma pack(4) 398 #endif 399 400 typedef struct vattr32 { 401 uint32_t va_mask; /* bit-mask of attributes */ 402 vtype_t va_type; /* vnode type (for create) */ 403 mode32_t va_mode; /* file access mode */ 404 uid32_t va_uid; /* owner user id */ 405 gid32_t va_gid; /* owner group id */ 406 dev32_t va_fsid; /* file system id (dev for now) */ 407 u_longlong_t va_nodeid; /* node id */ 408 nlink_t va_nlink; /* number of references to file */ 409 u_offset_t va_size; /* file size in bytes */ 410 timestruc32_t va_atime; /* time of last access */ 411 timestruc32_t va_mtime; /* time of last modification */ 412 timestruc32_t va_ctime; /* time of last status change */ 413 dev32_t va_rdev; /* device the file represents */ 414 uint32_t va_blksize; /* fundamental block size */ 415 u_longlong_t va_nblocks; /* # of blocks allocated */ 416 uint32_t va_seq; /* sequence number */ 417 } vattr32_t; 418 419 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 420 #pragma pack() 421 #endif 422 423 #else /* not _SYSCALL32 */ 424 #define vattr32 vattr 425 typedef vattr_t vattr32_t; 426 #endif /* _SYSCALL32 */ 427 428 /* 429 * Attributes of interest to the caller of setattr or getattr. 430 */ 431 #define AT_TYPE 0x0001 432 #define AT_MODE 0x0002 433 #define AT_UID 0x0004 434 #define AT_GID 0x0008 435 #define AT_FSID 0x0010 436 #define AT_NODEID 0x0020 437 #define AT_NLINK 0x0040 438 #define AT_SIZE 0x0080 439 #define AT_ATIME 0x0100 440 #define AT_MTIME 0x0200 441 #define AT_CTIME 0x0400 442 #define AT_RDEV 0x0800 443 #define AT_BLKSIZE 0x1000 444 #define AT_NBLOCKS 0x2000 445 /* 0x4000 */ /* unused */ 446 #define AT_SEQ 0x8000 447 448 #define AT_ALL (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\ 449 AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\ 450 AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) 451 452 #define AT_STAT (AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\ 453 AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV|AT_TYPE) 454 455 #define AT_TIMES (AT_ATIME|AT_MTIME|AT_CTIME) 456 457 #define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\ 458 AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) 459 460 /* 461 * Modes. Some values same as S_xxx entries from stat.h for convenience. 462 */ 463 #define VSUID 04000 /* set user id on execution */ 464 #define VSGID 02000 /* set group id on execution */ 465 #define VSVTX 01000 /* save swapped text even after use */ 466 467 /* 468 * Permissions. 469 */ 470 #define VREAD 00400 471 #define VWRITE 00200 472 #define VEXEC 00100 473 474 #define MODEMASK 07777 /* mode bits plus permission bits */ 475 #define PERMMASK 00777 /* permission bits */ 476 477 /* 478 * Check whether mandatory file locking is enabled. 479 */ 480 481 #define MANDMODE(mode) (((mode) & (VSGID|(VEXEC>>3))) == VSGID) 482 #define MANDLOCK(vp, mode) ((vp)->v_type == VREG && MANDMODE(mode)) 483 484 /* 485 * Flags for vnode operations. 486 */ 487 enum rm { RMFILE, RMDIRECTORY }; /* rm or rmdir (remove) */ 488 enum symfollow { NO_FOLLOW, FOLLOW }; /* follow symlinks (or not) */ 489 enum vcexcl { NONEXCL, EXCL }; /* (non)excl create */ 490 enum create { CRCREAT, CRMKNOD, CRMKDIR }; /* reason for create */ 491 492 typedef enum rm rm_t; 493 typedef enum symfollow symfollow_t; 494 typedef enum vcexcl vcexcl_t; 495 typedef enum create create_t; 496 497 /* Vnode Events - Used by VOP_VNEVENT */ 498 typedef enum vnevent { 499 VE_SUPPORT = 0, /* Query */ 500 VE_RENAME_SRC = 1, /* Rename, with vnode as source */ 501 VE_RENAME_DEST = 2, /* Rename, with vnode as target/destination */ 502 VE_REMOVE = 3, /* Remove of vnode's name */ 503 VE_RMDIR = 4 /* Remove of directory vnode's name */ 504 } vnevent_t; 505 506 /* 507 * Values for checking vnode open and map counts 508 */ 509 enum v_mode { V_READ, V_WRITE, V_RDORWR, V_RDANDWR }; 510 511 typedef enum v_mode v_mode_t; 512 513 #define V_TRUE 1 514 #define V_FALSE 0 515 516 /* 517 * Structure used on VOP_GETSECATTR and VOP_SETSECATTR operations 518 */ 519 520 typedef struct vsecattr { 521 uint_t vsa_mask; /* See below */ 522 int vsa_aclcnt; /* ACL entry count */ 523 void *vsa_aclentp; /* pointer to ACL entries */ 524 int vsa_dfaclcnt; /* default ACL entry count */ 525 void *vsa_dfaclentp; /* pointer to default ACL entries */ 526 } vsecattr_t; 527 528 /* vsa_mask values */ 529 #define VSA_ACL 0x0001 530 #define VSA_ACLCNT 0x0002 531 #define VSA_DFACL 0x0004 532 #define VSA_DFACLCNT 0x0008 533 #define VSA_ACE 0x0010 534 #define VSA_ACECNT 0x0020 535 536 /* 537 * Structure used by various vnode operations to determine 538 * the context (pid, host, identity) of a caller. 539 * 540 * The cc_caller_id is used to identify one or more callers who invoke 541 * operations, possibly on behalf of others. For example, the NFS 542 * server could have it's own cc_caller_id which can be detected by 543 * vnode/vfs operations or (FEM) monitors on those operations. New 544 * caller IDs are generated by fs_new_caller_id(). 545 */ 546 typedef struct caller_context { 547 pid_t cc_pid; /* Process ID of the caller */ 548 int cc_sysid; /* System ID, used for remote calls */ 549 u_longlong_t cc_caller_id; /* Identifier for (set of) caller(s) */ 550 } caller_context_t; 551 552 /* 553 * Structure tags for function prototypes, defined elsewhere. 554 */ 555 struct pathname; 556 struct fid; 557 struct flock64; 558 struct flk_callback; 559 struct shrlock; 560 struct page; 561 struct seg; 562 struct as; 563 struct pollhead; 564 565 /* 566 * Operations on vnodes. Note: File systems should never operate directly 567 * on a 'vnodeops' structure -- it WILL change in future releases! They 568 * should use vn_make_ops() to create the structure. 569 */ 570 typedef struct vnodeops { 571 const char *vnop_name; 572 int (*vop_open)(vnode_t **, int, cred_t *); 573 int (*vop_close)(vnode_t *, int, int, offset_t, cred_t *); 574 int (*vop_read)(vnode_t *, uio_t *, int, cred_t *, 575 caller_context_t *); 576 int (*vop_write)(vnode_t *, uio_t *, int, cred_t *, 577 caller_context_t *); 578 int (*vop_ioctl)(vnode_t *, int, intptr_t, int, cred_t *, int *); 579 int (*vop_setfl)(vnode_t *, int, int, cred_t *); 580 int (*vop_getattr)(vnode_t *, vattr_t *, int, cred_t *); 581 int (*vop_setattr)(vnode_t *, vattr_t *, int, cred_t *, 582 caller_context_t *); 583 int (*vop_access)(vnode_t *, int, int, cred_t *); 584 int (*vop_lookup)(vnode_t *, char *, vnode_t **, struct pathname *, 585 int, vnode_t *, cred_t *); 586 int (*vop_create)(vnode_t *, char *, vattr_t *, vcexcl_t, int, 587 vnode_t **, cred_t *, int); 588 int (*vop_remove)(vnode_t *, char *, cred_t *); 589 int (*vop_link)(vnode_t *, vnode_t *, char *, cred_t *); 590 int (*vop_rename)(vnode_t *, char *, vnode_t *, char *, cred_t *); 591 int (*vop_mkdir)(vnode_t *, char *, vattr_t *, vnode_t **, 592 cred_t *); 593 int (*vop_rmdir)(vnode_t *, char *, vnode_t *, cred_t *); 594 int (*vop_readdir)(vnode_t *, uio_t *, cred_t *, int *); 595 int (*vop_symlink)(vnode_t *, char *, vattr_t *, char *, cred_t *); 596 int (*vop_readlink)(vnode_t *, uio_t *, cred_t *); 597 int (*vop_fsync)(vnode_t *, int, cred_t *); 598 void (*vop_inactive)(vnode_t *, cred_t *); 599 int (*vop_fid)(vnode_t *, struct fid *); 600 int (*vop_rwlock)(vnode_t *, int, caller_context_t *); 601 void (*vop_rwunlock)(vnode_t *, int, caller_context_t *); 602 int (*vop_seek)(vnode_t *, offset_t, offset_t *); 603 int (*vop_cmp)(vnode_t *, vnode_t *); 604 int (*vop_frlock)(vnode_t *, int, struct flock64 *, int, offset_t, 605 struct flk_callback *, cred_t *); 606 int (*vop_space)(vnode_t *, int, struct flock64 *, int, offset_t, 607 cred_t *, caller_context_t *); 608 int (*vop_realvp)(vnode_t *, vnode_t **); 609 int (*vop_getpage)(vnode_t *, offset_t, size_t, uint_t *, 610 struct page **, size_t, struct seg *, 611 caddr_t, enum seg_rw, cred_t *); 612 int (*vop_putpage)(vnode_t *, offset_t, size_t, int, cred_t *); 613 int (*vop_map)(vnode_t *, offset_t, struct as *, caddr_t *, size_t, 614 uchar_t, uchar_t, uint_t, cred_t *); 615 int (*vop_addmap)(vnode_t *, offset_t, struct as *, caddr_t, size_t, 616 uchar_t, uchar_t, uint_t, cred_t *); 617 int (*vop_delmap)(vnode_t *, offset_t, struct as *, caddr_t, size_t, 618 uint_t, uint_t, uint_t, cred_t *); 619 int (*vop_poll)(vnode_t *, short, int, short *, struct pollhead **); 620 int (*vop_dump)(vnode_t *, caddr_t, int, int); 621 int (*vop_pathconf)(vnode_t *, int, ulong_t *, cred_t *); 622 int (*vop_pageio)(vnode_t *, struct page *, u_offset_t, size_t, 623 int, cred_t *); 624 int (*vop_dumpctl)(vnode_t *, int, int *); 625 void (*vop_dispose)(vnode_t *, struct page *, int, int, cred_t *); 626 int (*vop_setsecattr)(vnode_t *, vsecattr_t *, int, cred_t *); 627 int (*vop_getsecattr)(vnode_t *, vsecattr_t *, int, cred_t *); 628 int (*vop_shrlock)(vnode_t *, int, struct shrlock *, int, cred_t *); 629 int (*vop_vnevent)(vnode_t *, vnevent_t); 630 } vnodeops_t; 631 632 #ifdef _KERNEL 633 634 extern int fop_open(vnode_t **, int, cred_t *); 635 extern int fop_close(vnode_t *, int, int, offset_t, cred_t *); 636 extern int fop_read(vnode_t *, uio_t *, int, cred_t *, caller_context_t *); 637 extern int fop_write(vnode_t *, uio_t *, int, cred_t *, 638 caller_context_t *); 639 extern int fop_ioctl(vnode_t *, int, intptr_t, int, cred_t *, int *); 640 extern int fop_setfl(vnode_t *, int, int, cred_t *); 641 extern int fop_getattr(vnode_t *, vattr_t *, int, cred_t *); 642 extern int fop_setattr(vnode_t *, vattr_t *, int, cred_t *, 643 caller_context_t *); 644 extern int fop_access(vnode_t *, int, int, cred_t *); 645 extern int fop_lookup(vnode_t *, char *, vnode_t **, struct pathname *, 646 int, vnode_t *, cred_t *); 647 extern int fop_create(vnode_t *, char *, vattr_t *, vcexcl_t, int, 648 vnode_t **, cred_t *, int); 649 extern int fop_remove(vnode_t *vp, char *, cred_t *); 650 extern int fop_link(vnode_t *, vnode_t *, char *, cred_t *); 651 extern int fop_rename(vnode_t *, char *, vnode_t *, char *, cred_t *); 652 extern int fop_mkdir(vnode_t *, char *, vattr_t *, vnode_t **, cred_t *); 653 extern int fop_rmdir(vnode_t *, char *, vnode_t *, cred_t *); 654 extern int fop_readdir(vnode_t *, uio_t *, cred_t *, int *); 655 extern int fop_symlink(vnode_t *, char *, vattr_t *, char *, cred_t *); 656 extern int fop_readlink(vnode_t *, uio_t *, cred_t *); 657 extern int fop_fsync(vnode_t *, int, cred_t *); 658 extern void fop_inactive(vnode_t *, cred_t *); 659 extern int fop_fid(vnode_t *, struct fid *); 660 extern int fop_rwlock(vnode_t *, int, caller_context_t *); 661 extern void fop_rwunlock(vnode_t *, int, caller_context_t *); 662 extern int fop_seek(vnode_t *, offset_t, offset_t *); 663 extern int fop_cmp(vnode_t *, vnode_t *); 664 extern int fop_frlock(vnode_t *, int, struct flock64 *, int, offset_t, 665 struct flk_callback *, cred_t *); 666 extern int fop_space(vnode_t *, int, struct flock64 *, int, offset_t, 667 cred_t *, caller_context_t *); 668 extern int fop_realvp(vnode_t *, vnode_t **); 669 extern int fop_getpage(vnode_t *, offset_t, size_t, uint_t *, 670 struct page **, size_t, struct seg *, 671 caddr_t, enum seg_rw, cred_t *); 672 extern int fop_putpage(vnode_t *, offset_t, size_t, int, cred_t *); 673 extern int fop_map(vnode_t *, offset_t, struct as *, caddr_t *, size_t, 674 uchar_t, uchar_t, uint_t, cred_t *cr); 675 extern int fop_addmap(vnode_t *, offset_t, struct as *, caddr_t, size_t, 676 uchar_t, uchar_t, uint_t, cred_t *); 677 extern int fop_delmap(vnode_t *, offset_t, struct as *, caddr_t, size_t, 678 uint_t, uint_t, uint_t, cred_t *); 679 extern int fop_poll(vnode_t *, short, int, short *, struct pollhead **); 680 extern int fop_dump(vnode_t *, caddr_t, int, int); 681 extern int fop_pathconf(vnode_t *, int, ulong_t *, cred_t *); 682 extern int fop_pageio(vnode_t *, struct page *, u_offset_t, size_t, int, 683 cred_t *); 684 extern int fop_dumpctl(vnode_t *, int, int *); 685 extern void fop_dispose(vnode_t *, struct page *, int, int, cred_t *); 686 extern int fop_setsecattr(vnode_t *, vsecattr_t *, int, cred_t *); 687 extern int fop_getsecattr(vnode_t *, vsecattr_t *, int, cred_t *); 688 extern int fop_shrlock(vnode_t *, int, struct shrlock *, int, cred_t *); 689 extern int fop_vnevent(vnode_t *, vnevent_t); 690 691 #endif /* _KERNEL */ 692 693 #define VOP_OPEN(vpp, mode, cr) \ 694 fop_open(vpp, mode, cr) 695 #define VOP_CLOSE(vp, f, c, o, cr) \ 696 fop_close(vp, f, c, o, cr) 697 #define VOP_READ(vp, uiop, iof, cr, ct) \ 698 fop_read(vp, uiop, iof, cr, ct) 699 #define VOP_WRITE(vp, uiop, iof, cr, ct) \ 700 fop_write(vp, uiop, iof, cr, ct) 701 #define VOP_IOCTL(vp, cmd, a, f, cr, rvp) \ 702 fop_ioctl(vp, cmd, a, f, cr, rvp) 703 #define VOP_SETFL(vp, f, a, cr) \ 704 fop_setfl(vp, f, a, cr) 705 #define VOP_GETATTR(vp, vap, f, cr) \ 706 fop_getattr(vp, vap, f, cr) 707 #define VOP_SETATTR(vp, vap, f, cr, ct) \ 708 fop_setattr(vp, vap, f, cr, ct) 709 #define VOP_ACCESS(vp, mode, f, cr) \ 710 fop_access(vp, mode, f, cr) 711 #define VOP_LOOKUP(vp, cp, vpp, pnp, f, rdir, cr) \ 712 fop_lookup(vp, cp, vpp, pnp, f, rdir, cr) 713 #define VOP_CREATE(dvp, p, vap, ex, mode, vpp, cr, flag) \ 714 fop_create(dvp, p, vap, ex, mode, vpp, cr, flag) 715 #define VOP_REMOVE(dvp, p, cr) \ 716 fop_remove(dvp, p, cr) 717 #define VOP_LINK(tdvp, fvp, p, cr) \ 718 fop_link(tdvp, fvp, p, cr) 719 #define VOP_RENAME(fvp, fnm, tdvp, tnm, cr) \ 720 fop_rename(fvp, fnm, tdvp, tnm, cr) 721 #define VOP_MKDIR(dp, p, vap, vpp, cr) \ 722 fop_mkdir(dp, p, vap, vpp, cr) 723 #define VOP_RMDIR(dp, p, cdir, cr) \ 724 fop_rmdir(dp, p, cdir, cr) 725 #define VOP_READDIR(vp, uiop, cr, eofp) \ 726 fop_readdir(vp, uiop, cr, eofp) 727 #define VOP_SYMLINK(dvp, lnm, vap, tnm, cr) \ 728 fop_symlink(dvp, lnm, vap, tnm, cr) 729 #define VOP_READLINK(vp, uiop, cr) \ 730 fop_readlink(vp, uiop, cr) 731 #define VOP_FSYNC(vp, syncflag, cr) \ 732 fop_fsync(vp, syncflag, cr) 733 #define VOP_INACTIVE(vp, cr) \ 734 fop_inactive(vp, cr) 735 #define VOP_FID(vp, fidp) \ 736 fop_fid(vp, fidp) 737 #define VOP_RWLOCK(vp, w, ct) \ 738 fop_rwlock(vp, w, ct) 739 #define VOP_RWUNLOCK(vp, w, ct) \ 740 fop_rwunlock(vp, w, ct) 741 #define VOP_SEEK(vp, ooff, noffp) \ 742 fop_seek(vp, ooff, noffp) 743 #define VOP_CMP(vp1, vp2) \ 744 fop_cmp(vp1, vp2) 745 #define VOP_FRLOCK(vp, cmd, a, f, o, cb, cr) \ 746 fop_frlock(vp, cmd, a, f, o, cb, cr) 747 #define VOP_SPACE(vp, cmd, a, f, o, cr, ct) \ 748 fop_space(vp, cmd, a, f, o, cr, ct) 749 #define VOP_REALVP(vp1, vp2) \ 750 fop_realvp(vp1, vp2) 751 #define VOP_GETPAGE(vp, of, sz, pr, pl, ps, sg, a, rw, cr) \ 752 fop_getpage(vp, of, sz, pr, pl, ps, sg, a, rw, cr) 753 #define VOP_PUTPAGE(vp, of, sz, fl, cr) \ 754 fop_putpage(vp, of, sz, fl, cr) 755 #define VOP_MAP(vp, of, as, a, sz, p, mp, fl, cr) \ 756 fop_map(vp, of, as, a, sz, p, mp, fl, cr) 757 #define VOP_ADDMAP(vp, of, as, a, sz, p, mp, fl, cr) \ 758 fop_addmap(vp, of, as, a, sz, p, mp, fl, cr) 759 #define VOP_DELMAP(vp, of, as, a, sz, p, mp, fl, cr) \ 760 fop_delmap(vp, of, as, a, sz, p, mp, fl, cr) 761 #define VOP_POLL(vp, events, anyyet, reventsp, phpp) \ 762 fop_poll(vp, events, anyyet, reventsp, phpp) 763 #define VOP_DUMP(vp, addr, bn, count) \ 764 fop_dump(vp, addr, bn, count) 765 #define VOP_PATHCONF(vp, cmd, valp, cr) \ 766 fop_pathconf(vp, cmd, valp, cr) 767 #define VOP_PAGEIO(vp, pp, io_off, io_len, flags, cr) \ 768 fop_pageio(vp, pp, io_off, io_len, flags, cr) 769 #define VOP_DUMPCTL(vp, action, blkp) \ 770 fop_dumpctl(vp, action, blkp) 771 #define VOP_DISPOSE(vp, pp, flag, dn, cr) \ 772 fop_dispose(vp, pp, flag, dn, cr) 773 #define VOP_GETSECATTR(vp, vsap, f, cr) \ 774 fop_getsecattr(vp, vsap, f, cr) 775 #define VOP_SETSECATTR(vp, vsap, f, cr) \ 776 fop_setsecattr(vp, vsap, f, cr) 777 #define VOP_SHRLOCK(vp, cmd, shr, f, cr) \ 778 fop_shrlock(vp, cmd, shr, f, cr) 779 #define VOP_VNEVENT(vp, vnevent) \ 780 fop_vnevent(vp, vnevent) 781 782 #define VOPNAME_OPEN "open" 783 #define VOPNAME_CLOSE "close" 784 #define VOPNAME_READ "read" 785 #define VOPNAME_WRITE "write" 786 #define VOPNAME_IOCTL "ioctl" 787 #define VOPNAME_SETFL "setfl" 788 #define VOPNAME_GETATTR "getattr" 789 #define VOPNAME_SETATTR "setattr" 790 #define VOPNAME_ACCESS "access" 791 #define VOPNAME_LOOKUP "lookup" 792 #define VOPNAME_CREATE "create" 793 #define VOPNAME_REMOVE "remove" 794 #define VOPNAME_LINK "link" 795 #define VOPNAME_RENAME "rename" 796 #define VOPNAME_MKDIR "mkdir" 797 #define VOPNAME_RMDIR "rmdir" 798 #define VOPNAME_READDIR "readdir" 799 #define VOPNAME_SYMLINK "symlink" 800 #define VOPNAME_READLINK "readlink" 801 #define VOPNAME_FSYNC "fsync" 802 #define VOPNAME_INACTIVE "inactive" 803 #define VOPNAME_FID "fid" 804 #define VOPNAME_RWLOCK "rwlock" 805 #define VOPNAME_RWUNLOCK "rwunlock" 806 #define VOPNAME_SEEK "seek" 807 #define VOPNAME_CMP "cmp" 808 #define VOPNAME_FRLOCK "frlock" 809 #define VOPNAME_SPACE "space" 810 #define VOPNAME_REALVP "realvp" 811 #define VOPNAME_GETPAGE "getpage" 812 #define VOPNAME_PUTPAGE "putpage" 813 #define VOPNAME_MAP "map" 814 #define VOPNAME_ADDMAP "addmap" 815 #define VOPNAME_DELMAP "delmap" 816 #define VOPNAME_POLL "poll" 817 #define VOPNAME_DUMP "dump" 818 #define VOPNAME_PATHCONF "pathconf" 819 #define VOPNAME_PAGEIO "pageio" 820 #define VOPNAME_DUMPCTL "dumpctl" 821 #define VOPNAME_DISPOSE "dispose" 822 #define VOPNAME_GETSECATTR "getsecattr" 823 #define VOPNAME_SETSECATTR "setsecattr" 824 #define VOPNAME_SHRLOCK "shrlock" 825 #define VOPNAME_VNEVENT "vnevent" 826 827 /* 828 * Flags for VOP_LOOKUP 829 */ 830 #define LOOKUP_DIR 0x01 /* want parent dir vp */ 831 #define LOOKUP_XATTR 0x02 /* lookup up extended attr dir */ 832 #define CREATE_XATTR_DIR 0x04 /* Create extended attr dir */ 833 834 /* 835 * Flags for VOP_RWLOCK/VOP_RWUNLOCK 836 * VOP_RWLOCK will return the flag that was actually set, or -1 if none. 837 */ 838 #define V_WRITELOCK_TRUE (1) /* Request write-lock on the vnode */ 839 #define V_WRITELOCK_FALSE (0) /* Request read-lock on the vnode */ 840 841 /* 842 * Flags for VOP_DUMPCTL 843 */ 844 #define DUMP_ALLOC 0 845 #define DUMP_FREE 1 846 #define DUMP_SCAN 2 847 848 /* 849 * Public vnode manipulation functions. 850 */ 851 #ifdef _KERNEL 852 853 vnode_t *vn_alloc(int); 854 void vn_reinit(vnode_t *); 855 void vn_recycle(vnode_t *); 856 void vn_free(vnode_t *); 857 858 int vn_is_readonly(vnode_t *); 859 int vn_is_opened(vnode_t *, v_mode_t); 860 int vn_is_mapped(vnode_t *, v_mode_t); 861 862 int vn_can_change_zones(vnode_t *vp); 863 864 int vn_has_flocks(vnode_t *); 865 int vn_has_mandatory_locks(vnode_t *, int); 866 int vn_has_cached_data(vnode_t *); 867 868 void vn_setops(vnode_t *, vnodeops_t *); 869 vnodeops_t *vn_getops(vnode_t *); 870 int vn_matchops(vnode_t *, vnodeops_t *); 871 int vn_matchopval(vnode_t *, char *, fs_generic_func_p); 872 int vn_ismntpt(vnode_t *); 873 874 struct vfs *vn_mountedvfs(vnode_t *); 875 876 void vn_create_cache(void); 877 void vn_destroy_cache(void); 878 879 int vn_make_ops(const char *, const fs_operation_def_t *, vnodeops_t **); 880 void vn_freevnodeops(vnodeops_t *); 881 882 int vn_open(char *pnamep, enum uio_seg seg, int filemode, int createmode, 883 struct vnode **vpp, enum create crwhy, mode_t umask); 884 int vn_openat(char *pnamep, enum uio_seg seg, int filemode, int createmode, 885 struct vnode **vpp, enum create crwhy, 886 mode_t umask, struct vnode *startvp); 887 int vn_create(char *pnamep, enum uio_seg seg, struct vattr *vap, 888 enum vcexcl excl, int mode, struct vnode **vpp, 889 enum create why, int flag, mode_t umask); 890 int vn_createat(char *pnamep, enum uio_seg seg, struct vattr *vap, 891 enum vcexcl excl, int mode, struct vnode **vpp, 892 enum create why, int flag, mode_t umask, struct vnode *startvp); 893 int vn_rdwr(enum uio_rw rw, struct vnode *vp, caddr_t base, ssize_t len, 894 offset_t offset, enum uio_seg seg, int ioflag, rlim64_t ulimit, 895 cred_t *cr, ssize_t *residp); 896 void vn_rele(struct vnode *vp); 897 void vn_rele_stream(struct vnode *vp); 898 int vn_link(char *from, char *to, enum uio_seg seg); 899 int vn_rename(char *from, char *to, enum uio_seg seg); 900 int vn_renameat(vnode_t *fdvp, char *fname, vnode_t *tdvp, char *tname, 901 enum uio_seg seg); 902 int vn_remove(char *fnamep, enum uio_seg seg, enum rm dirflag); 903 int vn_removeat(vnode_t *startvp, char *fnamep, enum uio_seg seg, 904 enum rm dirflag); 905 int vn_compare(vnode_t *vp1, vnode_t *vp2); 906 int vn_vfswlock(struct vnode *vp); 907 int vn_vfswlock_wait(struct vnode *vp); 908 int vn_vfsrlock(struct vnode *vp); 909 int vn_vfsrlock_wait(struct vnode *vp); 910 void vn_vfsunlock(struct vnode *vp); 911 int vn_vfswlock_held(struct vnode *vp); 912 vnode_t *specvp(struct vnode *vp, dev_t dev, vtype_t type, struct cred *cr); 913 vnode_t *makespecvp(dev_t dev, vtype_t type); 914 vn_vfslocks_entry_t *vn_vfslocks_getlock(void *); 915 void vn_vfslocks_rele(vn_vfslocks_entry_t *); 916 917 void vn_copypath(struct vnode *src, struct vnode *dst); 918 void vn_setpath_str(struct vnode *vp, const char *str, size_t len); 919 void vn_setpath(vnode_t *rootvp, struct vnode *startvp, struct vnode *vp, 920 const char *path, size_t plen); 921 922 /* Vnode event notification */ 923 void vnevent_rename_src(vnode_t *); 924 void vnevent_rename_dest(vnode_t *); 925 void vnevent_remove(vnode_t *); 926 void vnevent_rmdir(vnode_t *); 927 int vnevent_support(vnode_t *); 928 929 /* Context identification */ 930 u_longlong_t fs_new_caller_id(); 931 932 int vn_vmpss_usepageio(vnode_t *); 933 934 /* 935 * Needed for use of IS_VMODSORT() in kernel. 936 */ 937 extern uint_t pvn_vmodsort_supported; 938 939 #define VN_HOLD(vp) { \ 940 mutex_enter(&(vp)->v_lock); \ 941 (vp)->v_count++; \ 942 mutex_exit(&(vp)->v_lock); \ 943 } 944 945 #define VN_RELE(vp) { \ 946 vn_rele(vp); \ 947 } 948 949 #define VN_SET_VFS_TYPE_DEV(vp, vfsp, type, dev) { \ 950 (vp)->v_vfsp = (vfsp); \ 951 (vp)->v_type = (type); \ 952 (vp)->v_rdev = (dev); \ 953 } 954 955 /* 956 * Compare two vnodes for equality. In general this macro should be used 957 * in preference to calling VOP_CMP directly. 958 */ 959 #define VN_CMP(VP1, VP2) ((VP1) == (VP2) ? 1 : \ 960 ((VP1) && (VP2) && (vn_getops(VP1) == vn_getops(VP2)) ? \ 961 VOP_CMP(VP1, VP2) : 0)) 962 963 extern struct vnode kvp; 964 extern struct vnode zvp; 965 966 #define VN_ISKAS(vp) ((vp) == &kvp || (vp) == &zvp) 967 968 #endif /* _KERNEL */ 969 970 /* 971 * Flags to VOP_SETATTR/VOP_GETATTR. 972 */ 973 #define ATTR_UTIME 0x01 /* non-default utime(2) request */ 974 #define ATTR_EXEC 0x02 /* invocation from exec(2) */ 975 #define ATTR_COMM 0x04 /* yield common vp attributes */ 976 #define ATTR_HINT 0x08 /* information returned will be `hint' */ 977 #define ATTR_REAL 0x10 /* yield attributes of the real vp */ 978 979 /* 980 * Generally useful macros. 981 */ 982 #define VBSIZE(vp) ((vp)->v_vfsp->vfs_bsize) 983 984 #define VTOZONE(vp) ((vp)->v_vfsp->vfs_zone) 985 986 #define NULLVP ((struct vnode *)0) 987 #define NULLVPP ((struct vnode **)0) 988 989 #ifdef _KERNEL 990 991 /* 992 * Structure used while handling asynchronous VOP_PUTPAGE operations. 993 */ 994 struct async_reqs { 995 struct async_reqs *a_next; /* pointer to next arg struct */ 996 struct vnode *a_vp; /* vnode pointer */ 997 u_offset_t a_off; /* offset in file */ 998 uint_t a_len; /* size of i/o request */ 999 int a_flags; /* flags to indicate operation type */ 1000 struct cred *a_cred; /* cred pointer */ 1001 ushort_t a_prealloced; /* set if struct is pre-allocated */ 1002 }; 1003 1004 /* 1005 * VN_DISPOSE() -- given a page pointer, safely invoke VOP_DISPOSE(). 1006 */ 1007 #define VN_DISPOSE(pp, flag, dn, cr) { \ 1008 extern struct vnode kvp; \ 1009 if ((pp)->p_vnode != NULL && !VN_ISKAS((pp)->p_vnode)) \ 1010 VOP_DISPOSE((pp)->p_vnode, (pp), (flag), (dn), (cr)); \ 1011 else if ((flag) == B_FREE) \ 1012 page_free((pp), (dn)); \ 1013 else \ 1014 page_destroy((pp), (dn)); \ 1015 } 1016 1017 #endif /* _KERNEL */ 1018 1019 #ifdef __cplusplus 1020 } 1021 #endif 1022 1023 #endif /* _SYS_VNODE_H */ 1024