xref: /illumos-gate/usr/src/uts/common/fs/fs_subr.h (revision 4763305e3243687c189d755d737d52205b2614ed)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
22 /*	  All Rights Reserved	*/
23 
24 /*
25  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
26  * Use is subject to license terms.
27  * Copyright 2017 Joyent, Inc.
28  */
29 
30 #ifndef	_SYS_FS_SUBR_H
31 #define	_SYS_FS_SUBR_H
32 
33 #include <sys/types.h>
34 #include <sys/cred.h>
35 #include <sys/fcntl.h>
36 #include <sys/poll.h>
37 #include <sys/vfs.h>
38 #include <sys/vnode.h>
39 #include <vm/page.h>
40 #include <sys/acl.h>
41 #include <sys/share.h>
42 #include <sys/flock.h>
43 
44 #ifdef	__cplusplus
45 extern "C" {
46 #endif
47 
48 /*
49  * Utilities shared among file system implementations.
50  */
51 
52 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
53 
54 extern int	fs_nosys();
55 extern int	fs_inval();
56 extern int	fs_notdir();
57 extern int	fs_nosys_syncfs(vfs_t *, uint64_t, cred_t *);
58 extern int	fs_nosys_map(struct vnode *, offset_t, struct as *, caddr_t *,
59 			size_t, uchar_t, uchar_t, uint_t, struct cred *,
60 			caller_context_t *);
61 extern int	fs_nosys_addmap(struct vnode *, offset_t, struct as *, caddr_t,
62 			size_t, uchar_t, uchar_t, uint_t, struct cred *,
63 			caller_context_t *);
64 extern int	fs_nosys_poll(struct vnode *, short, int, short *,
65 			struct pollhead **, caller_context_t *);
66 extern int	fs_ioctl(vnode_t *, int, intptr_t, int, cred_t *, int *);
67 extern int	fs_putpage(vnode_t *, offset_t, size_t, int, cred_t *,
68 			caller_context_t *);
69 extern int	fs_fsync(vnode_t *, int, cred_t *, caller_context_t *);
70 extern int	fs_sync(struct vfs *, short, cred_t *);
71 extern int	fs_syncfs_nop(vfs_t *, uint64_t, cred_t *);
72 extern int	fs_rwlock(vnode_t *, int, caller_context_t *);
73 extern void	fs_rwunlock(vnode_t *, int, caller_context_t *);
74 extern int	fs_cmp(vnode_t *, vnode_t *, caller_context_t *);
75 extern int	fs_seek(vnode_t *, offset_t, offset_t *, caller_context_t *);
76 extern int	fs_frlock(vnode_t *, int, struct flock64 *, int, offset_t,
77 			struct flk_callback *, cred_t *, caller_context_t *);
78 extern int	fs_setfl(vnode_t *, int, int, cred_t *, caller_context_t *);
79 extern int	fs_poll(vnode_t *, short, int, short *, struct pollhead **,
80 			caller_context_t *);
81 extern int	fs_pathconf(struct vnode *, int, ulong_t *, struct cred *,
82 			caller_context_t *);
83 extern void	clkset(time_t);
84 extern void	fs_dispose(struct vnode *, page_t *, int, int, struct cred *,
85 			caller_context_t *);
86 extern void	fs_nodispose(struct vnode *, page_t *, int, int, struct cred *,
87 			caller_context_t *);
88 extern int	fs_fab_acl(struct vnode *, vsecattr_t *, int flag, cred_t *,
89 			caller_context_t *);
90 extern int	fs_shrlock(struct vnode *, int, struct shrlock *, int,
91 			cred_t *, caller_context_t *);
92 extern int	fs_vnevent_nosupport(vnode_t *, vnevent_t, vnode_t *dvp,
93 			char *fnm, caller_context_t *);
94 extern int	fs_vnevent_support(vnode_t *, vnevent_t, vnode_t *dvp,
95 			char *fnm, caller_context_t *);
96 extern int	fs_acl_nontrivial(struct vnode *vp, struct cred *cr);
97 extern int	fs_need_estale_retry(int);
98 extern void	fs_vscan_register(int (*av_scan)(vnode_t *, cred_t *, int));
99 extern int	fs_vscan(vnode_t *, cred_t *, int);
100 
101 extern vfs_t	*fs_vfsp_global(struct vfsops *, dev_t, int, uint_t);
102 
103 /* Helper function to detect when epoll checks VOP_POLL handlers */
104 extern boolean_t fs_reject_epoll();
105 
106 #endif	/* _KERNEL */
107 
108 #ifdef	__cplusplus
109 }
110 #endif
111 
112 #endif /* _SYS_FS_SUBR_H */
113