xref: /titanic_53/usr/src/uts/common/sys/fem.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_FEM_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_FEM_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
33*7c478bd9Sstevel@tonic-gate #include <sys/mutex.h>
34*7c478bd9Sstevel@tonic-gate #include <sys/pathname.h>
35*7c478bd9Sstevel@tonic-gate #include <sys/uio.h>
36*7c478bd9Sstevel@tonic-gate #include <sys/file.h>
37*7c478bd9Sstevel@tonic-gate #include <sys/cred.h>
38*7c478bd9Sstevel@tonic-gate #include <sys/vfs.h>
39*7c478bd9Sstevel@tonic-gate #include <sys/vnode.h>
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
43*7c478bd9Sstevel@tonic-gate extern "C" {
44*7c478bd9Sstevel@tonic-gate #endif
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate struct fs_operation_def;	/* from vfs.h */
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate /*
49*7c478bd9Sstevel@tonic-gate  * overview:
50*7c478bd9Sstevel@tonic-gate  *
51*7c478bd9Sstevel@tonic-gate  * fem - file event monitoring
52*7c478bd9Sstevel@tonic-gate  *
53*7c478bd9Sstevel@tonic-gate  * File Event Monitoring is a formalized mechanism to monitor events on a
54*7c478bd9Sstevel@tonic-gate  * vnode or vfs by intercpting the vnode/vfs operations.  The framework enables
55*7c478bd9Sstevel@tonic-gate  * the consumer to request event notifications for specified files and
56*7c478bd9Sstevel@tonic-gate  * directories.  The consumers, which intercepts the events, are responsible for
57*7c478bd9Sstevel@tonic-gate  * delivering the event to the next interceptor or the terminal destination.
58*7c478bd9Sstevel@tonic-gate  *
59*7c478bd9Sstevel@tonic-gate  */
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate /*
62*7c478bd9Sstevel@tonic-gate  * protocol:
63*7c478bd9Sstevel@tonic-gate  *
64*7c478bd9Sstevel@tonic-gate  *  vnode ->  fem_head.
65*7c478bd9Sstevel@tonic-gate  *	There can only be one fem_head for a vnode.
66*7c478bd9Sstevel@tonic-gate  *	Once attached, the fem_head persists until explicitly detached
67*7c478bd9Sstevel@tonic-gate  *	or the vnode expires.
68*7c478bd9Sstevel@tonic-gate  *
69*7c478bd9Sstevel@tonic-gate  * fem_head -> fem_list.
70*7c478bd9Sstevel@tonic-gate  *	There can be many lists for a head, as each reconfiguration of
71*7c478bd9Sstevel@tonic-gate  *	the list causes a new one to be created and initialized from the
72*7c478bd9Sstevel@tonic-gate  *	old one.  For this reason, modules cannot assume that they can
73*7c478bd9Sstevel@tonic-gate  *	reach thier list by vnode->fem_head->fem_list->list[n] == mod;
74*7c478bd9Sstevel@tonic-gate  *
75*7c478bd9Sstevel@tonic-gate  * fem_arg -> vnode, &vnode.
76*7c478bd9Sstevel@tonic-gate  *	This relationship is established at the head of the call (ie. in
77*7c478bd9Sstevel@tonic-gate  *	femhead_open()) where the fem_arg is allocated.  Intermediate nodes
78*7c478bd9Sstevel@tonic-gate  *	have direct access to this.
79*7c478bd9Sstevel@tonic-gate  *
80*7c478bd9Sstevel@tonic-gate  * fem_arg -> fem_node
81*7c478bd9Sstevel@tonic-gate  *	This relationship is established at the head of the call (ie. in
82*7c478bd9Sstevel@tonic-gate  *	femhead_open()) where the fem_arg is allocated.  The fem_arg is
83*7c478bd9Sstevel@tonic-gate  *	updated as intermediate nodes are invoked, however not as they
84*7c478bd9Sstevel@tonic-gate  *	return.  For this reason, nodes which are interested in maintaining
85*7c478bd9Sstevel@tonic-gate  *	context following a "next" should store a copy of the fem_available
86*7c478bd9Sstevel@tonic-gate  *	field before invoking the 'next'.
87*7c478bd9Sstevel@tonic-gate  */
88*7c478bd9Sstevel@tonic-gate typedef struct fem_arg femarg_t, fsemarg_t;
89*7c478bd9Sstevel@tonic-gate typedef struct fem fem_t;
90*7c478bd9Sstevel@tonic-gate typedef struct fsem    fsem_t;
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate typedef int femop_t();
93*7c478bd9Sstevel@tonic-gate typedef int vop_t();
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate /*
96*7c478bd9Sstevel@tonic-gate  * The following enumerations specify the conditions
97*7c478bd9Sstevel@tonic-gate  * under which a monitor (operation/argument combination)
98*7c478bd9Sstevel@tonic-gate  * should be installed.  These are used when calling
99*7c478bd9Sstevel@tonic-gate  * fem_install() and fsem_install()
100*7c478bd9Sstevel@tonic-gate  */
101*7c478bd9Sstevel@tonic-gate typedef enum femhow {
102*7c478bd9Sstevel@tonic-gate 	FORCE		= 0,	/* Force the installation of this monitor */
103*7c478bd9Sstevel@tonic-gate 	OPUNIQ		= 1,	/* Install if operation set is unique */
104*7c478bd9Sstevel@tonic-gate 	OPARGUNIQ	= 2	/* Install if op/arg combination is unique */
105*7c478bd9Sstevel@tonic-gate } femhow_t;
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate struct fem_node {
108*7c478bd9Sstevel@tonic-gate 	void		*fn_available;
109*7c478bd9Sstevel@tonic-gate 	union {
110*7c478bd9Sstevel@tonic-gate 		fem_t		*fem;
111*7c478bd9Sstevel@tonic-gate 		vnodeops_t	*vnode;
112*7c478bd9Sstevel@tonic-gate 		fsem_t		*fsem;
113*7c478bd9Sstevel@tonic-gate 		vfsops_t	*vfs;
114*7c478bd9Sstevel@tonic-gate 		void		*anon; /* anonymous, for updates */
115*7c478bd9Sstevel@tonic-gate 	}		fn_op;
116*7c478bd9Sstevel@tonic-gate 	void		(*fn_av_hold)(void *);	/* Hold for "fn_available" */
117*7c478bd9Sstevel@tonic-gate 	void		(*fn_av_rele)(void *);	/* Release for "fn_available" */
118*7c478bd9Sstevel@tonic-gate };
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate struct fem_arg {
121*7c478bd9Sstevel@tonic-gate 	union {
122*7c478bd9Sstevel@tonic-gate 		vnode_t	*vp,
123*7c478bd9Sstevel@tonic-gate 			**vpp;
124*7c478bd9Sstevel@tonic-gate 		vfs_t	*vfsp;
125*7c478bd9Sstevel@tonic-gate 		void	*anon;
126*7c478bd9Sstevel@tonic-gate 	}		fa_vnode;
127*7c478bd9Sstevel@tonic-gate 	struct fem_node	*fa_fnode;
128*7c478bd9Sstevel@tonic-gate };
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate 
131*7c478bd9Sstevel@tonic-gate struct fem_list {
132*7c478bd9Sstevel@tonic-gate 	uint_t	feml_refc;	/* reference count */
133*7c478bd9Sstevel@tonic-gate 	int	feml_tos;	/* top of stack pointer(index) */
134*7c478bd9Sstevel@tonic-gate 	int	feml_ssize;	/* stack size */
135*7c478bd9Sstevel@tonic-gate 	int	feml_pad;	/* alignment */
136*7c478bd9Sstevel@tonic-gate 	struct fem_node feml_nodes[1]; /* variable bounds */
137*7c478bd9Sstevel@tonic-gate };
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate struct fem_head {
140*7c478bd9Sstevel@tonic-gate 	kmutex_t	femh_lock;
141*7c478bd9Sstevel@tonic-gate 	struct fem_list *femh_list;
142*7c478bd9Sstevel@tonic-gate };
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate struct fem {
145*7c478bd9Sstevel@tonic-gate 	const char *name;
146*7c478bd9Sstevel@tonic-gate 	const struct fs_operation_def *templ;
147*7c478bd9Sstevel@tonic-gate 	int (*vsop_open)(femarg_t *vf, int mode, cred_t *cr);
148*7c478bd9Sstevel@tonic-gate 	int (*vsop_close)(femarg_t *vf, int flag, int count,
149*7c478bd9Sstevel@tonic-gate 			offset_t offset, cred_t *cr);
150*7c478bd9Sstevel@tonic-gate 	int (*vsop_read)(femarg_t *vf, uio_t *uiop, int ioflag, cred_t *cr,
151*7c478bd9Sstevel@tonic-gate 			struct caller_context *ct);
152*7c478bd9Sstevel@tonic-gate 	int (*vsop_write)(femarg_t *vf, uio_t *uiop, int ioflag,
153*7c478bd9Sstevel@tonic-gate 			cred_t *cr, struct caller_context *ct);
154*7c478bd9Sstevel@tonic-gate 	int (*vsop_ioctl)(femarg_t *vf, int cmd, intptr_t arg, int flag,
155*7c478bd9Sstevel@tonic-gate 			cred_t *cr, int *rvalp);
156*7c478bd9Sstevel@tonic-gate 	int (*vsop_setfl)(femarg_t *vf, int oflags, int nflags, cred_t *cr);
157*7c478bd9Sstevel@tonic-gate 	int (*vsop_getattr)(femarg_t *vf, vattr_t *vap, int flags,
158*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
159*7c478bd9Sstevel@tonic-gate 	int (*vsop_setattr)(femarg_t *vf, vattr_t *vap, int flags,
160*7c478bd9Sstevel@tonic-gate 			cred_t *cr, caller_context_t *ct);
161*7c478bd9Sstevel@tonic-gate 	int (*vsop_access)(femarg_t *vf, int mode, int flags, cred_t *cr);
162*7c478bd9Sstevel@tonic-gate 	int (*vsop_lookup)(femarg_t *vf, char *nm, vnode_t **vpp,
163*7c478bd9Sstevel@tonic-gate 			pathname_t *pnp, int flags, vnode_t *rdir,
164*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
165*7c478bd9Sstevel@tonic-gate 	int (*vsop_create)(femarg_t *vf, char *name, vattr_t *vap,
166*7c478bd9Sstevel@tonic-gate 			vcexcl_t excl, int mode, vnode_t **vpp, cred_t *cr,
167*7c478bd9Sstevel@tonic-gate 			int flag);
168*7c478bd9Sstevel@tonic-gate 	int (*vsop_remove)(femarg_t *vf, char *nm, cred_t *cr);
169*7c478bd9Sstevel@tonic-gate 	int (*vsop_link)(femarg_t *vf, vnode_t *svp, char *tnm, cred_t *cr);
170*7c478bd9Sstevel@tonic-gate 	int (*vsop_rename)(femarg_t *vf, char *snm, vnode_t *tdvp,
171*7c478bd9Sstevel@tonic-gate 			char *tnm, cred_t *cr);
172*7c478bd9Sstevel@tonic-gate 	int (*vsop_mkdir)(femarg_t *vf, char *dirname, vattr_t *vap,
173*7c478bd9Sstevel@tonic-gate 			vnode_t **vpp, cred_t *cr);
174*7c478bd9Sstevel@tonic-gate 	int (*vsop_rmdir)(femarg_t *vf, char *nm, vnode_t *cdir,
175*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
176*7c478bd9Sstevel@tonic-gate 	int (*vsop_readdir)(femarg_t *vf, uio_t *uiop, cred_t *cr,
177*7c478bd9Sstevel@tonic-gate 			int *eofp);
178*7c478bd9Sstevel@tonic-gate 	int (*vsop_symlink)(femarg_t *vf, char *linkname, vattr_t *vap,
179*7c478bd9Sstevel@tonic-gate 			char *target, cred_t *cr);
180*7c478bd9Sstevel@tonic-gate 	int (*vsop_readlink)(femarg_t *vf, uio_t *uiop, cred_t *cr);
181*7c478bd9Sstevel@tonic-gate 	int (*vsop_fsync)(femarg_t *vf, int syncflag, cred_t *cr);
182*7c478bd9Sstevel@tonic-gate 	void (*vsop_inactive)(femarg_t *vf, cred_t *cr);
183*7c478bd9Sstevel@tonic-gate 	int (*vsop_fid)(femarg_t *vf, fid_t *fidp);
184*7c478bd9Sstevel@tonic-gate 	int (*vsop_rwlock)(femarg_t *vf, int write_lock,
185*7c478bd9Sstevel@tonic-gate 			caller_context_t *ct);
186*7c478bd9Sstevel@tonic-gate 	void (*vsop_rwunlock)(femarg_t *vf, int write_lock,
187*7c478bd9Sstevel@tonic-gate 			caller_context_t *ct);
188*7c478bd9Sstevel@tonic-gate 	int (*vsop_seek)(femarg_t *vf, offset_t ooff, offset_t *noffp);
189*7c478bd9Sstevel@tonic-gate 	int (*vsop_cmp)(femarg_t *vf, vnode_t *vp2);
190*7c478bd9Sstevel@tonic-gate 	int (*vsop_frlock)(femarg_t *vf, int cmd, struct flock64 *bfp,
191*7c478bd9Sstevel@tonic-gate 			int flag, offset_t offset,
192*7c478bd9Sstevel@tonic-gate 			struct flk_callback *flk_cbp, cred_t *cr);
193*7c478bd9Sstevel@tonic-gate 	int (*vsop_space)(femarg_t *vf, int cmd, struct flock64 *bfp,
194*7c478bd9Sstevel@tonic-gate 			int flag, offset_t offset, cred_t *cr,
195*7c478bd9Sstevel@tonic-gate 			caller_context_t *ct);
196*7c478bd9Sstevel@tonic-gate 	int (*vsop_realvp)(femarg_t *vf, vnode_t **vpp);
197*7c478bd9Sstevel@tonic-gate 	int (*vsop_getpage)(femarg_t *vf, offset_t off, size_t len,
198*7c478bd9Sstevel@tonic-gate 			uint_t *protp, struct page **plarr, size_t plsz,
199*7c478bd9Sstevel@tonic-gate 			struct seg *seg, caddr_t addr, enum seg_rw rw,
200*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
201*7c478bd9Sstevel@tonic-gate 	int (*vsop_putpage)(femarg_t *vf, offset_t off, size_t len,
202*7c478bd9Sstevel@tonic-gate 			int flags, cred_t *cr);
203*7c478bd9Sstevel@tonic-gate 	int (*vsop_map)(femarg_t *vf, offset_t off, struct as *as,
204*7c478bd9Sstevel@tonic-gate 			caddr_t *addrp, size_t len, uchar_t prot,
205*7c478bd9Sstevel@tonic-gate 			uchar_t maxprot, uint_t flags, cred_t *cr);
206*7c478bd9Sstevel@tonic-gate 	int (*vsop_addmap)(femarg_t *vf, offset_t off, struct as *as,
207*7c478bd9Sstevel@tonic-gate 			caddr_t addr, size_t len, uchar_t prot,
208*7c478bd9Sstevel@tonic-gate 			uchar_t maxprot, uint_t flags, cred_t *cr);
209*7c478bd9Sstevel@tonic-gate 	int (*vsop_delmap)(femarg_t *vf, offset_t off, struct as *as,
210*7c478bd9Sstevel@tonic-gate 			caddr_t addr, size_t len, uint_t prot,
211*7c478bd9Sstevel@tonic-gate 			uint_t maxprot, uint_t flags, cred_t *cr);
212*7c478bd9Sstevel@tonic-gate 	int (*vsop_poll)(femarg_t *vf, short events, int anyyet,
213*7c478bd9Sstevel@tonic-gate 			short *reventsp, struct pollhead **phpp);
214*7c478bd9Sstevel@tonic-gate 	int (*vsop_dump)(femarg_t *vf, caddr_t addr, int lbdn, int dblks);
215*7c478bd9Sstevel@tonic-gate 	int (*vsop_pathconf)(femarg_t *vf, int cmd, ulong_t *valp,
216*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
217*7c478bd9Sstevel@tonic-gate 	int (*vsop_pageio)(femarg_t *vf, struct page *pp,
218*7c478bd9Sstevel@tonic-gate 			u_offset_t io_off, size_t io_len, int flags,
219*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
220*7c478bd9Sstevel@tonic-gate 	int (*vsop_dumpctl)(femarg_t *vf, int action, int *blkp);
221*7c478bd9Sstevel@tonic-gate 	void (*vsop_dispose)(femarg_t *vf, struct page *pp, int flag,
222*7c478bd9Sstevel@tonic-gate 			int dn, cred_t *cr);
223*7c478bd9Sstevel@tonic-gate 	int (*vsop_setsecattr)(femarg_t *vf, vsecattr_t *vsap, int flag,
224*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
225*7c478bd9Sstevel@tonic-gate 	int (*vsop_getsecattr)(femarg_t *vf, vsecattr_t *vsap, int flag,
226*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
227*7c478bd9Sstevel@tonic-gate 	int (*vsop_shrlock)(femarg_t *vf, int cmd, struct shrlock *shr,
228*7c478bd9Sstevel@tonic-gate 			int flag, cred_t *cr);
229*7c478bd9Sstevel@tonic-gate 	int (*vsop_vnevent)(femarg_t *vf, vnevent_t vnevent);
230*7c478bd9Sstevel@tonic-gate };
231*7c478bd9Sstevel@tonic-gate 
232*7c478bd9Sstevel@tonic-gate struct fsem {
233*7c478bd9Sstevel@tonic-gate 	const char *name;
234*7c478bd9Sstevel@tonic-gate 	const struct fs_operation_def *templ;
235*7c478bd9Sstevel@tonic-gate 	int (*vfsop_mount)(fsemarg_t *vf, vnode_t *mvp, struct mounta *uap,
236*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
237*7c478bd9Sstevel@tonic-gate 	int (*vfsop_unmount)(fsemarg_t *vf, int flag, cred_t *cr);
238*7c478bd9Sstevel@tonic-gate 	int (*vfsop_root)(fsemarg_t *vf, vnode_t **vpp);
239*7c478bd9Sstevel@tonic-gate 	int (*vfsop_statvfs)(fsemarg_t *vf, statvfs64_t *sp);
240*7c478bd9Sstevel@tonic-gate 	int (*vfsop_sync)(fsemarg_t *vf, short flag, cred_t *cr);
241*7c478bd9Sstevel@tonic-gate 	int (*vfsop_vget)(fsemarg_t *vf, vnode_t **vpp, fid_t *fidp);
242*7c478bd9Sstevel@tonic-gate 	int (*vfsop_mountroot)(fsemarg_t *vf, enum whymountroot reason);
243*7c478bd9Sstevel@tonic-gate 	void (*vfsop_freevfs)(fsemarg_t *vf);
244*7c478bd9Sstevel@tonic-gate 	int (*vfsop_vnstate)(fsemarg_t *vf, vnode_t *vp, vntrans_t nstate);
245*7c478bd9Sstevel@tonic-gate };
246*7c478bd9Sstevel@tonic-gate 
247*7c478bd9Sstevel@tonic-gate extern int vnext_open(femarg_t *vf, int mode, cred_t *cr);
248*7c478bd9Sstevel@tonic-gate extern int vnext_close(femarg_t *vf, int flag, int count, offset_t offset,
249*7c478bd9Sstevel@tonic-gate 		cred_t *cr);
250*7c478bd9Sstevel@tonic-gate extern int vnext_read(femarg_t *vf, uio_t *uiop, int ioflag, cred_t *cr,
251*7c478bd9Sstevel@tonic-gate 		struct caller_context *ct);
252*7c478bd9Sstevel@tonic-gate extern int vnext_write(femarg_t *vf, uio_t *uiop, int ioflag, cred_t *cr,
253*7c478bd9Sstevel@tonic-gate 		struct caller_context *ct);
254*7c478bd9Sstevel@tonic-gate extern int vnext_ioctl(femarg_t *vf, int cmd, intptr_t arg, int flag,
255*7c478bd9Sstevel@tonic-gate 		cred_t *cr, int *rvalp);
256*7c478bd9Sstevel@tonic-gate extern int vnext_setfl(femarg_t *vf, int oflags, int nflags, cred_t *cr);
257*7c478bd9Sstevel@tonic-gate extern int vnext_getattr(femarg_t *vf, vattr_t *vap, int flags, cred_t *cr);
258*7c478bd9Sstevel@tonic-gate extern int vnext_setattr(femarg_t *vf, vattr_t *vap, int flags, cred_t *cr,
259*7c478bd9Sstevel@tonic-gate 		caller_context_t *ct);
260*7c478bd9Sstevel@tonic-gate extern int vnext_access(femarg_t *vf, int mode, int flags, cred_t *cr);
261*7c478bd9Sstevel@tonic-gate extern int vnext_lookup(femarg_t *vf, char *nm, vnode_t **vpp,
262*7c478bd9Sstevel@tonic-gate 			pathname_t *pnp, int flags, vnode_t *rdir,
263*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
264*7c478bd9Sstevel@tonic-gate extern int vnext_create(femarg_t *vf, char *name, vattr_t *vap,
265*7c478bd9Sstevel@tonic-gate 			vcexcl_t excl, int mode, vnode_t **vpp, cred_t *cr,
266*7c478bd9Sstevel@tonic-gate 			int flag);
267*7c478bd9Sstevel@tonic-gate extern int vnext_remove(femarg_t *vf, char *nm, cred_t *cr);
268*7c478bd9Sstevel@tonic-gate extern int vnext_link(femarg_t *vf, vnode_t *svp, char *tnm, cred_t *cr);
269*7c478bd9Sstevel@tonic-gate extern int vnext_rename(femarg_t *vf, char *snm, vnode_t *tdvp, char *tnm,
270*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
271*7c478bd9Sstevel@tonic-gate extern int vnext_mkdir(femarg_t *vf, char *dirname, vattr_t *vap,
272*7c478bd9Sstevel@tonic-gate 		vnode_t **vpp, cred_t *cr);
273*7c478bd9Sstevel@tonic-gate extern int vnext_rmdir(femarg_t *vf, char *nm, vnode_t *cdir, cred_t *cr);
274*7c478bd9Sstevel@tonic-gate extern int vnext_readdir(femarg_t *vf, uio_t *uiop, cred_t *cr, int *eofp);
275*7c478bd9Sstevel@tonic-gate extern int vnext_symlink(femarg_t *vf, char *linkname, vattr_t *vap,
276*7c478bd9Sstevel@tonic-gate 			char *target, cred_t *cr);
277*7c478bd9Sstevel@tonic-gate extern int vnext_readlink(femarg_t *vf, uio_t *uiop, cred_t *cr);
278*7c478bd9Sstevel@tonic-gate extern int vnext_fsync(femarg_t *vf, int syncflag, cred_t *cr);
279*7c478bd9Sstevel@tonic-gate extern void vnext_inactive(femarg_t *vf, cred_t *cr);
280*7c478bd9Sstevel@tonic-gate extern int vnext_fid(femarg_t *vf, fid_t *fidp);
281*7c478bd9Sstevel@tonic-gate extern int vnext_rwlock(femarg_t *vf, int write_lock, caller_context_t *ct);
282*7c478bd9Sstevel@tonic-gate extern void vnext_rwunlock(femarg_t *vf, int write_lock, caller_context_t *ct);
283*7c478bd9Sstevel@tonic-gate extern int vnext_seek(femarg_t *vf, offset_t ooff, offset_t *noffp);
284*7c478bd9Sstevel@tonic-gate extern int vnext_cmp(femarg_t *vf, vnode_t *vp2);
285*7c478bd9Sstevel@tonic-gate extern int vnext_frlock(femarg_t *vf, int cmd, struct flock64 *bfp,
286*7c478bd9Sstevel@tonic-gate 			int flag, offset_t offset,
287*7c478bd9Sstevel@tonic-gate 			struct flk_callback *flk_cbp, cred_t *cr);
288*7c478bd9Sstevel@tonic-gate extern int vnext_space(femarg_t *vf, int cmd, struct flock64 *bfp,
289*7c478bd9Sstevel@tonic-gate 			int flag, offset_t offset, cred_t *cr,
290*7c478bd9Sstevel@tonic-gate 			caller_context_t *ct);
291*7c478bd9Sstevel@tonic-gate extern int vnext_realvp(femarg_t *vf, vnode_t **vpp);
292*7c478bd9Sstevel@tonic-gate extern int vnext_getpage(femarg_t *vf, offset_t off, size_t len,
293*7c478bd9Sstevel@tonic-gate 			uint_t *protp, struct page **plarr, size_t plsz,
294*7c478bd9Sstevel@tonic-gate 			struct seg *seg, caddr_t addr, enum seg_rw rw,
295*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
296*7c478bd9Sstevel@tonic-gate extern int vnext_putpage(femarg_t *vf, offset_t off, size_t len, int flags,
297*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
298*7c478bd9Sstevel@tonic-gate extern int vnext_map(femarg_t *vf, offset_t off, struct as *as,
299*7c478bd9Sstevel@tonic-gate 		caddr_t *addrp, size_t len, uchar_t prot, uchar_t maxprot,
300*7c478bd9Sstevel@tonic-gate 		uint_t flags, cred_t *cr);
301*7c478bd9Sstevel@tonic-gate extern int vnext_addmap(femarg_t *vf, offset_t off, struct as *as,
302*7c478bd9Sstevel@tonic-gate 			caddr_t addr, size_t len, uchar_t prot,
303*7c478bd9Sstevel@tonic-gate 			uchar_t maxprot, uint_t flags, cred_t *cr);
304*7c478bd9Sstevel@tonic-gate extern int vnext_delmap(femarg_t *vf, offset_t off, struct as *as,
305*7c478bd9Sstevel@tonic-gate 			caddr_t addr, size_t len, uint_t prot,
306*7c478bd9Sstevel@tonic-gate 			uint_t maxprot, uint_t flags, cred_t *cr);
307*7c478bd9Sstevel@tonic-gate extern int vnext_poll(femarg_t *vf, short events, int anyyet,
308*7c478bd9Sstevel@tonic-gate 		short *reventsp, struct pollhead **phpp);
309*7c478bd9Sstevel@tonic-gate extern int vnext_dump(femarg_t *vf, caddr_t addr, int lbdn, int dblks);
310*7c478bd9Sstevel@tonic-gate extern int vnext_pathconf(femarg_t *vf, int cmd, ulong_t *valp, cred_t *cr);
311*7c478bd9Sstevel@tonic-gate extern int vnext_pageio(femarg_t *vf, struct page *pp, u_offset_t io_off,
312*7c478bd9Sstevel@tonic-gate 			size_t io_len, int flags, cred_t *cr);
313*7c478bd9Sstevel@tonic-gate extern int vnext_dumpctl(femarg_t *vf, int action, int *blkp);
314*7c478bd9Sstevel@tonic-gate extern void vnext_dispose(femarg_t *vf, struct page *pp, int flag, int dn,
315*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
316*7c478bd9Sstevel@tonic-gate extern int vnext_setsecattr(femarg_t *vf, vsecattr_t *vsap, int flag,
317*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
318*7c478bd9Sstevel@tonic-gate extern int vnext_getsecattr(femarg_t *vf, vsecattr_t *vsap, int flag,
319*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
320*7c478bd9Sstevel@tonic-gate extern int vnext_shrlock(femarg_t *vf, int cmd, struct shrlock *shr,
321*7c478bd9Sstevel@tonic-gate 			int flag, cred_t *cr);
322*7c478bd9Sstevel@tonic-gate extern int vnext_vnevent(femarg_t *vf, vnevent_t vevent);
323*7c478bd9Sstevel@tonic-gate 
324*7c478bd9Sstevel@tonic-gate extern int vfsnext_mount(fsemarg_t *vf, vnode_t *mvp, struct mounta *uap,
325*7c478bd9Sstevel@tonic-gate 			cred_t *cr);
326*7c478bd9Sstevel@tonic-gate extern int vfsnext_unmount(fsemarg_t *vf, int flag, cred_t *cr);
327*7c478bd9Sstevel@tonic-gate extern int vfsnext_root(fsemarg_t *vf, vnode_t **vpp);
328*7c478bd9Sstevel@tonic-gate extern int vfsnext_statvfs(fsemarg_t *vf, statvfs64_t *sp);
329*7c478bd9Sstevel@tonic-gate extern int vfsnext_sync(fsemarg_t *vf, short flag, cred_t *cr);
330*7c478bd9Sstevel@tonic-gate extern int vfsnext_vget(fsemarg_t *vf, vnode_t **vpp, fid_t *fidp);
331*7c478bd9Sstevel@tonic-gate extern int vfsnext_mountroot(fsemarg_t *vf, enum whymountroot reason);
332*7c478bd9Sstevel@tonic-gate extern void vfsnext_freevfs(fsemarg_t *vf);
333*7c478bd9Sstevel@tonic-gate extern int vfsnext_vnstate(fsemarg_t *vf, vnode_t *vp, vntrans_t nstate);
334*7c478bd9Sstevel@tonic-gate 
335*7c478bd9Sstevel@tonic-gate 
336*7c478bd9Sstevel@tonic-gate extern void fem_init(void); /* called once, by startup */
337*7c478bd9Sstevel@tonic-gate 
338*7c478bd9Sstevel@tonic-gate /* fem api */
339*7c478bd9Sstevel@tonic-gate extern int fem_create(char *name, const struct fs_operation_def *templ,
340*7c478bd9Sstevel@tonic-gate 			fem_t **actual);
341*7c478bd9Sstevel@tonic-gate extern void fem_free(fem_t *fem);
342*7c478bd9Sstevel@tonic-gate extern int fem_install(struct vnode *v, fem_t *mon, void *arg, femhow_t how,
343*7c478bd9Sstevel@tonic-gate 		void (*arg_hold)(void *), void (*arg_rele)(void *));
344*7c478bd9Sstevel@tonic-gate extern int fem_is_installed(struct vnode *v, fem_t *mon, void *arg);
345*7c478bd9Sstevel@tonic-gate extern int fem_uninstall(struct vnode *v, fem_t *mon, void *arg);
346*7c478bd9Sstevel@tonic-gate extern vnodeops_t *fem_getvnops(struct vnode *v);
347*7c478bd9Sstevel@tonic-gate extern void fem_setvnops(struct vnode *v, struct vnodeops *nops);
348*7c478bd9Sstevel@tonic-gate 
349*7c478bd9Sstevel@tonic-gate 
350*7c478bd9Sstevel@tonic-gate extern int fsem_create(char *name, const struct fs_operation_def *templ,
351*7c478bd9Sstevel@tonic-gate 			fsem_t **actual);
352*7c478bd9Sstevel@tonic-gate extern void fsem_free(fsem_t *fsem);
353*7c478bd9Sstevel@tonic-gate extern int fsem_is_installed(struct vfs *v, fsem_t *mon, void *arg);
354*7c478bd9Sstevel@tonic-gate extern int fsem_install(struct vfs *v, fsem_t *mon, void *arg, femhow_t how,
355*7c478bd9Sstevel@tonic-gate 		void (*arg_hold)(void *), void (*arg_rele)(void *));
356*7c478bd9Sstevel@tonic-gate extern int fsem_uninstall(struct vfs *v, fsem_t *mon, void *arg);
357*7c478bd9Sstevel@tonic-gate extern vfsops_t *fsem_getvfsops(struct vfs *v);
358*7c478bd9Sstevel@tonic-gate extern void fsem_setvfsops(struct vfs *v, struct vfsops *nops);
359*7c478bd9Sstevel@tonic-gate 
360*7c478bd9Sstevel@tonic-gate 
361*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
362*7c478bd9Sstevel@tonic-gate }
363*7c478bd9Sstevel@tonic-gate #endif
364*7c478bd9Sstevel@tonic-gate 
365*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_FEM_H */
366