113 _FEMOPDEF(MAP, map),
114 _FEMOPDEF(ADDMAP, addmap),
115 _FEMOPDEF(DELMAP, delmap),
116 _FEMOPDEF(POLL, poll),
117 _FEMOPDEF(DUMP, dump),
118 _FEMOPDEF(PATHCONF, pathconf),
119 _FEMOPDEF(PAGEIO, pageio),
120 _FEMOPDEF(DUMPCTL, dumpctl),
121 _FEMOPDEF(DISPOSE, dispose),
122 _FEMOPDEF(SETSECATTR, setsecattr),
123 _FEMOPDEF(GETSECATTR, getsecattr),
124 _FEMOPDEF(SHRLOCK, shrlock),
125 _FEMOPDEF(VNEVENT, vnevent),
126 _FEMOPDEF(REQZCBUF, reqzcbuf),
127 _FEMOPDEF(RETZCBUF, retzcbuf),
128 { NULL, 0, NULL, NULL }
129 };
130
131
132 #define _FEMGUARD(name, ignore) \
133 { VOPNAME_##name, (femop_t *)fem_err }
134
135 static struct fs_operation_def fem_guard_ops[] = {
136 _FEMGUARD(OPEN, open),
137 _FEMGUARD(CLOSE, close),
138 _FEMGUARD(READ, read),
139 _FEMGUARD(WRITE, write),
140 _FEMGUARD(IOCTL, ioctl),
141 _FEMGUARD(SETFL, setfl),
142 _FEMGUARD(GETATTR, getattr),
143 _FEMGUARD(SETATTR, setattr),
144 _FEMGUARD(ACCESS, access),
145 _FEMGUARD(LOOKUP, lookup),
146 _FEMGUARD(CREATE, create),
147 _FEMGUARD(REMOVE, remove),
148 _FEMGUARD(LINK, link),
149 _FEMGUARD(RENAME, rename),
150 _FEMGUARD(MKDIR, mkdir),
151 _FEMGUARD(RMDIR, rmdir),
152 _FEMGUARD(READDIR, readdir),
153 _FEMGUARD(SYMLINK, symlink),
162 _FEMGUARD(FRLOCK, frlock),
163 _FEMGUARD(SPACE, space),
164 _FEMGUARD(REALVP, realvp),
165 _FEMGUARD(GETPAGE, getpage),
166 _FEMGUARD(PUTPAGE, putpage),
167 _FEMGUARD(MAP, map),
168 _FEMGUARD(ADDMAP, addmap),
169 _FEMGUARD(DELMAP, delmap),
170 _FEMGUARD(POLL, poll),
171 _FEMGUARD(DUMP, dump),
172 _FEMGUARD(PATHCONF, pathconf),
173 _FEMGUARD(PAGEIO, pageio),
174 _FEMGUARD(DUMPCTL, dumpctl),
175 _FEMGUARD(DISPOSE, dispose),
176 _FEMGUARD(SETSECATTR, setsecattr),
177 _FEMGUARD(GETSECATTR, getsecattr),
178 _FEMGUARD(SHRLOCK, shrlock),
179 _FEMGUARD(VNEVENT, vnevent),
180 _FEMGUARD(REQZCBUF, reqzcbuf),
181 _FEMGUARD(RETZCBUF, retzcbuf),
182 { NULL, NULL }
183 };
184
185
186 #define _FSEMOPDEF(name, member) \
187 { VFSNAME_##name, offsetof(fsem_t, fsemop_##member), NULL, fsem_err }
188
189 static fs_operation_trans_def_t fsem_opdef[] = {
190 _FSEMOPDEF(MOUNT, mount),
191 _FSEMOPDEF(UNMOUNT, unmount),
192 _FSEMOPDEF(ROOT, root),
193 _FSEMOPDEF(STATVFS, statvfs),
194 _FSEMOPDEF(SYNC, sync),
195 _FSEMOPDEF(VGET, vget),
196 _FSEMOPDEF(MOUNTROOT, mountroot),
197 _FSEMOPDEF(FREEVFS, freevfs),
198 _FSEMOPDEF(VNSTATE, vnstate),
199 { NULL, 0, NULL, NULL }
200 };
201
202 #define _FSEMGUARD(name, ignore) \
203 { VFSNAME_##name, (femop_t *)fsem_err }
204
205 static struct fs_operation_def fsem_guard_ops[] = {
206 _FSEMGUARD(MOUNT, mount),
207 _FSEMGUARD(UNMOUNT, unmount),
208 _FSEMGUARD(ROOT, root),
209 _FSEMGUARD(STATVFS, statvfs),
210 _FSEMGUARD(SYNC, sync),
211 _FSEMGUARD(VGET, vget),
212 _FSEMGUARD(MOUNTROOT, mountroot),
213 _FSEMGUARD(FREEVFS, freevfs),
214 _FSEMGUARD(VNSTATE, vnstate),
215 { NULL, NULL}
216 };
217
218
219 /*
220 * vsop_find, vfsop_find -
221 *
222 * These macros descend the stack until they find either a basic
223 * vnode/vfs operation [ indicated by a null fn_available ] or a
224 * stacked item where this method is non-null [_vsop].
225 *
226 * The DEBUG one is written with a single function which manually applies
227 * the structure offsets. It can have additional debugging support.
228 */
229
230 #ifndef DEBUG
231
232 #define vsop_find(ap, func, funct, arg0, _vop, _vsop) \
233 for (;;) { \
234 if ((ap)->fa_fnode->fn_available == NULL) { \
235 *(func) = (funct (*)())((ap)->fa_fnode->fn_op.vnode->_vop); \
1939 } else {
1940 fem_addref(femsp);
1941 fem_unlock(vfsp->vfs_femhead);
1942 farg.fa_vnode.vfsp = vfsp;
1943 farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos;
1944 vfsop_find(&farg, &func, int, &arg0, vfs_vnstate,
1945 fsemop_vnstate);
1946 errc = (*func)(arg0, vp, nstate);
1947 fem_release(femsp);
1948 }
1949 return (errc);
1950 }
1951
1952
1953 /*
1954 * specification table for the vhead vnode operations.
1955 * It is an error for any operations to be missing.
1956 */
1957
1958 static struct fs_operation_def fhead_vn_spec[] = {
1959 { VOPNAME_OPEN, (femop_t *)vhead_open },
1960 { VOPNAME_CLOSE, (femop_t *)vhead_close },
1961 { VOPNAME_READ, (femop_t *)vhead_read },
1962 { VOPNAME_WRITE, (femop_t *)vhead_write },
1963 { VOPNAME_IOCTL, (femop_t *)vhead_ioctl },
1964 { VOPNAME_SETFL, (femop_t *)vhead_setfl },
1965 { VOPNAME_GETATTR, (femop_t *)vhead_getattr },
1966 { VOPNAME_SETATTR, (femop_t *)vhead_setattr },
1967 { VOPNAME_ACCESS, (femop_t *)vhead_access },
1968 { VOPNAME_LOOKUP, (femop_t *)vhead_lookup },
1969 { VOPNAME_CREATE, (femop_t *)vhead_create },
1970 { VOPNAME_REMOVE, (femop_t *)vhead_remove },
1971 { VOPNAME_LINK, (femop_t *)vhead_link },
1972 { VOPNAME_RENAME, (femop_t *)vhead_rename },
1973 { VOPNAME_MKDIR, (femop_t *)vhead_mkdir },
1974 { VOPNAME_RMDIR, (femop_t *)vhead_rmdir },
1975 { VOPNAME_READDIR, (femop_t *)vhead_readdir },
1976 { VOPNAME_SYMLINK, (femop_t *)vhead_symlink },
1977 { VOPNAME_READLINK, (femop_t *)vhead_readlink },
1978 { VOPNAME_FSYNC, (femop_t *)vhead_fsync },
1979 { VOPNAME_INACTIVE, (femop_t *)vhead_inactive },
1980 { VOPNAME_FID, (femop_t *)vhead_fid },
1981 { VOPNAME_RWLOCK, (femop_t *)vhead_rwlock },
1982 { VOPNAME_RWUNLOCK, (femop_t *)vhead_rwunlock },
1983 { VOPNAME_SEEK, (femop_t *)vhead_seek },
1984 { VOPNAME_CMP, (femop_t *)vhead_cmp },
1985 { VOPNAME_FRLOCK, (femop_t *)vhead_frlock },
1986 { VOPNAME_SPACE, (femop_t *)vhead_space },
1987 { VOPNAME_REALVP, (femop_t *)vhead_realvp },
1988 { VOPNAME_GETPAGE, (femop_t *)vhead_getpage },
1989 { VOPNAME_PUTPAGE, (femop_t *)vhead_putpage },
1990 { VOPNAME_MAP, (femop_t *)vhead_map },
1991 { VOPNAME_ADDMAP, (femop_t *)vhead_addmap },
1992 { VOPNAME_DELMAP, (femop_t *)vhead_delmap },
1993 { VOPNAME_POLL, (femop_t *)vhead_poll },
1994 { VOPNAME_DUMP, (femop_t *)vhead_dump },
1995 { VOPNAME_PATHCONF, (femop_t *)vhead_pathconf },
1996 { VOPNAME_PAGEIO, (femop_t *)vhead_pageio },
1997 { VOPNAME_DUMPCTL, (femop_t *)vhead_dumpctl },
1998 { VOPNAME_DISPOSE, (femop_t *)vhead_dispose },
1999 { VOPNAME_SETSECATTR, (femop_t *)vhead_setsecattr },
2000 { VOPNAME_GETSECATTR, (femop_t *)vhead_getsecattr },
2001 { VOPNAME_SHRLOCK, (femop_t *)vhead_shrlock },
2002 { VOPNAME_VNEVENT, (femop_t *)vhead_vnevent },
2003 { VOPNAME_REQZCBUF, (femop_t *)vhead_reqzcbuf },
2004 { VOPNAME_RETZCBUF, (femop_t *)vhead_retzcbuf },
2005 { NULL, NULL }
2006 };
2007
2008 /*
2009 * specification table for the vfshead vnode operations.
2010 * It is an error for any operations to be missing.
2011 */
2012
2013 static struct fs_operation_def fshead_vfs_spec[] = {
2014 { VFSNAME_MOUNT, (femop_t *)fshead_mount },
2015 { VFSNAME_UNMOUNT, (femop_t *)fshead_unmount },
2016 { VFSNAME_ROOT, (femop_t *)fshead_root },
2017 { VFSNAME_STATVFS, (femop_t *)fshead_statvfs },
2018 { VFSNAME_SYNC, (femop_t *)fshead_sync },
2019 { VFSNAME_VGET, (femop_t *)fshead_vget },
2020 { VFSNAME_MOUNTROOT, (femop_t *)fshead_mountroot },
2021 { VFSNAME_FREEVFS, (femop_t *)fshead_freevfs },
2022 { VFSNAME_VNSTATE, (femop_t *)fshead_vnstate },
2023 { NULL, NULL }
2024 };
2025
2026 /*
2027 * This set of routines transfer control to the next stacked monitor.
2028 *
2029 * Each routine is identical except for naming, types and arguments.
2030 *
2031 * The basic steps are:
2032 * 1. Decrease the stack pointer by one.
2033 * 2. If the current item is a base operation (vnode, vfs), goto 5.
2034 * 3. If the current item does not have a corresponding operation, goto 1
2035 * 4. Return by invoking the current item with the argument handle.
2036 * 5. Return by invoking the base operation with the base object.
2037 *
2038 * for each classification, there needs to be at least one "next" operation
2039 * for each "head"operation.
2040 *
2041 */
2042
2043 int
|
113 _FEMOPDEF(MAP, map),
114 _FEMOPDEF(ADDMAP, addmap),
115 _FEMOPDEF(DELMAP, delmap),
116 _FEMOPDEF(POLL, poll),
117 _FEMOPDEF(DUMP, dump),
118 _FEMOPDEF(PATHCONF, pathconf),
119 _FEMOPDEF(PAGEIO, pageio),
120 _FEMOPDEF(DUMPCTL, dumpctl),
121 _FEMOPDEF(DISPOSE, dispose),
122 _FEMOPDEF(SETSECATTR, setsecattr),
123 _FEMOPDEF(GETSECATTR, getsecattr),
124 _FEMOPDEF(SHRLOCK, shrlock),
125 _FEMOPDEF(VNEVENT, vnevent),
126 _FEMOPDEF(REQZCBUF, reqzcbuf),
127 _FEMOPDEF(RETZCBUF, retzcbuf),
128 { NULL, 0, NULL, NULL }
129 };
130
131
132 #define _FEMGUARD(name, ignore) \
133 { VOPNAME_##name, {(femop_t *)fem_err} }
134
135 static struct fs_operation_def fem_guard_ops[] = {
136 _FEMGUARD(OPEN, open),
137 _FEMGUARD(CLOSE, close),
138 _FEMGUARD(READ, read),
139 _FEMGUARD(WRITE, write),
140 _FEMGUARD(IOCTL, ioctl),
141 _FEMGUARD(SETFL, setfl),
142 _FEMGUARD(GETATTR, getattr),
143 _FEMGUARD(SETATTR, setattr),
144 _FEMGUARD(ACCESS, access),
145 _FEMGUARD(LOOKUP, lookup),
146 _FEMGUARD(CREATE, create),
147 _FEMGUARD(REMOVE, remove),
148 _FEMGUARD(LINK, link),
149 _FEMGUARD(RENAME, rename),
150 _FEMGUARD(MKDIR, mkdir),
151 _FEMGUARD(RMDIR, rmdir),
152 _FEMGUARD(READDIR, readdir),
153 _FEMGUARD(SYMLINK, symlink),
162 _FEMGUARD(FRLOCK, frlock),
163 _FEMGUARD(SPACE, space),
164 _FEMGUARD(REALVP, realvp),
165 _FEMGUARD(GETPAGE, getpage),
166 _FEMGUARD(PUTPAGE, putpage),
167 _FEMGUARD(MAP, map),
168 _FEMGUARD(ADDMAP, addmap),
169 _FEMGUARD(DELMAP, delmap),
170 _FEMGUARD(POLL, poll),
171 _FEMGUARD(DUMP, dump),
172 _FEMGUARD(PATHCONF, pathconf),
173 _FEMGUARD(PAGEIO, pageio),
174 _FEMGUARD(DUMPCTL, dumpctl),
175 _FEMGUARD(DISPOSE, dispose),
176 _FEMGUARD(SETSECATTR, setsecattr),
177 _FEMGUARD(GETSECATTR, getsecattr),
178 _FEMGUARD(SHRLOCK, shrlock),
179 _FEMGUARD(VNEVENT, vnevent),
180 _FEMGUARD(REQZCBUF, reqzcbuf),
181 _FEMGUARD(RETZCBUF, retzcbuf),
182 { NULL, {NULL} }
183 };
184
185
186 #define _FSEMOPDEF(name, member) \
187 { VFSNAME_##name, offsetof(fsem_t, fsemop_##member), NULL, fsem_err }
188
189 static fs_operation_trans_def_t fsem_opdef[] = {
190 _FSEMOPDEF(MOUNT, mount),
191 _FSEMOPDEF(UNMOUNT, unmount),
192 _FSEMOPDEF(ROOT, root),
193 _FSEMOPDEF(STATVFS, statvfs),
194 _FSEMOPDEF(SYNC, sync),
195 _FSEMOPDEF(VGET, vget),
196 _FSEMOPDEF(MOUNTROOT, mountroot),
197 _FSEMOPDEF(FREEVFS, freevfs),
198 _FSEMOPDEF(VNSTATE, vnstate),
199 { NULL, 0, NULL, NULL }
200 };
201
202 #define _FSEMGUARD(name, ignore) \
203 { VFSNAME_##name, {(femop_t *)fsem_err} }
204
205 static struct fs_operation_def fsem_guard_ops[] = {
206 _FSEMGUARD(MOUNT, mount),
207 _FSEMGUARD(UNMOUNT, unmount),
208 _FSEMGUARD(ROOT, root),
209 _FSEMGUARD(STATVFS, statvfs),
210 _FSEMGUARD(SYNC, sync),
211 _FSEMGUARD(VGET, vget),
212 _FSEMGUARD(MOUNTROOT, mountroot),
213 _FSEMGUARD(FREEVFS, freevfs),
214 _FSEMGUARD(VNSTATE, vnstate),
215 { NULL, {NULL}}
216 };
217
218
219 /*
220 * vsop_find, vfsop_find -
221 *
222 * These macros descend the stack until they find either a basic
223 * vnode/vfs operation [ indicated by a null fn_available ] or a
224 * stacked item where this method is non-null [_vsop].
225 *
226 * The DEBUG one is written with a single function which manually applies
227 * the structure offsets. It can have additional debugging support.
228 */
229
230 #ifndef DEBUG
231
232 #define vsop_find(ap, func, funct, arg0, _vop, _vsop) \
233 for (;;) { \
234 if ((ap)->fa_fnode->fn_available == NULL) { \
235 *(func) = (funct (*)())((ap)->fa_fnode->fn_op.vnode->_vop); \
1939 } else {
1940 fem_addref(femsp);
1941 fem_unlock(vfsp->vfs_femhead);
1942 farg.fa_vnode.vfsp = vfsp;
1943 farg.fa_fnode = femsp->feml_nodes + femsp->feml_tos;
1944 vfsop_find(&farg, &func, int, &arg0, vfs_vnstate,
1945 fsemop_vnstate);
1946 errc = (*func)(arg0, vp, nstate);
1947 fem_release(femsp);
1948 }
1949 return (errc);
1950 }
1951
1952
1953 /*
1954 * specification table for the vhead vnode operations.
1955 * It is an error for any operations to be missing.
1956 */
1957
1958 static struct fs_operation_def fhead_vn_spec[] = {
1959 { VOPNAME_OPEN, {(femop_t *)vhead_open} },
1960 { VOPNAME_CLOSE, {(femop_t *)vhead_close} },
1961 { VOPNAME_READ, {(femop_t *)vhead_read} },
1962 { VOPNAME_WRITE, {(femop_t *)vhead_write} },
1963 { VOPNAME_IOCTL, {(femop_t *)vhead_ioctl} },
1964 { VOPNAME_SETFL, {(femop_t *)vhead_setfl} },
1965 { VOPNAME_GETATTR, {(femop_t *)vhead_getattr} },
1966 { VOPNAME_SETATTR, {(femop_t *)vhead_setattr} },
1967 { VOPNAME_ACCESS, {(femop_t *)vhead_access} },
1968 { VOPNAME_LOOKUP, {(femop_t *)vhead_lookup} },
1969 { VOPNAME_CREATE, {(femop_t *)vhead_create} },
1970 { VOPNAME_REMOVE, {(femop_t *)vhead_remove} },
1971 { VOPNAME_LINK, {(femop_t *)vhead_link} },
1972 { VOPNAME_RENAME, {(femop_t *)vhead_rename} },
1973 { VOPNAME_MKDIR, {(femop_t *)vhead_mkdir} },
1974 { VOPNAME_RMDIR, {(femop_t *)vhead_rmdir} },
1975 { VOPNAME_READDIR, {(femop_t *)vhead_readdir} },
1976 { VOPNAME_SYMLINK, {(femop_t *)vhead_symlink} },
1977 { VOPNAME_READLINK, {(femop_t *)vhead_readlink} },
1978 { VOPNAME_FSYNC, {(femop_t *)vhead_fsync} },
1979 { VOPNAME_INACTIVE, {(femop_t *)vhead_inactive} },
1980 { VOPNAME_FID, {(femop_t *)vhead_fid} },
1981 { VOPNAME_RWLOCK, {(femop_t *)vhead_rwlock} },
1982 { VOPNAME_RWUNLOCK, {(femop_t *)vhead_rwunlock} },
1983 { VOPNAME_SEEK, {(femop_t *)vhead_seek} },
1984 { VOPNAME_CMP, {(femop_t *)vhead_cmp} },
1985 { VOPNAME_FRLOCK, {(femop_t *)vhead_frlock} },
1986 { VOPNAME_SPACE, {(femop_t *)vhead_space} },
1987 { VOPNAME_REALVP, {(femop_t *)vhead_realvp} },
1988 { VOPNAME_GETPAGE, {(femop_t *)vhead_getpage} },
1989 { VOPNAME_PUTPAGE, {(femop_t *)vhead_putpage} },
1990 { VOPNAME_MAP, {(femop_t *)vhead_map} },
1991 { VOPNAME_ADDMAP, {(femop_t *)vhead_addmap} },
1992 { VOPNAME_DELMAP, {(femop_t *)vhead_delmap} },
1993 { VOPNAME_POLL, {(femop_t *)vhead_poll} },
1994 { VOPNAME_DUMP, {(femop_t *)vhead_dump} },
1995 { VOPNAME_PATHCONF, {(femop_t *)vhead_pathconf} },
1996 { VOPNAME_PAGEIO, {(femop_t *)vhead_pageio} },
1997 { VOPNAME_DUMPCTL, {(femop_t *)vhead_dumpctl} },
1998 { VOPNAME_DISPOSE, {(femop_t *)vhead_dispose} },
1999 { VOPNAME_SETSECATTR, {(femop_t *)vhead_setsecattr} },
2000 { VOPNAME_GETSECATTR, {(femop_t *)vhead_getsecattr} },
2001 { VOPNAME_SHRLOCK, {(femop_t *)vhead_shrlock} },
2002 { VOPNAME_VNEVENT, {(femop_t *)vhead_vnevent} },
2003 { VOPNAME_REQZCBUF, {(femop_t *)vhead_reqzcbuf} },
2004 { VOPNAME_RETZCBUF, {(femop_t *)vhead_retzcbuf} },
2005 { NULL, {NULL} }
2006 };
2007
2008 /*
2009 * specification table for the vfshead vnode operations.
2010 * It is an error for any operations to be missing.
2011 */
2012
2013 static struct fs_operation_def fshead_vfs_spec[] = {
2014 { VFSNAME_MOUNT, {(femop_t *)fshead_mount} },
2015 { VFSNAME_UNMOUNT, {(femop_t *)fshead_unmount} },
2016 { VFSNAME_ROOT, {(femop_t *)fshead_root} },
2017 { VFSNAME_STATVFS, {(femop_t *)fshead_statvfs} },
2018 { VFSNAME_SYNC, {(femop_t *)fshead_sync} },
2019 { VFSNAME_VGET, {(femop_t *)fshead_vget} },
2020 { VFSNAME_MOUNTROOT, {(femop_t *)fshead_mountroot} },
2021 { VFSNAME_FREEVFS, {(femop_t *)fshead_freevfs} },
2022 { VFSNAME_VNSTATE, {(femop_t *)fshead_vnstate} },
2023 { NULL, {NULL} }
2024 };
2025
2026 /*
2027 * This set of routines transfer control to the next stacked monitor.
2028 *
2029 * Each routine is identical except for naming, types and arguments.
2030 *
2031 * The basic steps are:
2032 * 1. Decrease the stack pointer by one.
2033 * 2. If the current item is a base operation (vnode, vfs), goto 5.
2034 * 3. If the current item does not have a corresponding operation, goto 1
2035 * 4. Return by invoking the current item with the argument handle.
2036 * 5. Return by invoking the base operation with the base object.
2037 *
2038 * for each classification, there needs to be at least one "next" operation
2039 * for each "head"operation.
2040 *
2041 */
2042
2043 int
|