ext2_vfsops.c (108533) | ext2_vfsops.c (109623) |
---|---|
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 | 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 108533 2003-01-01 18:49:04Z schweikh $ | 40 * $FreeBSD: head/sys/gnu/fs/ext2fs/ext2_vfsops.c 109623 2003-01-21 08:56:16Z alfred $ |
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> --- 81 unchanged lines hidden (view full) --- 130 struct ext2mount *ump; 131 u_int size; 132 int error; 133 134 if ((error = bdevvp(rootdev, &rootvp))) { 135 printf("ext2_mountroot: can't find rootvp\n"); 136 return (error); 137 } | 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> --- 81 unchanged lines hidden (view full) --- 130 struct ext2mount *ump; 131 u_int size; 132 int error; 133 134 if ((error = bdevvp(rootdev, &rootvp))) { 135 printf("ext2_mountroot: can't find rootvp\n"); 136 return (error); 137 } |
138 mp = bsd_malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK); | 138 mp = bsd_malloc((u_long)sizeof(struct mount), M_MOUNT, 0); |
139 bzero((char *)mp, (u_long)sizeof(struct mount)); 140 TAILQ_INIT(&mp->mnt_nvnodelist); 141 TAILQ_INIT(&mp->mnt_reservedvnlist); 142 mp->mnt_op = &ext2fs_vfsops; 143 mp->mnt_flag = MNT_RDONLY; 144 if (error = ext2_mountfs(rootvp, mp, td)) { 145 bsd_free(mp, M_MOUNT); 146 return (error); --- 321 unchanged lines hidden (view full) --- 468 EXT2_BLOCKS_PER_GROUP(fs); 469 V(s_groups_count) 470 db_count = (fs->s_groups_count + EXT2_DESC_PER_BLOCK(fs) - 1) / 471 EXT2_DESC_PER_BLOCK(fs); 472 fs->s_db_per_group = db_count; 473 V(s_db_per_group) 474 475 fs->s_group_desc = bsd_malloc(db_count * sizeof (struct buf *), | 139 bzero((char *)mp, (u_long)sizeof(struct mount)); 140 TAILQ_INIT(&mp->mnt_nvnodelist); 141 TAILQ_INIT(&mp->mnt_reservedvnlist); 142 mp->mnt_op = &ext2fs_vfsops; 143 mp->mnt_flag = MNT_RDONLY; 144 if (error = ext2_mountfs(rootvp, mp, td)) { 145 bsd_free(mp, M_MOUNT); 146 return (error); --- 321 unchanged lines hidden (view full) --- 468 EXT2_BLOCKS_PER_GROUP(fs); 469 V(s_groups_count) 470 db_count = (fs->s_groups_count + EXT2_DESC_PER_BLOCK(fs) - 1) / 471 EXT2_DESC_PER_BLOCK(fs); 472 fs->s_db_per_group = db_count; 473 V(s_db_per_group) 474 475 fs->s_group_desc = bsd_malloc(db_count * sizeof (struct buf *), |
476 M_EXT2MNT, M_WAITOK); | 476 M_EXT2MNT, 0); |
477 478 /* adjust logic_sb_block */ 479 if(fs->s_blocksize > SBSIZE) 480 /* Godmar thinks: if the blocksize is greater than 1024, then 481 the superblock is logically part of block zero. 482 */ 483 logic_sb_block = 0; 484 --- 193 unchanged lines hidden (view full) --- 678"WARNING: Filesystem was not properly dismounted\n"); 679 } else { 680 printf( 681"WARNING: R/W mount denied. Filesystem is not clean - run fsck\n"); 682 error = EPERM; 683 goto out; 684 } 685 } | 477 478 /* adjust logic_sb_block */ 479 if(fs->s_blocksize > SBSIZE) 480 /* Godmar thinks: if the blocksize is greater than 1024, then 481 the superblock is logically part of block zero. 482 */ 483 logic_sb_block = 0; 484 --- 193 unchanged lines hidden (view full) --- 678"WARNING: Filesystem was not properly dismounted\n"); 679 } else { 680 printf( 681"WARNING: R/W mount denied. Filesystem is not clean - run fsck\n"); 682 error = EPERM; 683 goto out; 684 } 685 } |
686 ump = bsd_malloc(sizeof *ump, M_EXT2MNT, M_WAITOK); | 686 ump = bsd_malloc(sizeof *ump, M_EXT2MNT, 0); |
687 bzero((caddr_t)ump, sizeof *ump); 688 /* I don't know whether this is the right strategy. Note that 689 we dynamically allocate both an ext2_sb_info and an ext2_super_block 690 while Linux keeps the super block in a locked buffer 691 */ 692 ump->um_e2fs = bsd_malloc(sizeof(struct ext2_sb_info), | 687 bzero((caddr_t)ump, sizeof *ump); 688 /* I don't know whether this is the right strategy. Note that 689 we dynamically allocate both an ext2_sb_info and an ext2_super_block 690 while Linux keeps the super block in a locked buffer 691 */ 692 ump->um_e2fs = bsd_malloc(sizeof(struct ext2_sb_info), |
693 M_EXT2MNT, M_WAITOK); | 693 M_EXT2MNT, 0); |
694 ump->um_e2fs->s_es = bsd_malloc(sizeof(struct ext2_super_block), | 694 ump->um_e2fs->s_es = bsd_malloc(sizeof(struct ext2_super_block), |
695 M_EXT2MNT, M_WAITOK); | 695 M_EXT2MNT, 0); |
696 bcopy(es, ump->um_e2fs->s_es, (u_int)sizeof(struct ext2_super_block)); 697 if ((error = compute_sb_data(devvp, ump->um_e2fs->s_es, ump->um_e2fs))) 698 goto out; 699 /* 700 * We don't free the group descriptors allocated by compute_sb_data() 701 * until ext2_unmount(). This is OK since the mount will succeed. 702 */ 703 brelse(bp); --- 296 unchanged lines hidden (view full) --- 1000 1001 /* 1002 * If this MALLOC() is performed after the getnewvnode() 1003 * it might block, leaving a vnode with a NULL v_data to be 1004 * found by ext2_sync() if a sync happens to fire right then, 1005 * which will cause a panic because ext2_sync() blindly 1006 * dereferences vp->v_data (as well it should). 1007 */ | 696 bcopy(es, ump->um_e2fs->s_es, (u_int)sizeof(struct ext2_super_block)); 697 if ((error = compute_sb_data(devvp, ump->um_e2fs->s_es, ump->um_e2fs))) 698 goto out; 699 /* 700 * We don't free the group descriptors allocated by compute_sb_data() 701 * until ext2_unmount(). This is OK since the mount will succeed. 702 */ 703 brelse(bp); --- 296 unchanged lines hidden (view full) --- 1000 1001 /* 1002 * If this MALLOC() is performed after the getnewvnode() 1003 * it might block, leaving a vnode with a NULL v_data to be 1004 * found by ext2_sync() if a sync happens to fire right then, 1005 * which will cause a panic because ext2_sync() blindly 1006 * dereferences vp->v_data (as well it should). 1007 */ |
1008 MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, M_WAITOK); | 1008 MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, 0); |
1009 1010 /* Allocate a new vnode/inode. */ 1011 if ((error = getnewvnode("ext2fs", mp, ext2_vnodeop_p, &vp)) != 0) { 1012 if (ext2fs_inode_hash_lock < 0) 1013 wakeup(&ext2fs_inode_hash_lock); 1014 ext2fs_inode_hash_lock = 0; 1015 *vpp = NULL; 1016 FREE(ip, M_EXT2NODE); --- 214 unchanged lines hidden --- | 1009 1010 /* Allocate a new vnode/inode. */ 1011 if ((error = getnewvnode("ext2fs", mp, ext2_vnodeop_p, &vp)) != 0) { 1012 if (ext2fs_inode_hash_lock < 0) 1013 wakeup(&ext2fs_inode_hash_lock); 1014 ext2fs_inode_hash_lock = 0; 1015 *vpp = NULL; 1016 FREE(ip, M_EXT2NODE); --- 214 unchanged lines hidden --- |