17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5ddfcde86Srsb * Common Development and Distribution License (the "License"). 6ddfcde86Srsb * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22c242f9a0Schunli zhang - Sun Microsystems - Irvine United States * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #include <sys/types.h> 277c478bd9Sstevel@tonic-gate #include <sys/atomic.h> 287c478bd9Sstevel@tonic-gate #include <sys/kmem.h> 297c478bd9Sstevel@tonic-gate #include <sys/mutex.h> 307c478bd9Sstevel@tonic-gate #include <sys/errno.h> 317c478bd9Sstevel@tonic-gate #include <sys/param.h> 327c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h> 337c478bd9Sstevel@tonic-gate #include <sys/systm.h> 347c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h> 357c478bd9Sstevel@tonic-gate #include <sys/debug.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #include <sys/fem.h> 387c478bd9Sstevel@tonic-gate #include <sys/vfs.h> 397c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 40aa59c4cbSrsb #include <sys/vfs_opreg.h> 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #define NNODES_DEFAULT 8 /* Default number of nodes in a fem_list */ 437c478bd9Sstevel@tonic-gate /* 447c478bd9Sstevel@tonic-gate * fl_ntob(n) - Fem_list: number of nodes to bytes 457c478bd9Sstevel@tonic-gate * Given the number of nodes in a fem_list return the size, in bytes, 467c478bd9Sstevel@tonic-gate * of the fem_list structure. 477c478bd9Sstevel@tonic-gate */ 487c478bd9Sstevel@tonic-gate #define fl_ntob(n) (sizeof (struct fem_list) + \ 497c478bd9Sstevel@tonic-gate ((n) - 1) * sizeof (struct fem_node)) 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate typedef enum { 527c478bd9Sstevel@tonic-gate FEMTYPE_NULL, /* Uninitialized */ 537c478bd9Sstevel@tonic-gate FEMTYPE_VNODE, 547c478bd9Sstevel@tonic-gate FEMTYPE_VFS, 557c478bd9Sstevel@tonic-gate FEMTYPE_NTYPES 567c478bd9Sstevel@tonic-gate } femtype_t; 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate #define FEM_HEAD(_t) femtype[(_t)].head.fn_op.anon 597c478bd9Sstevel@tonic-gate #define FEM_GUARD(_t) femtype[(_t)].guard 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate static struct fem_type_info { 627c478bd9Sstevel@tonic-gate struct fem_node head; 637c478bd9Sstevel@tonic-gate struct fem_node guard; 647c478bd9Sstevel@tonic-gate femop_t *errf; 657c478bd9Sstevel@tonic-gate } femtype[FEMTYPE_NTYPES]; 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* 697c478bd9Sstevel@tonic-gate * For each type, two tables - the translation offset definition, which 707c478bd9Sstevel@tonic-gate * is used by fs_build_vector to layout the operation(s) vector; and the 717c478bd9Sstevel@tonic-gate * guard_operation_vector which protects from stack under-run. 727c478bd9Sstevel@tonic-gate */ 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate int fem_err(); 757c478bd9Sstevel@tonic-gate int fsem_err(); 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate #define _FEMOPDEF(name, member) \ 79aa59c4cbSrsb { VOPNAME_##name, offsetof(fem_t, femop_##member), NULL, fem_err } 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate static fs_operation_trans_def_t fem_opdef[] = { 827c478bd9Sstevel@tonic-gate _FEMOPDEF(OPEN, open), 837c478bd9Sstevel@tonic-gate _FEMOPDEF(CLOSE, close), 847c478bd9Sstevel@tonic-gate _FEMOPDEF(READ, read), 857c478bd9Sstevel@tonic-gate _FEMOPDEF(WRITE, write), 867c478bd9Sstevel@tonic-gate _FEMOPDEF(IOCTL, ioctl), 877c478bd9Sstevel@tonic-gate _FEMOPDEF(SETFL, setfl), 887c478bd9Sstevel@tonic-gate _FEMOPDEF(GETATTR, getattr), 897c478bd9Sstevel@tonic-gate _FEMOPDEF(SETATTR, setattr), 907c478bd9Sstevel@tonic-gate _FEMOPDEF(ACCESS, access), 917c478bd9Sstevel@tonic-gate _FEMOPDEF(LOOKUP, lookup), 927c478bd9Sstevel@tonic-gate _FEMOPDEF(CREATE, create), 937c478bd9Sstevel@tonic-gate _FEMOPDEF(REMOVE, remove), 947c478bd9Sstevel@tonic-gate _FEMOPDEF(LINK, link), 957c478bd9Sstevel@tonic-gate _FEMOPDEF(RENAME, rename), 967c478bd9Sstevel@tonic-gate _FEMOPDEF(MKDIR, mkdir), 977c478bd9Sstevel@tonic-gate _FEMOPDEF(RMDIR, rmdir), 987c478bd9Sstevel@tonic-gate _FEMOPDEF(READDIR, readdir), 997c478bd9Sstevel@tonic-gate _FEMOPDEF(SYMLINK, symlink), 1007c478bd9Sstevel@tonic-gate _FEMOPDEF(READLINK, readlink), 1017c478bd9Sstevel@tonic-gate _FEMOPDEF(FSYNC, fsync), 1027c478bd9Sstevel@tonic-gate _FEMOPDEF(INACTIVE, inactive), 1037c478bd9Sstevel@tonic-gate _FEMOPDEF(FID, fid), 1047c478bd9Sstevel@tonic-gate _FEMOPDEF(RWLOCK, rwlock), 1057c478bd9Sstevel@tonic-gate _FEMOPDEF(RWUNLOCK, rwunlock), 1067c478bd9Sstevel@tonic-gate _FEMOPDEF(SEEK, seek), 1077c478bd9Sstevel@tonic-gate _FEMOPDEF(CMP, cmp), 1087c478bd9Sstevel@tonic-gate _FEMOPDEF(FRLOCK, frlock), 1097c478bd9Sstevel@tonic-gate _FEMOPDEF(SPACE, space), 1107c478bd9Sstevel@tonic-gate _FEMOPDEF(REALVP, realvp), 1117c478bd9Sstevel@tonic-gate _FEMOPDEF(GETPAGE, getpage), 1127c478bd9Sstevel@tonic-gate _FEMOPDEF(PUTPAGE, putpage), 1137c478bd9Sstevel@tonic-gate _FEMOPDEF(MAP, map), 1147c478bd9Sstevel@tonic-gate _FEMOPDEF(ADDMAP, addmap), 1157c478bd9Sstevel@tonic-gate _FEMOPDEF(DELMAP, delmap), 1167c478bd9Sstevel@tonic-gate _FEMOPDEF(POLL, poll), 1177c478bd9Sstevel@tonic-gate _FEMOPDEF(DUMP, dump), 1187c478bd9Sstevel@tonic-gate _FEMOPDEF(PATHCONF, pathconf), 1197c478bd9Sstevel@tonic-gate _FEMOPDEF(PAGEIO, pageio), 1207c478bd9Sstevel@tonic-gate _FEMOPDEF(DUMPCTL, dumpctl), 1217c478bd9Sstevel@tonic-gate _FEMOPDEF(DISPOSE, dispose), 1227c478bd9Sstevel@tonic-gate _FEMOPDEF(SETSECATTR, setsecattr), 1237c478bd9Sstevel@tonic-gate _FEMOPDEF(GETSECATTR, getsecattr), 1247c478bd9Sstevel@tonic-gate _FEMOPDEF(SHRLOCK, shrlock), 1257c478bd9Sstevel@tonic-gate _FEMOPDEF(VNEVENT, vnevent), 126c242f9a0Schunli zhang - Sun Microsystems - Irvine United States _FEMOPDEF(REQZCBUF, reqzcbuf), 127c242f9a0Schunli zhang - Sun Microsystems - Irvine United States _FEMOPDEF(RETZCBUF, retzcbuf), 1287c478bd9Sstevel@tonic-gate { NULL, 0, NULL, NULL } 1297c478bd9Sstevel@tonic-gate }; 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate #define _FEMGUARD(name, ignore) \ 1337c478bd9Sstevel@tonic-gate { VOPNAME_##name, (femop_t *)fem_err } 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate static struct fs_operation_def fem_guard_ops[] = { 1367c478bd9Sstevel@tonic-gate _FEMGUARD(OPEN, open), 1377c478bd9Sstevel@tonic-gate _FEMGUARD(CLOSE, close), 1387c478bd9Sstevel@tonic-gate _FEMGUARD(READ, read), 1397c478bd9Sstevel@tonic-gate _FEMGUARD(WRITE, write), 1407c478bd9Sstevel@tonic-gate _FEMGUARD(IOCTL, ioctl), 1417c478bd9Sstevel@tonic-gate _FEMGUARD(SETFL, setfl), 1427c478bd9Sstevel@tonic-gate _FEMGUARD(GETATTR, getattr), 1437c478bd9Sstevel@tonic-gate _FEMGUARD(SETATTR, setattr), 1447c478bd9Sstevel@tonic-gate _FEMGUARD(ACCESS, access), 1457c478bd9Sstevel@tonic-gate _FEMGUARD(LOOKUP, lookup), 1467c478bd9Sstevel@tonic-gate _FEMGUARD(CREATE, create), 1477c478bd9Sstevel@tonic-gate _FEMGUARD(REMOVE, remove), 1487c478bd9Sstevel@tonic-gate _FEMGUARD(LINK, link), 1497c478bd9Sstevel@tonic-gate _FEMGUARD(RENAME, rename), 1507c478bd9Sstevel@tonic-gate _FEMGUARD(MKDIR, mkdir), 1517c478bd9Sstevel@tonic-gate _FEMGUARD(RMDIR, rmdir), 1527c478bd9Sstevel@tonic-gate _FEMGUARD(READDIR, readdir), 1537c478bd9Sstevel@tonic-gate _FEMGUARD(SYMLINK, symlink), 1547c478bd9Sstevel@tonic-gate _FEMGUARD(READLINK, readlink), 1557c478bd9Sstevel@tonic-gate _FEMGUARD(FSYNC, fsync), 1567c478bd9Sstevel@tonic-gate _FEMGUARD(INACTIVE, inactive), 1577c478bd9Sstevel@tonic-gate _FEMGUARD(FID, fid), 1587c478bd9Sstevel@tonic-gate _FEMGUARD(RWLOCK, rwlock), 1597c478bd9Sstevel@tonic-gate _FEMGUARD(RWUNLOCK, rwunlock), 1607c478bd9Sstevel@tonic-gate _FEMGUARD(SEEK, seek), 1617c478bd9Sstevel@tonic-gate _FEMGUARD(CMP, cmp), 1627c478bd9Sstevel@tonic-gate _FEMGUARD(FRLOCK, frlock), 1637c478bd9Sstevel@tonic-gate _FEMGUARD(SPACE, space), 1647c478bd9Sstevel@tonic-gate _FEMGUARD(REALVP, realvp), 1657c478bd9Sstevel@tonic-gate _FEMGUARD(GETPAGE, getpage), 1667c478bd9Sstevel@tonic-gate _FEMGUARD(PUTPAGE, putpage), 1677c478bd9Sstevel@tonic-gate _FEMGUARD(MAP, map), 1687c478bd9Sstevel@tonic-gate _FEMGUARD(ADDMAP, addmap), 1697c478bd9Sstevel@tonic-gate _FEMGUARD(DELMAP, delmap), 1707c478bd9Sstevel@tonic-gate _FEMGUARD(POLL, poll), 1717c478bd9Sstevel@tonic-gate _FEMGUARD(DUMP, dump), 1727c478bd9Sstevel@tonic-gate _FEMGUARD(PATHCONF, pathconf), 1737c478bd9Sstevel@tonic-gate _FEMGUARD(PAGEIO, pageio), 1747c478bd9Sstevel@tonic-gate _FEMGUARD(DUMPCTL, dumpctl), 1757c478bd9Sstevel@tonic-gate _FEMGUARD(DISPOSE, dispose), 1767c478bd9Sstevel@tonic-gate _FEMGUARD(SETSECATTR, setsecattr), 1777c478bd9Sstevel@tonic-gate _FEMGUARD(GETSECATTR, getsecattr), 1787c478bd9Sstevel@tonic-gate _FEMGUARD(SHRLOCK, shrlock), 1797c478bd9Sstevel@tonic-gate _FEMGUARD(VNEVENT, vnevent), 180c242f9a0Schunli zhang - Sun Microsystems - Irvine United States _FEMGUARD(REQZCBUF, reqzcbuf), 181c242f9a0Schunli zhang - Sun Microsystems - Irvine United States _FEMGUARD(RETZCBUF, retzcbuf), 1827c478bd9Sstevel@tonic-gate { NULL, NULL } 1837c478bd9Sstevel@tonic-gate }; 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate #define _FSEMOPDEF(name, member) \ 187aa59c4cbSrsb { VFSNAME_##name, offsetof(fsem_t, fsemop_##member), NULL, fsem_err } 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate static fs_operation_trans_def_t fsem_opdef[] = { 1907c478bd9Sstevel@tonic-gate _FSEMOPDEF(MOUNT, mount), 1917c478bd9Sstevel@tonic-gate _FSEMOPDEF(UNMOUNT, unmount), 1927c478bd9Sstevel@tonic-gate _FSEMOPDEF(ROOT, root), 1937c478bd9Sstevel@tonic-gate _FSEMOPDEF(STATVFS, statvfs), 1947c478bd9Sstevel@tonic-gate _FSEMOPDEF(SYNC, sync), 1957c478bd9Sstevel@tonic-gate _FSEMOPDEF(VGET, vget), 1967c478bd9Sstevel@tonic-gate _FSEMOPDEF(MOUNTROOT, mountroot), 1977c478bd9Sstevel@tonic-gate _FSEMOPDEF(FREEVFS, freevfs), 1987c478bd9Sstevel@tonic-gate _FSEMOPDEF(VNSTATE, vnstate), 1997c478bd9Sstevel@tonic-gate { NULL, 0, NULL, NULL } 2007c478bd9Sstevel@tonic-gate }; 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate #define _FSEMGUARD(name, ignore) \ 2037c478bd9Sstevel@tonic-gate { VFSNAME_##name, (femop_t *)fsem_err } 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate static struct fs_operation_def fsem_guard_ops[] = { 2067c478bd9Sstevel@tonic-gate _FSEMGUARD(MOUNT, mount), 2077c478bd9Sstevel@tonic-gate _FSEMGUARD(UNMOUNT, unmount), 2087c478bd9Sstevel@tonic-gate _FSEMGUARD(ROOT, root), 2097c478bd9Sstevel@tonic-gate _FSEMGUARD(STATVFS, statvfs), 2107c478bd9Sstevel@tonic-gate _FSEMGUARD(SYNC, sync), 2117c478bd9Sstevel@tonic-gate _FSEMGUARD(VGET, vget), 2127c478bd9Sstevel@tonic-gate _FSEMGUARD(MOUNTROOT, mountroot), 2137c478bd9Sstevel@tonic-gate _FSEMGUARD(FREEVFS, freevfs), 2147c478bd9Sstevel@tonic-gate _FSEMGUARD(VNSTATE, vnstate), 2157c478bd9Sstevel@tonic-gate { NULL, NULL} 2167c478bd9Sstevel@tonic-gate }; 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate /* 2207c478bd9Sstevel@tonic-gate * vsop_find, vfsop_find - 2217c478bd9Sstevel@tonic-gate * 2227c478bd9Sstevel@tonic-gate * These macros descend the stack until they find either a basic 2237c478bd9Sstevel@tonic-gate * vnode/vfs operation [ indicated by a null fn_available ] or a 2247c478bd9Sstevel@tonic-gate * stacked item where this method is non-null [_vsop]. 2257c478bd9Sstevel@tonic-gate * 2267c478bd9Sstevel@tonic-gate * The DEBUG one is written with a single function which manually applies 2277c478bd9Sstevel@tonic-gate * the structure offsets. It can have additional debugging support. 2287c478bd9Sstevel@tonic-gate */ 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate #ifndef DEBUG 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate #define vsop_find(ap, func, funct, arg0, _vop, _vsop) \ 2337c478bd9Sstevel@tonic-gate for (;;) { \ 2347c478bd9Sstevel@tonic-gate if ((ap)->fa_fnode->fn_available == NULL) { \ 2357c478bd9Sstevel@tonic-gate *(func) = (funct (*)())((ap)->fa_fnode->fn_op.vnode->_vop); \ 2367c478bd9Sstevel@tonic-gate *(arg0) = (void *)(ap)->fa_vnode.vp; \ 2377c478bd9Sstevel@tonic-gate break; \ 2387c478bd9Sstevel@tonic-gate } else if ((*(func) = (funct (*)())((ap)->fa_fnode->fn_op.fem->_vsop))\ 2397c478bd9Sstevel@tonic-gate != NULL) { \ 2407c478bd9Sstevel@tonic-gate *(arg0) = (void *) (ap); \ 2417c478bd9Sstevel@tonic-gate break; \ 2427c478bd9Sstevel@tonic-gate } else { \ 2437c478bd9Sstevel@tonic-gate (ap)->fa_fnode--; \ 2447c478bd9Sstevel@tonic-gate } \ 2457c478bd9Sstevel@tonic-gate } \ 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate #define vfsop_find(ap, func, funct, arg0, _vop, _vsop) \ 2487c478bd9Sstevel@tonic-gate for (;;) { \ 2497c478bd9Sstevel@tonic-gate if ((ap)->fa_fnode->fn_available == NULL) { \ 2507c478bd9Sstevel@tonic-gate *(func) = (funct (*)())((ap)->fa_fnode->fn_op.vfs->_vop); \ 2517c478bd9Sstevel@tonic-gate *(arg0) = (void *)(ap)->fa_vnode.vp; \ 2527c478bd9Sstevel@tonic-gate break; \ 2537c478bd9Sstevel@tonic-gate } else if ((*(func) = (funct (*)())((ap)->fa_fnode->fn_op.fsem->_vsop))\ 2547c478bd9Sstevel@tonic-gate != NULL) { \ 2557c478bd9Sstevel@tonic-gate *(arg0) = (void *) (ap); \ 2567c478bd9Sstevel@tonic-gate break; \ 2577c478bd9Sstevel@tonic-gate } else { \ 2587c478bd9Sstevel@tonic-gate (ap)->fa_fnode--; \ 2597c478bd9Sstevel@tonic-gate } \ 2607c478bd9Sstevel@tonic-gate } \ 2617c478bd9Sstevel@tonic-gate 2627c478bd9Sstevel@tonic-gate #else 2637c478bd9Sstevel@tonic-gate 2647c478bd9Sstevel@tonic-gate #define vsop_find(ap, func, funct, arg0, _vop, _vsop) \ 2657c478bd9Sstevel@tonic-gate *(arg0) = _op_find((ap), (void **)(func), \ 2667c478bd9Sstevel@tonic-gate offsetof(vnodeops_t, _vop), offsetof(fem_t, _vsop)) 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate #define vfsop_find(ap, func, funct, arg0, _fop, _fsop) \ 2697c478bd9Sstevel@tonic-gate *(arg0) = _op_find((ap), (void **)(func), \ 2707c478bd9Sstevel@tonic-gate offsetof(vfsops_t, _fop), offsetof(fsem_t, _fsop)) 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate static void * 2737c478bd9Sstevel@tonic-gate _op_find(femarg_t *ap, void **fp, int offs0, int offs1) 2747c478bd9Sstevel@tonic-gate { 2757c478bd9Sstevel@tonic-gate void *ptr; 2767c478bd9Sstevel@tonic-gate for (;;) { 2777c478bd9Sstevel@tonic-gate struct fem_node *fnod = ap->fa_fnode; 2787c478bd9Sstevel@tonic-gate if (fnod->fn_available == NULL) { 2797c478bd9Sstevel@tonic-gate *fp = *(void **)((char *)fnod->fn_op.anon + offs0); 2807c478bd9Sstevel@tonic-gate ptr = (void *)(ap->fa_vnode.anon); 2817c478bd9Sstevel@tonic-gate break; 2827c478bd9Sstevel@tonic-gate } else if ((*fp = *(void **)((char *)fnod->fn_op.anon+offs1)) 2837c478bd9Sstevel@tonic-gate != NULL) { 2847c478bd9Sstevel@tonic-gate ptr = (void *)(ap); 2857c478bd9Sstevel@tonic-gate break; 2867c478bd9Sstevel@tonic-gate } else { 2877c478bd9Sstevel@tonic-gate ap->fa_fnode--; 2887c478bd9Sstevel@tonic-gate } 2897c478bd9Sstevel@tonic-gate } 2907c478bd9Sstevel@tonic-gate return (ptr); 2917c478bd9Sstevel@tonic-gate } 2927c478bd9Sstevel@tonic-gate #endif 2937c478bd9Sstevel@tonic-gate 2947c478bd9Sstevel@tonic-gate static fem_t * 2957c478bd9Sstevel@tonic-gate fem_alloc() 2967c478bd9Sstevel@tonic-gate { 2977c478bd9Sstevel@tonic-gate fem_t *p; 2987c478bd9Sstevel@tonic-gate 2997c478bd9Sstevel@tonic-gate p = (fem_t *)kmem_alloc(sizeof (*p), KM_SLEEP); 3007c478bd9Sstevel@tonic-gate return (p); 3017c478bd9Sstevel@tonic-gate } 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate void 3047c478bd9Sstevel@tonic-gate fem_free(fem_t *p) 3057c478bd9Sstevel@tonic-gate { 3067c478bd9Sstevel@tonic-gate kmem_free(p, sizeof (*p)); 3077c478bd9Sstevel@tonic-gate } 3087c478bd9Sstevel@tonic-gate 3097c478bd9Sstevel@tonic-gate static fsem_t * 3107c478bd9Sstevel@tonic-gate fsem_alloc() 3117c478bd9Sstevel@tonic-gate { 3127c478bd9Sstevel@tonic-gate fsem_t *p; 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gate p = (fsem_t *)kmem_alloc(sizeof (*p), KM_SLEEP); 3157c478bd9Sstevel@tonic-gate return (p); 3167c478bd9Sstevel@tonic-gate } 3177c478bd9Sstevel@tonic-gate 3187c478bd9Sstevel@tonic-gate void 3197c478bd9Sstevel@tonic-gate fsem_free(fsem_t *p) 3207c478bd9Sstevel@tonic-gate { 3217c478bd9Sstevel@tonic-gate kmem_free(p, sizeof (*p)); 3227c478bd9Sstevel@tonic-gate } 3237c478bd9Sstevel@tonic-gate 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate /* 3267c478bd9Sstevel@tonic-gate * fem_get, fem_release - manage reference counts on the stack. 3277c478bd9Sstevel@tonic-gate * 3287c478bd9Sstevel@tonic-gate * The list of monitors can be updated while operations are in 3297c478bd9Sstevel@tonic-gate * progress on the object. 3307c478bd9Sstevel@tonic-gate * 3317c478bd9Sstevel@tonic-gate * The reference count facilitates this by counting the number of 3327c478bd9Sstevel@tonic-gate * current accessors, and deconstructing the list when it is exhausted. 3337c478bd9Sstevel@tonic-gate * 3347c478bd9Sstevel@tonic-gate * fem_lock() is required to: 3357c478bd9Sstevel@tonic-gate * look at femh_list 3367c478bd9Sstevel@tonic-gate * update what femh_list points to 3377c478bd9Sstevel@tonic-gate * update femh_list 3387c478bd9Sstevel@tonic-gate * increase femh_list->feml_refc. 3397c478bd9Sstevel@tonic-gate * 3407c478bd9Sstevel@tonic-gate * the feml_refc can decrement without holding the lock; 3417c478bd9Sstevel@tonic-gate * when feml_refc becomes zero, the list is destroyed. 3427c478bd9Sstevel@tonic-gate * 3437c478bd9Sstevel@tonic-gate */ 3447c478bd9Sstevel@tonic-gate 3457c478bd9Sstevel@tonic-gate static struct fem_list * 3467c478bd9Sstevel@tonic-gate fem_lock(struct fem_head *fp) 3477c478bd9Sstevel@tonic-gate { 3487c478bd9Sstevel@tonic-gate struct fem_list *sp = NULL; 3497c478bd9Sstevel@tonic-gate 3507c478bd9Sstevel@tonic-gate ASSERT(fp != NULL); 3517c478bd9Sstevel@tonic-gate mutex_enter(&fp->femh_lock); 3527c478bd9Sstevel@tonic-gate sp = fp->femh_list; 3537c478bd9Sstevel@tonic-gate return (sp); 3547c478bd9Sstevel@tonic-gate } 3557c478bd9Sstevel@tonic-gate 3567c478bd9Sstevel@tonic-gate static void 3577c478bd9Sstevel@tonic-gate fem_unlock(struct fem_head *fp) 3587c478bd9Sstevel@tonic-gate { 3597c478bd9Sstevel@tonic-gate ASSERT(fp != NULL); 3607c478bd9Sstevel@tonic-gate mutex_exit(&fp->femh_lock); 3617c478bd9Sstevel@tonic-gate } 3627c478bd9Sstevel@tonic-gate 3637c478bd9Sstevel@tonic-gate /* 3647c478bd9Sstevel@tonic-gate * Addref can only be called while its head->lock is held. 3657c478bd9Sstevel@tonic-gate */ 3667c478bd9Sstevel@tonic-gate 3677c478bd9Sstevel@tonic-gate static void 3687c478bd9Sstevel@tonic-gate fem_addref(struct fem_list *sp) 3697c478bd9Sstevel@tonic-gate { 370*1a5e258fSJosef 'Jeff' Sipek atomic_inc_32(&sp->feml_refc); 3717c478bd9Sstevel@tonic-gate } 3727c478bd9Sstevel@tonic-gate 373677d097aSjwahlig static uint32_t 3747c478bd9Sstevel@tonic-gate fem_delref(struct fem_list *sp) 3757c478bd9Sstevel@tonic-gate { 376*1a5e258fSJosef 'Jeff' Sipek return (atomic_dec_32_nv(&sp->feml_refc)); 3777c478bd9Sstevel@tonic-gate } 3787c478bd9Sstevel@tonic-gate 3797c478bd9Sstevel@tonic-gate static struct fem_list * 3807c478bd9Sstevel@tonic-gate fem_get(struct fem_head *fp) 3817c478bd9Sstevel@tonic-gate { 3827c478bd9Sstevel@tonic-gate struct fem_list *sp = NULL; 3837c478bd9Sstevel@tonic-gate 3847c478bd9Sstevel@tonic-gate if (fp != NULL) { 3857c478bd9Sstevel@tonic-gate if ((sp = fem_lock(fp)) != NULL) { 3867c478bd9Sstevel@tonic-gate fem_addref(sp); 3877c478bd9Sstevel@tonic-gate } 3887c478bd9Sstevel@tonic-gate fem_unlock(fp); 3897c478bd9Sstevel@tonic-gate } 3907c478bd9Sstevel@tonic-gate return (sp); 3917c478bd9Sstevel@tonic-gate } 3927c478bd9Sstevel@tonic-gate 3937c478bd9Sstevel@tonic-gate static void 3947c478bd9Sstevel@tonic-gate fem_release(struct fem_list *sp) 3957c478bd9Sstevel@tonic-gate { 3967c478bd9Sstevel@tonic-gate int i; 3977c478bd9Sstevel@tonic-gate 398677d097aSjwahlig ASSERT(sp->feml_refc != 0); 399677d097aSjwahlig if (fem_delref(sp) == 0) { 4007c478bd9Sstevel@tonic-gate /* 4017c478bd9Sstevel@tonic-gate * Before freeing the list, we need to release the 4027c478bd9Sstevel@tonic-gate * caller-provided data. 4037c478bd9Sstevel@tonic-gate */ 4047c478bd9Sstevel@tonic-gate for (i = sp->feml_tos; i > 0; i--) { 4057c478bd9Sstevel@tonic-gate struct fem_node *fnp = &sp->feml_nodes[i]; 4067c478bd9Sstevel@tonic-gate 4077c478bd9Sstevel@tonic-gate if (fnp->fn_av_rele) 4087c478bd9Sstevel@tonic-gate (*(fnp->fn_av_rele))(fnp->fn_available); 4097c478bd9Sstevel@tonic-gate } 4107c478bd9Sstevel@tonic-gate kmem_free(sp, fl_ntob(sp->feml_ssize)); 4117c478bd9Sstevel@tonic-gate } 4127c478bd9Sstevel@tonic-gate } 4137c478bd9Sstevel@tonic-gate 4147c478bd9Sstevel@tonic-gate 4157c478bd9Sstevel@tonic-gate /* 4167c478bd9Sstevel@tonic-gate * These are the 'head' operations which perform the interposition. 4177c478bd9Sstevel@tonic-gate * 4187c478bd9Sstevel@tonic-gate * This set must be 1:1, onto with the (vnodeops, vfsos). 4197c478bd9Sstevel@tonic-gate * 4207c478bd9Sstevel@tonic-gate * If there is a desire to globally disable interposition for a particular 4217c478bd9Sstevel@tonic-gate * method, the corresponding 'head' routine should unearth the base method 4227c478bd9Sstevel@tonic-gate * and invoke it directly rather than bypassing the function. 4237c478bd9Sstevel@tonic-gate * 4247c478bd9Sstevel@tonic-gate * All the functions are virtually the same, save for names, types & args. 4257c478bd9Sstevel@tonic-gate * 1. get a reference to the monitor stack for this object. 4267c478bd9Sstevel@tonic-gate * 2. store the top of stack into the femarg structure. 4277c478bd9Sstevel@tonic-gate * 3. store the basic object (vnode *, vnode **, vfs *) in the femarg struc. 4287c478bd9Sstevel@tonic-gate * 4. invoke the "top" method for this object. 4297c478bd9Sstevel@tonic-gate * 5. release the reference to the monitor stack. 4307c478bd9Sstevel@tonic-gate * 4317c478bd9Sstevel@tonic-gate */ 4327c478bd9Sstevel@tonic-gate 4337c478bd9Sstevel@tonic-gate static int 434da6c28aaSamw vhead_open(vnode_t **vpp, int mode, cred_t *cr, caller_context_t *ct) 4357c478bd9Sstevel@tonic-gate { 4367c478bd9Sstevel@tonic-gate femarg_t farg; 4377c478bd9Sstevel@tonic-gate struct fem_list *femsp; 4387c478bd9Sstevel@tonic-gate int (*func)(); 4397c478bd9Sstevel@tonic-gate void *arg0; 4407c478bd9Sstevel@tonic-gate int errc; 4417c478bd9Sstevel@tonic-gate 4427c478bd9Sstevel@tonic-gate if ((femsp = fem_lock((*vpp)->v_femhead)) == NULL) { 4437c478bd9Sstevel@tonic-gate func = (int (*)()) ((*vpp)->v_op->vop_open); 4447c478bd9Sstevel@tonic-gate arg0 = (void *)vpp; 4457c478bd9Sstevel@tonic-gate fem_unlock((*vpp)->v_femhead); 446da6c28aaSamw errc = (*func)(arg0, mode, cr, ct); 4477c478bd9Sstevel@tonic-gate } else { 4487c478bd9Sstevel@tonic-gate fem_addref(femsp); 4497c478bd9Sstevel@tonic-gate fem_unlock((*vpp)->v_femhead); 4507c478bd9Sstevel@tonic-gate farg.fa_vnode.vpp = vpp; 4517c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 452aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_open, femop_open); 453da6c28aaSamw errc = (*func)(arg0, mode, cr, ct); 4547c478bd9Sstevel@tonic-gate fem_release(femsp); 4557c478bd9Sstevel@tonic-gate } 4567c478bd9Sstevel@tonic-gate return (errc); 4577c478bd9Sstevel@tonic-gate } 4587c478bd9Sstevel@tonic-gate 4597c478bd9Sstevel@tonic-gate static int 460da6c28aaSamw vhead_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr, 461da6c28aaSamw caller_context_t *ct) 4627c478bd9Sstevel@tonic-gate { 4637c478bd9Sstevel@tonic-gate femarg_t farg; 4647c478bd9Sstevel@tonic-gate struct fem_list *femsp; 4657c478bd9Sstevel@tonic-gate int (*func)(); 4667c478bd9Sstevel@tonic-gate void *arg0; 4677c478bd9Sstevel@tonic-gate int errc; 4687c478bd9Sstevel@tonic-gate 4697c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 4707c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_close); 4717c478bd9Sstevel@tonic-gate arg0 = vp; 4727c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 473da6c28aaSamw errc = (*func)(arg0, flag, count, offset, cr, ct); 4747c478bd9Sstevel@tonic-gate } else { 4757c478bd9Sstevel@tonic-gate fem_addref(femsp); 4767c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 4777c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 4787c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 479aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_close, femop_close); 480da6c28aaSamw errc = (*func)(arg0, flag, count, offset, cr, ct); 4817c478bd9Sstevel@tonic-gate fem_release(femsp); 4827c478bd9Sstevel@tonic-gate } 4837c478bd9Sstevel@tonic-gate return (errc); 4847c478bd9Sstevel@tonic-gate } 4857c478bd9Sstevel@tonic-gate 4867c478bd9Sstevel@tonic-gate static int 4877c478bd9Sstevel@tonic-gate vhead_read(vnode_t *vp, uio_t *uiop, int ioflag, cred_t *cr, 488da6c28aaSamw caller_context_t *ct) 4897c478bd9Sstevel@tonic-gate { 4907c478bd9Sstevel@tonic-gate femarg_t farg; 4917c478bd9Sstevel@tonic-gate struct fem_list *femsp; 4927c478bd9Sstevel@tonic-gate int (*func)(); 4937c478bd9Sstevel@tonic-gate void *arg0; 4947c478bd9Sstevel@tonic-gate int errc; 4957c478bd9Sstevel@tonic-gate 4967c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 4977c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_read); 4987c478bd9Sstevel@tonic-gate arg0 = vp; 4997c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 5007c478bd9Sstevel@tonic-gate errc = (*func)(arg0, uiop, ioflag, cr, ct); 5017c478bd9Sstevel@tonic-gate } else { 5027c478bd9Sstevel@tonic-gate fem_addref(femsp); 5037c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 5047c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 5057c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 506aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_read, femop_read); 5077c478bd9Sstevel@tonic-gate errc = (*func)(arg0, uiop, ioflag, cr, ct); 5087c478bd9Sstevel@tonic-gate fem_release(femsp); 5097c478bd9Sstevel@tonic-gate } 5107c478bd9Sstevel@tonic-gate return (errc); 5117c478bd9Sstevel@tonic-gate } 5127c478bd9Sstevel@tonic-gate 5137c478bd9Sstevel@tonic-gate static int 5147c478bd9Sstevel@tonic-gate vhead_write(vnode_t *vp, uio_t *uiop, int ioflag, cred_t *cr, 515da6c28aaSamw caller_context_t *ct) 5167c478bd9Sstevel@tonic-gate { 5177c478bd9Sstevel@tonic-gate femarg_t farg; 5187c478bd9Sstevel@tonic-gate struct fem_list *femsp; 5197c478bd9Sstevel@tonic-gate int (*func)(); 5207c478bd9Sstevel@tonic-gate void *arg0; 5217c478bd9Sstevel@tonic-gate int errc; 5227c478bd9Sstevel@tonic-gate 5237c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 5247c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_write); 5257c478bd9Sstevel@tonic-gate arg0 = vp; 5267c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 5277c478bd9Sstevel@tonic-gate errc = (*func)(arg0, uiop, ioflag, cr, ct); 5287c478bd9Sstevel@tonic-gate } else { 5297c478bd9Sstevel@tonic-gate fem_addref(femsp); 5307c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 5317c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 5327c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 533aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_write, femop_write); 5347c478bd9Sstevel@tonic-gate errc = (*func)(arg0, uiop, ioflag, cr, ct); 5357c478bd9Sstevel@tonic-gate fem_release(femsp); 5367c478bd9Sstevel@tonic-gate } 5377c478bd9Sstevel@tonic-gate return (errc); 5387c478bd9Sstevel@tonic-gate } 5397c478bd9Sstevel@tonic-gate 5407c478bd9Sstevel@tonic-gate static int 5417c478bd9Sstevel@tonic-gate vhead_ioctl(vnode_t *vp, int cmd, intptr_t arg, int flag, cred_t *cr, 542da6c28aaSamw int *rvalp, caller_context_t *ct) 5437c478bd9Sstevel@tonic-gate { 5447c478bd9Sstevel@tonic-gate femarg_t farg; 5457c478bd9Sstevel@tonic-gate struct fem_list *femsp; 5467c478bd9Sstevel@tonic-gate int (*func)(); 5477c478bd9Sstevel@tonic-gate void *arg0; 5487c478bd9Sstevel@tonic-gate int errc; 5497c478bd9Sstevel@tonic-gate 5507c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 5517c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_ioctl); 5527c478bd9Sstevel@tonic-gate arg0 = vp; 5537c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 554da6c28aaSamw errc = (*func)(arg0, cmd, arg, flag, cr, rvalp, ct); 5557c478bd9Sstevel@tonic-gate } else { 5567c478bd9Sstevel@tonic-gate fem_addref(femsp); 5577c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 5587c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 5597c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 560aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_ioctl, femop_ioctl); 561da6c28aaSamw errc = (*func)(arg0, cmd, arg, flag, cr, rvalp, ct); 5627c478bd9Sstevel@tonic-gate fem_release(femsp); 5637c478bd9Sstevel@tonic-gate } 5647c478bd9Sstevel@tonic-gate return (errc); 5657c478bd9Sstevel@tonic-gate } 5667c478bd9Sstevel@tonic-gate 5677c478bd9Sstevel@tonic-gate static int 568da6c28aaSamw vhead_setfl(vnode_t *vp, int oflags, int nflags, cred_t *cr, 569da6c28aaSamw caller_context_t *ct) 5707c478bd9Sstevel@tonic-gate { 5717c478bd9Sstevel@tonic-gate femarg_t farg; 5727c478bd9Sstevel@tonic-gate struct fem_list *femsp; 5737c478bd9Sstevel@tonic-gate int (*func)(); 5747c478bd9Sstevel@tonic-gate void *arg0; 5757c478bd9Sstevel@tonic-gate int errc; 5767c478bd9Sstevel@tonic-gate 5777c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 5787c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_setfl); 5797c478bd9Sstevel@tonic-gate arg0 = vp; 5807c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 581da6c28aaSamw errc = (*func)(arg0, oflags, nflags, cr, ct); 5827c478bd9Sstevel@tonic-gate } else { 5837c478bd9Sstevel@tonic-gate fem_addref(femsp); 5847c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 5857c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 5867c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 587aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_setfl, femop_setfl); 588da6c28aaSamw errc = (*func)(arg0, oflags, nflags, cr, ct); 5897c478bd9Sstevel@tonic-gate fem_release(femsp); 5907c478bd9Sstevel@tonic-gate } 5917c478bd9Sstevel@tonic-gate return (errc); 5927c478bd9Sstevel@tonic-gate } 5937c478bd9Sstevel@tonic-gate 5947c478bd9Sstevel@tonic-gate static int 595da6c28aaSamw vhead_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, 596da6c28aaSamw caller_context_t *ct) 5977c478bd9Sstevel@tonic-gate { 5987c478bd9Sstevel@tonic-gate femarg_t farg; 5997c478bd9Sstevel@tonic-gate struct fem_list *femsp; 6007c478bd9Sstevel@tonic-gate int (*func)(); 6017c478bd9Sstevel@tonic-gate void *arg0; 6027c478bd9Sstevel@tonic-gate int errc; 6037c478bd9Sstevel@tonic-gate 6047c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 6057c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_getattr); 6067c478bd9Sstevel@tonic-gate arg0 = vp; 6077c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 608da6c28aaSamw errc = (*func)(arg0, vap, flags, cr, ct); 6097c478bd9Sstevel@tonic-gate } else { 6107c478bd9Sstevel@tonic-gate fem_addref(femsp); 6117c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 6127c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 6137c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 6147c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_getattr, 615aa59c4cbSrsb femop_getattr); 616da6c28aaSamw errc = (*func)(arg0, vap, flags, cr, ct); 6177c478bd9Sstevel@tonic-gate fem_release(femsp); 6187c478bd9Sstevel@tonic-gate } 6197c478bd9Sstevel@tonic-gate return (errc); 6207c478bd9Sstevel@tonic-gate } 6217c478bd9Sstevel@tonic-gate 6227c478bd9Sstevel@tonic-gate static int 6237c478bd9Sstevel@tonic-gate vhead_setattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, 6247c478bd9Sstevel@tonic-gate caller_context_t *ct) 6257c478bd9Sstevel@tonic-gate { 6267c478bd9Sstevel@tonic-gate femarg_t farg; 6277c478bd9Sstevel@tonic-gate struct fem_list *femsp; 6287c478bd9Sstevel@tonic-gate int (*func)(); 6297c478bd9Sstevel@tonic-gate void *arg0; 6307c478bd9Sstevel@tonic-gate int errc; 6317c478bd9Sstevel@tonic-gate 6327c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 6337c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_setattr); 6347c478bd9Sstevel@tonic-gate arg0 = vp; 6357c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 6367c478bd9Sstevel@tonic-gate errc = (*func)(arg0, vap, flags, cr, ct); 6377c478bd9Sstevel@tonic-gate } else { 6387c478bd9Sstevel@tonic-gate fem_addref(femsp); 6397c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 6407c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 6417c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 6427c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_setattr, 643aa59c4cbSrsb femop_setattr); 6447c478bd9Sstevel@tonic-gate errc = (*func)(arg0, vap, flags, cr, ct); 6457c478bd9Sstevel@tonic-gate fem_release(femsp); 6467c478bd9Sstevel@tonic-gate } 6477c478bd9Sstevel@tonic-gate return (errc); 6487c478bd9Sstevel@tonic-gate } 6497c478bd9Sstevel@tonic-gate 6507c478bd9Sstevel@tonic-gate static int 651da6c28aaSamw vhead_access(vnode_t *vp, int mode, int flags, cred_t *cr, 652da6c28aaSamw caller_context_t *ct) 6537c478bd9Sstevel@tonic-gate { 6547c478bd9Sstevel@tonic-gate femarg_t farg; 6557c478bd9Sstevel@tonic-gate struct fem_list *femsp; 6567c478bd9Sstevel@tonic-gate int (*func)(); 6577c478bd9Sstevel@tonic-gate void *arg0; 6587c478bd9Sstevel@tonic-gate int errc; 6597c478bd9Sstevel@tonic-gate 6607c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 6617c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_access); 6627c478bd9Sstevel@tonic-gate arg0 = vp; 6637c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 664da6c28aaSamw errc = (*func)(arg0, mode, flags, cr, ct); 6657c478bd9Sstevel@tonic-gate } else { 6667c478bd9Sstevel@tonic-gate fem_addref(femsp); 6677c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 6687c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 6697c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 6707c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_access, 671aa59c4cbSrsb femop_access); 672da6c28aaSamw errc = (*func)(arg0, mode, flags, cr, ct); 6737c478bd9Sstevel@tonic-gate fem_release(femsp); 6747c478bd9Sstevel@tonic-gate } 6757c478bd9Sstevel@tonic-gate return (errc); 6767c478bd9Sstevel@tonic-gate } 6777c478bd9Sstevel@tonic-gate 6787c478bd9Sstevel@tonic-gate static int 6797c478bd9Sstevel@tonic-gate vhead_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp, 680da6c28aaSamw int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct, 681da6c28aaSamw int *direntflags, pathname_t *realpnp) 6827c478bd9Sstevel@tonic-gate { 6837c478bd9Sstevel@tonic-gate femarg_t farg; 6847c478bd9Sstevel@tonic-gate struct fem_list *femsp; 6857c478bd9Sstevel@tonic-gate int (*func)(); 6867c478bd9Sstevel@tonic-gate void *arg0; 6877c478bd9Sstevel@tonic-gate int errc; 6887c478bd9Sstevel@tonic-gate 6897c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(dvp->v_femhead)) == NULL) { 6907c478bd9Sstevel@tonic-gate func = (int (*)()) (dvp->v_op->vop_lookup); 6917c478bd9Sstevel@tonic-gate arg0 = dvp; 6927c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 693da6c28aaSamw errc = (*func)(arg0, nm, vpp, pnp, flags, rdir, cr, ct, 694da6c28aaSamw direntflags, realpnp); 6957c478bd9Sstevel@tonic-gate } else { 6967c478bd9Sstevel@tonic-gate fem_addref(femsp); 6977c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 6987c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = dvp; 6997c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 7007c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_lookup, 701aa59c4cbSrsb femop_lookup); 702da6c28aaSamw errc = (*func)(arg0, nm, vpp, pnp, flags, rdir, cr, ct, 703da6c28aaSamw direntflags, realpnp); 7047c478bd9Sstevel@tonic-gate fem_release(femsp); 7057c478bd9Sstevel@tonic-gate } 7067c478bd9Sstevel@tonic-gate return (errc); 7077c478bd9Sstevel@tonic-gate } 7087c478bd9Sstevel@tonic-gate 7097c478bd9Sstevel@tonic-gate static int 7107c478bd9Sstevel@tonic-gate vhead_create(vnode_t *dvp, char *name, vattr_t *vap, vcexcl_t excl, 711da6c28aaSamw int mode, vnode_t **vpp, cred_t *cr, int flag, caller_context_t *ct, 712da6c28aaSamw vsecattr_t *vsecp) 7137c478bd9Sstevel@tonic-gate { 7147c478bd9Sstevel@tonic-gate femarg_t farg; 7157c478bd9Sstevel@tonic-gate struct fem_list *femsp; 7167c478bd9Sstevel@tonic-gate int (*func)(); 7177c478bd9Sstevel@tonic-gate void *arg0; 7187c478bd9Sstevel@tonic-gate int errc; 7197c478bd9Sstevel@tonic-gate 7207c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(dvp->v_femhead)) == NULL) { 7217c478bd9Sstevel@tonic-gate func = (int (*)()) (dvp->v_op->vop_create); 7227c478bd9Sstevel@tonic-gate arg0 = dvp; 7237c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 724da6c28aaSamw errc = (*func)(arg0, name, vap, excl, mode, vpp, cr, flag, 725da6c28aaSamw ct, vsecp); 7267c478bd9Sstevel@tonic-gate } else { 7277c478bd9Sstevel@tonic-gate fem_addref(femsp); 7287c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 7297c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = dvp; 7307c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 7317c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_create, 732aa59c4cbSrsb femop_create); 733da6c28aaSamw errc = (*func)(arg0, name, vap, excl, mode, vpp, cr, flag, 734da6c28aaSamw ct, vsecp); 7357c478bd9Sstevel@tonic-gate fem_release(femsp); 7367c478bd9Sstevel@tonic-gate } 7377c478bd9Sstevel@tonic-gate return (errc); 7387c478bd9Sstevel@tonic-gate } 7397c478bd9Sstevel@tonic-gate 7407c478bd9Sstevel@tonic-gate static int 741da6c28aaSamw vhead_remove(vnode_t *dvp, char *nm, cred_t *cr, caller_context_t *ct, 742da6c28aaSamw int flags) 7437c478bd9Sstevel@tonic-gate { 7447c478bd9Sstevel@tonic-gate femarg_t farg; 7457c478bd9Sstevel@tonic-gate struct fem_list *femsp; 7467c478bd9Sstevel@tonic-gate int (*func)(); 7477c478bd9Sstevel@tonic-gate void *arg0; 7487c478bd9Sstevel@tonic-gate int errc; 7497c478bd9Sstevel@tonic-gate 7507c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(dvp->v_femhead)) == NULL) { 7517c478bd9Sstevel@tonic-gate func = (int (*)()) (dvp->v_op->vop_remove); 7527c478bd9Sstevel@tonic-gate arg0 = dvp; 7537c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 754da6c28aaSamw errc = (*func)(arg0, nm, cr, ct, flags); 7557c478bd9Sstevel@tonic-gate } else { 7567c478bd9Sstevel@tonic-gate fem_addref(femsp); 7577c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 7587c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = dvp; 7597c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 7607c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_remove, 761aa59c4cbSrsb femop_remove); 762da6c28aaSamw errc = (*func)(arg0, nm, cr, ct, flags); 7637c478bd9Sstevel@tonic-gate fem_release(femsp); 7647c478bd9Sstevel@tonic-gate } 7657c478bd9Sstevel@tonic-gate return (errc); 7667c478bd9Sstevel@tonic-gate } 7677c478bd9Sstevel@tonic-gate 7687c478bd9Sstevel@tonic-gate static int 769da6c28aaSamw vhead_link(vnode_t *tdvp, vnode_t *svp, char *tnm, cred_t *cr, 770da6c28aaSamw caller_context_t *ct, int flags) 7717c478bd9Sstevel@tonic-gate { 7727c478bd9Sstevel@tonic-gate femarg_t farg; 7737c478bd9Sstevel@tonic-gate struct fem_list *femsp; 7747c478bd9Sstevel@tonic-gate int (*func)(); 7757c478bd9Sstevel@tonic-gate void *arg0; 7767c478bd9Sstevel@tonic-gate int errc; 7777c478bd9Sstevel@tonic-gate 7787c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(tdvp->v_femhead)) == NULL) { 7797c478bd9Sstevel@tonic-gate func = (int (*)()) (tdvp->v_op->vop_link); 7807c478bd9Sstevel@tonic-gate arg0 = tdvp; 7817c478bd9Sstevel@tonic-gate fem_unlock(tdvp->v_femhead); 782da6c28aaSamw errc = (*func)(arg0, svp, tnm, cr, ct, flags); 7837c478bd9Sstevel@tonic-gate } else { 7847c478bd9Sstevel@tonic-gate fem_addref(femsp); 7857c478bd9Sstevel@tonic-gate fem_unlock(tdvp->v_femhead); 7867c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = tdvp; 7877c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 788aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_link, femop_link); 789da6c28aaSamw errc = (*func)(arg0, svp, tnm, cr, ct, flags); 7907c478bd9Sstevel@tonic-gate fem_release(femsp); 7917c478bd9Sstevel@tonic-gate } 7927c478bd9Sstevel@tonic-gate return (errc); 7937c478bd9Sstevel@tonic-gate } 7947c478bd9Sstevel@tonic-gate 7957c478bd9Sstevel@tonic-gate static int 7967c478bd9Sstevel@tonic-gate vhead_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, 797da6c28aaSamw cred_t *cr, caller_context_t *ct, int flags) 7987c478bd9Sstevel@tonic-gate { 7997c478bd9Sstevel@tonic-gate femarg_t farg; 8007c478bd9Sstevel@tonic-gate struct fem_list *femsp; 8017c478bd9Sstevel@tonic-gate int (*func)(); 8027c478bd9Sstevel@tonic-gate void *arg0; 8037c478bd9Sstevel@tonic-gate int errc; 8047c478bd9Sstevel@tonic-gate 8057c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(sdvp->v_femhead)) == NULL) { 8067c478bd9Sstevel@tonic-gate func = (int (*)()) (sdvp->v_op->vop_rename); 8077c478bd9Sstevel@tonic-gate arg0 = sdvp; 8087c478bd9Sstevel@tonic-gate fem_unlock(sdvp->v_femhead); 809da6c28aaSamw errc = (*func)(arg0, snm, tdvp, tnm, cr, ct, flags); 8107c478bd9Sstevel@tonic-gate } else { 8117c478bd9Sstevel@tonic-gate fem_addref(femsp); 8127c478bd9Sstevel@tonic-gate fem_unlock(sdvp->v_femhead); 8137c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = sdvp; 8147c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 8157c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_rename, 816aa59c4cbSrsb femop_rename); 817da6c28aaSamw errc = (*func)(arg0, snm, tdvp, tnm, cr, ct, flags); 8187c478bd9Sstevel@tonic-gate fem_release(femsp); 8197c478bd9Sstevel@tonic-gate } 8207c478bd9Sstevel@tonic-gate return (errc); 8217c478bd9Sstevel@tonic-gate } 8227c478bd9Sstevel@tonic-gate 8237c478bd9Sstevel@tonic-gate static int 8247c478bd9Sstevel@tonic-gate vhead_mkdir(vnode_t *dvp, char *dirname, vattr_t *vap, vnode_t **vpp, 825da6c28aaSamw cred_t *cr, caller_context_t *ct, int flags, vsecattr_t *vsecp) 8267c478bd9Sstevel@tonic-gate { 8277c478bd9Sstevel@tonic-gate femarg_t farg; 8287c478bd9Sstevel@tonic-gate struct fem_list *femsp; 8297c478bd9Sstevel@tonic-gate int (*func)(); 8307c478bd9Sstevel@tonic-gate void *arg0; 8317c478bd9Sstevel@tonic-gate int errc; 8327c478bd9Sstevel@tonic-gate 8337c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(dvp->v_femhead)) == NULL) { 8347c478bd9Sstevel@tonic-gate func = (int (*)()) (dvp->v_op->vop_mkdir); 8357c478bd9Sstevel@tonic-gate arg0 = dvp; 8367c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 837da6c28aaSamw errc = (*func)(arg0, dirname, vap, vpp, cr, ct, flags, vsecp); 8387c478bd9Sstevel@tonic-gate } else { 8397c478bd9Sstevel@tonic-gate fem_addref(femsp); 8407c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 8417c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = dvp; 8427c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 843aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_mkdir, femop_mkdir); 844da6c28aaSamw errc = (*func)(arg0, dirname, vap, vpp, cr, ct, flags, vsecp); 8457c478bd9Sstevel@tonic-gate fem_release(femsp); 8467c478bd9Sstevel@tonic-gate } 8477c478bd9Sstevel@tonic-gate return (errc); 8487c478bd9Sstevel@tonic-gate } 8497c478bd9Sstevel@tonic-gate 8507c478bd9Sstevel@tonic-gate static int 851da6c28aaSamw vhead_rmdir(vnode_t *dvp, char *nm, vnode_t *cdir, cred_t *cr, 852da6c28aaSamw caller_context_t *ct, int flags) 8537c478bd9Sstevel@tonic-gate { 8547c478bd9Sstevel@tonic-gate femarg_t farg; 8557c478bd9Sstevel@tonic-gate struct fem_list *femsp; 8567c478bd9Sstevel@tonic-gate int (*func)(); 8577c478bd9Sstevel@tonic-gate void *arg0; 8587c478bd9Sstevel@tonic-gate int errc; 8597c478bd9Sstevel@tonic-gate 8607c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(dvp->v_femhead)) == NULL) { 8617c478bd9Sstevel@tonic-gate func = (int (*)()) (dvp->v_op->vop_rmdir); 8627c478bd9Sstevel@tonic-gate arg0 = dvp; 8637c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 864da6c28aaSamw errc = (*func)(arg0, nm, cdir, cr, ct, flags); 8657c478bd9Sstevel@tonic-gate } else { 8667c478bd9Sstevel@tonic-gate fem_addref(femsp); 8677c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 8687c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = dvp; 8697c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 870aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_rmdir, femop_rmdir); 871da6c28aaSamw errc = (*func)(arg0, nm, cdir, cr, ct, flags); 8727c478bd9Sstevel@tonic-gate fem_release(femsp); 8737c478bd9Sstevel@tonic-gate } 8747c478bd9Sstevel@tonic-gate return (errc); 8757c478bd9Sstevel@tonic-gate } 8767c478bd9Sstevel@tonic-gate 8777c478bd9Sstevel@tonic-gate static int 878da6c28aaSamw vhead_readdir(vnode_t *vp, uio_t *uiop, cred_t *cr, int *eofp, 879da6c28aaSamw caller_context_t *ct, int flags) 8807c478bd9Sstevel@tonic-gate { 8817c478bd9Sstevel@tonic-gate femarg_t farg; 8827c478bd9Sstevel@tonic-gate struct fem_list *femsp; 8837c478bd9Sstevel@tonic-gate int (*func)(); 8847c478bd9Sstevel@tonic-gate void *arg0; 8857c478bd9Sstevel@tonic-gate int errc; 8867c478bd9Sstevel@tonic-gate 8877c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 8887c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_readdir); 8897c478bd9Sstevel@tonic-gate arg0 = vp; 8907c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 891da6c28aaSamw errc = (*func)(arg0, uiop, cr, eofp, ct, flags); 8927c478bd9Sstevel@tonic-gate } else { 8937c478bd9Sstevel@tonic-gate fem_addref(femsp); 8947c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 8957c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 8967c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 8977c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_readdir, 898aa59c4cbSrsb femop_readdir); 899da6c28aaSamw errc = (*func)(arg0, uiop, cr, eofp, ct, flags); 9007c478bd9Sstevel@tonic-gate fem_release(femsp); 9017c478bd9Sstevel@tonic-gate } 9027c478bd9Sstevel@tonic-gate return (errc); 9037c478bd9Sstevel@tonic-gate } 9047c478bd9Sstevel@tonic-gate 9057c478bd9Sstevel@tonic-gate static int 9067c478bd9Sstevel@tonic-gate vhead_symlink(vnode_t *dvp, char *linkname, vattr_t *vap, char *target, 907da6c28aaSamw cred_t *cr, caller_context_t *ct, int flags) 9087c478bd9Sstevel@tonic-gate { 9097c478bd9Sstevel@tonic-gate femarg_t farg; 9107c478bd9Sstevel@tonic-gate struct fem_list *femsp; 9117c478bd9Sstevel@tonic-gate int (*func)(); 9127c478bd9Sstevel@tonic-gate void *arg0; 9137c478bd9Sstevel@tonic-gate int errc; 9147c478bd9Sstevel@tonic-gate 9157c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(dvp->v_femhead)) == NULL) { 9167c478bd9Sstevel@tonic-gate func = (int (*)()) (dvp->v_op->vop_symlink); 9177c478bd9Sstevel@tonic-gate arg0 = dvp; 9187c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 919da6c28aaSamw errc = (*func)(arg0, linkname, vap, target, cr, ct, flags); 9207c478bd9Sstevel@tonic-gate } else { 9217c478bd9Sstevel@tonic-gate fem_addref(femsp); 9227c478bd9Sstevel@tonic-gate fem_unlock(dvp->v_femhead); 9237c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = dvp; 9247c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 9257c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_symlink, 926aa59c4cbSrsb femop_symlink); 927da6c28aaSamw errc = (*func)(arg0, linkname, vap, target, cr, ct, flags); 9287c478bd9Sstevel@tonic-gate fem_release(femsp); 9297c478bd9Sstevel@tonic-gate } 9307c478bd9Sstevel@tonic-gate return (errc); 9317c478bd9Sstevel@tonic-gate } 9327c478bd9Sstevel@tonic-gate 9337c478bd9Sstevel@tonic-gate static int 934da6c28aaSamw vhead_readlink(vnode_t *vp, uio_t *uiop, cred_t *cr, caller_context_t *ct) 9357c478bd9Sstevel@tonic-gate { 9367c478bd9Sstevel@tonic-gate femarg_t farg; 9377c478bd9Sstevel@tonic-gate struct fem_list *femsp; 9387c478bd9Sstevel@tonic-gate int (*func)(); 9397c478bd9Sstevel@tonic-gate void *arg0; 9407c478bd9Sstevel@tonic-gate int errc; 9417c478bd9Sstevel@tonic-gate 9427c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 9437c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_readlink); 9447c478bd9Sstevel@tonic-gate arg0 = vp; 9457c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 946da6c28aaSamw errc = (*func)(arg0, uiop, cr, ct); 9477c478bd9Sstevel@tonic-gate } else { 9487c478bd9Sstevel@tonic-gate fem_addref(femsp); 9497c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 9507c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 9517c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 9527c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_readlink, 953aa59c4cbSrsb femop_readlink); 954da6c28aaSamw errc = (*func)(arg0, uiop, cr, ct); 9557c478bd9Sstevel@tonic-gate fem_release(femsp); 9567c478bd9Sstevel@tonic-gate } 9577c478bd9Sstevel@tonic-gate return (errc); 9587c478bd9Sstevel@tonic-gate } 9597c478bd9Sstevel@tonic-gate 9607c478bd9Sstevel@tonic-gate static int 961da6c28aaSamw vhead_fsync(vnode_t *vp, int syncflag, cred_t *cr, caller_context_t *ct) 9627c478bd9Sstevel@tonic-gate { 9637c478bd9Sstevel@tonic-gate femarg_t farg; 9647c478bd9Sstevel@tonic-gate struct fem_list *femsp; 9657c478bd9Sstevel@tonic-gate int (*func)(); 9667c478bd9Sstevel@tonic-gate void *arg0; 9677c478bd9Sstevel@tonic-gate int errc; 9687c478bd9Sstevel@tonic-gate 9697c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 9707c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_fsync); 9717c478bd9Sstevel@tonic-gate arg0 = vp; 9727c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 973da6c28aaSamw errc = (*func)(arg0, syncflag, cr, ct); 9747c478bd9Sstevel@tonic-gate } else { 9757c478bd9Sstevel@tonic-gate fem_addref(femsp); 9767c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 9777c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 9787c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 979aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_fsync, femop_fsync); 980da6c28aaSamw errc = (*func)(arg0, syncflag, cr, ct); 9817c478bd9Sstevel@tonic-gate fem_release(femsp); 9827c478bd9Sstevel@tonic-gate } 9837c478bd9Sstevel@tonic-gate return (errc); 9847c478bd9Sstevel@tonic-gate } 9857c478bd9Sstevel@tonic-gate 9867c478bd9Sstevel@tonic-gate static void 987da6c28aaSamw vhead_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct) 9887c478bd9Sstevel@tonic-gate { 9897c478bd9Sstevel@tonic-gate femarg_t farg; 9907c478bd9Sstevel@tonic-gate struct fem_list *femsp; 9917c478bd9Sstevel@tonic-gate void (*func)(); 9927c478bd9Sstevel@tonic-gate void *arg0; 9937c478bd9Sstevel@tonic-gate 9947c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 9957c478bd9Sstevel@tonic-gate func = (void (*)()) (vp->v_op->vop_inactive); 9967c478bd9Sstevel@tonic-gate arg0 = vp; 9977c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 998da6c28aaSamw (*func)(arg0, cr, ct); 9997c478bd9Sstevel@tonic-gate } else { 10007c478bd9Sstevel@tonic-gate fem_addref(femsp); 10017c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 10027c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 10037c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 10047c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, void, &arg0, vop_inactive, 1005aa59c4cbSrsb femop_inactive); 1006da6c28aaSamw (*func)(arg0, cr, ct); 10077c478bd9Sstevel@tonic-gate fem_release(femsp); 10087c478bd9Sstevel@tonic-gate } 10097c478bd9Sstevel@tonic-gate } 10107c478bd9Sstevel@tonic-gate 10117c478bd9Sstevel@tonic-gate static int 1012da6c28aaSamw vhead_fid(vnode_t *vp, fid_t *fidp, caller_context_t *ct) 10137c478bd9Sstevel@tonic-gate { 10147c478bd9Sstevel@tonic-gate femarg_t farg; 10157c478bd9Sstevel@tonic-gate struct fem_list *femsp; 10167c478bd9Sstevel@tonic-gate int (*func)(); 10177c478bd9Sstevel@tonic-gate void *arg0; 10187c478bd9Sstevel@tonic-gate int errc; 10197c478bd9Sstevel@tonic-gate 10207c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 10217c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_fid); 10227c478bd9Sstevel@tonic-gate arg0 = vp; 10237c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1024da6c28aaSamw errc = (*func)(arg0, fidp, ct); 10257c478bd9Sstevel@tonic-gate } else { 10267c478bd9Sstevel@tonic-gate fem_addref(femsp); 10277c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 10287c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 10297c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1030aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_fid, femop_fid); 1031da6c28aaSamw errc = (*func)(arg0, fidp, ct); 10327c478bd9Sstevel@tonic-gate fem_release(femsp); 10337c478bd9Sstevel@tonic-gate } 10347c478bd9Sstevel@tonic-gate return (errc); 10357c478bd9Sstevel@tonic-gate } 10367c478bd9Sstevel@tonic-gate 10377c478bd9Sstevel@tonic-gate static int 10387c478bd9Sstevel@tonic-gate vhead_rwlock(vnode_t *vp, int write_lock, caller_context_t *ct) 10397c478bd9Sstevel@tonic-gate { 10407c478bd9Sstevel@tonic-gate femarg_t farg; 10417c478bd9Sstevel@tonic-gate struct fem_list *femsp; 10427c478bd9Sstevel@tonic-gate int (*func)(); 10437c478bd9Sstevel@tonic-gate void *arg0; 10447c478bd9Sstevel@tonic-gate int errc; 10457c478bd9Sstevel@tonic-gate 10467c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 10477c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_rwlock); 10487c478bd9Sstevel@tonic-gate arg0 = vp; 10497c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 10507c478bd9Sstevel@tonic-gate errc = (*func)(arg0, write_lock, ct); 10517c478bd9Sstevel@tonic-gate } else { 10527c478bd9Sstevel@tonic-gate fem_addref(femsp); 10537c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 10547c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 10557c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 10567c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_rwlock, 1057aa59c4cbSrsb femop_rwlock); 10587c478bd9Sstevel@tonic-gate errc = (*func)(arg0, write_lock, ct); 10597c478bd9Sstevel@tonic-gate fem_release(femsp); 10607c478bd9Sstevel@tonic-gate } 10617c478bd9Sstevel@tonic-gate return (errc); 10627c478bd9Sstevel@tonic-gate } 10637c478bd9Sstevel@tonic-gate 10647c478bd9Sstevel@tonic-gate static void 10657c478bd9Sstevel@tonic-gate vhead_rwunlock(vnode_t *vp, int write_lock, caller_context_t *ct) 10667c478bd9Sstevel@tonic-gate { 10677c478bd9Sstevel@tonic-gate femarg_t farg; 10687c478bd9Sstevel@tonic-gate struct fem_list *femsp; 10697c478bd9Sstevel@tonic-gate void (*func)(); 10707c478bd9Sstevel@tonic-gate void *arg0; 10717c478bd9Sstevel@tonic-gate 10727c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 10737c478bd9Sstevel@tonic-gate func = (void (*)()) (vp->v_op->vop_rwunlock); 10747c478bd9Sstevel@tonic-gate arg0 = vp; 10757c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 10767c478bd9Sstevel@tonic-gate (*func)(arg0, write_lock, ct); 10777c478bd9Sstevel@tonic-gate } else { 10787c478bd9Sstevel@tonic-gate fem_addref(femsp); 10797c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 10807c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 10817c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 10827c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, void, &arg0, vop_rwunlock, 1083aa59c4cbSrsb femop_rwunlock); 10847c478bd9Sstevel@tonic-gate (*func)(arg0, write_lock, ct); 10857c478bd9Sstevel@tonic-gate fem_release(femsp); 10867c478bd9Sstevel@tonic-gate } 10877c478bd9Sstevel@tonic-gate } 10887c478bd9Sstevel@tonic-gate 10897c478bd9Sstevel@tonic-gate static int 1090da6c28aaSamw vhead_seek(vnode_t *vp, offset_t ooff, offset_t *noffp, caller_context_t *ct) 10917c478bd9Sstevel@tonic-gate { 10927c478bd9Sstevel@tonic-gate femarg_t farg; 10937c478bd9Sstevel@tonic-gate struct fem_list *femsp; 10947c478bd9Sstevel@tonic-gate int (*func)(); 10957c478bd9Sstevel@tonic-gate void *arg0; 10967c478bd9Sstevel@tonic-gate int errc; 10977c478bd9Sstevel@tonic-gate 10987c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 10997c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_seek); 11007c478bd9Sstevel@tonic-gate arg0 = vp; 11017c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1102da6c28aaSamw errc = (*func)(arg0, ooff, noffp, ct); 11037c478bd9Sstevel@tonic-gate } else { 11047c478bd9Sstevel@tonic-gate fem_addref(femsp); 11057c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 11067c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 11077c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1108aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_seek, femop_seek); 1109da6c28aaSamw errc = (*func)(arg0, ooff, noffp, ct); 11107c478bd9Sstevel@tonic-gate fem_release(femsp); 11117c478bd9Sstevel@tonic-gate } 11127c478bd9Sstevel@tonic-gate return (errc); 11137c478bd9Sstevel@tonic-gate } 11147c478bd9Sstevel@tonic-gate 11157c478bd9Sstevel@tonic-gate static int 1116da6c28aaSamw vhead_cmp(vnode_t *vp1, vnode_t *vp2, caller_context_t *ct) 11177c478bd9Sstevel@tonic-gate { 11187c478bd9Sstevel@tonic-gate femarg_t farg; 11197c478bd9Sstevel@tonic-gate struct fem_list *femsp; 11207c478bd9Sstevel@tonic-gate int (*func)(); 11217c478bd9Sstevel@tonic-gate void *arg0; 11227c478bd9Sstevel@tonic-gate int errc; 11237c478bd9Sstevel@tonic-gate 11247c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp1->v_femhead)) == NULL) { 11257c478bd9Sstevel@tonic-gate func = (int (*)()) (vp1->v_op->vop_cmp); 11267c478bd9Sstevel@tonic-gate arg0 = vp1; 11277c478bd9Sstevel@tonic-gate fem_unlock(vp1->v_femhead); 1128da6c28aaSamw errc = (*func)(arg0, vp2, ct); 11297c478bd9Sstevel@tonic-gate } else { 11307c478bd9Sstevel@tonic-gate fem_addref(femsp); 11317c478bd9Sstevel@tonic-gate fem_unlock(vp1->v_femhead); 11327c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp1; 11337c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1134aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_cmp, femop_cmp); 1135da6c28aaSamw errc = (*func)(arg0, vp2, ct); 11367c478bd9Sstevel@tonic-gate fem_release(femsp); 11377c478bd9Sstevel@tonic-gate } 11387c478bd9Sstevel@tonic-gate return (errc); 11397c478bd9Sstevel@tonic-gate } 11407c478bd9Sstevel@tonic-gate 11417c478bd9Sstevel@tonic-gate static int 11427c478bd9Sstevel@tonic-gate vhead_frlock(vnode_t *vp, int cmd, struct flock64 *bfp, int flag, 1143da6c28aaSamw offset_t offset, struct flk_callback *flk_cbp, cred_t *cr, 1144da6c28aaSamw caller_context_t *ct) 11457c478bd9Sstevel@tonic-gate { 11467c478bd9Sstevel@tonic-gate femarg_t farg; 11477c478bd9Sstevel@tonic-gate struct fem_list *femsp; 11487c478bd9Sstevel@tonic-gate int (*func)(); 11497c478bd9Sstevel@tonic-gate void *arg0; 11507c478bd9Sstevel@tonic-gate int errc; 11517c478bd9Sstevel@tonic-gate 11527c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 11537c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_frlock); 11547c478bd9Sstevel@tonic-gate arg0 = vp; 11557c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1156da6c28aaSamw errc = (*func)(arg0, cmd, bfp, flag, offset, flk_cbp, cr, ct); 11577c478bd9Sstevel@tonic-gate } else { 11587c478bd9Sstevel@tonic-gate fem_addref(femsp); 11597c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 11607c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 11617c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 11627c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_frlock, 1163aa59c4cbSrsb femop_frlock); 1164da6c28aaSamw errc = (*func)(arg0, cmd, bfp, flag, offset, flk_cbp, cr, ct); 11657c478bd9Sstevel@tonic-gate fem_release(femsp); 11667c478bd9Sstevel@tonic-gate } 11677c478bd9Sstevel@tonic-gate return (errc); 11687c478bd9Sstevel@tonic-gate } 11697c478bd9Sstevel@tonic-gate 11707c478bd9Sstevel@tonic-gate static int 11717c478bd9Sstevel@tonic-gate vhead_space(vnode_t *vp, int cmd, struct flock64 *bfp, int flag, 11727c478bd9Sstevel@tonic-gate offset_t offset, cred_t *cr, caller_context_t *ct) 11737c478bd9Sstevel@tonic-gate { 11747c478bd9Sstevel@tonic-gate femarg_t farg; 11757c478bd9Sstevel@tonic-gate struct fem_list *femsp; 11767c478bd9Sstevel@tonic-gate int (*func)(); 11777c478bd9Sstevel@tonic-gate void *arg0; 11787c478bd9Sstevel@tonic-gate int errc; 11797c478bd9Sstevel@tonic-gate 11807c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 11817c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_space); 11827c478bd9Sstevel@tonic-gate arg0 = vp; 11837c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 11847c478bd9Sstevel@tonic-gate errc = (*func)(arg0, cmd, bfp, flag, offset, cr, ct); 11857c478bd9Sstevel@tonic-gate } else { 11867c478bd9Sstevel@tonic-gate fem_addref(femsp); 11877c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 11887c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 11897c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1190aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_space, femop_space); 11917c478bd9Sstevel@tonic-gate errc = (*func)(arg0, cmd, bfp, flag, offset, cr, ct); 11927c478bd9Sstevel@tonic-gate fem_release(femsp); 11937c478bd9Sstevel@tonic-gate } 11947c478bd9Sstevel@tonic-gate return (errc); 11957c478bd9Sstevel@tonic-gate } 11967c478bd9Sstevel@tonic-gate 11977c478bd9Sstevel@tonic-gate static int 1198da6c28aaSamw vhead_realvp(vnode_t *vp, vnode_t **vpp, caller_context_t *ct) 11997c478bd9Sstevel@tonic-gate { 12007c478bd9Sstevel@tonic-gate femarg_t farg; 12017c478bd9Sstevel@tonic-gate struct fem_list *femsp; 12027c478bd9Sstevel@tonic-gate int (*func)(); 12037c478bd9Sstevel@tonic-gate void *arg0; 12047c478bd9Sstevel@tonic-gate int errc; 12057c478bd9Sstevel@tonic-gate 12067c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 12077c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_realvp); 12087c478bd9Sstevel@tonic-gate arg0 = vp; 12097c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1210da6c28aaSamw errc = (*func)(arg0, vpp, ct); 12117c478bd9Sstevel@tonic-gate } else { 12127c478bd9Sstevel@tonic-gate fem_addref(femsp); 12137c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 12147c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 12157c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 12167c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_realvp, 1217aa59c4cbSrsb femop_realvp); 1218da6c28aaSamw errc = (*func)(arg0, vpp, ct); 12197c478bd9Sstevel@tonic-gate fem_release(femsp); 12207c478bd9Sstevel@tonic-gate } 12217c478bd9Sstevel@tonic-gate return (errc); 12227c478bd9Sstevel@tonic-gate } 12237c478bd9Sstevel@tonic-gate 12247c478bd9Sstevel@tonic-gate static int 12257c478bd9Sstevel@tonic-gate vhead_getpage(vnode_t *vp, offset_t off, size_t len, uint_t *protp, 12267c478bd9Sstevel@tonic-gate struct page **plarr, size_t plsz, struct seg *seg, caddr_t addr, 1227da6c28aaSamw enum seg_rw rw, cred_t *cr, caller_context_t *ct) 12287c478bd9Sstevel@tonic-gate { 12297c478bd9Sstevel@tonic-gate femarg_t farg; 12307c478bd9Sstevel@tonic-gate struct fem_list *femsp; 12317c478bd9Sstevel@tonic-gate int (*func)(); 12327c478bd9Sstevel@tonic-gate void *arg0; 12337c478bd9Sstevel@tonic-gate int errc; 12347c478bd9Sstevel@tonic-gate 12357c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 12367c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_getpage); 12377c478bd9Sstevel@tonic-gate arg0 = vp; 12387c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 12397c478bd9Sstevel@tonic-gate errc = (*func)(arg0, off, len, protp, plarr, plsz, seg, 1240da6c28aaSamw addr, rw, cr, ct); 12417c478bd9Sstevel@tonic-gate } else { 12427c478bd9Sstevel@tonic-gate fem_addref(femsp); 12437c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 12447c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 12457c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 12467c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_getpage, 1247aa59c4cbSrsb femop_getpage); 12487c478bd9Sstevel@tonic-gate errc = (*func)(arg0, off, len, protp, plarr, plsz, seg, 1249da6c28aaSamw addr, rw, cr, ct); 12507c478bd9Sstevel@tonic-gate fem_release(femsp); 12517c478bd9Sstevel@tonic-gate } 12527c478bd9Sstevel@tonic-gate return (errc); 12537c478bd9Sstevel@tonic-gate } 12547c478bd9Sstevel@tonic-gate 12557c478bd9Sstevel@tonic-gate static int 1256da6c28aaSamw vhead_putpage(vnode_t *vp, offset_t off, size_t len, int flags, cred_t *cr, 1257da6c28aaSamw caller_context_t *ct) 12587c478bd9Sstevel@tonic-gate { 12597c478bd9Sstevel@tonic-gate femarg_t farg; 12607c478bd9Sstevel@tonic-gate struct fem_list *femsp; 12617c478bd9Sstevel@tonic-gate int (*func)(); 12627c478bd9Sstevel@tonic-gate void *arg0; 12637c478bd9Sstevel@tonic-gate int errc; 12647c478bd9Sstevel@tonic-gate 12657c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 12667c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_putpage); 12677c478bd9Sstevel@tonic-gate arg0 = vp; 12687c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1269da6c28aaSamw errc = (*func)(arg0, off, len, flags, cr, ct); 12707c478bd9Sstevel@tonic-gate } else { 12717c478bd9Sstevel@tonic-gate fem_addref(femsp); 12727c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 12737c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 12747c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 12757c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_putpage, 1276aa59c4cbSrsb femop_putpage); 1277da6c28aaSamw errc = (*func)(arg0, off, len, flags, cr, ct); 12787c478bd9Sstevel@tonic-gate fem_release(femsp); 12797c478bd9Sstevel@tonic-gate } 12807c478bd9Sstevel@tonic-gate return (errc); 12817c478bd9Sstevel@tonic-gate } 12827c478bd9Sstevel@tonic-gate 12837c478bd9Sstevel@tonic-gate static int 12847c478bd9Sstevel@tonic-gate vhead_map(vnode_t *vp, offset_t off, struct as *as, caddr_t *addrp, 12857c478bd9Sstevel@tonic-gate size_t len, uchar_t prot, uchar_t maxprot, uint_t flags, 1286da6c28aaSamw cred_t *cr, caller_context_t *ct) 12877c478bd9Sstevel@tonic-gate { 12887c478bd9Sstevel@tonic-gate femarg_t farg; 12897c478bd9Sstevel@tonic-gate struct fem_list *femsp; 12907c478bd9Sstevel@tonic-gate int (*func)(); 12917c478bd9Sstevel@tonic-gate void *arg0; 12927c478bd9Sstevel@tonic-gate int errc; 12937c478bd9Sstevel@tonic-gate 12947c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 12957c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_map); 12967c478bd9Sstevel@tonic-gate arg0 = vp; 12977c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 12987c478bd9Sstevel@tonic-gate errc = (*func)(arg0, off, as, addrp, len, prot, maxprot, 1299da6c28aaSamw flags, cr, ct); 13007c478bd9Sstevel@tonic-gate } else { 13017c478bd9Sstevel@tonic-gate fem_addref(femsp); 13027c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 13037c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 13047c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1305aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_map, femop_map); 13067c478bd9Sstevel@tonic-gate errc = (*func)(arg0, off, as, addrp, len, prot, maxprot, 1307da6c28aaSamw flags, cr, ct); 13087c478bd9Sstevel@tonic-gate fem_release(femsp); 13097c478bd9Sstevel@tonic-gate } 13107c478bd9Sstevel@tonic-gate return (errc); 13117c478bd9Sstevel@tonic-gate } 13127c478bd9Sstevel@tonic-gate 13137c478bd9Sstevel@tonic-gate static int 13147c478bd9Sstevel@tonic-gate vhead_addmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr, 13157c478bd9Sstevel@tonic-gate size_t len, uchar_t prot, uchar_t maxprot, uint_t flags, 1316da6c28aaSamw cred_t *cr, caller_context_t *ct) 13177c478bd9Sstevel@tonic-gate { 13187c478bd9Sstevel@tonic-gate femarg_t farg; 13197c478bd9Sstevel@tonic-gate struct fem_list *femsp; 13207c478bd9Sstevel@tonic-gate int (*func)(); 13217c478bd9Sstevel@tonic-gate void *arg0; 13227c478bd9Sstevel@tonic-gate int errc; 13237c478bd9Sstevel@tonic-gate 13247c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 13257c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_addmap); 13267c478bd9Sstevel@tonic-gate arg0 = vp; 13277c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 13287c478bd9Sstevel@tonic-gate errc = (*func)(arg0, off, as, addr, len, prot, maxprot, 1329da6c28aaSamw flags, cr, ct); 13307c478bd9Sstevel@tonic-gate } else { 13317c478bd9Sstevel@tonic-gate fem_addref(femsp); 13327c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 13337c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 13347c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 13357c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_addmap, 1336aa59c4cbSrsb femop_addmap); 13377c478bd9Sstevel@tonic-gate errc = (*func)(arg0, off, as, addr, len, prot, maxprot, 1338da6c28aaSamw flags, cr, ct); 13397c478bd9Sstevel@tonic-gate fem_release(femsp); 13407c478bd9Sstevel@tonic-gate } 13417c478bd9Sstevel@tonic-gate return (errc); 13427c478bd9Sstevel@tonic-gate } 13437c478bd9Sstevel@tonic-gate 13447c478bd9Sstevel@tonic-gate static int 13457c478bd9Sstevel@tonic-gate vhead_delmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr, 1346da6c28aaSamw size_t len, uint_t prot, uint_t maxprot, uint_t flags, cred_t *cr, 1347da6c28aaSamw caller_context_t *ct) 13487c478bd9Sstevel@tonic-gate { 13497c478bd9Sstevel@tonic-gate femarg_t farg; 13507c478bd9Sstevel@tonic-gate struct fem_list *femsp; 13517c478bd9Sstevel@tonic-gate int (*func)(); 13527c478bd9Sstevel@tonic-gate void *arg0; 13537c478bd9Sstevel@tonic-gate int errc; 13547c478bd9Sstevel@tonic-gate 13557c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 13567c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_delmap); 13577c478bd9Sstevel@tonic-gate arg0 = vp; 13587c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 13597c478bd9Sstevel@tonic-gate errc = (*func)(arg0, off, as, addr, len, prot, maxprot, 1360da6c28aaSamw flags, cr, ct); 13617c478bd9Sstevel@tonic-gate } else { 13627c478bd9Sstevel@tonic-gate fem_addref(femsp); 13637c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 13647c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 13657c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 13667c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_delmap, 1367aa59c4cbSrsb femop_delmap); 13687c478bd9Sstevel@tonic-gate errc = (*func)(arg0, off, as, addr, len, prot, maxprot, 1369da6c28aaSamw flags, cr, ct); 13707c478bd9Sstevel@tonic-gate fem_release(femsp); 13717c478bd9Sstevel@tonic-gate } 13727c478bd9Sstevel@tonic-gate return (errc); 13737c478bd9Sstevel@tonic-gate } 13747c478bd9Sstevel@tonic-gate 13757c478bd9Sstevel@tonic-gate static int 13767c478bd9Sstevel@tonic-gate vhead_poll(vnode_t *vp, short events, int anyyet, short *reventsp, 1377da6c28aaSamw struct pollhead **phpp, caller_context_t *ct) 13787c478bd9Sstevel@tonic-gate { 13797c478bd9Sstevel@tonic-gate femarg_t farg; 13807c478bd9Sstevel@tonic-gate struct fem_list *femsp; 13817c478bd9Sstevel@tonic-gate int (*func)(); 13827c478bd9Sstevel@tonic-gate void *arg0; 13837c478bd9Sstevel@tonic-gate int errc; 13847c478bd9Sstevel@tonic-gate 13857c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 13867c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_poll); 13877c478bd9Sstevel@tonic-gate arg0 = vp; 13887c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1389da6c28aaSamw errc = (*func)(arg0, events, anyyet, reventsp, phpp, ct); 13907c478bd9Sstevel@tonic-gate } else { 13917c478bd9Sstevel@tonic-gate fem_addref(femsp); 13927c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 13937c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 13947c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1395aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_poll, femop_poll); 1396da6c28aaSamw errc = (*func)(arg0, events, anyyet, reventsp, phpp, ct); 13977c478bd9Sstevel@tonic-gate fem_release(femsp); 13987c478bd9Sstevel@tonic-gate } 13997c478bd9Sstevel@tonic-gate return (errc); 14007c478bd9Sstevel@tonic-gate } 14017c478bd9Sstevel@tonic-gate 14027c478bd9Sstevel@tonic-gate static int 1403d7334e51Srm15945 vhead_dump(vnode_t *vp, caddr_t addr, offset_t lbdn, offset_t dblks, 1404d7334e51Srm15945 caller_context_t *ct) 14057c478bd9Sstevel@tonic-gate { 14067c478bd9Sstevel@tonic-gate femarg_t farg; 14077c478bd9Sstevel@tonic-gate struct fem_list *femsp; 14087c478bd9Sstevel@tonic-gate int (*func)(); 14097c478bd9Sstevel@tonic-gate void *arg0; 14107c478bd9Sstevel@tonic-gate int errc; 14117c478bd9Sstevel@tonic-gate 14127c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 14137c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_dump); 14147c478bd9Sstevel@tonic-gate arg0 = vp; 14157c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1416da6c28aaSamw errc = (*func)(arg0, addr, lbdn, dblks, ct); 14177c478bd9Sstevel@tonic-gate } else { 14187c478bd9Sstevel@tonic-gate fem_addref(femsp); 14197c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 14207c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 14217c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1422aa59c4cbSrsb vsop_find(&farg, &func, int, &arg0, vop_dump, femop_dump); 1423da6c28aaSamw errc = (*func)(arg0, addr, lbdn, dblks, ct); 14247c478bd9Sstevel@tonic-gate fem_release(femsp); 14257c478bd9Sstevel@tonic-gate } 14267c478bd9Sstevel@tonic-gate return (errc); 14277c478bd9Sstevel@tonic-gate } 14287c478bd9Sstevel@tonic-gate 14297c478bd9Sstevel@tonic-gate static int 1430da6c28aaSamw vhead_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, 1431da6c28aaSamw caller_context_t *ct) 14327c478bd9Sstevel@tonic-gate { 14337c478bd9Sstevel@tonic-gate femarg_t farg; 14347c478bd9Sstevel@tonic-gate struct fem_list *femsp; 14357c478bd9Sstevel@tonic-gate int (*func)(); 14367c478bd9Sstevel@tonic-gate void *arg0; 14377c478bd9Sstevel@tonic-gate int errc; 14387c478bd9Sstevel@tonic-gate 14397c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 14407c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_pathconf); 14417c478bd9Sstevel@tonic-gate arg0 = vp; 14427c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1443da6c28aaSamw errc = (*func)(arg0, cmd, valp, cr, ct); 14447c478bd9Sstevel@tonic-gate } else { 14457c478bd9Sstevel@tonic-gate fem_addref(femsp); 14467c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 14477c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 14487c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 14497c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_pathconf, 1450aa59c4cbSrsb femop_pathconf); 1451da6c28aaSamw errc = (*func)(arg0, cmd, valp, cr, ct); 14527c478bd9Sstevel@tonic-gate fem_release(femsp); 14537c478bd9Sstevel@tonic-gate } 14547c478bd9Sstevel@tonic-gate return (errc); 14557c478bd9Sstevel@tonic-gate } 14567c478bd9Sstevel@tonic-gate 14577c478bd9Sstevel@tonic-gate static int 14587c478bd9Sstevel@tonic-gate vhead_pageio(vnode_t *vp, struct page *pp, u_offset_t io_off, 1459da6c28aaSamw size_t io_len, int flags, cred_t *cr, caller_context_t *ct) 14607c478bd9Sstevel@tonic-gate { 14617c478bd9Sstevel@tonic-gate femarg_t farg; 14627c478bd9Sstevel@tonic-gate struct fem_list *femsp; 14637c478bd9Sstevel@tonic-gate int (*func)(); 14647c478bd9Sstevel@tonic-gate void *arg0; 14657c478bd9Sstevel@tonic-gate int errc; 14667c478bd9Sstevel@tonic-gate 14677c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 14687c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_pageio); 14697c478bd9Sstevel@tonic-gate arg0 = vp; 14707c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1471da6c28aaSamw errc = (*func)(arg0, pp, io_off, io_len, flags, cr, ct); 14727c478bd9Sstevel@tonic-gate } else { 14737c478bd9Sstevel@tonic-gate fem_addref(femsp); 14747c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 14757c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 14767c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 14777c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_pageio, 1478aa59c4cbSrsb femop_pageio); 1479da6c28aaSamw errc = (*func)(arg0, pp, io_off, io_len, flags, cr, ct); 14807c478bd9Sstevel@tonic-gate fem_release(femsp); 14817c478bd9Sstevel@tonic-gate } 14827c478bd9Sstevel@tonic-gate return (errc); 14837c478bd9Sstevel@tonic-gate } 14847c478bd9Sstevel@tonic-gate 14857c478bd9Sstevel@tonic-gate static int 1486d7334e51Srm15945 vhead_dumpctl(vnode_t *vp, int action, offset_t *blkp, caller_context_t *ct) 14877c478bd9Sstevel@tonic-gate { 14887c478bd9Sstevel@tonic-gate femarg_t farg; 14897c478bd9Sstevel@tonic-gate struct fem_list *femsp; 14907c478bd9Sstevel@tonic-gate int (*func)(); 14917c478bd9Sstevel@tonic-gate void *arg0; 14927c478bd9Sstevel@tonic-gate int errc; 14937c478bd9Sstevel@tonic-gate 14947c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 14957c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_dumpctl); 14967c478bd9Sstevel@tonic-gate arg0 = vp; 14977c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1498da6c28aaSamw errc = (*func)(arg0, action, blkp, ct); 14997c478bd9Sstevel@tonic-gate } else { 15007c478bd9Sstevel@tonic-gate fem_addref(femsp); 15017c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 15027c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 15037c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 15047c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_dumpctl, 1505aa59c4cbSrsb femop_dumpctl); 1506da6c28aaSamw errc = (*func)(arg0, action, blkp, ct); 15077c478bd9Sstevel@tonic-gate fem_release(femsp); 15087c478bd9Sstevel@tonic-gate } 15097c478bd9Sstevel@tonic-gate return (errc); 15107c478bd9Sstevel@tonic-gate } 15117c478bd9Sstevel@tonic-gate 15127c478bd9Sstevel@tonic-gate static void 1513da6c28aaSamw vhead_dispose(vnode_t *vp, struct page *pp, int flag, int dn, cred_t *cr, 1514da6c28aaSamw caller_context_t *ct) 15157c478bd9Sstevel@tonic-gate { 15167c478bd9Sstevel@tonic-gate femarg_t farg; 15177c478bd9Sstevel@tonic-gate struct fem_list *femsp; 15187c478bd9Sstevel@tonic-gate void (*func)(); 15197c478bd9Sstevel@tonic-gate void *arg0; 15207c478bd9Sstevel@tonic-gate 15217c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 15227c478bd9Sstevel@tonic-gate func = (void (*)()) (vp->v_op->vop_dispose); 15237c478bd9Sstevel@tonic-gate arg0 = vp; 15247c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1525da6c28aaSamw (*func)(arg0, pp, flag, dn, cr, ct); 15267c478bd9Sstevel@tonic-gate } else { 15277c478bd9Sstevel@tonic-gate fem_addref(femsp); 15287c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 15297c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 15307c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 15317c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, void, &arg0, vop_dispose, 1532aa59c4cbSrsb femop_dispose); 1533da6c28aaSamw (*func)(arg0, pp, flag, dn, cr, ct); 15347c478bd9Sstevel@tonic-gate fem_release(femsp); 15357c478bd9Sstevel@tonic-gate } 15367c478bd9Sstevel@tonic-gate } 15377c478bd9Sstevel@tonic-gate 15387c478bd9Sstevel@tonic-gate static int 1539da6c28aaSamw vhead_setsecattr(vnode_t *vp, vsecattr_t *vsap, int flag, cred_t *cr, 1540da6c28aaSamw caller_context_t *ct) 15417c478bd9Sstevel@tonic-gate { 15427c478bd9Sstevel@tonic-gate femarg_t farg; 15437c478bd9Sstevel@tonic-gate struct fem_list *femsp; 15447c478bd9Sstevel@tonic-gate int (*func)(); 15457c478bd9Sstevel@tonic-gate void *arg0; 15467c478bd9Sstevel@tonic-gate int errc; 15477c478bd9Sstevel@tonic-gate 15487c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 15497c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_setsecattr); 15507c478bd9Sstevel@tonic-gate arg0 = vp; 15517c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1552da6c28aaSamw errc = (*func)(arg0, vsap, flag, cr, ct); 15537c478bd9Sstevel@tonic-gate } else { 15547c478bd9Sstevel@tonic-gate fem_addref(femsp); 15557c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 15567c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 15577c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 15587c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_setsecattr, 1559aa59c4cbSrsb femop_setsecattr); 1560da6c28aaSamw errc = (*func)(arg0, vsap, flag, cr, ct); 15617c478bd9Sstevel@tonic-gate fem_release(femsp); 15627c478bd9Sstevel@tonic-gate } 15637c478bd9Sstevel@tonic-gate return (errc); 15647c478bd9Sstevel@tonic-gate } 15657c478bd9Sstevel@tonic-gate 15667c478bd9Sstevel@tonic-gate static int 1567da6c28aaSamw vhead_getsecattr(vnode_t *vp, vsecattr_t *vsap, int flag, cred_t *cr, 1568da6c28aaSamw caller_context_t *ct) 15697c478bd9Sstevel@tonic-gate { 15707c478bd9Sstevel@tonic-gate femarg_t farg; 15717c478bd9Sstevel@tonic-gate struct fem_list *femsp; 15727c478bd9Sstevel@tonic-gate int (*func)(); 15737c478bd9Sstevel@tonic-gate void *arg0; 15747c478bd9Sstevel@tonic-gate int errc; 15757c478bd9Sstevel@tonic-gate 15767c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 15777c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_getsecattr); 15787c478bd9Sstevel@tonic-gate arg0 = vp; 15797c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1580da6c28aaSamw errc = (*func)(arg0, vsap, flag, cr, ct); 15817c478bd9Sstevel@tonic-gate } else { 15827c478bd9Sstevel@tonic-gate fem_addref(femsp); 15837c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 15847c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 15857c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 15867c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_getsecattr, 1587aa59c4cbSrsb femop_getsecattr); 1588da6c28aaSamw errc = (*func)(arg0, vsap, flag, cr, ct); 15897c478bd9Sstevel@tonic-gate fem_release(femsp); 15907c478bd9Sstevel@tonic-gate } 15917c478bd9Sstevel@tonic-gate return (errc); 15927c478bd9Sstevel@tonic-gate } 15937c478bd9Sstevel@tonic-gate 15947c478bd9Sstevel@tonic-gate static int 15957c478bd9Sstevel@tonic-gate vhead_shrlock(vnode_t *vp, int cmd, struct shrlock *shr, int flag, 1596da6c28aaSamw cred_t *cr, caller_context_t *ct) 15977c478bd9Sstevel@tonic-gate { 15987c478bd9Sstevel@tonic-gate femarg_t farg; 15997c478bd9Sstevel@tonic-gate struct fem_list *femsp; 16007c478bd9Sstevel@tonic-gate int (*func)(); 16017c478bd9Sstevel@tonic-gate void *arg0; 16027c478bd9Sstevel@tonic-gate int errc; 16037c478bd9Sstevel@tonic-gate 16047c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 16057c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_shrlock); 16067c478bd9Sstevel@tonic-gate arg0 = vp; 16077c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1608da6c28aaSamw errc = (*func)(arg0, cmd, shr, flag, cr, ct); 16097c478bd9Sstevel@tonic-gate } else { 16107c478bd9Sstevel@tonic-gate fem_addref(femsp); 16117c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 16127c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 16137c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 16147c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_shrlock, 1615aa59c4cbSrsb femop_shrlock); 1616da6c28aaSamw errc = (*func)(arg0, cmd, shr, flag, cr, ct); 16177c478bd9Sstevel@tonic-gate fem_release(femsp); 16187c478bd9Sstevel@tonic-gate } 16197c478bd9Sstevel@tonic-gate return (errc); 16207c478bd9Sstevel@tonic-gate } 16217c478bd9Sstevel@tonic-gate 16227c478bd9Sstevel@tonic-gate static int 1623da6c28aaSamw vhead_vnevent(vnode_t *vp, vnevent_t vnevent, vnode_t *dvp, char *cname, 1624da6c28aaSamw caller_context_t *ct) 16257c478bd9Sstevel@tonic-gate { 16267c478bd9Sstevel@tonic-gate femarg_t farg; 16277c478bd9Sstevel@tonic-gate struct fem_list *femsp; 16287c478bd9Sstevel@tonic-gate int (*func)(); 16297c478bd9Sstevel@tonic-gate void *arg0; 16307c478bd9Sstevel@tonic-gate int errc; 16317c478bd9Sstevel@tonic-gate 16327c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 16337c478bd9Sstevel@tonic-gate func = (int (*)()) (vp->v_op->vop_vnevent); 16347c478bd9Sstevel@tonic-gate arg0 = vp; 16357c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 1636da6c28aaSamw errc = (*func)(arg0, vnevent, dvp, cname, ct); 16377c478bd9Sstevel@tonic-gate } else { 16387c478bd9Sstevel@tonic-gate fem_addref(femsp); 16397c478bd9Sstevel@tonic-gate fem_unlock(vp->v_femhead); 16407c478bd9Sstevel@tonic-gate farg.fa_vnode.vp = vp; 16417c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 16427c478bd9Sstevel@tonic-gate vsop_find(&farg, &func, int, &arg0, vop_vnevent, 1643aa59c4cbSrsb femop_vnevent); 1644da6c28aaSamw errc = (*func)(arg0, vnevent, dvp, cname, ct); 16457c478bd9Sstevel@tonic-gate fem_release(femsp); 16467c478bd9Sstevel@tonic-gate } 16477c478bd9Sstevel@tonic-gate return (errc); 16487c478bd9Sstevel@tonic-gate } 16497c478bd9Sstevel@tonic-gate 16507c478bd9Sstevel@tonic-gate static int 1651c242f9a0Schunli zhang - Sun Microsystems - Irvine United States vhead_reqzcbuf(vnode_t *vp, enum uio_rw ioflag, xuio_t *xuiop, cred_t *cr, 1652c242f9a0Schunli zhang - Sun Microsystems - Irvine United States caller_context_t *ct) 1653c242f9a0Schunli zhang - Sun Microsystems - Irvine United States { 1654c242f9a0Schunli zhang - Sun Microsystems - Irvine United States femarg_t farg; 1655c242f9a0Schunli zhang - Sun Microsystems - Irvine United States struct fem_list *femsp; 1656c242f9a0Schunli zhang - Sun Microsystems - Irvine United States int (*func)(); 1657c242f9a0Schunli zhang - Sun Microsystems - Irvine United States void *arg0; 1658c242f9a0Schunli zhang - Sun Microsystems - Irvine United States int errc; 1659c242f9a0Schunli zhang - Sun Microsystems - Irvine United States 1660c242f9a0Schunli zhang - Sun Microsystems - Irvine United States if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 1661c242f9a0Schunli zhang - Sun Microsystems - Irvine United States func = (int (*)()) (vp->v_op->vop_reqzcbuf); 1662c242f9a0Schunli zhang - Sun Microsystems - Irvine United States arg0 = vp; 1663c242f9a0Schunli zhang - Sun Microsystems - Irvine United States fem_unlock(vp->v_femhead); 1664c242f9a0Schunli zhang - Sun Microsystems - Irvine United States errc = (*func)(arg0, ioflag, xuiop, cr, ct); 1665c242f9a0Schunli zhang - Sun Microsystems - Irvine United States } else { 1666c242f9a0Schunli zhang - Sun Microsystems - Irvine United States fem_addref(femsp); 1667c242f9a0Schunli zhang - Sun Microsystems - Irvine United States fem_unlock(vp->v_femhead); 1668c242f9a0Schunli zhang - Sun Microsystems - Irvine United States farg.fa_vnode.vp = vp; 1669c242f9a0Schunli zhang - Sun Microsystems - Irvine United States farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1670c242f9a0Schunli zhang - Sun Microsystems - Irvine United States vsop_find(&farg, &func, int, &arg0, vop_reqzcbuf, 1671c242f9a0Schunli zhang - Sun Microsystems - Irvine United States femop_reqzcbuf); 1672c242f9a0Schunli zhang - Sun Microsystems - Irvine United States errc = (*func)(arg0, ioflag, xuiop, cr, ct); 1673c242f9a0Schunli zhang - Sun Microsystems - Irvine United States fem_release(femsp); 1674c242f9a0Schunli zhang - Sun Microsystems - Irvine United States } 1675c242f9a0Schunli zhang - Sun Microsystems - Irvine United States return (errc); 1676c242f9a0Schunli zhang - Sun Microsystems - Irvine United States } 1677c242f9a0Schunli zhang - Sun Microsystems - Irvine United States 1678c242f9a0Schunli zhang - Sun Microsystems - Irvine United States static int 1679c242f9a0Schunli zhang - Sun Microsystems - Irvine United States vhead_retzcbuf(vnode_t *vp, xuio_t *xuiop, cred_t *cr, caller_context_t *ct) 1680c242f9a0Schunli zhang - Sun Microsystems - Irvine United States { 1681c242f9a0Schunli zhang - Sun Microsystems - Irvine United States femarg_t farg; 1682c242f9a0Schunli zhang - Sun Microsystems - Irvine United States struct fem_list *femsp; 1683c242f9a0Schunli zhang - Sun Microsystems - Irvine United States int (*func)(); 1684c242f9a0Schunli zhang - Sun Microsystems - Irvine United States void *arg0; 1685c242f9a0Schunli zhang - Sun Microsystems - Irvine United States int errc; 1686c242f9a0Schunli zhang - Sun Microsystems - Irvine United States 1687c242f9a0Schunli zhang - Sun Microsystems - Irvine United States if ((femsp = fem_lock(vp->v_femhead)) == NULL) { 1688c242f9a0Schunli zhang - Sun Microsystems - Irvine United States func = (int (*)()) (vp->v_op->vop_retzcbuf); 1689c242f9a0Schunli zhang - Sun Microsystems - Irvine United States arg0 = vp; 1690c242f9a0Schunli zhang - Sun Microsystems - Irvine United States fem_unlock(vp->v_femhead); 1691c242f9a0Schunli zhang - Sun Microsystems - Irvine United States errc = (*func)(arg0, xuiop, cr, ct); 1692c242f9a0Schunli zhang - Sun Microsystems - Irvine United States } else { 1693c242f9a0Schunli zhang - Sun Microsystems - Irvine United States fem_addref(femsp); 1694c242f9a0Schunli zhang - Sun Microsystems - Irvine United States fem_unlock(vp->v_femhead); 1695c242f9a0Schunli zhang - Sun Microsystems - Irvine United States farg.fa_vnode.vp = vp; 1696c242f9a0Schunli zhang - Sun Microsystems - Irvine United States farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1697c242f9a0Schunli zhang - Sun Microsystems - Irvine United States vsop_find(&farg, &func, int, &arg0, vop_retzcbuf, 1698c242f9a0Schunli zhang - Sun Microsystems - Irvine United States femop_retzcbuf); 1699c242f9a0Schunli zhang - Sun Microsystems - Irvine United States errc = (*func)(arg0, xuiop, cr, ct); 1700c242f9a0Schunli zhang - Sun Microsystems - Irvine United States fem_release(femsp); 1701c242f9a0Schunli zhang - Sun Microsystems - Irvine United States } 1702c242f9a0Schunli zhang - Sun Microsystems - Irvine United States return (errc); 1703c242f9a0Schunli zhang - Sun Microsystems - Irvine United States } 1704c242f9a0Schunli zhang - Sun Microsystems - Irvine United States 1705c242f9a0Schunli zhang - Sun Microsystems - Irvine United States static int 17067c478bd9Sstevel@tonic-gate fshead_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr) 17077c478bd9Sstevel@tonic-gate { 17087c478bd9Sstevel@tonic-gate fsemarg_t farg; 17097c478bd9Sstevel@tonic-gate struct fem_list *femsp; 17107c478bd9Sstevel@tonic-gate int (*func)(); 17117c478bd9Sstevel@tonic-gate void *arg0; 17127c478bd9Sstevel@tonic-gate int errc; 17137c478bd9Sstevel@tonic-gate 1714ddfcde86Srsb ASSERT(vfsp->vfs_implp); 1715ddfcde86Srsb 17167c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) { 17177c478bd9Sstevel@tonic-gate func = (int (*)()) vfsp->vfs_op->vfs_mount; 17187c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 17197c478bd9Sstevel@tonic-gate errc = (*func)(vfsp, mvp, uap, cr); 17207c478bd9Sstevel@tonic-gate } else { 17217c478bd9Sstevel@tonic-gate fem_addref(femsp); 17227c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 17237c478bd9Sstevel@tonic-gate farg.fa_vnode.vfsp = vfsp; 17247c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 17257c478bd9Sstevel@tonic-gate vfsop_find(&farg, &func, int, &arg0, vfs_mount, 1726aa59c4cbSrsb fsemop_mount); 17277c478bd9Sstevel@tonic-gate errc = (*func)(arg0, mvp, uap, cr); 17287c478bd9Sstevel@tonic-gate fem_release(femsp); 17297c478bd9Sstevel@tonic-gate } 17307c478bd9Sstevel@tonic-gate return (errc); 17317c478bd9Sstevel@tonic-gate } 17327c478bd9Sstevel@tonic-gate 17337c478bd9Sstevel@tonic-gate static int 17347c478bd9Sstevel@tonic-gate fshead_unmount(vfs_t *vfsp, int flag, cred_t *cr) 17357c478bd9Sstevel@tonic-gate { 17367c478bd9Sstevel@tonic-gate fsemarg_t farg; 17377c478bd9Sstevel@tonic-gate struct fem_list *femsp; 17387c478bd9Sstevel@tonic-gate int (*func)(); 17397c478bd9Sstevel@tonic-gate void *arg0; 17407c478bd9Sstevel@tonic-gate int errc; 17417c478bd9Sstevel@tonic-gate 1742ddfcde86Srsb ASSERT(vfsp->vfs_implp); 1743ddfcde86Srsb 17447c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) { 17457c478bd9Sstevel@tonic-gate func = (int (*)()) vfsp->vfs_op->vfs_unmount; 17467c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 17477c478bd9Sstevel@tonic-gate errc = (*func)(vfsp, flag, cr); 17487c478bd9Sstevel@tonic-gate } else { 17497c478bd9Sstevel@tonic-gate fem_addref(femsp); 17507c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 17517c478bd9Sstevel@tonic-gate farg.fa_vnode.vfsp = vfsp; 17527c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 17537c478bd9Sstevel@tonic-gate vfsop_find(&farg, &func, int, &arg0, vfs_unmount, 1754aa59c4cbSrsb fsemop_unmount); 17557c478bd9Sstevel@tonic-gate errc = (*func)(arg0, flag, cr); 17567c478bd9Sstevel@tonic-gate fem_release(femsp); 17577c478bd9Sstevel@tonic-gate } 17587c478bd9Sstevel@tonic-gate return (errc); 17597c478bd9Sstevel@tonic-gate } 17607c478bd9Sstevel@tonic-gate 17617c478bd9Sstevel@tonic-gate static int 17627c478bd9Sstevel@tonic-gate fshead_root(vfs_t *vfsp, vnode_t **vpp) 17637c478bd9Sstevel@tonic-gate { 17647c478bd9Sstevel@tonic-gate fsemarg_t farg; 17657c478bd9Sstevel@tonic-gate struct fem_list *femsp; 17667c478bd9Sstevel@tonic-gate int (*func)(); 17677c478bd9Sstevel@tonic-gate void *arg0; 17687c478bd9Sstevel@tonic-gate int errc; 17697c478bd9Sstevel@tonic-gate 1770ddfcde86Srsb ASSERT(vfsp->vfs_implp); 1771ddfcde86Srsb 17727c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) { 17737c478bd9Sstevel@tonic-gate func = (int (*)()) vfsp->vfs_op->vfs_root; 17747c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 17757c478bd9Sstevel@tonic-gate errc = (*func)(vfsp, vpp); 17767c478bd9Sstevel@tonic-gate } else { 17777c478bd9Sstevel@tonic-gate fem_addref(femsp); 17787c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 17797c478bd9Sstevel@tonic-gate farg.fa_vnode.vfsp = vfsp; 17807c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1781aa59c4cbSrsb vfsop_find(&farg, &func, int, &arg0, vfs_root, fsemop_root); 17827c478bd9Sstevel@tonic-gate errc = (*func)(arg0, vpp); 17837c478bd9Sstevel@tonic-gate fem_release(femsp); 17847c478bd9Sstevel@tonic-gate } 17857c478bd9Sstevel@tonic-gate return (errc); 17867c478bd9Sstevel@tonic-gate } 17877c478bd9Sstevel@tonic-gate 17887c478bd9Sstevel@tonic-gate static int 17897c478bd9Sstevel@tonic-gate fshead_statvfs(vfs_t *vfsp, statvfs64_t *sp) 17907c478bd9Sstevel@tonic-gate { 17917c478bd9Sstevel@tonic-gate fsemarg_t farg; 17927c478bd9Sstevel@tonic-gate struct fem_list *femsp; 17937c478bd9Sstevel@tonic-gate int (*func)(); 17947c478bd9Sstevel@tonic-gate void *arg0; 17957c478bd9Sstevel@tonic-gate int errc; 17967c478bd9Sstevel@tonic-gate 1797ddfcde86Srsb ASSERT(vfsp->vfs_implp); 1798ddfcde86Srsb 17997c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) { 18007c478bd9Sstevel@tonic-gate func = (int (*)()) vfsp->vfs_op->vfs_statvfs; 18017c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 18027c478bd9Sstevel@tonic-gate errc = (*func)(vfsp, sp); 18037c478bd9Sstevel@tonic-gate } else { 18047c478bd9Sstevel@tonic-gate fem_addref(femsp); 18057c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 18067c478bd9Sstevel@tonic-gate farg.fa_vnode.vfsp = vfsp; 18077c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 18087c478bd9Sstevel@tonic-gate vfsop_find(&farg, &func, int, &arg0, vfs_statvfs, 1809aa59c4cbSrsb fsemop_statvfs); 18107c478bd9Sstevel@tonic-gate errc = (*func)(arg0, sp); 18117c478bd9Sstevel@tonic-gate fem_release(femsp); 18127c478bd9Sstevel@tonic-gate } 18137c478bd9Sstevel@tonic-gate return (errc); 18147c478bd9Sstevel@tonic-gate } 18157c478bd9Sstevel@tonic-gate 18167c478bd9Sstevel@tonic-gate static int 18177c478bd9Sstevel@tonic-gate fshead_sync(vfs_t *vfsp, short flag, cred_t *cr) 18187c478bd9Sstevel@tonic-gate { 18197c478bd9Sstevel@tonic-gate fsemarg_t farg; 18207c478bd9Sstevel@tonic-gate struct fem_list *femsp; 18217c478bd9Sstevel@tonic-gate int (*func)(); 18227c478bd9Sstevel@tonic-gate void *arg0; 18237c478bd9Sstevel@tonic-gate int errc; 18247c478bd9Sstevel@tonic-gate 1825ddfcde86Srsb ASSERT(vfsp->vfs_implp); 1826ddfcde86Srsb 18277c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) { 18287c478bd9Sstevel@tonic-gate func = (int (*)()) vfsp->vfs_op->vfs_sync; 18297c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 18307c478bd9Sstevel@tonic-gate errc = (*func)(vfsp, flag, cr); 18317c478bd9Sstevel@tonic-gate } else { 18327c478bd9Sstevel@tonic-gate fem_addref(femsp); 18337c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 18347c478bd9Sstevel@tonic-gate farg.fa_vnode.vfsp = vfsp; 18357c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1836aa59c4cbSrsb vfsop_find(&farg, &func, int, &arg0, vfs_sync, fsemop_sync); 18377c478bd9Sstevel@tonic-gate errc = (*func)(arg0, flag, cr); 18387c478bd9Sstevel@tonic-gate fem_release(femsp); 18397c478bd9Sstevel@tonic-gate } 18407c478bd9Sstevel@tonic-gate return (errc); 18417c478bd9Sstevel@tonic-gate } 18427c478bd9Sstevel@tonic-gate 18437c478bd9Sstevel@tonic-gate static int 18447c478bd9Sstevel@tonic-gate fshead_vget(vfs_t *vfsp, vnode_t **vpp, fid_t *fidp) 18457c478bd9Sstevel@tonic-gate { 18467c478bd9Sstevel@tonic-gate fsemarg_t farg; 18477c478bd9Sstevel@tonic-gate struct fem_list *femsp; 18487c478bd9Sstevel@tonic-gate int (*func)(); 18497c478bd9Sstevel@tonic-gate void *arg0; 18507c478bd9Sstevel@tonic-gate int errc; 18517c478bd9Sstevel@tonic-gate 1852ddfcde86Srsb ASSERT(vfsp->vfs_implp); 1853ddfcde86Srsb 18547c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) { 18557c478bd9Sstevel@tonic-gate func = (int (*)()) vfsp->vfs_op->vfs_vget; 18567c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 18577c478bd9Sstevel@tonic-gate errc = (*func)(vfsp, vpp, fidp); 18587c478bd9Sstevel@tonic-gate } else { 18597c478bd9Sstevel@tonic-gate fem_addref(femsp); 18607c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 18617c478bd9Sstevel@tonic-gate farg.fa_vnode.vfsp = vfsp; 18627c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 1863aa59c4cbSrsb vfsop_find(&farg, &func, int, &arg0, vfs_vget, fsemop_vget); 18647c478bd9Sstevel@tonic-gate errc = (*func)(arg0, vpp, fidp); 18657c478bd9Sstevel@tonic-gate fem_release(femsp); 18667c478bd9Sstevel@tonic-gate } 18677c478bd9Sstevel@tonic-gate return (errc); 18687c478bd9Sstevel@tonic-gate } 18697c478bd9Sstevel@tonic-gate 18707c478bd9Sstevel@tonic-gate static int 18717c478bd9Sstevel@tonic-gate fshead_mountroot(vfs_t *vfsp, enum whymountroot reason) 18727c478bd9Sstevel@tonic-gate { 18737c478bd9Sstevel@tonic-gate fsemarg_t farg; 18747c478bd9Sstevel@tonic-gate struct fem_list *femsp; 18757c478bd9Sstevel@tonic-gate int (*func)(); 18767c478bd9Sstevel@tonic-gate void *arg0; 18777c478bd9Sstevel@tonic-gate int errc; 18787c478bd9Sstevel@tonic-gate 1879ddfcde86Srsb ASSERT(vfsp->vfs_implp); 1880ddfcde86Srsb 18817c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) { 18827c478bd9Sstevel@tonic-gate func = (int (*)()) vfsp->vfs_op->vfs_mountroot; 18837c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 18847c478bd9Sstevel@tonic-gate errc = (*func)(vfsp, reason); 18857c478bd9Sstevel@tonic-gate } else { 18867c478bd9Sstevel@tonic-gate fem_addref(femsp); 18877c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 18887c478bd9Sstevel@tonic-gate farg.fa_vnode.vfsp = vfsp; 18897c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 18907c478bd9Sstevel@tonic-gate vfsop_find(&farg, &func, int, &arg0, vfs_mountroot, 1891aa59c4cbSrsb fsemop_mountroot); 18927c478bd9Sstevel@tonic-gate errc = (*func)(arg0, reason); 18937c478bd9Sstevel@tonic-gate fem_release(femsp); 18947c478bd9Sstevel@tonic-gate } 18957c478bd9Sstevel@tonic-gate return (errc); 18967c478bd9Sstevel@tonic-gate } 18977c478bd9Sstevel@tonic-gate 18987c478bd9Sstevel@tonic-gate static void 18997c478bd9Sstevel@tonic-gate fshead_freevfs(vfs_t *vfsp) 19007c478bd9Sstevel@tonic-gate { 19017c478bd9Sstevel@tonic-gate fsemarg_t farg; 19027c478bd9Sstevel@tonic-gate struct fem_list *femsp; 19037c478bd9Sstevel@tonic-gate void (*func)(); 19047c478bd9Sstevel@tonic-gate void *arg0; 19057c478bd9Sstevel@tonic-gate 1906ddfcde86Srsb ASSERT(vfsp->vfs_implp); 1907ddfcde86Srsb 19087c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) { 19097c478bd9Sstevel@tonic-gate func = (void (*)()) vfsp->vfs_op->vfs_freevfs; 19107c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 19117c478bd9Sstevel@tonic-gate (*func)(vfsp); 19127c478bd9Sstevel@tonic-gate } else { 19137c478bd9Sstevel@tonic-gate fem_addref(femsp); 19147c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 19157c478bd9Sstevel@tonic-gate farg.fa_vnode.vfsp = vfsp; 19167c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 19177c478bd9Sstevel@tonic-gate vfsop_find(&farg, &func, void, &arg0, vfs_freevfs, 1918aa59c4cbSrsb fsemop_freevfs); 19197c478bd9Sstevel@tonic-gate (*func)(arg0); 19207c478bd9Sstevel@tonic-gate fem_release(femsp); 19217c478bd9Sstevel@tonic-gate } 19227c478bd9Sstevel@tonic-gate } 19237c478bd9Sstevel@tonic-gate 19247c478bd9Sstevel@tonic-gate static int 19257c478bd9Sstevel@tonic-gate fshead_vnstate(vfs_t *vfsp, vnode_t *vp, vntrans_t nstate) 19267c478bd9Sstevel@tonic-gate { 19277c478bd9Sstevel@tonic-gate fsemarg_t farg; 19287c478bd9Sstevel@tonic-gate struct fem_list *femsp; 19297c478bd9Sstevel@tonic-gate int (*func)(); 19307c478bd9Sstevel@tonic-gate void *arg0; 19317c478bd9Sstevel@tonic-gate int errc; 19327c478bd9Sstevel@tonic-gate 1933ddfcde86Srsb ASSERT(vfsp->vfs_implp); 1934ddfcde86Srsb 19357c478bd9Sstevel@tonic-gate if ((femsp = fem_lock(vfsp->vfs_femhead)) == NULL) { 19367c478bd9Sstevel@tonic-gate func = (int (*)()) vfsp->vfs_op->vfs_vnstate; 19377c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 19387c478bd9Sstevel@tonic-gate errc = (*func)(vfsp, vp, nstate); 19397c478bd9Sstevel@tonic-gate } else { 19407c478bd9Sstevel@tonic-gate fem_addref(femsp); 19417c478bd9Sstevel@tonic-gate fem_unlock(vfsp->vfs_femhead); 19427c478bd9Sstevel@tonic-gate farg.fa_vnode.vfsp = vfsp; 19437c478bd9Sstevel@tonic-gate farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos; 19447c478bd9Sstevel@tonic-gate vfsop_find(&farg, &func, int, &arg0, vfs_vnstate, 1945aa59c4cbSrsb fsemop_vnstate); 19467c478bd9Sstevel@tonic-gate errc = (*func)(arg0, vp, nstate); 19477c478bd9Sstevel@tonic-gate fem_release(femsp); 19487c478bd9Sstevel@tonic-gate } 19497c478bd9Sstevel@tonic-gate return (errc); 19507c478bd9Sstevel@tonic-gate } 19517c478bd9Sstevel@tonic-gate 19527c478bd9Sstevel@tonic-gate 19537c478bd9Sstevel@tonic-gate /* 19547c478bd9Sstevel@tonic-gate * specification table for the vhead vnode operations. 19557c478bd9Sstevel@tonic-gate * It is an error for any operations to be missing. 19567c478bd9Sstevel@tonic-gate */ 19577c478bd9Sstevel@tonic-gate 19587c478bd9Sstevel@tonic-gate static struct fs_operation_def fhead_vn_spec[] = { 19597c478bd9Sstevel@tonic-gate { VOPNAME_OPEN, (femop_t *)vhead_open }, 19607c478bd9Sstevel@tonic-gate { VOPNAME_CLOSE, (femop_t *)vhead_close }, 19617c478bd9Sstevel@tonic-gate { VOPNAME_READ, (femop_t *)vhead_read }, 19627c478bd9Sstevel@tonic-gate { VOPNAME_WRITE, (femop_t *)vhead_write }, 19637c478bd9Sstevel@tonic-gate { VOPNAME_IOCTL, (femop_t *)vhead_ioctl }, 19647c478bd9Sstevel@tonic-gate { VOPNAME_SETFL, (femop_t *)vhead_setfl }, 19657c478bd9Sstevel@tonic-gate { VOPNAME_GETATTR, (femop_t *)vhead_getattr }, 19667c478bd9Sstevel@tonic-gate { VOPNAME_SETATTR, (femop_t *)vhead_setattr }, 19677c478bd9Sstevel@tonic-gate { VOPNAME_ACCESS, (femop_t *)vhead_access }, 19687c478bd9Sstevel@tonic-gate { VOPNAME_LOOKUP, (femop_t *)vhead_lookup }, 19697c478bd9Sstevel@tonic-gate { VOPNAME_CREATE, (femop_t *)vhead_create }, 19707c478bd9Sstevel@tonic-gate { VOPNAME_REMOVE, (femop_t *)vhead_remove }, 19717c478bd9Sstevel@tonic-gate { VOPNAME_LINK, (femop_t *)vhead_link }, 19727c478bd9Sstevel@tonic-gate { VOPNAME_RENAME, (femop_t *)vhead_rename }, 19737c478bd9Sstevel@tonic-gate { VOPNAME_MKDIR, (femop_t *)vhead_mkdir }, 19747c478bd9Sstevel@tonic-gate { VOPNAME_RMDIR, (femop_t *)vhead_rmdir }, 19757c478bd9Sstevel@tonic-gate { VOPNAME_READDIR, (femop_t *)vhead_readdir }, 19767c478bd9Sstevel@tonic-gate { VOPNAME_SYMLINK, (femop_t *)vhead_symlink }, 19777c478bd9Sstevel@tonic-gate { VOPNAME_READLINK, (femop_t *)vhead_readlink }, 19787c478bd9Sstevel@tonic-gate { VOPNAME_FSYNC, (femop_t *)vhead_fsync }, 19797c478bd9Sstevel@tonic-gate { VOPNAME_INACTIVE, (femop_t *)vhead_inactive }, 19807c478bd9Sstevel@tonic-gate { VOPNAME_FID, (femop_t *)vhead_fid }, 19817c478bd9Sstevel@tonic-gate { VOPNAME_RWLOCK, (femop_t *)vhead_rwlock }, 19827c478bd9Sstevel@tonic-gate { VOPNAME_RWUNLOCK, (femop_t *)vhead_rwunlock }, 19837c478bd9Sstevel@tonic-gate { VOPNAME_SEEK, (femop_t *)vhead_seek }, 19847c478bd9Sstevel@tonic-gate { VOPNAME_CMP, (femop_t *)vhead_cmp }, 19857c478bd9Sstevel@tonic-gate { VOPNAME_FRLOCK, (femop_t *)vhead_frlock }, 19867c478bd9Sstevel@tonic-gate { VOPNAME_SPACE, (femop_t *)vhead_space }, 19877c478bd9Sstevel@tonic-gate { VOPNAME_REALVP, (femop_t *)vhead_realvp }, 19887c478bd9Sstevel@tonic-gate { VOPNAME_GETPAGE, (femop_t *)vhead_getpage }, 19897c478bd9Sstevel@tonic-gate { VOPNAME_PUTPAGE, (femop_t *)vhead_putpage }, 19907c478bd9Sstevel@tonic-gate { VOPNAME_MAP, (femop_t *)vhead_map }, 19917c478bd9Sstevel@tonic-gate { VOPNAME_ADDMAP, (femop_t *)vhead_addmap }, 19927c478bd9Sstevel@tonic-gate { VOPNAME_DELMAP, (femop_t *)vhead_delmap }, 19937c478bd9Sstevel@tonic-gate { VOPNAME_POLL, (femop_t *)vhead_poll }, 19947c478bd9Sstevel@tonic-gate { VOPNAME_DUMP, (femop_t *)vhead_dump }, 19957c478bd9Sstevel@tonic-gate { VOPNAME_PATHCONF, (femop_t *)vhead_pathconf }, 19967c478bd9Sstevel@tonic-gate { VOPNAME_PAGEIO, (femop_t *)vhead_pageio }, 19977c478bd9Sstevel@tonic-gate { VOPNAME_DUMPCTL, (femop_t *)vhead_dumpctl }, 19987c478bd9Sstevel@tonic-gate { VOPNAME_DISPOSE, (femop_t *)vhead_dispose }, 19997c478bd9Sstevel@tonic-gate { VOPNAME_SETSECATTR, (femop_t *)vhead_setsecattr }, 20007c478bd9Sstevel@tonic-gate { VOPNAME_GETSECATTR, (femop_t *)vhead_getsecattr }, 20017c478bd9Sstevel@tonic-gate { VOPNAME_SHRLOCK, (femop_t *)vhead_shrlock }, 20027c478bd9Sstevel@tonic-gate { VOPNAME_VNEVENT, (femop_t *)vhead_vnevent }, 2003c242f9a0Schunli zhang - Sun Microsystems - Irvine United States { VOPNAME_REQZCBUF, (femop_t *)vhead_reqzcbuf }, 2004c242f9a0Schunli zhang - Sun Microsystems - Irvine United States { VOPNAME_RETZCBUF, (femop_t *)vhead_retzcbuf }, 20057c478bd9Sstevel@tonic-gate { NULL, NULL } 20067c478bd9Sstevel@tonic-gate }; 20077c478bd9Sstevel@tonic-gate 20087c478bd9Sstevel@tonic-gate /* 20097c478bd9Sstevel@tonic-gate * specification table for the vfshead vnode operations. 20107c478bd9Sstevel@tonic-gate * It is an error for any operations to be missing. 20117c478bd9Sstevel@tonic-gate */ 20127c478bd9Sstevel@tonic-gate 20137c478bd9Sstevel@tonic-gate static struct fs_operation_def fshead_vfs_spec[] = { 20147c478bd9Sstevel@tonic-gate { VFSNAME_MOUNT, (femop_t *)fshead_mount }, 20157c478bd9Sstevel@tonic-gate { VFSNAME_UNMOUNT, (femop_t *)fshead_unmount }, 20167c478bd9Sstevel@tonic-gate { VFSNAME_ROOT, (femop_t *)fshead_root }, 20177c478bd9Sstevel@tonic-gate { VFSNAME_STATVFS, (femop_t *)fshead_statvfs }, 20187c478bd9Sstevel@tonic-gate { VFSNAME_SYNC, (femop_t *)fshead_sync }, 20197c478bd9Sstevel@tonic-gate { VFSNAME_VGET, (femop_t *)fshead_vget }, 20207c478bd9Sstevel@tonic-gate { VFSNAME_MOUNTROOT, (femop_t *)fshead_mountroot }, 20217c478bd9Sstevel@tonic-gate { VFSNAME_FREEVFS, (femop_t *)fshead_freevfs }, 20227c478bd9Sstevel@tonic-gate { VFSNAME_VNSTATE, (femop_t *)fshead_vnstate }, 20237c478bd9Sstevel@tonic-gate { NULL, NULL } 20247c478bd9Sstevel@tonic-gate }; 20257c478bd9Sstevel@tonic-gate 20267c478bd9Sstevel@tonic-gate /* 20277c478bd9Sstevel@tonic-gate * This set of routines transfer control to the next stacked monitor. 20287c478bd9Sstevel@tonic-gate * 20297c478bd9Sstevel@tonic-gate * Each routine is identical except for naming, types and arguments. 20307c478bd9Sstevel@tonic-gate * 20317c478bd9Sstevel@tonic-gate * The basic steps are: 20327c478bd9Sstevel@tonic-gate * 1. Decrease the stack pointer by one. 20337c478bd9Sstevel@tonic-gate * 2. If the current item is a base operation (vnode, vfs), goto 5. 20347c478bd9Sstevel@tonic-gate * 3. If the current item does not have a corresponding operation, goto 1 20357c478bd9Sstevel@tonic-gate * 4. Return by invoking the current item with the argument handle. 20367c478bd9Sstevel@tonic-gate * 5. Return by invoking the base operation with the base object. 20377c478bd9Sstevel@tonic-gate * 20387c478bd9Sstevel@tonic-gate * for each classification, there needs to be at least one "next" operation 20397c478bd9Sstevel@tonic-gate * for each "head"operation. 20407c478bd9Sstevel@tonic-gate * 20417c478bd9Sstevel@tonic-gate */ 20427c478bd9Sstevel@tonic-gate 20437c478bd9Sstevel@tonic-gate int 2044da6c28aaSamw vnext_open(femarg_t *vf, int mode, cred_t *cr, caller_context_t *ct) 20457c478bd9Sstevel@tonic-gate { 20467c478bd9Sstevel@tonic-gate int (*func)() = NULL; 20477c478bd9Sstevel@tonic-gate void *arg0 = NULL; 20487c478bd9Sstevel@tonic-gate 20497c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 20507c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2051aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_open, femop_open); 20527c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 20537c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2054da6c28aaSamw return ((*func)(arg0, mode, cr, ct)); 20557c478bd9Sstevel@tonic-gate } 20567c478bd9Sstevel@tonic-gate 20577c478bd9Sstevel@tonic-gate int 2058da6c28aaSamw vnext_close(femarg_t *vf, int flag, int count, offset_t offset, cred_t *cr, 2059da6c28aaSamw caller_context_t *ct) 20607c478bd9Sstevel@tonic-gate { 20617c478bd9Sstevel@tonic-gate int (*func)() = NULL; 20627c478bd9Sstevel@tonic-gate void *arg0 = NULL; 20637c478bd9Sstevel@tonic-gate 20647c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 20657c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2066aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_close, femop_close); 20677c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 20687c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2069da6c28aaSamw return ((*func)(arg0, flag, count, offset, cr, ct)); 20707c478bd9Sstevel@tonic-gate } 20717c478bd9Sstevel@tonic-gate 20727c478bd9Sstevel@tonic-gate int 20737c478bd9Sstevel@tonic-gate vnext_read(femarg_t *vf, uio_t *uiop, int ioflag, cred_t *cr, 2074da6c28aaSamw caller_context_t *ct) 20757c478bd9Sstevel@tonic-gate { 20767c478bd9Sstevel@tonic-gate int (*func)() = NULL; 20777c478bd9Sstevel@tonic-gate void *arg0 = NULL; 20787c478bd9Sstevel@tonic-gate 20797c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 20807c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2081aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_read, femop_read); 20827c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 20837c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 20847c478bd9Sstevel@tonic-gate return ((*func)(arg0, uiop, ioflag, cr, ct)); 20857c478bd9Sstevel@tonic-gate } 20867c478bd9Sstevel@tonic-gate 20877c478bd9Sstevel@tonic-gate int 20887c478bd9Sstevel@tonic-gate vnext_write(femarg_t *vf, uio_t *uiop, int ioflag, cred_t *cr, 2089da6c28aaSamw caller_context_t *ct) 20907c478bd9Sstevel@tonic-gate { 20917c478bd9Sstevel@tonic-gate int (*func)() = NULL; 20927c478bd9Sstevel@tonic-gate void *arg0 = NULL; 20937c478bd9Sstevel@tonic-gate 20947c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 20957c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2096aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_write, femop_write); 20977c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 20987c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 20997c478bd9Sstevel@tonic-gate return ((*func)(arg0, uiop, ioflag, cr, ct)); 21007c478bd9Sstevel@tonic-gate } 21017c478bd9Sstevel@tonic-gate 21027c478bd9Sstevel@tonic-gate int 21037c478bd9Sstevel@tonic-gate vnext_ioctl(femarg_t *vf, int cmd, intptr_t arg, int flag, cred_t *cr, 2104da6c28aaSamw int *rvalp, caller_context_t *ct) 21057c478bd9Sstevel@tonic-gate { 21067c478bd9Sstevel@tonic-gate int (*func)() = NULL; 21077c478bd9Sstevel@tonic-gate void *arg0 = NULL; 21087c478bd9Sstevel@tonic-gate 21097c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 21107c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2111aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_ioctl, femop_ioctl); 21127c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 21137c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2114da6c28aaSamw return ((*func)(arg0, cmd, arg, flag, cr, rvalp, ct)); 21157c478bd9Sstevel@tonic-gate } 21167c478bd9Sstevel@tonic-gate 21177c478bd9Sstevel@tonic-gate int 2118da6c28aaSamw vnext_setfl(femarg_t *vf, int oflags, int nflags, cred_t *cr, 2119da6c28aaSamw caller_context_t *ct) 21207c478bd9Sstevel@tonic-gate { 21217c478bd9Sstevel@tonic-gate int (*func)() = NULL; 21227c478bd9Sstevel@tonic-gate void *arg0 = NULL; 21237c478bd9Sstevel@tonic-gate 21247c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 21257c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2126aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_setfl, femop_setfl); 21277c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 21287c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2129da6c28aaSamw return ((*func)(arg0, oflags, nflags, cr, ct)); 21307c478bd9Sstevel@tonic-gate } 21317c478bd9Sstevel@tonic-gate 21327c478bd9Sstevel@tonic-gate int 2133da6c28aaSamw vnext_getattr(femarg_t *vf, vattr_t *vap, int flags, cred_t *cr, 2134da6c28aaSamw caller_context_t *ct) 21357c478bd9Sstevel@tonic-gate { 21367c478bd9Sstevel@tonic-gate int (*func)() = NULL; 21377c478bd9Sstevel@tonic-gate void *arg0 = NULL; 21387c478bd9Sstevel@tonic-gate 21397c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 21407c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2141aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_getattr, femop_getattr); 21427c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 21437c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2144da6c28aaSamw return ((*func)(arg0, vap, flags, cr, ct)); 21457c478bd9Sstevel@tonic-gate } 21467c478bd9Sstevel@tonic-gate 21477c478bd9Sstevel@tonic-gate int 21487c478bd9Sstevel@tonic-gate vnext_setattr(femarg_t *vf, vattr_t *vap, int flags, cred_t *cr, 21497c478bd9Sstevel@tonic-gate caller_context_t *ct) 21507c478bd9Sstevel@tonic-gate { 21517c478bd9Sstevel@tonic-gate int (*func)() = NULL; 21527c478bd9Sstevel@tonic-gate void *arg0 = NULL; 21537c478bd9Sstevel@tonic-gate 21547c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 21557c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2156aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_setattr, femop_setattr); 21577c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 21587c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 21597c478bd9Sstevel@tonic-gate return ((*func)(arg0, vap, flags, cr, ct)); 21607c478bd9Sstevel@tonic-gate } 21617c478bd9Sstevel@tonic-gate 21627c478bd9Sstevel@tonic-gate int 2163da6c28aaSamw vnext_access(femarg_t *vf, int mode, int flags, cred_t *cr, 2164da6c28aaSamw caller_context_t *ct) 21657c478bd9Sstevel@tonic-gate { 21667c478bd9Sstevel@tonic-gate int (*func)() = NULL; 21677c478bd9Sstevel@tonic-gate void *arg0 = NULL; 21687c478bd9Sstevel@tonic-gate 21697c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 21707c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2171aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_access, femop_access); 21727c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 21737c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2174da6c28aaSamw return ((*func)(arg0, mode, flags, cr, ct)); 21757c478bd9Sstevel@tonic-gate } 21767c478bd9Sstevel@tonic-gate 21777c478bd9Sstevel@tonic-gate int 21787c478bd9Sstevel@tonic-gate vnext_lookup(femarg_t *vf, char *nm, vnode_t **vpp, pathname_t *pnp, 2179da6c28aaSamw int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct, 2180da6c28aaSamw int *direntflags, pathname_t *realpnp) 21817c478bd9Sstevel@tonic-gate { 21827c478bd9Sstevel@tonic-gate int (*func)() = NULL; 21837c478bd9Sstevel@tonic-gate void *arg0 = NULL; 21847c478bd9Sstevel@tonic-gate 21857c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 21867c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2187aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_lookup, femop_lookup); 21887c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 21897c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2190da6c28aaSamw return ((*func)(arg0, nm, vpp, pnp, flags, rdir, cr, ct, 2191da6c28aaSamw direntflags, realpnp)); 21927c478bd9Sstevel@tonic-gate } 21937c478bd9Sstevel@tonic-gate 21947c478bd9Sstevel@tonic-gate int 21957c478bd9Sstevel@tonic-gate vnext_create(femarg_t *vf, char *name, vattr_t *vap, vcexcl_t excl, 2196da6c28aaSamw int mode, vnode_t **vpp, cred_t *cr, int flag, caller_context_t *ct, 2197da6c28aaSamw vsecattr_t *vsecp) 21987c478bd9Sstevel@tonic-gate { 21997c478bd9Sstevel@tonic-gate int (*func)() = NULL; 22007c478bd9Sstevel@tonic-gate void *arg0 = NULL; 22017c478bd9Sstevel@tonic-gate 22027c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 22037c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2204aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_create, femop_create); 22057c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 22067c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2207da6c28aaSamw return ((*func)(arg0, name, vap, excl, mode, vpp, cr, flag, ct, vsecp)); 22087c478bd9Sstevel@tonic-gate } 22097c478bd9Sstevel@tonic-gate 22107c478bd9Sstevel@tonic-gate int 2211da6c28aaSamw vnext_remove(femarg_t *vf, char *nm, cred_t *cr, caller_context_t *ct, 2212da6c28aaSamw int flags) 22137c478bd9Sstevel@tonic-gate { 22147c478bd9Sstevel@tonic-gate int (*func)() = NULL; 22157c478bd9Sstevel@tonic-gate void *arg0 = NULL; 22167c478bd9Sstevel@tonic-gate 22177c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 22187c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2219aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_remove, femop_remove); 22207c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 22217c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2222da6c28aaSamw return ((*func)(arg0, nm, cr, ct, flags)); 22237c478bd9Sstevel@tonic-gate } 22247c478bd9Sstevel@tonic-gate 22257c478bd9Sstevel@tonic-gate int 2226da6c28aaSamw vnext_link(femarg_t *vf, vnode_t *svp, char *tnm, cred_t *cr, 2227da6c28aaSamw caller_context_t *ct, int flags) 22287c478bd9Sstevel@tonic-gate { 22297c478bd9Sstevel@tonic-gate int (*func)() = NULL; 22307c478bd9Sstevel@tonic-gate void *arg0 = NULL; 22317c478bd9Sstevel@tonic-gate 22327c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 22337c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2234aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_link, femop_link); 22357c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 22367c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2237da6c28aaSamw return ((*func)(arg0, svp, tnm, cr, ct, flags)); 22387c478bd9Sstevel@tonic-gate } 22397c478bd9Sstevel@tonic-gate 22407c478bd9Sstevel@tonic-gate int 2241da6c28aaSamw vnext_rename(femarg_t *vf, char *snm, vnode_t *tdvp, char *tnm, cred_t *cr, 2242da6c28aaSamw caller_context_t *ct, int flags) 22437c478bd9Sstevel@tonic-gate { 22447c478bd9Sstevel@tonic-gate int (*func)() = NULL; 22457c478bd9Sstevel@tonic-gate void *arg0 = NULL; 22467c478bd9Sstevel@tonic-gate 22477c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 22487c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2249aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_rename, femop_rename); 22507c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 22517c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2252da6c28aaSamw return ((*func)(arg0, snm, tdvp, tnm, cr, ct, flags)); 22537c478bd9Sstevel@tonic-gate } 22547c478bd9Sstevel@tonic-gate 22557c478bd9Sstevel@tonic-gate int 22567c478bd9Sstevel@tonic-gate vnext_mkdir(femarg_t *vf, char *dirname, vattr_t *vap, vnode_t **vpp, 2257da6c28aaSamw cred_t *cr, caller_context_t *ct, int flags, vsecattr_t *vsecp) 22587c478bd9Sstevel@tonic-gate { 22597c478bd9Sstevel@tonic-gate int (*func)() = NULL; 22607c478bd9Sstevel@tonic-gate void *arg0 = NULL; 22617c478bd9Sstevel@tonic-gate 22627c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 22637c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2264aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_mkdir, femop_mkdir); 22657c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 22667c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2267da6c28aaSamw return ((*func)(arg0, dirname, vap, vpp, cr, ct, flags, vsecp)); 22687c478bd9Sstevel@tonic-gate } 22697c478bd9Sstevel@tonic-gate 22707c478bd9Sstevel@tonic-gate int 2271da6c28aaSamw vnext_rmdir(femarg_t *vf, char *nm, vnode_t *cdir, cred_t *cr, 2272da6c28aaSamw caller_context_t *ct, int flags) 22737c478bd9Sstevel@tonic-gate { 22747c478bd9Sstevel@tonic-gate int (*func)() = NULL; 22757c478bd9Sstevel@tonic-gate void *arg0 = NULL; 22767c478bd9Sstevel@tonic-gate 22777c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 22787c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2279aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_rmdir, femop_rmdir); 22807c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 22817c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2282da6c28aaSamw return ((*func)(arg0, nm, cdir, cr, ct, flags)); 22837c478bd9Sstevel@tonic-gate } 22847c478bd9Sstevel@tonic-gate 22857c478bd9Sstevel@tonic-gate int 2286da6c28aaSamw vnext_readdir(femarg_t *vf, uio_t *uiop, cred_t *cr, int *eofp, 2287da6c28aaSamw caller_context_t *ct, int flags) 22887c478bd9Sstevel@tonic-gate { 22897c478bd9Sstevel@tonic-gate int (*func)() = NULL; 22907c478bd9Sstevel@tonic-gate void *arg0 = NULL; 22917c478bd9Sstevel@tonic-gate 22927c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 22937c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2294aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_readdir, femop_readdir); 22957c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 22967c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2297da6c28aaSamw return ((*func)(arg0, uiop, cr, eofp, ct, flags)); 22987c478bd9Sstevel@tonic-gate } 22997c478bd9Sstevel@tonic-gate 23007c478bd9Sstevel@tonic-gate int 23017c478bd9Sstevel@tonic-gate vnext_symlink(femarg_t *vf, char *linkname, vattr_t *vap, char *target, 2302da6c28aaSamw cred_t *cr, caller_context_t *ct, int flags) 23037c478bd9Sstevel@tonic-gate { 23047c478bd9Sstevel@tonic-gate int (*func)() = NULL; 23057c478bd9Sstevel@tonic-gate void *arg0 = NULL; 23067c478bd9Sstevel@tonic-gate 23077c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 23087c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2309aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_symlink, femop_symlink); 23107c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 23117c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2312da6c28aaSamw return ((*func)(arg0, linkname, vap, target, cr, ct, flags)); 23137c478bd9Sstevel@tonic-gate } 23147c478bd9Sstevel@tonic-gate 23157c478bd9Sstevel@tonic-gate int 2316da6c28aaSamw vnext_readlink(femarg_t *vf, uio_t *uiop, cred_t *cr, caller_context_t *ct) 23177c478bd9Sstevel@tonic-gate { 23187c478bd9Sstevel@tonic-gate int (*func)() = NULL; 23197c478bd9Sstevel@tonic-gate void *arg0 = NULL; 23207c478bd9Sstevel@tonic-gate 23217c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 23227c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2323aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_readlink, femop_readlink); 23247c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 23257c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2326da6c28aaSamw return ((*func)(arg0, uiop, cr, ct)); 23277c478bd9Sstevel@tonic-gate } 23287c478bd9Sstevel@tonic-gate 23297c478bd9Sstevel@tonic-gate int 2330da6c28aaSamw vnext_fsync(femarg_t *vf, int syncflag, cred_t *cr, caller_context_t *ct) 23317c478bd9Sstevel@tonic-gate { 23327c478bd9Sstevel@tonic-gate int (*func)() = NULL; 23337c478bd9Sstevel@tonic-gate void *arg0 = NULL; 23347c478bd9Sstevel@tonic-gate 23357c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 23367c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2337aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_fsync, femop_fsync); 23387c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 23397c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2340da6c28aaSamw return ((*func)(arg0, syncflag, cr, ct)); 23417c478bd9Sstevel@tonic-gate } 23427c478bd9Sstevel@tonic-gate 23437c478bd9Sstevel@tonic-gate void 2344da6c28aaSamw vnext_inactive(femarg_t *vf, cred_t *cr, caller_context_t *ct) 23457c478bd9Sstevel@tonic-gate { 23467c478bd9Sstevel@tonic-gate void (*func)() = NULL; 23477c478bd9Sstevel@tonic-gate void *arg0 = NULL; 23487c478bd9Sstevel@tonic-gate 23497c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 23507c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2351aa59c4cbSrsb vsop_find(vf, &func, void, &arg0, vop_inactive, femop_inactive); 23527c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 23537c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2354da6c28aaSamw (*func)(arg0, cr, ct); 23557c478bd9Sstevel@tonic-gate } 23567c478bd9Sstevel@tonic-gate 23577c478bd9Sstevel@tonic-gate int 2358da6c28aaSamw vnext_fid(femarg_t *vf, fid_t *fidp, caller_context_t *ct) 23597c478bd9Sstevel@tonic-gate { 23607c478bd9Sstevel@tonic-gate int (*func)() = NULL; 23617c478bd9Sstevel@tonic-gate void *arg0 = NULL; 23627c478bd9Sstevel@tonic-gate 23637c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 23647c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2365aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_fid, femop_fid); 23667c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 23677c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2368da6c28aaSamw return ((*func)(arg0, fidp, ct)); 23697c478bd9Sstevel@tonic-gate } 23707c478bd9Sstevel@tonic-gate 23717c478bd9Sstevel@tonic-gate int 23727c478bd9Sstevel@tonic-gate vnext_rwlock(femarg_t *vf, int write_lock, caller_context_t *ct) 23737c478bd9Sstevel@tonic-gate { 23747c478bd9Sstevel@tonic-gate int (*func)() = NULL; 23757c478bd9Sstevel@tonic-gate void *arg0 = NULL; 23767c478bd9Sstevel@tonic-gate 23777c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 23787c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2379aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_rwlock, femop_rwlock); 23807c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 23817c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 23827c478bd9Sstevel@tonic-gate return ((*func)(arg0, write_lock, ct)); 23837c478bd9Sstevel@tonic-gate } 23847c478bd9Sstevel@tonic-gate 23857c478bd9Sstevel@tonic-gate void 23867c478bd9Sstevel@tonic-gate vnext_rwunlock(femarg_t *vf, int write_lock, caller_context_t *ct) 23877c478bd9Sstevel@tonic-gate { 23887c478bd9Sstevel@tonic-gate void (*func)() = NULL; 23897c478bd9Sstevel@tonic-gate void *arg0 = NULL; 23907c478bd9Sstevel@tonic-gate 23917c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 23927c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2393aa59c4cbSrsb vsop_find(vf, &func, void, &arg0, vop_rwunlock, femop_rwunlock); 23947c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 23957c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 23967c478bd9Sstevel@tonic-gate (*func)(arg0, write_lock, ct); 23977c478bd9Sstevel@tonic-gate } 23987c478bd9Sstevel@tonic-gate 23997c478bd9Sstevel@tonic-gate int 2400da6c28aaSamw vnext_seek(femarg_t *vf, offset_t ooff, offset_t *noffp, caller_context_t *ct) 24017c478bd9Sstevel@tonic-gate { 24027c478bd9Sstevel@tonic-gate int (*func)() = NULL; 24037c478bd9Sstevel@tonic-gate void *arg0 = NULL; 24047c478bd9Sstevel@tonic-gate 24057c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 24067c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2407aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_seek, femop_seek); 24087c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 24097c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2410da6c28aaSamw return ((*func)(arg0, ooff, noffp, ct)); 24117c478bd9Sstevel@tonic-gate } 24127c478bd9Sstevel@tonic-gate 24137c478bd9Sstevel@tonic-gate int 2414da6c28aaSamw vnext_cmp(femarg_t *vf, vnode_t *vp2, caller_context_t *ct) 24157c478bd9Sstevel@tonic-gate { 24167c478bd9Sstevel@tonic-gate int (*func)() = NULL; 24177c478bd9Sstevel@tonic-gate void *arg0 = NULL; 24187c478bd9Sstevel@tonic-gate 24197c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 24207c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2421aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_cmp, femop_cmp); 24227c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 24237c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2424da6c28aaSamw return ((*func)(arg0, vp2, ct)); 24257c478bd9Sstevel@tonic-gate } 24267c478bd9Sstevel@tonic-gate 24277c478bd9Sstevel@tonic-gate int 24287c478bd9Sstevel@tonic-gate vnext_frlock(femarg_t *vf, int cmd, struct flock64 *bfp, int flag, 2429da6c28aaSamw offset_t offset, struct flk_callback *flk_cbp, cred_t *cr, 2430da6c28aaSamw caller_context_t *ct) 24317c478bd9Sstevel@tonic-gate { 24327c478bd9Sstevel@tonic-gate int (*func)() = NULL; 24337c478bd9Sstevel@tonic-gate void *arg0 = NULL; 24347c478bd9Sstevel@tonic-gate 24357c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 24367c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2437aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_frlock, femop_frlock); 24387c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 24397c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2440da6c28aaSamw return ((*func)(arg0, cmd, bfp, flag, offset, flk_cbp, cr, ct)); 24417c478bd9Sstevel@tonic-gate } 24427c478bd9Sstevel@tonic-gate 24437c478bd9Sstevel@tonic-gate int 24447c478bd9Sstevel@tonic-gate vnext_space(femarg_t *vf, int cmd, struct flock64 *bfp, int flag, 24457c478bd9Sstevel@tonic-gate offset_t offset, cred_t *cr, caller_context_t *ct) 24467c478bd9Sstevel@tonic-gate { 24477c478bd9Sstevel@tonic-gate int (*func)() = NULL; 24487c478bd9Sstevel@tonic-gate void *arg0 = NULL; 24497c478bd9Sstevel@tonic-gate 24507c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 24517c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2452aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_space, femop_space); 24537c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 24547c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 24557c478bd9Sstevel@tonic-gate return ((*func)(arg0, cmd, bfp, flag, offset, cr, ct)); 24567c478bd9Sstevel@tonic-gate } 24577c478bd9Sstevel@tonic-gate 24587c478bd9Sstevel@tonic-gate int 2459da6c28aaSamw vnext_realvp(femarg_t *vf, vnode_t **vpp, caller_context_t *ct) 24607c478bd9Sstevel@tonic-gate { 24617c478bd9Sstevel@tonic-gate int (*func)() = NULL; 24627c478bd9Sstevel@tonic-gate void *arg0 = NULL; 24637c478bd9Sstevel@tonic-gate 24647c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 24657c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2466aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_realvp, femop_realvp); 24677c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 24687c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2469da6c28aaSamw return ((*func)(arg0, vpp, ct)); 24707c478bd9Sstevel@tonic-gate } 24717c478bd9Sstevel@tonic-gate 24727c478bd9Sstevel@tonic-gate int 24737c478bd9Sstevel@tonic-gate vnext_getpage(femarg_t *vf, offset_t off, size_t len, uint_t *protp, 24747c478bd9Sstevel@tonic-gate struct page **plarr, size_t plsz, struct seg *seg, caddr_t addr, 2475da6c28aaSamw enum seg_rw rw, cred_t *cr, caller_context_t *ct) 24767c478bd9Sstevel@tonic-gate { 24777c478bd9Sstevel@tonic-gate int (*func)() = NULL; 24787c478bd9Sstevel@tonic-gate void *arg0 = NULL; 24797c478bd9Sstevel@tonic-gate 24807c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 24817c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2482aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_getpage, femop_getpage); 24837c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 24847c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 24857c478bd9Sstevel@tonic-gate return ((*func)(arg0, off, len, protp, plarr, plsz, seg, addr, rw, 2486da6c28aaSamw cr, ct)); 24877c478bd9Sstevel@tonic-gate } 24887c478bd9Sstevel@tonic-gate 24897c478bd9Sstevel@tonic-gate int 24907c478bd9Sstevel@tonic-gate vnext_putpage(femarg_t *vf, offset_t off, size_t len, int flags, 2491da6c28aaSamw cred_t *cr, caller_context_t *ct) 24927c478bd9Sstevel@tonic-gate { 24937c478bd9Sstevel@tonic-gate int (*func)() = NULL; 24947c478bd9Sstevel@tonic-gate void *arg0 = NULL; 24957c478bd9Sstevel@tonic-gate 24967c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 24977c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2498aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_putpage, femop_putpage); 24997c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 25007c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2501da6c28aaSamw return ((*func)(arg0, off, len, flags, cr, ct)); 25027c478bd9Sstevel@tonic-gate } 25037c478bd9Sstevel@tonic-gate 25047c478bd9Sstevel@tonic-gate int 25057c478bd9Sstevel@tonic-gate vnext_map(femarg_t *vf, offset_t off, struct as *as, caddr_t *addrp, 25067c478bd9Sstevel@tonic-gate size_t len, uchar_t prot, uchar_t maxprot, uint_t flags, 2507da6c28aaSamw cred_t *cr, caller_context_t *ct) 25087c478bd9Sstevel@tonic-gate { 25097c478bd9Sstevel@tonic-gate int (*func)() = NULL; 25107c478bd9Sstevel@tonic-gate void *arg0 = NULL; 25117c478bd9Sstevel@tonic-gate 25127c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 25137c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2514aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_map, femop_map); 25157c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 25167c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 25177c478bd9Sstevel@tonic-gate return ((*func)(arg0, off, as, addrp, len, prot, maxprot, flags, 2518da6c28aaSamw cr, ct)); 25197c478bd9Sstevel@tonic-gate } 25207c478bd9Sstevel@tonic-gate 25217c478bd9Sstevel@tonic-gate int 25227c478bd9Sstevel@tonic-gate vnext_addmap(femarg_t *vf, offset_t off, struct as *as, caddr_t addr, 25237c478bd9Sstevel@tonic-gate size_t len, uchar_t prot, uchar_t maxprot, uint_t flags, 2524da6c28aaSamw cred_t *cr, caller_context_t *ct) 25257c478bd9Sstevel@tonic-gate { 25267c478bd9Sstevel@tonic-gate int (*func)() = NULL; 25277c478bd9Sstevel@tonic-gate void *arg0 = NULL; 25287c478bd9Sstevel@tonic-gate 25297c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 25307c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2531aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_addmap, femop_addmap); 25327c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 25337c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2534da6c28aaSamw return ((*func)(arg0, off, as, addr, len, prot, maxprot, flags, 2535da6c28aaSamw cr, ct)); 25367c478bd9Sstevel@tonic-gate } 25377c478bd9Sstevel@tonic-gate 25387c478bd9Sstevel@tonic-gate int 25397c478bd9Sstevel@tonic-gate vnext_delmap(femarg_t *vf, offset_t off, struct as *as, caddr_t addr, 2540da6c28aaSamw size_t len, uint_t prot, uint_t maxprot, uint_t flags, 2541da6c28aaSamw cred_t *cr, caller_context_t *ct) 25427c478bd9Sstevel@tonic-gate { 25437c478bd9Sstevel@tonic-gate int (*func)() = NULL; 25447c478bd9Sstevel@tonic-gate void *arg0 = NULL; 25457c478bd9Sstevel@tonic-gate 25467c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 25477c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2548aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_delmap, femop_delmap); 25497c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 25507c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2551da6c28aaSamw return ((*func)(arg0, off, as, addr, len, prot, maxprot, flags, 2552da6c28aaSamw cr, ct)); 25537c478bd9Sstevel@tonic-gate } 25547c478bd9Sstevel@tonic-gate 25557c478bd9Sstevel@tonic-gate int 25567c478bd9Sstevel@tonic-gate vnext_poll(femarg_t *vf, short events, int anyyet, short *reventsp, 2557da6c28aaSamw struct pollhead **phpp, caller_context_t *ct) 25587c478bd9Sstevel@tonic-gate { 25597c478bd9Sstevel@tonic-gate int (*func)() = NULL; 25607c478bd9Sstevel@tonic-gate void *arg0 = NULL; 25617c478bd9Sstevel@tonic-gate 25627c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 25637c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2564aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_poll, femop_poll); 25657c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 25667c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2567da6c28aaSamw return ((*func)(arg0, events, anyyet, reventsp, phpp, ct)); 25687c478bd9Sstevel@tonic-gate } 25697c478bd9Sstevel@tonic-gate 25707c478bd9Sstevel@tonic-gate int 2571d7334e51Srm15945 vnext_dump(femarg_t *vf, caddr_t addr, offset_t lbdn, offset_t dblks, 2572da6c28aaSamw caller_context_t *ct) 25737c478bd9Sstevel@tonic-gate { 25747c478bd9Sstevel@tonic-gate int (*func)() = NULL; 25757c478bd9Sstevel@tonic-gate void *arg0 = NULL; 25767c478bd9Sstevel@tonic-gate 25777c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 25787c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2579aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_dump, femop_dump); 25807c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 25817c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2582da6c28aaSamw return ((*func)(arg0, addr, lbdn, dblks, ct)); 25837c478bd9Sstevel@tonic-gate } 25847c478bd9Sstevel@tonic-gate 25857c478bd9Sstevel@tonic-gate int 2586da6c28aaSamw vnext_pathconf(femarg_t *vf, int cmd, ulong_t *valp, cred_t *cr, 2587da6c28aaSamw caller_context_t *ct) 25887c478bd9Sstevel@tonic-gate { 25897c478bd9Sstevel@tonic-gate int (*func)() = NULL; 25907c478bd9Sstevel@tonic-gate void *arg0 = NULL; 25917c478bd9Sstevel@tonic-gate 25927c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 25937c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2594aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_pathconf, femop_pathconf); 25957c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 25967c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2597da6c28aaSamw return ((*func)(arg0, cmd, valp, cr, ct)); 25987c478bd9Sstevel@tonic-gate } 25997c478bd9Sstevel@tonic-gate 26007c478bd9Sstevel@tonic-gate int 26017c478bd9Sstevel@tonic-gate vnext_pageio(femarg_t *vf, struct page *pp, u_offset_t io_off, 2602da6c28aaSamw size_t io_len, int flags, cred_t *cr, caller_context_t *ct) 26037c478bd9Sstevel@tonic-gate { 26047c478bd9Sstevel@tonic-gate int (*func)() = NULL; 26057c478bd9Sstevel@tonic-gate void *arg0 = NULL; 26067c478bd9Sstevel@tonic-gate 26077c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 26087c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2609aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_pageio, femop_pageio); 26107c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 26117c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2612da6c28aaSamw return ((*func)(arg0, pp, io_off, io_len, flags, cr, ct)); 26137c478bd9Sstevel@tonic-gate } 26147c478bd9Sstevel@tonic-gate 26157c478bd9Sstevel@tonic-gate int 2616d7334e51Srm15945 vnext_dumpctl(femarg_t *vf, int action, offset_t *blkp, caller_context_t *ct) 26177c478bd9Sstevel@tonic-gate { 26187c478bd9Sstevel@tonic-gate int (*func)() = NULL; 26197c478bd9Sstevel@tonic-gate void *arg0 = NULL; 26207c478bd9Sstevel@tonic-gate 26217c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 26227c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2623aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_dumpctl, femop_dumpctl); 26247c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 26257c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2626da6c28aaSamw return ((*func)(arg0, action, blkp, ct)); 26277c478bd9Sstevel@tonic-gate } 26287c478bd9Sstevel@tonic-gate 26297c478bd9Sstevel@tonic-gate void 2630da6c28aaSamw vnext_dispose(femarg_t *vf, struct page *pp, int flag, int dn, cred_t *cr, 2631da6c28aaSamw caller_context_t *ct) 26327c478bd9Sstevel@tonic-gate { 26337c478bd9Sstevel@tonic-gate void (*func)() = NULL; 26347c478bd9Sstevel@tonic-gate void *arg0 = NULL; 26357c478bd9Sstevel@tonic-gate 26367c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 26377c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2638aa59c4cbSrsb vsop_find(vf, &func, void, &arg0, vop_dispose, femop_dispose); 26397c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 26407c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2641da6c28aaSamw (*func)(arg0, pp, flag, dn, cr, ct); 26427c478bd9Sstevel@tonic-gate } 26437c478bd9Sstevel@tonic-gate 26447c478bd9Sstevel@tonic-gate int 2645da6c28aaSamw vnext_setsecattr(femarg_t *vf, vsecattr_t *vsap, int flag, cred_t *cr, 2646da6c28aaSamw caller_context_t *ct) 26477c478bd9Sstevel@tonic-gate { 26487c478bd9Sstevel@tonic-gate int (*func)() = NULL; 26497c478bd9Sstevel@tonic-gate void *arg0 = NULL; 26507c478bd9Sstevel@tonic-gate 26517c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 26527c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2653aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_setsecattr, femop_setsecattr); 26547c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 26557c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2656da6c28aaSamw return ((*func)(arg0, vsap, flag, cr, ct)); 26577c478bd9Sstevel@tonic-gate } 26587c478bd9Sstevel@tonic-gate 26597c478bd9Sstevel@tonic-gate int 2660da6c28aaSamw vnext_getsecattr(femarg_t *vf, vsecattr_t *vsap, int flag, cred_t *cr, 2661da6c28aaSamw caller_context_t *ct) 26627c478bd9Sstevel@tonic-gate { 26637c478bd9Sstevel@tonic-gate int (*func)() = NULL; 26647c478bd9Sstevel@tonic-gate void *arg0 = NULL; 26657c478bd9Sstevel@tonic-gate 26667c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 26677c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2668aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_getsecattr, femop_getsecattr); 26697c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 26707c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2671da6c28aaSamw return ((*func)(arg0, vsap, flag, cr, ct)); 26727c478bd9Sstevel@tonic-gate } 26737c478bd9Sstevel@tonic-gate 26747c478bd9Sstevel@tonic-gate int 26757c478bd9Sstevel@tonic-gate vnext_shrlock(femarg_t *vf, int cmd, struct shrlock *shr, int flag, 2676da6c28aaSamw cred_t *cr, caller_context_t *ct) 26777c478bd9Sstevel@tonic-gate { 26787c478bd9Sstevel@tonic-gate int (*func)() = NULL; 26797c478bd9Sstevel@tonic-gate void *arg0 = NULL; 26807c478bd9Sstevel@tonic-gate 26817c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 26827c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2683aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_shrlock, femop_shrlock); 26847c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 26857c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2686da6c28aaSamw return ((*func)(arg0, cmd, shr, flag, cr, ct)); 26877c478bd9Sstevel@tonic-gate } 26887c478bd9Sstevel@tonic-gate 26897c478bd9Sstevel@tonic-gate int 2690da6c28aaSamw vnext_vnevent(femarg_t *vf, vnevent_t vnevent, vnode_t *dvp, char *cname, 2691da6c28aaSamw caller_context_t *ct) 26927c478bd9Sstevel@tonic-gate { 26937c478bd9Sstevel@tonic-gate int (*func)() = NULL; 26947c478bd9Sstevel@tonic-gate void *arg0 = NULL; 26957c478bd9Sstevel@tonic-gate 26967c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 26977c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2698aa59c4cbSrsb vsop_find(vf, &func, int, &arg0, vop_vnevent, femop_vnevent); 26997c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 27007c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 2701da6c28aaSamw return ((*func)(arg0, vnevent, dvp, cname, ct)); 27027c478bd9Sstevel@tonic-gate } 27037c478bd9Sstevel@tonic-gate 27047c478bd9Sstevel@tonic-gate int 2705c242f9a0Schunli zhang - Sun Microsystems - Irvine United States vnext_reqzcbuf(femarg_t *vf, enum uio_rw ioflag, xuio_t *xuiop, cred_t *cr, 2706c242f9a0Schunli zhang - Sun Microsystems - Irvine United States caller_context_t *ct) 2707c242f9a0Schunli zhang - Sun Microsystems - Irvine United States { 2708c242f9a0Schunli zhang - Sun Microsystems - Irvine United States int (*func)() = NULL; 2709c242f9a0Schunli zhang - Sun Microsystems - Irvine United States void *arg0 = NULL; 2710c242f9a0Schunli zhang - Sun Microsystems - Irvine United States 2711c242f9a0Schunli zhang - Sun Microsystems - Irvine United States ASSERT(vf != NULL); 2712c242f9a0Schunli zhang - Sun Microsystems - Irvine United States vf->fa_fnode--; 2713c242f9a0Schunli zhang - Sun Microsystems - Irvine United States vsop_find(vf, &func, int, &arg0, vop_reqzcbuf, femop_reqzcbuf); 2714c242f9a0Schunli zhang - Sun Microsystems - Irvine United States ASSERT(func != NULL); 2715c242f9a0Schunli zhang - Sun Microsystems - Irvine United States ASSERT(arg0 != NULL); 2716c242f9a0Schunli zhang - Sun Microsystems - Irvine United States return ((*func)(arg0, ioflag, xuiop, cr, ct)); 2717c242f9a0Schunli zhang - Sun Microsystems - Irvine United States } 2718c242f9a0Schunli zhang - Sun Microsystems - Irvine United States 2719c242f9a0Schunli zhang - Sun Microsystems - Irvine United States int 2720c242f9a0Schunli zhang - Sun Microsystems - Irvine United States vnext_retzcbuf(femarg_t *vf, xuio_t *xuiop, cred_t *cr, caller_context_t *ct) 2721c242f9a0Schunli zhang - Sun Microsystems - Irvine United States { 2722c242f9a0Schunli zhang - Sun Microsystems - Irvine United States int (*func)() = NULL; 2723c242f9a0Schunli zhang - Sun Microsystems - Irvine United States void *arg0 = NULL; 2724c242f9a0Schunli zhang - Sun Microsystems - Irvine United States 2725c242f9a0Schunli zhang - Sun Microsystems - Irvine United States ASSERT(vf != NULL); 2726c242f9a0Schunli zhang - Sun Microsystems - Irvine United States vf->fa_fnode--; 2727c242f9a0Schunli zhang - Sun Microsystems - Irvine United States vsop_find(vf, &func, int, &arg0, vop_retzcbuf, femop_retzcbuf); 2728c242f9a0Schunli zhang - Sun Microsystems - Irvine United States ASSERT(func != NULL); 2729c242f9a0Schunli zhang - Sun Microsystems - Irvine United States ASSERT(arg0 != NULL); 2730c242f9a0Schunli zhang - Sun Microsystems - Irvine United States return ((*func)(arg0, xuiop, cr, ct)); 2731c242f9a0Schunli zhang - Sun Microsystems - Irvine United States } 2732c242f9a0Schunli zhang - Sun Microsystems - Irvine United States 2733c242f9a0Schunli zhang - Sun Microsystems - Irvine United States int 27347c478bd9Sstevel@tonic-gate vfsnext_mount(fsemarg_t *vf, vnode_t *mvp, struct mounta *uap, cred_t *cr) 27357c478bd9Sstevel@tonic-gate { 27367c478bd9Sstevel@tonic-gate int (*func)() = NULL; 27377c478bd9Sstevel@tonic-gate void *arg0 = NULL; 27387c478bd9Sstevel@tonic-gate 27397c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 27407c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2741aa59c4cbSrsb vfsop_find(vf, &func, int, &arg0, vfs_mount, fsemop_mount); 27427c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 27437c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 27447c478bd9Sstevel@tonic-gate return ((*func)(arg0, mvp, uap, cr)); 27457c478bd9Sstevel@tonic-gate } 27467c478bd9Sstevel@tonic-gate 27477c478bd9Sstevel@tonic-gate int 27487c478bd9Sstevel@tonic-gate vfsnext_unmount(fsemarg_t *vf, int flag, cred_t *cr) 27497c478bd9Sstevel@tonic-gate { 27507c478bd9Sstevel@tonic-gate int (*func)() = NULL; 27517c478bd9Sstevel@tonic-gate void *arg0 = NULL; 27527c478bd9Sstevel@tonic-gate 27537c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 27547c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2755aa59c4cbSrsb vfsop_find(vf, &func, int, &arg0, vfs_unmount, fsemop_unmount); 27567c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 27577c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 27587c478bd9Sstevel@tonic-gate return ((*func)(arg0, flag, cr)); 27597c478bd9Sstevel@tonic-gate } 27607c478bd9Sstevel@tonic-gate 27617c478bd9Sstevel@tonic-gate int 27627c478bd9Sstevel@tonic-gate vfsnext_root(fsemarg_t *vf, vnode_t **vpp) 27637c478bd9Sstevel@tonic-gate { 27647c478bd9Sstevel@tonic-gate int (*func)() = NULL; 27657c478bd9Sstevel@tonic-gate void *arg0 = NULL; 27667c478bd9Sstevel@tonic-gate 27677c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 27687c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2769aa59c4cbSrsb vfsop_find(vf, &func, int, &arg0, vfs_root, fsemop_root); 27707c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 27717c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 27727c478bd9Sstevel@tonic-gate return ((*func)(arg0, vpp)); 27737c478bd9Sstevel@tonic-gate } 27747c478bd9Sstevel@tonic-gate 27757c478bd9Sstevel@tonic-gate int 27767c478bd9Sstevel@tonic-gate vfsnext_statvfs(fsemarg_t *vf, statvfs64_t *sp) 27777c478bd9Sstevel@tonic-gate { 27787c478bd9Sstevel@tonic-gate int (*func)() = NULL; 27797c478bd9Sstevel@tonic-gate void *arg0 = NULL; 27807c478bd9Sstevel@tonic-gate 27817c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 27827c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2783aa59c4cbSrsb vfsop_find(vf, &func, int, &arg0, vfs_statvfs, fsemop_statvfs); 27847c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 27857c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 27867c478bd9Sstevel@tonic-gate return ((*func)(arg0, sp)); 27877c478bd9Sstevel@tonic-gate } 27887c478bd9Sstevel@tonic-gate 27897c478bd9Sstevel@tonic-gate int 27907c478bd9Sstevel@tonic-gate vfsnext_sync(fsemarg_t *vf, short flag, cred_t *cr) 27917c478bd9Sstevel@tonic-gate { 27927c478bd9Sstevel@tonic-gate int (*func)() = NULL; 27937c478bd9Sstevel@tonic-gate void *arg0 = NULL; 27947c478bd9Sstevel@tonic-gate 27957c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 27967c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2797aa59c4cbSrsb vfsop_find(vf, &func, int, &arg0, vfs_sync, fsemop_sync); 27987c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 27997c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 28007c478bd9Sstevel@tonic-gate return ((*func)(arg0, flag, cr)); 28017c478bd9Sstevel@tonic-gate } 28027c478bd9Sstevel@tonic-gate 28037c478bd9Sstevel@tonic-gate int 28047c478bd9Sstevel@tonic-gate vfsnext_vget(fsemarg_t *vf, vnode_t **vpp, fid_t *fidp) 28057c478bd9Sstevel@tonic-gate { 28067c478bd9Sstevel@tonic-gate int (*func)() = NULL; 28077c478bd9Sstevel@tonic-gate void *arg0 = NULL; 28087c478bd9Sstevel@tonic-gate 28097c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 28107c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2811aa59c4cbSrsb vfsop_find(vf, &func, int, &arg0, vfs_vget, fsemop_vget); 28127c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 28137c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 28147c478bd9Sstevel@tonic-gate return ((*func)(arg0, vpp, fidp)); 28157c478bd9Sstevel@tonic-gate } 28167c478bd9Sstevel@tonic-gate 28177c478bd9Sstevel@tonic-gate int 28187c478bd9Sstevel@tonic-gate vfsnext_mountroot(fsemarg_t *vf, enum whymountroot reason) 28197c478bd9Sstevel@tonic-gate { 28207c478bd9Sstevel@tonic-gate int (*func)() = NULL; 28217c478bd9Sstevel@tonic-gate void *arg0 = NULL; 28227c478bd9Sstevel@tonic-gate 28237c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 28247c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2825aa59c4cbSrsb vfsop_find(vf, &func, int, &arg0, vfs_mountroot, fsemop_mountroot); 28267c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 28277c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 28287c478bd9Sstevel@tonic-gate return ((*func)(arg0, reason)); 28297c478bd9Sstevel@tonic-gate } 28307c478bd9Sstevel@tonic-gate 28317c478bd9Sstevel@tonic-gate void 28327c478bd9Sstevel@tonic-gate vfsnext_freevfs(fsemarg_t *vf) 28337c478bd9Sstevel@tonic-gate { 28347c478bd9Sstevel@tonic-gate void (*func)() = NULL; 28357c478bd9Sstevel@tonic-gate void *arg0 = NULL; 28367c478bd9Sstevel@tonic-gate 28377c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 28387c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2839aa59c4cbSrsb vfsop_find(vf, &func, void, &arg0, vfs_freevfs, fsemop_freevfs); 28407c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 28417c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 28427c478bd9Sstevel@tonic-gate (*func)(arg0); 28437c478bd9Sstevel@tonic-gate } 28447c478bd9Sstevel@tonic-gate 28457c478bd9Sstevel@tonic-gate int 28467c478bd9Sstevel@tonic-gate vfsnext_vnstate(fsemarg_t *vf, vnode_t *vp, vntrans_t nstate) 28477c478bd9Sstevel@tonic-gate { 28487c478bd9Sstevel@tonic-gate int (*func)() = NULL; 28497c478bd9Sstevel@tonic-gate void *arg0 = NULL; 28507c478bd9Sstevel@tonic-gate 28517c478bd9Sstevel@tonic-gate ASSERT(vf != NULL); 28527c478bd9Sstevel@tonic-gate vf->fa_fnode--; 2853aa59c4cbSrsb vfsop_find(vf, &func, int, &arg0, vfs_vnstate, fsemop_vnstate); 28547c478bd9Sstevel@tonic-gate ASSERT(func != NULL); 28557c478bd9Sstevel@tonic-gate ASSERT(arg0 != NULL); 28567c478bd9Sstevel@tonic-gate return ((*func)(arg0, vp, nstate)); 28577c478bd9Sstevel@tonic-gate } 28587c478bd9Sstevel@tonic-gate 28597c478bd9Sstevel@tonic-gate 28607c478bd9Sstevel@tonic-gate /* 28617c478bd9Sstevel@tonic-gate * Create a new fem_head and associate with the vnode. 28627c478bd9Sstevel@tonic-gate * To keep the unaugmented vnode access path lock free, we spin 28637c478bd9Sstevel@tonic-gate * update this - create a new one, then try and install it. If 28647c478bd9Sstevel@tonic-gate * we fail to install, release the old one and pretend we succeeded. 28657c478bd9Sstevel@tonic-gate */ 28667c478bd9Sstevel@tonic-gate 28677c478bd9Sstevel@tonic-gate static struct fem_head * 28687c478bd9Sstevel@tonic-gate new_femhead(struct fem_head **hp) 28697c478bd9Sstevel@tonic-gate { 28707c478bd9Sstevel@tonic-gate struct fem_head *head; 28717c478bd9Sstevel@tonic-gate 28727c478bd9Sstevel@tonic-gate head = kmem_alloc(sizeof (*head), KM_SLEEP); 28737c478bd9Sstevel@tonic-gate mutex_init(&head->femh_lock, NULL, MUTEX_DEFAULT, NULL); 28747c478bd9Sstevel@tonic-gate head->femh_list = NULL; 287575d94465SJosef 'Jeff' Sipek if (atomic_cas_ptr(hp, NULL, head) != NULL) { 28767c478bd9Sstevel@tonic-gate kmem_free(head, sizeof (*head)); 28777c478bd9Sstevel@tonic-gate head = *hp; 28787c478bd9Sstevel@tonic-gate } 28797c478bd9Sstevel@tonic-gate return (head); 28807c478bd9Sstevel@tonic-gate } 28817c478bd9Sstevel@tonic-gate 28827c478bd9Sstevel@tonic-gate /* 28837c478bd9Sstevel@tonic-gate * Create a fem_list. The fem_list that gets returned is in a 28847c478bd9Sstevel@tonic-gate * very rudimentary state and MUST NOT be used until it's initialized 28857c478bd9Sstevel@tonic-gate * (usually by femlist_construct() or fem_dup_list()). The refcount 28867c478bd9Sstevel@tonic-gate * and size is set properly and top-of-stack is set to the "guard" node 28877c478bd9Sstevel@tonic-gate * just to be consistent. 28887c478bd9Sstevel@tonic-gate * 28897c478bd9Sstevel@tonic-gate * If anyone were to accidentally trying to run on this fem_list before 28907c478bd9Sstevel@tonic-gate * it's initialized then the system would likely panic trying to defererence 28917c478bd9Sstevel@tonic-gate * the (NULL) fn_op pointer. 28927c478bd9Sstevel@tonic-gate * 28937c478bd9Sstevel@tonic-gate */ 28947c478bd9Sstevel@tonic-gate static struct fem_list * 28957c478bd9Sstevel@tonic-gate femlist_create(int numnodes) 28967c478bd9Sstevel@tonic-gate { 28977c478bd9Sstevel@tonic-gate struct fem_list *sp; 28987c478bd9Sstevel@tonic-gate 28997c478bd9Sstevel@tonic-gate sp = kmem_alloc(fl_ntob(numnodes), KM_SLEEP); 29007c478bd9Sstevel@tonic-gate sp->feml_refc = 1; 29017c478bd9Sstevel@tonic-gate sp->feml_ssize = numnodes; 29027c478bd9Sstevel@tonic-gate sp->feml_nodes[0] = FEM_GUARD(FEMTYPE_NULL); 29037c478bd9Sstevel@tonic-gate sp->feml_tos = 0; 29047c478bd9Sstevel@tonic-gate return (sp); 29057c478bd9Sstevel@tonic-gate } 29067c478bd9Sstevel@tonic-gate 29077c478bd9Sstevel@tonic-gate /* 29087c478bd9Sstevel@tonic-gate * Construct a new femlist. 29097c478bd9Sstevel@tonic-gate * The list is constructed with the appropriate type of guard to 29107c478bd9Sstevel@tonic-gate * anchor it, and inserts the original ops. 29117c478bd9Sstevel@tonic-gate */ 29127c478bd9Sstevel@tonic-gate 29137c478bd9Sstevel@tonic-gate static struct fem_list * 29147c478bd9Sstevel@tonic-gate femlist_construct(void *baseops, int type, int numnodes) 29157c478bd9Sstevel@tonic-gate { 29167c478bd9Sstevel@tonic-gate struct fem_list *sp; 29177c478bd9Sstevel@tonic-gate 29187c478bd9Sstevel@tonic-gate sp = femlist_create(numnodes); 29197c478bd9Sstevel@tonic-gate sp->feml_nodes[0] = FEM_GUARD(type); 29207c478bd9Sstevel@tonic-gate sp->feml_nodes[1].fn_op.anon = baseops; 29217c478bd9Sstevel@tonic-gate sp->feml_nodes[1].fn_available = NULL; 29227c478bd9Sstevel@tonic-gate sp->feml_nodes[1].fn_av_hold = NULL; 29237c478bd9Sstevel@tonic-gate sp->feml_nodes[1].fn_av_rele = NULL; 29247c478bd9Sstevel@tonic-gate sp->feml_tos = 1; 29257c478bd9Sstevel@tonic-gate return (sp); 29267c478bd9Sstevel@tonic-gate } 29277c478bd9Sstevel@tonic-gate 29287c478bd9Sstevel@tonic-gate /* 29297c478bd9Sstevel@tonic-gate * Duplicate a list. Copy the original list to the clone. 29307c478bd9Sstevel@tonic-gate * 29317c478bd9Sstevel@tonic-gate * NOTE: The caller must have the fem_head for the lists locked. 29327c478bd9Sstevel@tonic-gate * Assuming the appropriate lock is held and the caller has done the 29337c478bd9Sstevel@tonic-gate * math right, the clone list should be big enough to old the original. 29347c478bd9Sstevel@tonic-gate */ 29357c478bd9Sstevel@tonic-gate 29367c478bd9Sstevel@tonic-gate static void 29377c478bd9Sstevel@tonic-gate fem_dup_list(struct fem_list *orig, struct fem_list *clone) 29387c478bd9Sstevel@tonic-gate { 29397c478bd9Sstevel@tonic-gate int i; 29407c478bd9Sstevel@tonic-gate 29417c478bd9Sstevel@tonic-gate ASSERT(clone->feml_ssize >= orig->feml_ssize); 29427c478bd9Sstevel@tonic-gate 29437c478bd9Sstevel@tonic-gate bcopy(orig->feml_nodes, clone->feml_nodes, 29447c478bd9Sstevel@tonic-gate sizeof (orig->feml_nodes[0]) * orig->feml_ssize); 29457c478bd9Sstevel@tonic-gate clone->feml_tos = orig->feml_tos; 29467c478bd9Sstevel@tonic-gate /* 29477c478bd9Sstevel@tonic-gate * Now that we've copied the old list (orig) to the new list (clone), 29487c478bd9Sstevel@tonic-gate * we need to walk the new list and put another hold on fn_available. 29497c478bd9Sstevel@tonic-gate */ 29507c478bd9Sstevel@tonic-gate for (i = clone->feml_tos; i > 0; i--) { 29517c478bd9Sstevel@tonic-gate struct fem_node *fnp = &clone->feml_nodes[i]; 29527c478bd9Sstevel@tonic-gate 29537c478bd9Sstevel@tonic-gate if (fnp->fn_av_hold) 29547c478bd9Sstevel@tonic-gate (*(fnp->fn_av_hold))(fnp->fn_available); 29557c478bd9Sstevel@tonic-gate } 29567c478bd9Sstevel@tonic-gate } 29577c478bd9Sstevel@tonic-gate 29587c478bd9Sstevel@tonic-gate 29597c478bd9Sstevel@tonic-gate static int 29607c478bd9Sstevel@tonic-gate fem_push_node( 29617c478bd9Sstevel@tonic-gate struct fem_head **hp, 29627c478bd9Sstevel@tonic-gate void **baseops, 29637c478bd9Sstevel@tonic-gate int type, 29647c478bd9Sstevel@tonic-gate struct fem_node *nnode, 29657c478bd9Sstevel@tonic-gate femhow_t how) 29667c478bd9Sstevel@tonic-gate { 29677c478bd9Sstevel@tonic-gate struct fem_head *hd; 29687c478bd9Sstevel@tonic-gate struct fem_list *list; 29697c478bd9Sstevel@tonic-gate void *oldops; 29707c478bd9Sstevel@tonic-gate int retry; 29717c478bd9Sstevel@tonic-gate int error = 0; 29727c478bd9Sstevel@tonic-gate int i; 29737c478bd9Sstevel@tonic-gate 29747c478bd9Sstevel@tonic-gate /* Validate the node */ 29757c478bd9Sstevel@tonic-gate if ((nnode->fn_op.anon == NULL) || (nnode->fn_available == NULL)) { 29767c478bd9Sstevel@tonic-gate return (EINVAL); 29777c478bd9Sstevel@tonic-gate } 29787c478bd9Sstevel@tonic-gate 29797c478bd9Sstevel@tonic-gate if ((hd = *hp) == NULL) { /* construct a proto-list */ 29807c478bd9Sstevel@tonic-gate hd = new_femhead(hp); 29817c478bd9Sstevel@tonic-gate } 29827c478bd9Sstevel@tonic-gate /* 29837c478bd9Sstevel@tonic-gate * RULE: once a femhead has been pushed onto a object, it cannot be 29847c478bd9Sstevel@tonic-gate * removed until the object is destroyed. It can be deactivated by 29857c478bd9Sstevel@tonic-gate * placing the original 'object operations' onto the object, which 29867c478bd9Sstevel@tonic-gate * will ignore the femhead. 29877c478bd9Sstevel@tonic-gate * The loop will exist when the femh_list has space to push a monitor 29887c478bd9Sstevel@tonic-gate * onto it. 29897c478bd9Sstevel@tonic-gate */ 29907c478bd9Sstevel@tonic-gate do { 29917c478bd9Sstevel@tonic-gate retry = 1; 29927c478bd9Sstevel@tonic-gate list = fem_lock(hd); 29937c478bd9Sstevel@tonic-gate oldops = *baseops; 29947c478bd9Sstevel@tonic-gate 29957c478bd9Sstevel@tonic-gate if (list != NULL) { 29967c478bd9Sstevel@tonic-gate if (list->feml_tos+1 < list->feml_ssize) { 29977c478bd9Sstevel@tonic-gate retry = 0; 29987c478bd9Sstevel@tonic-gate } else { 29997c478bd9Sstevel@tonic-gate struct fem_list *olist = list; 30007c478bd9Sstevel@tonic-gate 30017c478bd9Sstevel@tonic-gate fem_addref(olist); 30027c478bd9Sstevel@tonic-gate fem_unlock(hd); 30037c478bd9Sstevel@tonic-gate list = femlist_create(olist->feml_ssize * 2); 30047c478bd9Sstevel@tonic-gate (void) fem_lock(hd); 30057c478bd9Sstevel@tonic-gate if (hd->femh_list == olist) { 30067c478bd9Sstevel@tonic-gate if (list->feml_ssize <= 30077c478bd9Sstevel@tonic-gate olist->feml_ssize) { 30087c478bd9Sstevel@tonic-gate /* 30097c478bd9Sstevel@tonic-gate * We have a new list, but it 30107c478bd9Sstevel@tonic-gate * is too small to hold the 30117c478bd9Sstevel@tonic-gate * original contents plus the 30127c478bd9Sstevel@tonic-gate * one to push. Release the 30137c478bd9Sstevel@tonic-gate * new list and start over. 30147c478bd9Sstevel@tonic-gate */ 30157c478bd9Sstevel@tonic-gate fem_release(list); 30167c478bd9Sstevel@tonic-gate fem_unlock(hd); 30177c478bd9Sstevel@tonic-gate } else { 30187c478bd9Sstevel@tonic-gate /* 30197c478bd9Sstevel@tonic-gate * Life is good: Our new list 30207c478bd9Sstevel@tonic-gate * is big enough to hold the 30217c478bd9Sstevel@tonic-gate * original list (olist) + 1. 30227c478bd9Sstevel@tonic-gate */ 30237c478bd9Sstevel@tonic-gate fem_dup_list(olist, list); 30247c478bd9Sstevel@tonic-gate /* orphan this list */ 30257c478bd9Sstevel@tonic-gate hd->femh_list = list; 3026677d097aSjwahlig (void) fem_delref(olist); 30277c478bd9Sstevel@tonic-gate retry = 0; 30287c478bd9Sstevel@tonic-gate } 30297c478bd9Sstevel@tonic-gate } else { 30307c478bd9Sstevel@tonic-gate /* concurrent update, retry */ 30317c478bd9Sstevel@tonic-gate fem_release(list); 30327c478bd9Sstevel@tonic-gate fem_unlock(hd); 30337c478bd9Sstevel@tonic-gate } 30347c478bd9Sstevel@tonic-gate /* remove the reference we added above */ 30357c478bd9Sstevel@tonic-gate fem_release(olist); 30367c478bd9Sstevel@tonic-gate } 30377c478bd9Sstevel@tonic-gate } else { 30387c478bd9Sstevel@tonic-gate fem_unlock(hd); 30397c478bd9Sstevel@tonic-gate list = femlist_construct(oldops, type, NNODES_DEFAULT); 30407c478bd9Sstevel@tonic-gate (void) fem_lock(hd); 30417c478bd9Sstevel@tonic-gate if (hd->femh_list != NULL || *baseops != oldops) { 30427c478bd9Sstevel@tonic-gate /* concurrent update, retry */ 30437c478bd9Sstevel@tonic-gate fem_release(list); 30447c478bd9Sstevel@tonic-gate fem_unlock(hd); 30457c478bd9Sstevel@tonic-gate } else { 30467c478bd9Sstevel@tonic-gate hd->femh_list = list; 30477c478bd9Sstevel@tonic-gate *baseops = FEM_HEAD(type); 30487c478bd9Sstevel@tonic-gate retry = 0; 30497c478bd9Sstevel@tonic-gate } 30507c478bd9Sstevel@tonic-gate } 30517c478bd9Sstevel@tonic-gate } while (retry); 30527c478bd9Sstevel@tonic-gate 30537c478bd9Sstevel@tonic-gate ASSERT(mutex_owner(&hd->femh_lock) == curthread); 30547c478bd9Sstevel@tonic-gate ASSERT(list->feml_tos+1 < list->feml_ssize); 30557c478bd9Sstevel@tonic-gate 30567c478bd9Sstevel@tonic-gate /* 30577c478bd9Sstevel@tonic-gate * The presence of "how" will modify the behavior of how/if 30587c478bd9Sstevel@tonic-gate * nodes are pushed. If it's FORCE, then we can skip 30597c478bd9Sstevel@tonic-gate * all the checks and push it on. 30607c478bd9Sstevel@tonic-gate */ 30617c478bd9Sstevel@tonic-gate if (how != FORCE) { 30627c478bd9Sstevel@tonic-gate /* Start at the top and work our way down */ 30637c478bd9Sstevel@tonic-gate for (i = list->feml_tos; i > 0; i--) { 30647c478bd9Sstevel@tonic-gate void *fn_av = list->feml_nodes[i].fn_available; 30657c478bd9Sstevel@tonic-gate void *fn_op = list->feml_nodes[i].fn_op.anon; 30667c478bd9Sstevel@tonic-gate 30677c478bd9Sstevel@tonic-gate /* 30687c478bd9Sstevel@tonic-gate * OPARGUNIQ means that this node should not 30697c478bd9Sstevel@tonic-gate * be pushed on if a node with the same op/avail 30707c478bd9Sstevel@tonic-gate * combination exists. This situation returns 30717c478bd9Sstevel@tonic-gate * EBUSY. 30727c478bd9Sstevel@tonic-gate * 30737c478bd9Sstevel@tonic-gate * OPUNIQ means that this node should not be 30747c478bd9Sstevel@tonic-gate * pushed on if a node with the same op exists. 30757c478bd9Sstevel@tonic-gate * This situation also returns EBUSY. 30767c478bd9Sstevel@tonic-gate */ 30777c478bd9Sstevel@tonic-gate switch (how) { 30787c478bd9Sstevel@tonic-gate 30797c478bd9Sstevel@tonic-gate case OPUNIQ: 30807c478bd9Sstevel@tonic-gate if (fn_op == nnode->fn_op.anon) { 30817c478bd9Sstevel@tonic-gate error = EBUSY; 30827c478bd9Sstevel@tonic-gate } 30837c478bd9Sstevel@tonic-gate break; 30847c478bd9Sstevel@tonic-gate 30857c478bd9Sstevel@tonic-gate case OPARGUNIQ: 30867c478bd9Sstevel@tonic-gate if ((fn_op == nnode->fn_op.anon) && 30877c478bd9Sstevel@tonic-gate (fn_av == nnode->fn_available)) { 30887c478bd9Sstevel@tonic-gate error = EBUSY; 30897c478bd9Sstevel@tonic-gate } 30907c478bd9Sstevel@tonic-gate break; 30917c478bd9Sstevel@tonic-gate 30927c478bd9Sstevel@tonic-gate default: 30937c478bd9Sstevel@tonic-gate error = EINVAL; /* Unexpected value */ 30947c478bd9Sstevel@tonic-gate break; 30957c478bd9Sstevel@tonic-gate } 30967c478bd9Sstevel@tonic-gate 30977c478bd9Sstevel@tonic-gate if (error) 30987c478bd9Sstevel@tonic-gate break; 30997c478bd9Sstevel@tonic-gate } 31007c478bd9Sstevel@tonic-gate } 31017c478bd9Sstevel@tonic-gate 31027c478bd9Sstevel@tonic-gate if (error == 0) { 31037c478bd9Sstevel@tonic-gate /* 31047c478bd9Sstevel@tonic-gate * If no errors, slap the node on the list. 31057c478bd9Sstevel@tonic-gate * Note: The following is a structure copy. 31067c478bd9Sstevel@tonic-gate */ 31077c478bd9Sstevel@tonic-gate list->feml_nodes[++(list->feml_tos)] = *nnode; 31087c478bd9Sstevel@tonic-gate } 31097c478bd9Sstevel@tonic-gate 31107c478bd9Sstevel@tonic-gate fem_unlock(hd); 31117c478bd9Sstevel@tonic-gate return (error); 31127c478bd9Sstevel@tonic-gate } 31137c478bd9Sstevel@tonic-gate 31147c478bd9Sstevel@tonic-gate /* 31157c478bd9Sstevel@tonic-gate * Remove a node by copying the list above it down a notch. 31167c478bd9Sstevel@tonic-gate * If the list is busy, replace it with an idle one and work 31177c478bd9Sstevel@tonic-gate * upon it. 31187c478bd9Sstevel@tonic-gate * A node matches if the opset matches and the datap matches or is 31197c478bd9Sstevel@tonic-gate * null. 31207c478bd9Sstevel@tonic-gate */ 31217c478bd9Sstevel@tonic-gate 31227c478bd9Sstevel@tonic-gate static int 31237c478bd9Sstevel@tonic-gate remove_node(struct fem_list *sp, void **baseops, void *opset, void *datap) 31247c478bd9Sstevel@tonic-gate { 31257c478bd9Sstevel@tonic-gate int i; 31267c478bd9Sstevel@tonic-gate struct fem_node *fn; 31277c478bd9Sstevel@tonic-gate 31287c478bd9Sstevel@tonic-gate for (i = sp->feml_tos; i > 0; i--) { 31297c478bd9Sstevel@tonic-gate fn = sp->feml_nodes+i; 31307c478bd9Sstevel@tonic-gate if (fn->fn_op.anon == opset && 31317c478bd9Sstevel@tonic-gate (fn->fn_available == datap || datap == NULL)) { 31327c478bd9Sstevel@tonic-gate break; 31337c478bd9Sstevel@tonic-gate } 31347c478bd9Sstevel@tonic-gate } 31357c478bd9Sstevel@tonic-gate if (i == 0) { 31367c478bd9Sstevel@tonic-gate return (EINVAL); 31377c478bd9Sstevel@tonic-gate } 31387c478bd9Sstevel@tonic-gate 31397c478bd9Sstevel@tonic-gate /* 31407c478bd9Sstevel@tonic-gate * At this point we have a node in-hand (*fn) that we are about 31417c478bd9Sstevel@tonic-gate * to remove by overwriting it and adjusting the stack. This is 31427c478bd9Sstevel@tonic-gate * our last chance to do anything with this node so we do the 31437c478bd9Sstevel@tonic-gate * release on the arg. 31447c478bd9Sstevel@tonic-gate */ 31457c478bd9Sstevel@tonic-gate if (fn->fn_av_rele) 31467c478bd9Sstevel@tonic-gate (*(fn->fn_av_rele))(fn->fn_available); 31477c478bd9Sstevel@tonic-gate 31487c478bd9Sstevel@tonic-gate while (i++ < sp->feml_tos) { 31497c478bd9Sstevel@tonic-gate sp->feml_nodes[i-1] = sp->feml_nodes[i]; 31507c478bd9Sstevel@tonic-gate } 31517c478bd9Sstevel@tonic-gate if (--(sp->feml_tos) == 1) { /* Empty, restore ops */ 31527c478bd9Sstevel@tonic-gate *baseops = sp->feml_nodes[1].fn_op.anon; 31537c478bd9Sstevel@tonic-gate } 31547c478bd9Sstevel@tonic-gate return (0); 31557c478bd9Sstevel@tonic-gate } 31567c478bd9Sstevel@tonic-gate 31577c478bd9Sstevel@tonic-gate static int 31587c478bd9Sstevel@tonic-gate fem_remove_node(struct fem_head *fh, void **baseops, void *opset, void *datap) 31597c478bd9Sstevel@tonic-gate { 31607c478bd9Sstevel@tonic-gate struct fem_list *sp; 3161de7d3445Sjwahlig int error = 0; 31627c478bd9Sstevel@tonic-gate int retry; 31637c478bd9Sstevel@tonic-gate 31647c478bd9Sstevel@tonic-gate if (fh == NULL) { 31657c478bd9Sstevel@tonic-gate return (EINVAL); 31667c478bd9Sstevel@tonic-gate } 31677c478bd9Sstevel@tonic-gate 31687c478bd9Sstevel@tonic-gate do { 31697c478bd9Sstevel@tonic-gate retry = 0; 31707c478bd9Sstevel@tonic-gate if ((sp = fem_lock(fh)) == NULL) { 31717c478bd9Sstevel@tonic-gate fem_unlock(fh); 31727c478bd9Sstevel@tonic-gate error = EINVAL; 31737c478bd9Sstevel@tonic-gate } else if (sp->feml_refc == 1) { 31747c478bd9Sstevel@tonic-gate error = remove_node(sp, baseops, opset, datap); 31757c478bd9Sstevel@tonic-gate if (sp->feml_tos == 1) { 31767c478bd9Sstevel@tonic-gate /* 31777c478bd9Sstevel@tonic-gate * The top-of-stack was decremented by 31787c478bd9Sstevel@tonic-gate * remove_node(). If it got down to 1, 31797c478bd9Sstevel@tonic-gate * then the base ops were replaced and we 31807c478bd9Sstevel@tonic-gate * call fem_release() which will free the 31817c478bd9Sstevel@tonic-gate * fem_list. 31827c478bd9Sstevel@tonic-gate */ 31837c478bd9Sstevel@tonic-gate fem_release(sp); 31847c478bd9Sstevel@tonic-gate fh->femh_list = NULL; 31857c478bd9Sstevel@tonic-gate /* XXX - Do we need a membar_producer() call? */ 31867c478bd9Sstevel@tonic-gate } 31877c478bd9Sstevel@tonic-gate fem_unlock(fh); 31887c478bd9Sstevel@tonic-gate } else { 31897c478bd9Sstevel@tonic-gate /* busy - install a new one without this monitor */ 31907c478bd9Sstevel@tonic-gate struct fem_list *nsp; /* New fem_list being cloned */ 31917c478bd9Sstevel@tonic-gate 31927c478bd9Sstevel@tonic-gate fem_addref(sp); 31937c478bd9Sstevel@tonic-gate fem_unlock(fh); 31947c478bd9Sstevel@tonic-gate nsp = femlist_create(sp->feml_ssize); 31957c478bd9Sstevel@tonic-gate if (fem_lock(fh) == sp) { 31967c478bd9Sstevel@tonic-gate /* 31977c478bd9Sstevel@tonic-gate * We popped out of the lock, created a 31987c478bd9Sstevel@tonic-gate * list, then relocked. If we're in here 31997c478bd9Sstevel@tonic-gate * then the fem_head points to the same list 32007c478bd9Sstevel@tonic-gate * it started with. 32017c478bd9Sstevel@tonic-gate */ 32027c478bd9Sstevel@tonic-gate fem_dup_list(sp, nsp); 32037c478bd9Sstevel@tonic-gate error = remove_node(nsp, baseops, opset, datap); 32047c478bd9Sstevel@tonic-gate if (error != 0) { 32057c478bd9Sstevel@tonic-gate fem_release(nsp); 32067c478bd9Sstevel@tonic-gate } else if (nsp->feml_tos == 1) { 32077c478bd9Sstevel@tonic-gate /* New list now empty, tear it down */ 32087c478bd9Sstevel@tonic-gate fem_release(nsp); 32097c478bd9Sstevel@tonic-gate fh->femh_list = NULL; 32107c478bd9Sstevel@tonic-gate } else { 32117c478bd9Sstevel@tonic-gate fh->femh_list = nsp; 32127c478bd9Sstevel@tonic-gate } 3213677d097aSjwahlig (void) fem_delref(sp); 32147c478bd9Sstevel@tonic-gate } else { 32157c478bd9Sstevel@tonic-gate /* List changed while locked, try again... */ 32167c478bd9Sstevel@tonic-gate fem_release(nsp); 32177c478bd9Sstevel@tonic-gate retry = 1; 32187c478bd9Sstevel@tonic-gate } 3219de7d3445Sjwahlig /* 3220de7d3445Sjwahlig * If error is set, then we tried to remove a node 3221de7d3445Sjwahlig * from the list, but failed. This means that we 3222de7d3445Sjwahlig * will still be using this list so don't release it. 3223de7d3445Sjwahlig */ 3224de7d3445Sjwahlig if (error == 0) 32257c478bd9Sstevel@tonic-gate fem_release(sp); 32267c478bd9Sstevel@tonic-gate fem_unlock(fh); 32277c478bd9Sstevel@tonic-gate } 32287c478bd9Sstevel@tonic-gate } while (retry); 32297c478bd9Sstevel@tonic-gate return (error); 32307c478bd9Sstevel@tonic-gate } 32317c478bd9Sstevel@tonic-gate 32327c478bd9Sstevel@tonic-gate 32337c478bd9Sstevel@tonic-gate /* 32347c478bd9Sstevel@tonic-gate * perform operation on each element until one returns non zero 32357c478bd9Sstevel@tonic-gate */ 32367c478bd9Sstevel@tonic-gate static int 32377c478bd9Sstevel@tonic-gate fem_walk_list( 32387c478bd9Sstevel@tonic-gate struct fem_list *sp, 32397c478bd9Sstevel@tonic-gate int (*f)(struct fem_node *, void *, void *), 32407c478bd9Sstevel@tonic-gate void *mon, 32417c478bd9Sstevel@tonic-gate void *arg) 32427c478bd9Sstevel@tonic-gate { 32437c478bd9Sstevel@tonic-gate int i; 32447c478bd9Sstevel@tonic-gate 32457c478bd9Sstevel@tonic-gate ASSERT(sp != NULL); 32467c478bd9Sstevel@tonic-gate for (i = sp->feml_tos; i > 0; i--) { 32477c478bd9Sstevel@tonic-gate if ((*f)(sp->feml_nodes+i, mon, arg) != 0) { 32487c478bd9Sstevel@tonic-gate break; 32497c478bd9Sstevel@tonic-gate } 32507c478bd9Sstevel@tonic-gate } 32517c478bd9Sstevel@tonic-gate return (i); 32527c478bd9Sstevel@tonic-gate } 32537c478bd9Sstevel@tonic-gate 32547c478bd9Sstevel@tonic-gate /* 32557c478bd9Sstevel@tonic-gate * companion comparison functions. 32567c478bd9Sstevel@tonic-gate */ 32577c478bd9Sstevel@tonic-gate static int 32587c478bd9Sstevel@tonic-gate fem_compare_mon(struct fem_node *n, void *mon, void *arg) 32597c478bd9Sstevel@tonic-gate { 32607c478bd9Sstevel@tonic-gate return ((n->fn_op.anon == mon) && (n->fn_available == arg)); 32617c478bd9Sstevel@tonic-gate } 32627c478bd9Sstevel@tonic-gate 32637c478bd9Sstevel@tonic-gate /* 32647c478bd9Sstevel@tonic-gate * VNODE interposition. 32657c478bd9Sstevel@tonic-gate */ 32667c478bd9Sstevel@tonic-gate 32677c478bd9Sstevel@tonic-gate int 32687c478bd9Sstevel@tonic-gate fem_create(char *name, const struct fs_operation_def *templ, 32697c478bd9Sstevel@tonic-gate fem_t **actual) 32707c478bd9Sstevel@tonic-gate { 32717c478bd9Sstevel@tonic-gate int unused_ops = 0; 32727c478bd9Sstevel@tonic-gate int e; 32737c478bd9Sstevel@tonic-gate fem_t *newf; 32747c478bd9Sstevel@tonic-gate 32757c478bd9Sstevel@tonic-gate newf = fem_alloc(); 32767c478bd9Sstevel@tonic-gate newf->name = name; 32777c478bd9Sstevel@tonic-gate newf->templ = templ; 32787c478bd9Sstevel@tonic-gate 32797c478bd9Sstevel@tonic-gate e = fs_build_vector(newf, &unused_ops, fem_opdef, templ); 32807c478bd9Sstevel@tonic-gate if (e != 0) { 32817c478bd9Sstevel@tonic-gate #ifdef DEBUG 32827c478bd9Sstevel@tonic-gate cmn_err(CE_WARN, "fem_create: error %d building vector", e); 32837c478bd9Sstevel@tonic-gate #endif 32847c478bd9Sstevel@tonic-gate fem_free(newf); 32857c478bd9Sstevel@tonic-gate } else { 32867c478bd9Sstevel@tonic-gate *actual = newf; 32877c478bd9Sstevel@tonic-gate } 32887c478bd9Sstevel@tonic-gate return (e); 32897c478bd9Sstevel@tonic-gate } 32907c478bd9Sstevel@tonic-gate 32917c478bd9Sstevel@tonic-gate int 32927c478bd9Sstevel@tonic-gate fem_install( 32937c478bd9Sstevel@tonic-gate vnode_t *vp, /* Vnode on which monitor is being installed */ 32947c478bd9Sstevel@tonic-gate fem_t *mon, /* Monitor operations being installed */ 32957c478bd9Sstevel@tonic-gate void *arg, /* Opaque data used by monitor */ 32967c478bd9Sstevel@tonic-gate femhow_t how, /* Installation control */ 32977c478bd9Sstevel@tonic-gate void (*arg_hold)(void *), /* Hold routine for "arg" */ 32987c478bd9Sstevel@tonic-gate void (*arg_rele)(void *)) /* Release routine for "arg" */ 32997c478bd9Sstevel@tonic-gate { 33007c478bd9Sstevel@tonic-gate int error; 33017c478bd9Sstevel@tonic-gate struct fem_node nnode; 33027c478bd9Sstevel@tonic-gate 33037c478bd9Sstevel@tonic-gate nnode.fn_available = arg; 33047c478bd9Sstevel@tonic-gate nnode.fn_op.fem = mon; 33057c478bd9Sstevel@tonic-gate nnode.fn_av_hold = arg_hold; 33067c478bd9Sstevel@tonic-gate nnode.fn_av_rele = arg_rele; 33077c478bd9Sstevel@tonic-gate /* 33087c478bd9Sstevel@tonic-gate * If we have a non-NULL hold function, do the hold right away. 33097c478bd9Sstevel@tonic-gate * The release is done in remove_node(). 33107c478bd9Sstevel@tonic-gate */ 33117c478bd9Sstevel@tonic-gate if (arg_hold) 33127c478bd9Sstevel@tonic-gate (*arg_hold)(arg); 33137c478bd9Sstevel@tonic-gate 33147c478bd9Sstevel@tonic-gate error = fem_push_node(&vp->v_femhead, (void **)&vp->v_op, FEMTYPE_VNODE, 33157c478bd9Sstevel@tonic-gate &nnode, how); 33167c478bd9Sstevel@tonic-gate 33177c478bd9Sstevel@tonic-gate /* If there was an error then the monitor wasn't pushed */ 33187c478bd9Sstevel@tonic-gate if (error && arg_rele) 33197c478bd9Sstevel@tonic-gate (*arg_rele)(arg); 33207c478bd9Sstevel@tonic-gate 33217c478bd9Sstevel@tonic-gate return (error); 33227c478bd9Sstevel@tonic-gate } 33237c478bd9Sstevel@tonic-gate 33247c478bd9Sstevel@tonic-gate int 33257c478bd9Sstevel@tonic-gate fem_is_installed(vnode_t *v, fem_t *mon, void *arg) 33267c478bd9Sstevel@tonic-gate { 33277c478bd9Sstevel@tonic-gate int e; 33287c478bd9Sstevel@tonic-gate struct fem_list *fl; 33297c478bd9Sstevel@tonic-gate 33307c478bd9Sstevel@tonic-gate fl = fem_get(v->v_femhead); 33317c478bd9Sstevel@tonic-gate if (fl != NULL) { 33327c478bd9Sstevel@tonic-gate e = fem_walk_list(fl, fem_compare_mon, (void *)mon, arg); 33337c478bd9Sstevel@tonic-gate fem_release(fl); 33347c478bd9Sstevel@tonic-gate return (e); 33357c478bd9Sstevel@tonic-gate } 33367c478bd9Sstevel@tonic-gate return (0); 33377c478bd9Sstevel@tonic-gate } 33387c478bd9Sstevel@tonic-gate 33397c478bd9Sstevel@tonic-gate int 33407c478bd9Sstevel@tonic-gate fem_uninstall(vnode_t *v, fem_t *mon, void *arg) 33417c478bd9Sstevel@tonic-gate { 33427c478bd9Sstevel@tonic-gate int e; 33437c478bd9Sstevel@tonic-gate e = fem_remove_node(v->v_femhead, (void **)&v->v_op, 33447c478bd9Sstevel@tonic-gate (void *)mon, arg); 33457c478bd9Sstevel@tonic-gate return (e); 33467c478bd9Sstevel@tonic-gate } 33477c478bd9Sstevel@tonic-gate 33487c478bd9Sstevel@tonic-gate void 33497c478bd9Sstevel@tonic-gate fem_setvnops(vnode_t *v, vnodeops_t *newops) 33507c478bd9Sstevel@tonic-gate { 33517c478bd9Sstevel@tonic-gate vnodeops_t *r; 33527c478bd9Sstevel@tonic-gate 33537c478bd9Sstevel@tonic-gate ASSERT(v != NULL); 33547c478bd9Sstevel@tonic-gate ASSERT(newops != NULL); 33557c478bd9Sstevel@tonic-gate 33567c478bd9Sstevel@tonic-gate do { 33577c478bd9Sstevel@tonic-gate r = v->v_op; 33587c478bd9Sstevel@tonic-gate membar_consumer(); 33597c478bd9Sstevel@tonic-gate if (v->v_femhead != NULL) { 33607c478bd9Sstevel@tonic-gate struct fem_list *fl; 33617c478bd9Sstevel@tonic-gate if ((fl = fem_lock(v->v_femhead)) != NULL) { 33627c478bd9Sstevel@tonic-gate fl->feml_nodes[1].fn_op.vnode = newops; 33637c478bd9Sstevel@tonic-gate fem_unlock(v->v_femhead); 33647c478bd9Sstevel@tonic-gate return; 33657c478bd9Sstevel@tonic-gate } 33667c478bd9Sstevel@tonic-gate fem_unlock(v->v_femhead); 33677c478bd9Sstevel@tonic-gate } 336875d94465SJosef 'Jeff' Sipek } while (atomic_cas_ptr(&v->v_op, r, newops) != r); 33697c478bd9Sstevel@tonic-gate } 33707c478bd9Sstevel@tonic-gate 33717c478bd9Sstevel@tonic-gate vnodeops_t * 33727c478bd9Sstevel@tonic-gate fem_getvnops(vnode_t *v) 33737c478bd9Sstevel@tonic-gate { 33747c478bd9Sstevel@tonic-gate vnodeops_t *r; 33757c478bd9Sstevel@tonic-gate 33767c478bd9Sstevel@tonic-gate ASSERT(v != NULL); 33777c478bd9Sstevel@tonic-gate 33787c478bd9Sstevel@tonic-gate r = v->v_op; 33797c478bd9Sstevel@tonic-gate membar_consumer(); 33807c478bd9Sstevel@tonic-gate if (v->v_femhead != NULL) { 33817c478bd9Sstevel@tonic-gate struct fem_list *fl; 33827c478bd9Sstevel@tonic-gate if ((fl = fem_lock(v->v_femhead)) != NULL) { 33837c478bd9Sstevel@tonic-gate r = fl->feml_nodes[1].fn_op.vnode; 33847c478bd9Sstevel@tonic-gate } 33857c478bd9Sstevel@tonic-gate fem_unlock(v->v_femhead); 33867c478bd9Sstevel@tonic-gate } 33877c478bd9Sstevel@tonic-gate return (r); 33887c478bd9Sstevel@tonic-gate } 33897c478bd9Sstevel@tonic-gate 33907c478bd9Sstevel@tonic-gate 33917c478bd9Sstevel@tonic-gate /* 33927c478bd9Sstevel@tonic-gate * VFS interposition 33937c478bd9Sstevel@tonic-gate */ 33947c478bd9Sstevel@tonic-gate int 33957c478bd9Sstevel@tonic-gate fsem_create(char *name, const struct fs_operation_def *templ, 33967c478bd9Sstevel@tonic-gate fsem_t **actual) 33977c478bd9Sstevel@tonic-gate { 33987c478bd9Sstevel@tonic-gate int unused_ops = 0; 33997c478bd9Sstevel@tonic-gate int e; 34007c478bd9Sstevel@tonic-gate fsem_t *newv; 34017c478bd9Sstevel@tonic-gate 34027c478bd9Sstevel@tonic-gate newv = fsem_alloc(); 34037c478bd9Sstevel@tonic-gate newv->name = (const char *)name; 34047c478bd9Sstevel@tonic-gate newv->templ = templ; 34057c478bd9Sstevel@tonic-gate 34067c478bd9Sstevel@tonic-gate e = fs_build_vector(newv, &unused_ops, fsem_opdef, templ); 34077c478bd9Sstevel@tonic-gate if (e != 0) { 34087c478bd9Sstevel@tonic-gate #ifdef DEBUG 34097c478bd9Sstevel@tonic-gate cmn_err(CE_WARN, "fsem_create: error %d building vector", e); 34107c478bd9Sstevel@tonic-gate #endif 34117c478bd9Sstevel@tonic-gate fsem_free(newv); 34127c478bd9Sstevel@tonic-gate } else { 34137c478bd9Sstevel@tonic-gate *actual = newv; 34147c478bd9Sstevel@tonic-gate } 34157c478bd9Sstevel@tonic-gate return (e); 34167c478bd9Sstevel@tonic-gate } 34177c478bd9Sstevel@tonic-gate 34187c478bd9Sstevel@tonic-gate /* 34197c478bd9Sstevel@tonic-gate * These need to be re-written, but there should be more common bits. 34207c478bd9Sstevel@tonic-gate */ 34217c478bd9Sstevel@tonic-gate 34227c478bd9Sstevel@tonic-gate int 34237c478bd9Sstevel@tonic-gate fsem_is_installed(struct vfs *v, fsem_t *mon, void *arg) 34247c478bd9Sstevel@tonic-gate { 34257c478bd9Sstevel@tonic-gate struct fem_list *fl; 34267c478bd9Sstevel@tonic-gate 3427ddfcde86Srsb if (v->vfs_implp == NULL) 3428ddfcde86Srsb return (0); 3429ddfcde86Srsb 34307c478bd9Sstevel@tonic-gate fl = fem_get(v->vfs_femhead); 34317c478bd9Sstevel@tonic-gate if (fl != NULL) { 34327c478bd9Sstevel@tonic-gate int e; 34337c478bd9Sstevel@tonic-gate e = fem_walk_list(fl, fem_compare_mon, (void *)mon, arg); 34347c478bd9Sstevel@tonic-gate fem_release(fl); 34357c478bd9Sstevel@tonic-gate return (e); 34367c478bd9Sstevel@tonic-gate } 34377c478bd9Sstevel@tonic-gate return (0); 34387c478bd9Sstevel@tonic-gate } 34397c478bd9Sstevel@tonic-gate 34407c478bd9Sstevel@tonic-gate int 34417c478bd9Sstevel@tonic-gate fsem_install( 34427c478bd9Sstevel@tonic-gate struct vfs *vfsp, /* VFS on which monitor is being installed */ 34437c478bd9Sstevel@tonic-gate fsem_t *mon, /* Monitor operations being installed */ 34447c478bd9Sstevel@tonic-gate void *arg, /* Opaque data used by monitor */ 34457c478bd9Sstevel@tonic-gate femhow_t how, /* Installation control */ 34467c478bd9Sstevel@tonic-gate void (*arg_hold)(void *), /* Hold routine for "arg" */ 34477c478bd9Sstevel@tonic-gate void (*arg_rele)(void *)) /* Release routine for "arg" */ 34487c478bd9Sstevel@tonic-gate { 34497c478bd9Sstevel@tonic-gate int error; 34507c478bd9Sstevel@tonic-gate struct fem_node nnode; 34517c478bd9Sstevel@tonic-gate 3452ddfcde86Srsb /* If this vfs hasn't been properly initialized, fail the install */ 3453ddfcde86Srsb if (vfsp->vfs_implp == NULL) 3454ddfcde86Srsb return (EINVAL); 3455ddfcde86Srsb 34567c478bd9Sstevel@tonic-gate nnode.fn_available = arg; 34577c478bd9Sstevel@tonic-gate nnode.fn_op.fsem = mon; 34587c478bd9Sstevel@tonic-gate nnode.fn_av_hold = arg_hold; 34597c478bd9Sstevel@tonic-gate nnode.fn_av_rele = arg_rele; 34607c478bd9Sstevel@tonic-gate /* 34617c478bd9Sstevel@tonic-gate * If we have a non-NULL hold function, do the hold right away. 34627c478bd9Sstevel@tonic-gate * The release is done in remove_node(). 34637c478bd9Sstevel@tonic-gate */ 34647c478bd9Sstevel@tonic-gate if (arg_hold) 34657c478bd9Sstevel@tonic-gate (*arg_hold)(arg); 34667c478bd9Sstevel@tonic-gate 34677c478bd9Sstevel@tonic-gate error = fem_push_node(&vfsp->vfs_femhead, (void **)&vfsp->vfs_op, 34687c478bd9Sstevel@tonic-gate FEMTYPE_VFS, &nnode, how); 34697c478bd9Sstevel@tonic-gate 34707c478bd9Sstevel@tonic-gate /* If there was an error then the monitor wasn't pushed */ 34717c478bd9Sstevel@tonic-gate if (error && arg_rele) 34727c478bd9Sstevel@tonic-gate (*arg_rele)(arg); 34737c478bd9Sstevel@tonic-gate 34747c478bd9Sstevel@tonic-gate return (error); 34757c478bd9Sstevel@tonic-gate } 34767c478bd9Sstevel@tonic-gate 34777c478bd9Sstevel@tonic-gate int 34787c478bd9Sstevel@tonic-gate fsem_uninstall(struct vfs *v, fsem_t *mon, void *arg) 34797c478bd9Sstevel@tonic-gate { 34807c478bd9Sstevel@tonic-gate int e; 3481ddfcde86Srsb 3482ddfcde86Srsb if (v->vfs_implp == NULL) 3483ddfcde86Srsb return (EINVAL); 3484ddfcde86Srsb 34857c478bd9Sstevel@tonic-gate e = fem_remove_node(v->vfs_femhead, (void **)&v->vfs_op, 34867c478bd9Sstevel@tonic-gate (void *)mon, arg); 34877c478bd9Sstevel@tonic-gate return (e); 34887c478bd9Sstevel@tonic-gate } 34897c478bd9Sstevel@tonic-gate 34907c478bd9Sstevel@tonic-gate void 34917c478bd9Sstevel@tonic-gate fsem_setvfsops(vfs_t *v, vfsops_t *newops) 34927c478bd9Sstevel@tonic-gate { 34937c478bd9Sstevel@tonic-gate vfsops_t *r; 34947c478bd9Sstevel@tonic-gate 34957c478bd9Sstevel@tonic-gate ASSERT(v != NULL); 34967c478bd9Sstevel@tonic-gate ASSERT(newops != NULL); 3497ddfcde86Srsb ASSERT(v->vfs_implp); 34987c478bd9Sstevel@tonic-gate 34997c478bd9Sstevel@tonic-gate do { 35007c478bd9Sstevel@tonic-gate r = v->vfs_op; 35017c478bd9Sstevel@tonic-gate membar_consumer(); 35027c478bd9Sstevel@tonic-gate if (v->vfs_femhead != NULL) { 35037c478bd9Sstevel@tonic-gate struct fem_list *fl; 35047c478bd9Sstevel@tonic-gate if ((fl = fem_lock(v->vfs_femhead)) != NULL) { 35057c478bd9Sstevel@tonic-gate fl->feml_nodes[1].fn_op.vfs = newops; 35067c478bd9Sstevel@tonic-gate fem_unlock(v->vfs_femhead); 35077c478bd9Sstevel@tonic-gate return; 35087c478bd9Sstevel@tonic-gate } 35097c478bd9Sstevel@tonic-gate fem_unlock(v->vfs_femhead); 35107c478bd9Sstevel@tonic-gate } 351175d94465SJosef 'Jeff' Sipek } while (atomic_cas_ptr(&v->vfs_op, r, newops) != r); 35127c478bd9Sstevel@tonic-gate } 35137c478bd9Sstevel@tonic-gate 35147c478bd9Sstevel@tonic-gate vfsops_t * 35157c478bd9Sstevel@tonic-gate fsem_getvfsops(vfs_t *v) 35167c478bd9Sstevel@tonic-gate { 35177c478bd9Sstevel@tonic-gate vfsops_t *r; 35187c478bd9Sstevel@tonic-gate 35197c478bd9Sstevel@tonic-gate ASSERT(v != NULL); 3520ddfcde86Srsb ASSERT(v->vfs_implp); 35217c478bd9Sstevel@tonic-gate 35227c478bd9Sstevel@tonic-gate r = v->vfs_op; 35237c478bd9Sstevel@tonic-gate membar_consumer(); 35247c478bd9Sstevel@tonic-gate if (v->vfs_femhead != NULL) { 35257c478bd9Sstevel@tonic-gate struct fem_list *fl; 35267c478bd9Sstevel@tonic-gate if ((fl = fem_lock(v->vfs_femhead)) != NULL) { 35277c478bd9Sstevel@tonic-gate r = fl->feml_nodes[1].fn_op.vfs; 35287c478bd9Sstevel@tonic-gate } 35297c478bd9Sstevel@tonic-gate fem_unlock(v->vfs_femhead); 35307c478bd9Sstevel@tonic-gate } 35317c478bd9Sstevel@tonic-gate return (r); 35327c478bd9Sstevel@tonic-gate } 35337c478bd9Sstevel@tonic-gate 35347c478bd9Sstevel@tonic-gate /* 35357c478bd9Sstevel@tonic-gate * Setup FEM. 35367c478bd9Sstevel@tonic-gate */ 35377c478bd9Sstevel@tonic-gate void 35387c478bd9Sstevel@tonic-gate fem_init() 35397c478bd9Sstevel@tonic-gate { 35407c478bd9Sstevel@tonic-gate struct fem_type_info *fi; 35417c478bd9Sstevel@tonic-gate 35427c478bd9Sstevel@tonic-gate /* 35437c478bd9Sstevel@tonic-gate * This femtype is only used for fem_list creation so we only 35447c478bd9Sstevel@tonic-gate * need the "guard" to be initialized so that feml_tos has 35457c478bd9Sstevel@tonic-gate * some rudimentary meaning. A fem_list must not be used until 35467c478bd9Sstevel@tonic-gate * it has been initialized (either via femlist_construct() or 35477c478bd9Sstevel@tonic-gate * fem_dup_list()). Anything that tries to use this fem_list 35487c478bd9Sstevel@tonic-gate * before it's actually initialized would panic the system as 35497c478bd9Sstevel@tonic-gate * soon as "fn_op" (NULL) is dereferenced. 35507c478bd9Sstevel@tonic-gate */ 35517c478bd9Sstevel@tonic-gate fi = femtype + FEMTYPE_NULL; 35527c478bd9Sstevel@tonic-gate fi->errf = fem_err; 35537c478bd9Sstevel@tonic-gate fi->guard.fn_available = (void *)&fi->guard; 35547c478bd9Sstevel@tonic-gate fi->guard.fn_av_hold = NULL; 35557c478bd9Sstevel@tonic-gate fi->guard.fn_av_rele = NULL; 35567c478bd9Sstevel@tonic-gate fi->guard.fn_op.anon = NULL; 35577c478bd9Sstevel@tonic-gate 35587c478bd9Sstevel@tonic-gate fi = femtype + FEMTYPE_VNODE; 35597c478bd9Sstevel@tonic-gate fi->errf = fem_err; 35607c478bd9Sstevel@tonic-gate fi->head.fn_available = NULL; 35617c478bd9Sstevel@tonic-gate fi->head.fn_av_hold = NULL; 35627c478bd9Sstevel@tonic-gate fi->head.fn_av_rele = NULL; 35637c478bd9Sstevel@tonic-gate (void) vn_make_ops("fem-head", fhead_vn_spec, &fi->head.fn_op.vnode); 35647c478bd9Sstevel@tonic-gate fi->guard.fn_available = (void *)&fi->guard; 35657c478bd9Sstevel@tonic-gate fi->guard.fn_av_hold = NULL; 35667c478bd9Sstevel@tonic-gate fi->guard.fn_av_rele = NULL; 35677c478bd9Sstevel@tonic-gate (void) fem_create("fem-guard", fem_guard_ops, &fi->guard.fn_op.fem); 35687c478bd9Sstevel@tonic-gate 35697c478bd9Sstevel@tonic-gate fi = femtype + FEMTYPE_VFS; 35707c478bd9Sstevel@tonic-gate fi->errf = fsem_err; 35717c478bd9Sstevel@tonic-gate fi->head.fn_available = NULL; 35727c478bd9Sstevel@tonic-gate fi->head.fn_av_hold = NULL; 35737c478bd9Sstevel@tonic-gate fi->head.fn_av_rele = NULL; 35747c478bd9Sstevel@tonic-gate (void) vfs_makefsops(fshead_vfs_spec, &fi->head.fn_op.vfs); 35757c478bd9Sstevel@tonic-gate 35767c478bd9Sstevel@tonic-gate fi->guard.fn_available = (void *)&fi->guard; 35777c478bd9Sstevel@tonic-gate fi->guard.fn_av_hold = NULL; 35787c478bd9Sstevel@tonic-gate fi->guard.fn_av_rele = NULL; 35797c478bd9Sstevel@tonic-gate (void) fsem_create("fem-guard", fsem_guard_ops, &fi->guard.fn_op.fsem); 35807c478bd9Sstevel@tonic-gate } 35817c478bd9Sstevel@tonic-gate 35827c478bd9Sstevel@tonic-gate 35837c478bd9Sstevel@tonic-gate int 35847c478bd9Sstevel@tonic-gate fem_err() 35857c478bd9Sstevel@tonic-gate { 35867c478bd9Sstevel@tonic-gate cmn_err(CE_PANIC, "fem/vnode operations corrupt"); 35877c478bd9Sstevel@tonic-gate return (0); 35887c478bd9Sstevel@tonic-gate } 35897c478bd9Sstevel@tonic-gate 35907c478bd9Sstevel@tonic-gate int 35917c478bd9Sstevel@tonic-gate fsem_err() 35927c478bd9Sstevel@tonic-gate { 35937c478bd9Sstevel@tonic-gate cmn_err(CE_PANIC, "fem/vfs operations corrupt"); 35947c478bd9Sstevel@tonic-gate return (0); 35957c478bd9Sstevel@tonic-gate } 3596