Deleted Added
full compact
ext2_vfsops.c (187397) ext2_vfsops.c (191990)
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

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

28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94
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

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

28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94
36 * $FreeBSD: head/sys/gnu/fs/ext2fs/ext2_vfsops.c 187397 2009-01-18 15:10:46Z stas $
36 * $FreeBSD: head/sys/gnu/fs/ext2fs/ext2_vfsops.c 191990 2009-05-11 15:33:26Z attilio $
37 */
38
39/*-
40 * COPYRIGHT.INFO says this has some GPL'd code from ext2_super.c in it
41 *
42 * This program is free software; you can redistribute it and/or modify
43 * it under the terms of the GNU General Public License as published by
44 * the Free Software Foundation; either version 2 of the License.

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

122 "noclusterr", "noclusterw", "force", NULL };
123
124/*
125 * VFS Operations.
126 *
127 * mount system call
128 */
129static int
37 */
38
39/*-
40 * COPYRIGHT.INFO says this has some GPL'd code from ext2_super.c in it
41 *
42 * This program is free software; you can redistribute it and/or modify
43 * it under the terms of the GNU General Public License as published by
44 * the Free Software Foundation; either version 2 of the License.

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

122 "noclusterr", "noclusterw", "force", NULL };
123
124/*
125 * VFS Operations.
126 *
127 * mount system call
128 */
129static int
130ext2_mount(mp, td)
130ext2_mount(mp)
131 struct mount *mp;
131 struct mount *mp;
132 struct thread *td;
133{
134 struct vfsoptlist *opts;
135 struct vnode *devvp;
132{
133 struct vfsoptlist *opts;
134 struct vnode *devvp;
135 struct thread *td;
136 struct ext2mount *ump = 0;
137 struct ext2_sb_info *fs;
138 char *path, *fspec;
139 int error, flags, len;
140 accmode_t accmode;
141 struct nameidata nd, *ndp = &nd;
142
136 struct ext2mount *ump = 0;
137 struct ext2_sb_info *fs;
138 char *path, *fspec;
139 int error, flags, len;
140 accmode_t accmode;
141 struct nameidata nd, *ndp = &nd;
142
143 td = curthread;
143 opts = mp->mnt_optnew;
144
145 if (vfs_filteropt(opts, ext2_opts))
146 return (EINVAL);
147
148 vfs_getopt(opts, "fspath", (void **)&path, NULL);
149 /* Double-check the length of path.. */
150 if (strlen(path) >= MAXMNTLEN - 1)

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

160 * read/write; if there is no device name, that's all we do.
161 */
162 if (mp->mnt_flag & MNT_UPDATE) {
163 ump = VFSTOEXT2(mp);
164 fs = ump->um_e2fs;
165 error = 0;
166 if (fs->s_rd_only == 0 &&
167 vfs_flagopt(opts, "ro", NULL, 0)) {
144 opts = mp->mnt_optnew;
145
146 if (vfs_filteropt(opts, ext2_opts))
147 return (EINVAL);
148
149 vfs_getopt(opts, "fspath", (void **)&path, NULL);
150 /* Double-check the length of path.. */
151 if (strlen(path) >= MAXMNTLEN - 1)

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

161 * read/write; if there is no device name, that's all we do.
162 */
163 if (mp->mnt_flag & MNT_UPDATE) {
164 ump = VFSTOEXT2(mp);
165 fs = ump->um_e2fs;
166 error = 0;
167 if (fs->s_rd_only == 0 &&
168 vfs_flagopt(opts, "ro", NULL, 0)) {
168 error = VFS_SYNC(mp, MNT_WAIT, td);
169 error = VFS_SYNC(mp, MNT_WAIT);
169 if (error)
170 return (error);
171 flags = WRITECLOSE;
172 if (mp->mnt_flag & MNT_FORCE)
173 flags |= FORCECLOSE;
174 if (vfs_busy(mp, MBF_NOWAIT))
175 return (EBUSY);
176 error = ext2_flushfiles(mp, flags, td);

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

729 }
730 return (error);
731}
732
733/*
734 * unmount system call
735 */
736static int
170 if (error)
171 return (error);
172 flags = WRITECLOSE;
173 if (mp->mnt_flag & MNT_FORCE)
174 flags |= FORCECLOSE;
175 if (vfs_busy(mp, MBF_NOWAIT))
176 return (EBUSY);
177 error = ext2_flushfiles(mp, flags, td);

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

730 }
731 return (error);
732}
733
734/*
735 * unmount system call
736 */
737static int
737ext2_unmount(mp, mntflags, td)
738ext2_unmount(mp, mntflags)
738 struct mount *mp;
739 int mntflags;
739 struct mount *mp;
740 int mntflags;
740 struct thread *td;
741{
742 struct ext2mount *ump;
743 struct ext2_sb_info *fs;
744 int error, flags, ronly, i;
745
746 flags = 0;
747 if (mntflags & MNT_FORCE) {
748 if (mp->mnt_flag & MNT_ROOTFS)
749 return (EINVAL);
750 flags |= FORCECLOSE;
751 }
741{
742 struct ext2mount *ump;
743 struct ext2_sb_info *fs;
744 int error, flags, ronly, i;
745
746 flags = 0;
747 if (mntflags & MNT_FORCE) {
748 if (mp->mnt_flag & MNT_ROOTFS)
749 return (EINVAL);
750 flags |= FORCECLOSE;
751 }
752 if ((error = ext2_flushfiles(mp, flags, td)) != 0)
752 if ((error = ext2_flushfiles(mp, flags, curthread)) != 0)
753 return (error);
754 ump = VFSTOEXT2(mp);
755 fs = ump->um_e2fs;
756 ronly = fs->s_rd_only;
757 if (ronly == 0) {
758 if (fs->s_wasvalid)
759 fs->s_es->s_state |= EXT2_VALID_FS;
760 ext2_sbupdate(ump, MNT_WAIT);

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

805 return (error);
806}
807
808/*
809 * Get file system statistics.
810 * taken from ext2/super.c ext2_statfs
811 */
812static int
753 return (error);
754 ump = VFSTOEXT2(mp);
755 fs = ump->um_e2fs;
756 ronly = fs->s_rd_only;
757 if (ronly == 0) {
758 if (fs->s_wasvalid)
759 fs->s_es->s_state |= EXT2_VALID_FS;
760 ext2_sbupdate(ump, MNT_WAIT);

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

805 return (error);
806}
807
808/*
809 * Get file system statistics.
810 * taken from ext2/super.c ext2_statfs
811 */
812static int
813ext2_statfs(mp, sbp, td)
813ext2_statfs(mp, sbp)
814 struct mount *mp;
815 struct statfs *sbp;
814 struct mount *mp;
815 struct statfs *sbp;
816 struct thread *td;
817{
818 unsigned long overhead;
819 struct ext2mount *ump;
820 struct ext2_sb_info *fs;
821 struct ext2_super_block *es;
822 int i, nsb;
823
824 ump = VFSTOEXT2(mp);

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

857/*
858 * Go through the disk queues to initiate sandbagged IO;
859 * go through the inodes to write those that have been modified;
860 * initiate the writing of the super block if it has been modified.
861 *
862 * Note: we are always called with the filesystem marked `MPBUSY'.
863 */
864static int
816{
817 unsigned long overhead;
818 struct ext2mount *ump;
819 struct ext2_sb_info *fs;
820 struct ext2_super_block *es;
821 int i, nsb;
822
823 ump = VFSTOEXT2(mp);

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

856/*
857 * Go through the disk queues to initiate sandbagged IO;
858 * go through the inodes to write those that have been modified;
859 * initiate the writing of the super block if it has been modified.
860 *
861 * Note: we are always called with the filesystem marked `MPBUSY'.
862 */
863static int
865ext2_sync(mp, waitfor, td)
864ext2_sync(mp, waitfor)
866 struct mount *mp;
867 int waitfor;
865 struct mount *mp;
866 int waitfor;
868 struct thread *td;
869{
870 struct vnode *mvp, *vp;
867{
868 struct vnode *mvp, *vp;
869 struct thread *td;
871 struct inode *ip;
872 struct ext2mount *ump = VFSTOEXT2(mp);
873 struct ext2_sb_info *fs;
874 int error, allerror = 0;
875
870 struct inode *ip;
871 struct ext2mount *ump = VFSTOEXT2(mp);
872 struct ext2_sb_info *fs;
873 int error, allerror = 0;
874
875 td = curthread;
876 fs = ump->um_e2fs;
877 if (fs->s_dirt != 0 && fs->s_rd_only != 0) { /* XXX */
878 printf("fs = %s\n", fs->fs_fsmnt);
879 panic("ext2_sync: rofs mod");
880 }
881 /*
882 * Write back each (modified) inode.
883 */

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

1138
1139 return (error);
1140}
1141
1142/*
1143 * Return the root of a filesystem.
1144 */
1145static int
876 fs = ump->um_e2fs;
877 if (fs->s_dirt != 0 && fs->s_rd_only != 0) { /* XXX */
878 printf("fs = %s\n", fs->fs_fsmnt);
879 panic("ext2_sync: rofs mod");
880 }
881 /*
882 * Write back each (modified) inode.
883 */

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

1138
1139 return (error);
1140}
1141
1142/*
1143 * Return the root of a filesystem.
1144 */
1145static int
1146ext2_root(mp, flags, vpp, td)
1146ext2_root(mp, flags, vpp)
1147 struct mount *mp;
1148 int flags;
1149 struct vnode **vpp;
1147 struct mount *mp;
1148 int flags;
1149 struct vnode **vpp;
1150 struct thread *td;
1151{
1152 struct vnode *nvp;
1153 int error;
1154
1155 error = VFS_VGET(mp, (ino_t)ROOTINO, LK_EXCLUSIVE, &nvp);
1156 if (error)
1157 return (error);
1158 *vpp = nvp;
1159 return (0);
1160}
1150{
1151 struct vnode *nvp;
1152 int error;
1153
1154 error = VFS_VGET(mp, (ino_t)ROOTINO, LK_EXCLUSIVE, &nvp);
1155 if (error)
1156 return (error);
1157 *vpp = nvp;
1158 return (0);
1159}