Deleted Added
sdiff udiff text old ( 96881 ) new ( 97255 )
full compact
1/*
2 * modified for EXT2FS support in Lites 1.1
3 *
4 * Aug 1995, Godmar Back (gback@cs.utah.edu)
5 * University of Utah, Department of Computer Science
6 */
7/*
8 * Copyright (c) 1989, 1991, 1993, 1994

--- 23 unchanged lines hidden (view full) ---

32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94
40 * $FreeBSD: head/sys/gnu/fs/ext2fs/ext2_vfsops.c 97255 2002-05-24 17:38:01Z mux $
41 */
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/namei.h>
46#include <sys/proc.h>
47#include <sys/kernel.h>
48#include <sys/vnode.h>

--- 12 unchanged lines hidden (view full) ---

61#include <gnu/ext2fs/fs.h>
62#include <gnu/ext2fs/ext2_extern.h>
63#include <gnu/ext2fs/ext2_fs.h>
64#include <gnu/ext2fs/ext2_fs_sb.h>
65
66static int ext2_fhtovp(struct mount *, struct fid *, struct vnode **);
67static int ext2_flushfiles(struct mount *mp, int flags, struct thread *td);
68static int ext2_init(struct vfsconf *);
69static int ext2_mount(struct mount *, struct nameidata *, struct thread *);
70static int ext2_mountfs(struct vnode *, struct mount *, struct thread *);
71static int ext2_reload(struct mount *mountp, struct ucred *cred,
72 struct thread *td);
73static int ext2_root(struct mount *, struct vnode **vpp);
74static int ext2_sbupdate(struct ext2mount *, int);
75static int ext2_statfs(struct mount *, struct statfs *, struct thread *);
76static int ext2_sync(struct mount *, int, struct ucred *, struct thread *);
77static int ext2_uninit(struct vfsconf *);
78static int ext2_unmount(struct mount *, int, struct thread *);
79static int ext2_vget(struct mount *, ino_t, int, struct vnode **);
80static int ext2_vptofh(struct vnode *, struct fid *);
81
82MALLOC_DEFINE(M_EXT2NODE, "EXT2 node", "EXT2 vnode private part");
83static MALLOC_DEFINE(M_EXT2MNT, "EXT2 mount", "EXT2 mount structure");
84
85static struct vfsops ext2fs_vfsops = {
86 NULL,
87 vfs_stdstart,
88 ext2_unmount,
89 ext2_root, /* root inode via vget */
90 vfs_stdquotactl,
91 ext2_statfs,
92 ext2_sync,
93 ext2_vget,
94 ext2_fhtovp,
95 vfs_stdcheckexp,
96 ext2_vptofh,
97 ext2_init,
98 ext2_uninit,
99 vfs_stdextattrctl,
100 ext2_mount,
101};
102
103VFS_SET(ext2fs_vfsops, ext2fs, 0);
104#define bsd_malloc malloc
105#define bsd_free free
106
107static int ext2fs_inode_hash_lock;
108

--- 61 unchanged lines hidden (view full) ---

170#endif
171
172/*
173 * VFS Operations.
174 *
175 * mount system call
176 */
177static int
178ext2_mount(mp, ndp, td)
179 struct mount *mp;
180 struct nameidata *ndp;
181 struct thread *td;
182{
183 struct export_args *export;
184 struct vfsoptlist *opts;
185 struct vnode *devvp;
186 struct ext2mount *ump = 0;
187 struct ext2_sb_info *fs;
188 char *path, *fspec;
189 size_t size;
190 int error, flags, len;
191 mode_t accessmode;
192
193 opts = mp->mnt_optnew;
194
195 vfs_getopt(opts, "fspath", (void **)&path, NULL);
196 /* Double-check the length of path.. */
197 if (strlen(path) >= MAXMNTLEN - 1)
198 return (ENAMETOOLONG);
199
200 fspec = NULL;
201 error = vfs_getopt(opts, "from", (void **)&fspec, &len);
202 if (!error && fspec[len - 1] != '\0')
203 return (EINVAL);
204
205 /*
206 * If updating, check whether changing from read-only to
207 * read/write; if there is no device name, that's all we do.
208 */
209 if (mp->mnt_flag & MNT_UPDATE) {
210 ump = VFSTOEXT2(mp);
211 fs = ump->um_e2fs;
212 error = 0;

--- 46 unchanged lines hidden (view full) ---

259 fs->fs_fsmnt);
260 return (EPERM);
261 }
262 }
263 fs->s_es->s_state &= ~EXT2_VALID_FS;
264 ext2_sbupdate(ump, MNT_WAIT);
265 fs->s_rd_only = 0;
266 }
267 if (fspec == NULL) {
268 error = vfs_getopt(opts, "export", (void **)&export,
269 &len);
270 if (error || len != sizeof(struct export_args))
271 return (EINVAL);
272 /* Process export requests. */
273 return (vfs_export(mp, export));
274 }
275 }
276 /*
277 * Not an update, or updating the name: look up the name
278 * and verify that it refers to a sensible block device.
279 */
280 if (fspec == NULL)
281 return (EINVAL);
282 NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td);
283 if ((error = namei(ndp)) != 0)
284 return (error);
285 NDFREE(ndp, NDF_ONLY_PNBUF);
286 devvp = ndp->ni_vp;
287
288 if (!vn_isdisk(devvp, &error)) {
289 vrele(devvp);
290 return (error);

--- 30 unchanged lines hidden (view full) ---

321 ump = VFSTOEXT2(mp);
322 fs = ump->um_e2fs;
323 /*
324 * Note that this strncpy() is ok because of a check at the start
325 * of ext2_mount().
326 */
327 strncpy(fs->fs_fsmnt, path, MAXMNTLEN);
328 fs->fs_fsmnt[MAXMNTLEN - 1] = '\0';
329 (void)copystr(fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size);
330 bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
331 (void)ext2_statfs(mp, &mp->mnt_stat, td);
332 return (0);
333}
334
335/*
336 * checks that the data in the descriptor blocks make sense
337 * this is taken from ext2/super.c

--- 894 unchanged lines hidden ---