xref: /titanic_54/usr/src/uts/common/sys/fem.h (revision c3ac4cfba46488d688ae1601abeaf5201e8eec2f)
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
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _SYS_FEM_H
287c478bd9Sstevel@tonic-gate #define	_SYS_FEM_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <sys/types.h>
337c478bd9Sstevel@tonic-gate #include <sys/mutex.h>
347c478bd9Sstevel@tonic-gate #include <sys/pathname.h>
357c478bd9Sstevel@tonic-gate #include <sys/uio.h>
367c478bd9Sstevel@tonic-gate #include <sys/file.h>
377c478bd9Sstevel@tonic-gate #include <sys/cred.h>
387c478bd9Sstevel@tonic-gate #include <sys/vfs.h>
397c478bd9Sstevel@tonic-gate #include <sys/vnode.h>
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
437c478bd9Sstevel@tonic-gate extern "C" {
447c478bd9Sstevel@tonic-gate #endif
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate struct fs_operation_def;	/* from vfs.h */
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  * overview:
507c478bd9Sstevel@tonic-gate  *
517c478bd9Sstevel@tonic-gate  * fem - file event monitoring
527c478bd9Sstevel@tonic-gate  *
537c478bd9Sstevel@tonic-gate  * File Event Monitoring is a formalized mechanism to monitor events on a
54*c3ac4cfbSpetede  * vnode or vfs by intercepting the vnode/vfs operations.  The framework enables
557c478bd9Sstevel@tonic-gate  * the consumer to request event notifications for specified files and
56*c3ac4cfbSpetede  * directories.  The consumers, which intercept the events, are responsible for
577c478bd9Sstevel@tonic-gate  * delivering the event to the next interceptor or the terminal destination.
587c478bd9Sstevel@tonic-gate  *
597c478bd9Sstevel@tonic-gate  */
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /*
627c478bd9Sstevel@tonic-gate  * protocol:
637c478bd9Sstevel@tonic-gate  *
647c478bd9Sstevel@tonic-gate  *  vnode ->  fem_head.
657c478bd9Sstevel@tonic-gate  *	There can only be one fem_head for a vnode.
667c478bd9Sstevel@tonic-gate  *	Once attached, the fem_head persists until explicitly detached
677c478bd9Sstevel@tonic-gate  *	or the vnode expires.
687c478bd9Sstevel@tonic-gate  *
697c478bd9Sstevel@tonic-gate  * fem_head -> fem_list.
707c478bd9Sstevel@tonic-gate  *	There can be many lists for a head, as each reconfiguration of
717c478bd9Sstevel@tonic-gate  *	the list causes a new one to be created and initialized from the
727c478bd9Sstevel@tonic-gate  *	old one.  For this reason, modules cannot assume that they can
737c478bd9Sstevel@tonic-gate  *	reach thier list by vnode->fem_head->fem_list->list[n] == mod;
747c478bd9Sstevel@tonic-gate  *
757c478bd9Sstevel@tonic-gate  * fem_arg -> vnode, &vnode.
767c478bd9Sstevel@tonic-gate  *	This relationship is established at the head of the call (ie. in
777c478bd9Sstevel@tonic-gate  *	femhead_open()) where the fem_arg is allocated.  Intermediate nodes
787c478bd9Sstevel@tonic-gate  *	have direct access to this.
797c478bd9Sstevel@tonic-gate  *
807c478bd9Sstevel@tonic-gate  * fem_arg -> fem_node
817c478bd9Sstevel@tonic-gate  *	This relationship is established at the head of the call (ie. in
827c478bd9Sstevel@tonic-gate  *	femhead_open()) where the fem_arg is allocated.  The fem_arg is
837c478bd9Sstevel@tonic-gate  *	updated as intermediate nodes are invoked, however not as they
847c478bd9Sstevel@tonic-gate  *	return.  For this reason, nodes which are interested in maintaining
857c478bd9Sstevel@tonic-gate  *	context following a "next" should store a copy of the fem_available
867c478bd9Sstevel@tonic-gate  *	field before invoking the 'next'.
877c478bd9Sstevel@tonic-gate  */
887c478bd9Sstevel@tonic-gate typedef struct fem_arg femarg_t, fsemarg_t;
897c478bd9Sstevel@tonic-gate typedef struct fem fem_t;
907c478bd9Sstevel@tonic-gate typedef struct fsem    fsem_t;
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate typedef int femop_t();
937c478bd9Sstevel@tonic-gate typedef int vop_t();
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate /*
967c478bd9Sstevel@tonic-gate  * The following enumerations specify the conditions
977c478bd9Sstevel@tonic-gate  * under which a monitor (operation/argument combination)
987c478bd9Sstevel@tonic-gate  * should be installed.  These are used when calling
997c478bd9Sstevel@tonic-gate  * fem_install() and fsem_install()
1007c478bd9Sstevel@tonic-gate  */
1017c478bd9Sstevel@tonic-gate typedef enum femhow {
1027c478bd9Sstevel@tonic-gate 	FORCE		= 0,	/* Force the installation of this monitor */
1037c478bd9Sstevel@tonic-gate 	OPUNIQ		= 1,	/* Install if operation set is unique */
1047c478bd9Sstevel@tonic-gate 	OPARGUNIQ	= 2	/* Install if op/arg combination is unique */
1057c478bd9Sstevel@tonic-gate } femhow_t;
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate struct fem_node {
1087c478bd9Sstevel@tonic-gate 	void		*fn_available;
1097c478bd9Sstevel@tonic-gate 	union {
1107c478bd9Sstevel@tonic-gate 		fem_t		*fem;
1117c478bd9Sstevel@tonic-gate 		vnodeops_t	*vnode;
1127c478bd9Sstevel@tonic-gate 		fsem_t		*fsem;
1137c478bd9Sstevel@tonic-gate 		vfsops_t	*vfs;
1147c478bd9Sstevel@tonic-gate 		void		*anon; /* anonymous, for updates */
1157c478bd9Sstevel@tonic-gate 	}		fn_op;
1167c478bd9Sstevel@tonic-gate 	void		(*fn_av_hold)(void *);	/* Hold for "fn_available" */
1177c478bd9Sstevel@tonic-gate 	void		(*fn_av_rele)(void *);	/* Release for "fn_available" */
1187c478bd9Sstevel@tonic-gate };
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate struct fem_arg {
1217c478bd9Sstevel@tonic-gate 	union {
1227c478bd9Sstevel@tonic-gate 		vnode_t	*vp,
1237c478bd9Sstevel@tonic-gate 			**vpp;
1247c478bd9Sstevel@tonic-gate 		vfs_t	*vfsp;
1257c478bd9Sstevel@tonic-gate 		void	*anon;
1267c478bd9Sstevel@tonic-gate 	}		fa_vnode;
1277c478bd9Sstevel@tonic-gate 	struct fem_node	*fa_fnode;
1287c478bd9Sstevel@tonic-gate };
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate struct fem_list {
1327c478bd9Sstevel@tonic-gate 	uint_t	feml_refc;	/* reference count */
1337c478bd9Sstevel@tonic-gate 	int	feml_tos;	/* top of stack pointer(index) */
1347c478bd9Sstevel@tonic-gate 	int	feml_ssize;	/* stack size */
1357c478bd9Sstevel@tonic-gate 	int	feml_pad;	/* alignment */
1367c478bd9Sstevel@tonic-gate 	struct fem_node feml_nodes[1]; /* variable bounds */
1377c478bd9Sstevel@tonic-gate };
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate struct fem_head {
1407c478bd9Sstevel@tonic-gate 	kmutex_t	femh_lock;
1417c478bd9Sstevel@tonic-gate 	struct fem_list *femh_list;
1427c478bd9Sstevel@tonic-gate };
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate struct fem {
1457c478bd9Sstevel@tonic-gate 	const char *name;
1467c478bd9Sstevel@tonic-gate 	const struct fs_operation_def *templ;
1477c478bd9Sstevel@tonic-gate 	int (*vsop_open)(femarg_t *vf, int mode, cred_t *cr);
1487c478bd9Sstevel@tonic-gate 	int (*vsop_close)(femarg_t *vf, int flag, int count,
1497c478bd9Sstevel@tonic-gate 			offset_t offset, cred_t *cr);
1507c478bd9Sstevel@tonic-gate 	int (*vsop_read)(femarg_t *vf, uio_t *uiop, int ioflag, cred_t *cr,
1517c478bd9Sstevel@tonic-gate 			struct caller_context *ct);
1527c478bd9Sstevel@tonic-gate 	int (*vsop_write)(femarg_t *vf, uio_t *uiop, int ioflag,
1537c478bd9Sstevel@tonic-gate 			cred_t *cr, struct caller_context *ct);
1547c478bd9Sstevel@tonic-gate 	int (*vsop_ioctl)(femarg_t *vf, int cmd, intptr_t arg, int flag,
1557c478bd9Sstevel@tonic-gate 			cred_t *cr, int *rvalp);
1567c478bd9Sstevel@tonic-gate 	int (*vsop_setfl)(femarg_t *vf, int oflags, int nflags, cred_t *cr);
1577c478bd9Sstevel@tonic-gate 	int (*vsop_getattr)(femarg_t *vf, vattr_t *vap, int flags,
1587c478bd9Sstevel@tonic-gate 			cred_t *cr);
1597c478bd9Sstevel@tonic-gate 	int (*vsop_setattr)(femarg_t *vf, vattr_t *vap, int flags,
1607c478bd9Sstevel@tonic-gate 			cred_t *cr, caller_context_t *ct);
1617c478bd9Sstevel@tonic-gate 	int (*vsop_access)(femarg_t *vf, int mode, int flags, cred_t *cr);
1627c478bd9Sstevel@tonic-gate 	int (*vsop_lookup)(femarg_t *vf, char *nm, vnode_t **vpp,
1637c478bd9Sstevel@tonic-gate 			pathname_t *pnp, int flags, vnode_t *rdir,
1647c478bd9Sstevel@tonic-gate 			cred_t *cr);
1657c478bd9Sstevel@tonic-gate 	int (*vsop_create)(femarg_t *vf, char *name, vattr_t *vap,
1667c478bd9Sstevel@tonic-gate 			vcexcl_t excl, int mode, vnode_t **vpp, cred_t *cr,
1677c478bd9Sstevel@tonic-gate 			int flag);
1687c478bd9Sstevel@tonic-gate 	int (*vsop_remove)(femarg_t *vf, char *nm, cred_t *cr);
1697c478bd9Sstevel@tonic-gate 	int (*vsop_link)(femarg_t *vf, vnode_t *svp, char *tnm, cred_t *cr);
1707c478bd9Sstevel@tonic-gate 	int (*vsop_rename)(femarg_t *vf, char *snm, vnode_t *tdvp,
1717c478bd9Sstevel@tonic-gate 			char *tnm, cred_t *cr);
1727c478bd9Sstevel@tonic-gate 	int (*vsop_mkdir)(femarg_t *vf, char *dirname, vattr_t *vap,
1737c478bd9Sstevel@tonic-gate 			vnode_t **vpp, cred_t *cr);
1747c478bd9Sstevel@tonic-gate 	int (*vsop_rmdir)(femarg_t *vf, char *nm, vnode_t *cdir,
1757c478bd9Sstevel@tonic-gate 			cred_t *cr);
1767c478bd9Sstevel@tonic-gate 	int (*vsop_readdir)(femarg_t *vf, uio_t *uiop, cred_t *cr,
1777c478bd9Sstevel@tonic-gate 			int *eofp);
1787c478bd9Sstevel@tonic-gate 	int (*vsop_symlink)(femarg_t *vf, char *linkname, vattr_t *vap,
1797c478bd9Sstevel@tonic-gate 			char *target, cred_t *cr);
1807c478bd9Sstevel@tonic-gate 	int (*vsop_readlink)(femarg_t *vf, uio_t *uiop, cred_t *cr);
1817c478bd9Sstevel@tonic-gate 	int (*vsop_fsync)(femarg_t *vf, int syncflag, cred_t *cr);
1827c478bd9Sstevel@tonic-gate 	void (*vsop_inactive)(femarg_t *vf, cred_t *cr);
1837c478bd9Sstevel@tonic-gate 	int (*vsop_fid)(femarg_t *vf, fid_t *fidp);
1847c478bd9Sstevel@tonic-gate 	int (*vsop_rwlock)(femarg_t *vf, int write_lock,
1857c478bd9Sstevel@tonic-gate 			caller_context_t *ct);
1867c478bd9Sstevel@tonic-gate 	void (*vsop_rwunlock)(femarg_t *vf, int write_lock,
1877c478bd9Sstevel@tonic-gate 			caller_context_t *ct);
1887c478bd9Sstevel@tonic-gate 	int (*vsop_seek)(femarg_t *vf, offset_t ooff, offset_t *noffp);
1897c478bd9Sstevel@tonic-gate 	int (*vsop_cmp)(femarg_t *vf, vnode_t *vp2);
1907c478bd9Sstevel@tonic-gate 	int (*vsop_frlock)(femarg_t *vf, int cmd, struct flock64 *bfp,
1917c478bd9Sstevel@tonic-gate 			int flag, offset_t offset,
1927c478bd9Sstevel@tonic-gate 			struct flk_callback *flk_cbp, cred_t *cr);
1937c478bd9Sstevel@tonic-gate 	int (*vsop_space)(femarg_t *vf, int cmd, struct flock64 *bfp,
1947c478bd9Sstevel@tonic-gate 			int flag, offset_t offset, cred_t *cr,
1957c478bd9Sstevel@tonic-gate 			caller_context_t *ct);
1967c478bd9Sstevel@tonic-gate 	int (*vsop_realvp)(femarg_t *vf, vnode_t **vpp);
1977c478bd9Sstevel@tonic-gate 	int (*vsop_getpage)(femarg_t *vf, offset_t off, size_t len,
1987c478bd9Sstevel@tonic-gate 			uint_t *protp, struct page **plarr, size_t plsz,
1997c478bd9Sstevel@tonic-gate 			struct seg *seg, caddr_t addr, enum seg_rw rw,
2007c478bd9Sstevel@tonic-gate 			cred_t *cr);
2017c478bd9Sstevel@tonic-gate 	int (*vsop_putpage)(femarg_t *vf, offset_t off, size_t len,
2027c478bd9Sstevel@tonic-gate 			int flags, cred_t *cr);
2037c478bd9Sstevel@tonic-gate 	int (*vsop_map)(femarg_t *vf, offset_t off, struct as *as,
2047c478bd9Sstevel@tonic-gate 			caddr_t *addrp, size_t len, uchar_t prot,
2057c478bd9Sstevel@tonic-gate 			uchar_t maxprot, uint_t flags, cred_t *cr);
2067c478bd9Sstevel@tonic-gate 	int (*vsop_addmap)(femarg_t *vf, offset_t off, struct as *as,
2077c478bd9Sstevel@tonic-gate 			caddr_t addr, size_t len, uchar_t prot,
2087c478bd9Sstevel@tonic-gate 			uchar_t maxprot, uint_t flags, cred_t *cr);
2097c478bd9Sstevel@tonic-gate 	int (*vsop_delmap)(femarg_t *vf, offset_t off, struct as *as,
2107c478bd9Sstevel@tonic-gate 			caddr_t addr, size_t len, uint_t prot,
2117c478bd9Sstevel@tonic-gate 			uint_t maxprot, uint_t flags, cred_t *cr);
2127c478bd9Sstevel@tonic-gate 	int (*vsop_poll)(femarg_t *vf, short events, int anyyet,
2137c478bd9Sstevel@tonic-gate 			short *reventsp, struct pollhead **phpp);
2147c478bd9Sstevel@tonic-gate 	int (*vsop_dump)(femarg_t *vf, caddr_t addr, int lbdn, int dblks);
2157c478bd9Sstevel@tonic-gate 	int (*vsop_pathconf)(femarg_t *vf, int cmd, ulong_t *valp,
2167c478bd9Sstevel@tonic-gate 			cred_t *cr);
2177c478bd9Sstevel@tonic-gate 	int (*vsop_pageio)(femarg_t *vf, struct page *pp,
2187c478bd9Sstevel@tonic-gate 			u_offset_t io_off, size_t io_len, int flags,
2197c478bd9Sstevel@tonic-gate 			cred_t *cr);
2207c478bd9Sstevel@tonic-gate 	int (*vsop_dumpctl)(femarg_t *vf, int action, int *blkp);
2217c478bd9Sstevel@tonic-gate 	void (*vsop_dispose)(femarg_t *vf, struct page *pp, int flag,
2227c478bd9Sstevel@tonic-gate 			int dn, cred_t *cr);
2237c478bd9Sstevel@tonic-gate 	int (*vsop_setsecattr)(femarg_t *vf, vsecattr_t *vsap, int flag,
2247c478bd9Sstevel@tonic-gate 			cred_t *cr);
2257c478bd9Sstevel@tonic-gate 	int (*vsop_getsecattr)(femarg_t *vf, vsecattr_t *vsap, int flag,
2267c478bd9Sstevel@tonic-gate 			cred_t *cr);
2277c478bd9Sstevel@tonic-gate 	int (*vsop_shrlock)(femarg_t *vf, int cmd, struct shrlock *shr,
2287c478bd9Sstevel@tonic-gate 			int flag, cred_t *cr);
2297c478bd9Sstevel@tonic-gate 	int (*vsop_vnevent)(femarg_t *vf, vnevent_t vnevent);
2307c478bd9Sstevel@tonic-gate };
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate struct fsem {
2337c478bd9Sstevel@tonic-gate 	const char *name;
2347c478bd9Sstevel@tonic-gate 	const struct fs_operation_def *templ;
2357c478bd9Sstevel@tonic-gate 	int (*vfsop_mount)(fsemarg_t *vf, vnode_t *mvp, struct mounta *uap,
2367c478bd9Sstevel@tonic-gate 			cred_t *cr);
2377c478bd9Sstevel@tonic-gate 	int (*vfsop_unmount)(fsemarg_t *vf, int flag, cred_t *cr);
2387c478bd9Sstevel@tonic-gate 	int (*vfsop_root)(fsemarg_t *vf, vnode_t **vpp);
2397c478bd9Sstevel@tonic-gate 	int (*vfsop_statvfs)(fsemarg_t *vf, statvfs64_t *sp);
2407c478bd9Sstevel@tonic-gate 	int (*vfsop_sync)(fsemarg_t *vf, short flag, cred_t *cr);
2417c478bd9Sstevel@tonic-gate 	int (*vfsop_vget)(fsemarg_t *vf, vnode_t **vpp, fid_t *fidp);
2427c478bd9Sstevel@tonic-gate 	int (*vfsop_mountroot)(fsemarg_t *vf, enum whymountroot reason);
2437c478bd9Sstevel@tonic-gate 	void (*vfsop_freevfs)(fsemarg_t *vf);
2447c478bd9Sstevel@tonic-gate 	int (*vfsop_vnstate)(fsemarg_t *vf, vnode_t *vp, vntrans_t nstate);
2457c478bd9Sstevel@tonic-gate };
2467c478bd9Sstevel@tonic-gate 
2477c478bd9Sstevel@tonic-gate extern int vnext_open(femarg_t *vf, int mode, cred_t *cr);
2487c478bd9Sstevel@tonic-gate extern int vnext_close(femarg_t *vf, int flag, int count, offset_t offset,
2497c478bd9Sstevel@tonic-gate 		cred_t *cr);
2507c478bd9Sstevel@tonic-gate extern int vnext_read(femarg_t *vf, uio_t *uiop, int ioflag, cred_t *cr,
2517c478bd9Sstevel@tonic-gate 		struct caller_context *ct);
2527c478bd9Sstevel@tonic-gate extern int vnext_write(femarg_t *vf, uio_t *uiop, int ioflag, cred_t *cr,
2537c478bd9Sstevel@tonic-gate 		struct caller_context *ct);
2547c478bd9Sstevel@tonic-gate extern int vnext_ioctl(femarg_t *vf, int cmd, intptr_t arg, int flag,
2557c478bd9Sstevel@tonic-gate 		cred_t *cr, int *rvalp);
2567c478bd9Sstevel@tonic-gate extern int vnext_setfl(femarg_t *vf, int oflags, int nflags, cred_t *cr);
2577c478bd9Sstevel@tonic-gate extern int vnext_getattr(femarg_t *vf, vattr_t *vap, int flags, cred_t *cr);
2587c478bd9Sstevel@tonic-gate extern int vnext_setattr(femarg_t *vf, vattr_t *vap, int flags, cred_t *cr,
2597c478bd9Sstevel@tonic-gate 		caller_context_t *ct);
2607c478bd9Sstevel@tonic-gate extern int vnext_access(femarg_t *vf, int mode, int flags, cred_t *cr);
2617c478bd9Sstevel@tonic-gate extern int vnext_lookup(femarg_t *vf, char *nm, vnode_t **vpp,
2627c478bd9Sstevel@tonic-gate 			pathname_t *pnp, int flags, vnode_t *rdir,
2637c478bd9Sstevel@tonic-gate 			cred_t *cr);
2647c478bd9Sstevel@tonic-gate extern int vnext_create(femarg_t *vf, char *name, vattr_t *vap,
2657c478bd9Sstevel@tonic-gate 			vcexcl_t excl, int mode, vnode_t **vpp, cred_t *cr,
2667c478bd9Sstevel@tonic-gate 			int flag);
2677c478bd9Sstevel@tonic-gate extern int vnext_remove(femarg_t *vf, char *nm, cred_t *cr);
2687c478bd9Sstevel@tonic-gate extern int vnext_link(femarg_t *vf, vnode_t *svp, char *tnm, cred_t *cr);
2697c478bd9Sstevel@tonic-gate extern int vnext_rename(femarg_t *vf, char *snm, vnode_t *tdvp, char *tnm,
2707c478bd9Sstevel@tonic-gate 			cred_t *cr);
2717c478bd9Sstevel@tonic-gate extern int vnext_mkdir(femarg_t *vf, char *dirname, vattr_t *vap,
2727c478bd9Sstevel@tonic-gate 		vnode_t **vpp, cred_t *cr);
2737c478bd9Sstevel@tonic-gate extern int vnext_rmdir(femarg_t *vf, char *nm, vnode_t *cdir, cred_t *cr);
2747c478bd9Sstevel@tonic-gate extern int vnext_readdir(femarg_t *vf, uio_t *uiop, cred_t *cr, int *eofp);
2757c478bd9Sstevel@tonic-gate extern int vnext_symlink(femarg_t *vf, char *linkname, vattr_t *vap,
2767c478bd9Sstevel@tonic-gate 			char *target, cred_t *cr);
2777c478bd9Sstevel@tonic-gate extern int vnext_readlink(femarg_t *vf, uio_t *uiop, cred_t *cr);
2787c478bd9Sstevel@tonic-gate extern int vnext_fsync(femarg_t *vf, int syncflag, cred_t *cr);
2797c478bd9Sstevel@tonic-gate extern void vnext_inactive(femarg_t *vf, cred_t *cr);
2807c478bd9Sstevel@tonic-gate extern int vnext_fid(femarg_t *vf, fid_t *fidp);
2817c478bd9Sstevel@tonic-gate extern int vnext_rwlock(femarg_t *vf, int write_lock, caller_context_t *ct);
2827c478bd9Sstevel@tonic-gate extern void vnext_rwunlock(femarg_t *vf, int write_lock, caller_context_t *ct);
2837c478bd9Sstevel@tonic-gate extern int vnext_seek(femarg_t *vf, offset_t ooff, offset_t *noffp);
2847c478bd9Sstevel@tonic-gate extern int vnext_cmp(femarg_t *vf, vnode_t *vp2);
2857c478bd9Sstevel@tonic-gate extern int vnext_frlock(femarg_t *vf, int cmd, struct flock64 *bfp,
2867c478bd9Sstevel@tonic-gate 			int flag, offset_t offset,
2877c478bd9Sstevel@tonic-gate 			struct flk_callback *flk_cbp, cred_t *cr);
2887c478bd9Sstevel@tonic-gate extern int vnext_space(femarg_t *vf, int cmd, struct flock64 *bfp,
2897c478bd9Sstevel@tonic-gate 			int flag, offset_t offset, cred_t *cr,
2907c478bd9Sstevel@tonic-gate 			caller_context_t *ct);
2917c478bd9Sstevel@tonic-gate extern int vnext_realvp(femarg_t *vf, vnode_t **vpp);
2927c478bd9Sstevel@tonic-gate extern int vnext_getpage(femarg_t *vf, offset_t off, size_t len,
2937c478bd9Sstevel@tonic-gate 			uint_t *protp, struct page **plarr, size_t plsz,
2947c478bd9Sstevel@tonic-gate 			struct seg *seg, caddr_t addr, enum seg_rw rw,
2957c478bd9Sstevel@tonic-gate 			cred_t *cr);
2967c478bd9Sstevel@tonic-gate extern int vnext_putpage(femarg_t *vf, offset_t off, size_t len, int flags,
2977c478bd9Sstevel@tonic-gate 			cred_t *cr);
2987c478bd9Sstevel@tonic-gate extern int vnext_map(femarg_t *vf, offset_t off, struct as *as,
2997c478bd9Sstevel@tonic-gate 		caddr_t *addrp, size_t len, uchar_t prot, uchar_t maxprot,
3007c478bd9Sstevel@tonic-gate 		uint_t flags, cred_t *cr);
3017c478bd9Sstevel@tonic-gate extern int vnext_addmap(femarg_t *vf, offset_t off, struct as *as,
3027c478bd9Sstevel@tonic-gate 			caddr_t addr, size_t len, uchar_t prot,
3037c478bd9Sstevel@tonic-gate 			uchar_t maxprot, uint_t flags, cred_t *cr);
3047c478bd9Sstevel@tonic-gate extern int vnext_delmap(femarg_t *vf, offset_t off, struct as *as,
3057c478bd9Sstevel@tonic-gate 			caddr_t addr, size_t len, uint_t prot,
3067c478bd9Sstevel@tonic-gate 			uint_t maxprot, uint_t flags, cred_t *cr);
3077c478bd9Sstevel@tonic-gate extern int vnext_poll(femarg_t *vf, short events, int anyyet,
3087c478bd9Sstevel@tonic-gate 		short *reventsp, struct pollhead **phpp);
3097c478bd9Sstevel@tonic-gate extern int vnext_dump(femarg_t *vf, caddr_t addr, int lbdn, int dblks);
3107c478bd9Sstevel@tonic-gate extern int vnext_pathconf(femarg_t *vf, int cmd, ulong_t *valp, cred_t *cr);
3117c478bd9Sstevel@tonic-gate extern int vnext_pageio(femarg_t *vf, struct page *pp, u_offset_t io_off,
3127c478bd9Sstevel@tonic-gate 			size_t io_len, int flags, cred_t *cr);
3137c478bd9Sstevel@tonic-gate extern int vnext_dumpctl(femarg_t *vf, int action, int *blkp);
3147c478bd9Sstevel@tonic-gate extern void vnext_dispose(femarg_t *vf, struct page *pp, int flag, int dn,
3157c478bd9Sstevel@tonic-gate 			cred_t *cr);
3167c478bd9Sstevel@tonic-gate extern int vnext_setsecattr(femarg_t *vf, vsecattr_t *vsap, int flag,
3177c478bd9Sstevel@tonic-gate 			cred_t *cr);
3187c478bd9Sstevel@tonic-gate extern int vnext_getsecattr(femarg_t *vf, vsecattr_t *vsap, int flag,
3197c478bd9Sstevel@tonic-gate 			cred_t *cr);
3207c478bd9Sstevel@tonic-gate extern int vnext_shrlock(femarg_t *vf, int cmd, struct shrlock *shr,
3217c478bd9Sstevel@tonic-gate 			int flag, cred_t *cr);
3227c478bd9Sstevel@tonic-gate extern int vnext_vnevent(femarg_t *vf, vnevent_t vevent);
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate extern int vfsnext_mount(fsemarg_t *vf, vnode_t *mvp, struct mounta *uap,
3257c478bd9Sstevel@tonic-gate 			cred_t *cr);
3267c478bd9Sstevel@tonic-gate extern int vfsnext_unmount(fsemarg_t *vf, int flag, cred_t *cr);
3277c478bd9Sstevel@tonic-gate extern int vfsnext_root(fsemarg_t *vf, vnode_t **vpp);
3287c478bd9Sstevel@tonic-gate extern int vfsnext_statvfs(fsemarg_t *vf, statvfs64_t *sp);
3297c478bd9Sstevel@tonic-gate extern int vfsnext_sync(fsemarg_t *vf, short flag, cred_t *cr);
3307c478bd9Sstevel@tonic-gate extern int vfsnext_vget(fsemarg_t *vf, vnode_t **vpp, fid_t *fidp);
3317c478bd9Sstevel@tonic-gate extern int vfsnext_mountroot(fsemarg_t *vf, enum whymountroot reason);
3327c478bd9Sstevel@tonic-gate extern void vfsnext_freevfs(fsemarg_t *vf);
3337c478bd9Sstevel@tonic-gate extern int vfsnext_vnstate(fsemarg_t *vf, vnode_t *vp, vntrans_t nstate);
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate extern void fem_init(void); /* called once, by startup */
3377c478bd9Sstevel@tonic-gate 
3387c478bd9Sstevel@tonic-gate /* fem api */
3397c478bd9Sstevel@tonic-gate extern int fem_create(char *name, const struct fs_operation_def *templ,
3407c478bd9Sstevel@tonic-gate 			fem_t **actual);
3417c478bd9Sstevel@tonic-gate extern void fem_free(fem_t *fem);
3427c478bd9Sstevel@tonic-gate extern int fem_install(struct vnode *v, fem_t *mon, void *arg, femhow_t how,
3437c478bd9Sstevel@tonic-gate 		void (*arg_hold)(void *), void (*arg_rele)(void *));
3447c478bd9Sstevel@tonic-gate extern int fem_is_installed(struct vnode *v, fem_t *mon, void *arg);
3457c478bd9Sstevel@tonic-gate extern int fem_uninstall(struct vnode *v, fem_t *mon, void *arg);
3467c478bd9Sstevel@tonic-gate extern vnodeops_t *fem_getvnops(struct vnode *v);
3477c478bd9Sstevel@tonic-gate extern void fem_setvnops(struct vnode *v, struct vnodeops *nops);
3487c478bd9Sstevel@tonic-gate 
3497c478bd9Sstevel@tonic-gate 
3507c478bd9Sstevel@tonic-gate extern int fsem_create(char *name, const struct fs_operation_def *templ,
3517c478bd9Sstevel@tonic-gate 			fsem_t **actual);
3527c478bd9Sstevel@tonic-gate extern void fsem_free(fsem_t *fsem);
3537c478bd9Sstevel@tonic-gate extern int fsem_is_installed(struct vfs *v, fsem_t *mon, void *arg);
3547c478bd9Sstevel@tonic-gate extern int fsem_install(struct vfs *v, fsem_t *mon, void *arg, femhow_t how,
3557c478bd9Sstevel@tonic-gate 		void (*arg_hold)(void *), void (*arg_rele)(void *));
3567c478bd9Sstevel@tonic-gate extern int fsem_uninstall(struct vfs *v, fsem_t *mon, void *arg);
3577c478bd9Sstevel@tonic-gate extern vfsops_t *fsem_getvfsops(struct vfs *v);
3587c478bd9Sstevel@tonic-gate extern void fsem_setvfsops(struct vfs *v, struct vfsops *nops);
3597c478bd9Sstevel@tonic-gate 
3607c478bd9Sstevel@tonic-gate 
3617c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3627c478bd9Sstevel@tonic-gate }
3637c478bd9Sstevel@tonic-gate #endif
3647c478bd9Sstevel@tonic-gate 
3657c478bd9Sstevel@tonic-gate #endif	/* _SYS_FEM_H */
366