xref: /386bsd/usr/src/kernel/mfs/mfs_node.h (revision a2142627)
1 /*
2  * Copyright (c) 1989 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *	This product includes software developed by the University of
16  *	California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  *	@(#)mfsnode.h	7.3 (Berkeley) 4/16/91
34  */
35 
36 /*
37  * This structure defines the control data for the memory
38  * based file system.
39  */
40 
41 struct mfsnode {
42 	struct	vnode *mfs_vnode;	/* vnode associated with this mfsnode */
43 	caddr_t	mfs_baseoff;		/* base of file system in memory */
44 	long	mfs_size;		/* size of memory file system */
45 	pid_t	mfs_pid;		/* supporting process pid */
46 	struct	buf *mfs_buflist;	/* list of I/O requests */
47 	long	mfs_spare[4];
48 };
49 
50 /*
51  * Convert between mfsnode pointers and vnode pointers
52  */
53 #define VTOMFS(vp)	((struct mfsnode *)(vp)->v_data)
54 #define MFSTOV(mfsp)	((mfsp)->mfs_vnode)
55 
56 /*
57  * Prototypes for MFS operations on vnodes.
58  */
59 int	mfs_badop();
60 #define mfs_lookup ((int (*) __P(( \
61 		struct vnode *vp, \
62 		struct nameidata *ndp, \
63 		struct proc *p))) mfs_badop)
64 #define mfs_create ((int (*) __P(( \
65 		struct nameidata *ndp, \
66 		struct vattr *vap, \
67 		struct proc *p))) mfs_badop)
68 #define mfs_mknod ((int (*) __P(( \
69 		struct nameidata *ndp, \
70 		struct vattr *vap, \
71 		struct ucred *cred, \
72 		struct proc *p))) mfs_badop)
73 int	mfs_open __P((
74 		struct vnode *vp,
75 		int mode,
76 		struct ucred *cred,
77 		struct proc *p));
78 int	mfs_close __P((
79 		struct vnode *vp,
80 		int fflag,
81 		struct ucred *cred,
82 		struct proc *p));
83 #define mfs_access ((int (*) __P(( \
84 		struct vnode *vp, \
85 		int mode, \
86 		struct ucred *cred, \
87 		struct proc *p))) mfs_badop)
88 #define mfs_getattr ((int (*) __P(( \
89 		struct vnode *vp, \
90 		struct vattr *vap, \
91 		struct ucred *cred, \
92 		struct proc *p))) mfs_badop)
93 #define mfs_setattr ((int (*) __P(( \
94 		struct vnode *vp, \
95 		struct vattr *vap, \
96 		struct ucred *cred, \
97 		struct proc *p))) mfs_badop)
98 #define mfs_read ((int (*) __P(( \
99 		struct vnode *vp, \
100 		struct uio *uio, \
101 		int ioflag, \
102 		struct ucred *cred))) mfs_badop)
103 #define mfs_write ((int (*) __P(( \
104 		struct vnode *vp, \
105 		struct uio *uio, \
106 		int ioflag, \
107 		struct ucred *cred))) mfs_badop)
108 int	mfs_ioctl __P((
109 		struct vnode *vp,
110 		int command,
111 		caddr_t data,
112 		int fflag,
113 		struct ucred *cred,
114 		struct proc *p));
115 #define mfs_select ((int (*) __P(( \
116 		struct vnode *vp, \
117 		int which, \
118 		int fflags, \
119 		struct ucred *cred, \
120 		struct proc *p))) mfs_badop)
121 #define mfs_mmap ((int (*) __P(( \
122 		struct vnode *vp, \
123 		int fflags, \
124 		struct ucred *cred, \
125 		struct proc *p))) mfs_badop)
126 #define mfs_fsync ((int (*) __P(( \
127 		struct vnode *vp, \
128 		int fflags, \
129 		struct ucred *cred, \
130 		int waitfor, \
131 		struct proc *p))) mfs_badop)
132 #define mfs_seek ((int (*) __P(( \
133 		struct vnode *vp, \
134 		off_t oldoff, \
135 		off_t newoff, \
136 		struct ucred *cred))) mfs_badop)
137 #define mfs_remove ((int (*) __P(( \
138 		struct nameidata *ndp, \
139 		struct proc *p))) mfs_badop)
140 #define mfs_link ((int (*) __P(( \
141 		struct vnode *vp, \
142 		struct nameidata *ndp, \
143 		struct proc *p))) mfs_badop)
144 #define mfs_rename ((int (*) __P(( \
145 		struct nameidata *fndp, \
146 		struct nameidata *tdnp, \
147 		struct proc *p))) mfs_badop)
148 #define mfs_mkdir ((int (*) __P(( \
149 		struct nameidata *ndp, \
150 		struct vattr *vap, \
151 		struct proc *p))) mfs_badop)
152 #define mfs_rmdir ((int (*) __P(( \
153 		struct nameidata *ndp, \
154 		struct proc *p))) mfs_badop)
155 #define mfs_symlink ((int (*) __P(( \
156 		struct nameidata *ndp, \
157 		struct vattr *vap, \
158 		char *target, \
159 		struct proc *p))) mfs_badop)
160 #define mfs_readdir ((int (*) __P(( \
161 		struct vnode *vp, \
162 		struct uio *uio, \
163 		struct ucred *cred, \
164 		int *eofflagp))) mfs_badop)
165 #define mfs_readlink ((int (*) __P(( \
166 		struct vnode *vp, \
167 		struct uio *uio, \
168 		struct ucred *cred))) mfs_badop)
169 #define mfs_abortop ((int (*) __P(( \
170 		struct nameidata *ndp))) mfs_badop)
171 int	mfs_inactive __P((
172 		struct vnode *vp,
173 		struct proc *p));
174 #define mfs_reclaim ((int (*) __P(( \
175 		struct vnode *vp))) nullop)
176 #define mfs_lock ((int (*) __P(( \
177 		struct vnode *vp))) nullop)
178 #define mfs_unlock ((int (*) __P(( \
179 		struct vnode *vp))) nullop)
180 int	mfs_bmap __P((
181 		struct vnode *vp,
182 		daddr_t bn,
183 		struct vnode **vpp,
184 		daddr_t *bnp));
185 int	mfs_strategy __P((
186 		struct buf *bp));
187 int	mfs_print __P((
188 		struct vnode *vp));
189 #define mfs_islocked ((int (*) __P(( \
190 		struct vnode *vp))) nullop)
191 #define mfs_advlock ((int (*) __P(( \
192 		struct vnode *vp, \
193 		caddr_t id, \
194 		int op, \
195 		struct flock *fl, \
196 		int flags))) mfs_badop)
197