--- fs/ext2.c +++ fs/ext2.c 1999/11/25 15:35:02 @@ -20,13 +20,12 @@ #include "disklabel.h" #include "utils.h" -#define MAX_SUPPORTED_GROUPS 256 /* supports 2GB filesystem */ #define MAX_OPEN_FILES 4 extern struct bootfs ext2fs; static struct ext2_super_block sb; -static struct ext2_group_desc gds[MAX_SUPPORTED_GROUPS]; +static struct ext2_group_desc *gds; static int ngroups = 0; static int directlim; /* Maximum direct blkno */ static int ind1lim; /* Maximum single-indir blkno */ @@ -87,21 +86,18 @@ ngroups = (sb.s_blocks_count + sb.s_blocks_per_group - 1) / sb.s_blocks_per_group; - if (ngroups > MAX_SUPPORTED_GROUPS) { - printf("ext2_init: too many groups (%d): max is %d\n", - ngroups, MAX_SUPPORTED_GROUPS); - return -1; - } + gds = (struct ext2_group_desc *) + malloc((size_t)(ngroups * sizeof(struct ext2_group_desc))); + ext2fs.blocksize = EXT2_BLOCK_SIZE(&sb); /* read in the group descriptors (immediately follows superblock) */ cons_read(dev, gds, ngroups * sizeof(struct ext2_group_desc), - partition_offset + sb_offset + sizeof(sb)); - + partition_offset + + ext2fs.blocksize*(EXT2_MIN_BLOCK_SIZE/ext2fs.blocksize +1) ); /* * Calculate direct/indirect block limits for this file system * (blocksize dependent): */ - ext2fs.blocksize = EXT2_BLOCK_SIZE(&sb); directlim = EXT2_NDIR_BLOCKS - 1; ptrs_per_blk = ext2fs.blocksize/sizeof(unsigned int); ind1lim = ptrs_per_blk + directlim; @@ -323,7 +319,7 @@ char namebuf[256]; char *component; struct ext2_inode *dir_inode; - struct ext2_dir_entry *dp; + struct ext2_dir_entry_2 *dp; int next_ino; /* squirrel away a copy of "namebuf" that we can modify: */ @@ -356,7 +352,7 @@ return NULL; } while (blockoffset < ext2fs.blocksize) { - dp = (struct ext2_dir_entry *) + dp = (struct ext2_dir_entry_2 *) (blkbuf + blockoffset); if ((dp->name_len == component_length) && (strncmp(component, dp->name,