fix ext2fs on arm
. the memory allocated with STATICINIT is flaky on arm Change-Id: Ib559ccbc2b890f22eea8ee602a37f8055d6fe4bd
This commit is contained in:
parent
d26b52b7cf
commit
0cec32da3e
|
|
@ -5,6 +5,7 @@
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <minix/com.h>
|
#include <minix/com.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "buf.h"
|
#include "buf.h"
|
||||||
|
|
@ -60,9 +61,9 @@ int fs_readsuper()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the super block. */
|
/* Fill in the super block. */
|
||||||
STATICINIT(superblock, 1);
|
if(!(superblock = malloc(sizeof(*superblock))))
|
||||||
if (!superblock)
|
|
||||||
panic("Can't allocate memory for superblock.");
|
panic("Can't allocate memory for superblock.");
|
||||||
|
|
||||||
superblock->s_dev = fs_dev; /* read_super() needs to know which dev */
|
superblock->s_dev = fs_dev; /* read_super() needs to know which dev */
|
||||||
r = read_super(superblock);
|
r = read_super(superblock);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,6 @@ register struct super_block *sp; /* pointer to a superblock */
|
||||||
int r;
|
int r;
|
||||||
/* group descriptors, sp->s_group_desc points to this. */
|
/* group descriptors, sp->s_group_desc points to this. */
|
||||||
static struct group_desc *group_descs;
|
static struct group_desc *group_descs;
|
||||||
char *buf;
|
|
||||||
block_t gd_size; /* group descriptors table size in blocks */
|
block_t gd_size; /* group descriptors table size in blocks */
|
||||||
int gdt_position;
|
int gdt_position;
|
||||||
static char superblock_buf[1024];
|
static char superblock_buf[1024];
|
||||||
|
|
@ -149,16 +148,10 @@ register struct super_block *sp; /* pointer to a superblock */
|
||||||
|
|
||||||
gd_size = sp->s_gdb_count * sp->s_block_size;
|
gd_size = sp->s_gdb_count * sp->s_block_size;
|
||||||
|
|
||||||
buf = 0;
|
if(!(group_descs = malloc(gd_size * sizeof(struct group_desc))))
|
||||||
STATICINIT(buf, gd_size);
|
panic("can't allocate group desc array");
|
||||||
group_descs = (struct group_desc *) buf;
|
if(!(ondisk_group_descs = malloc(gd_size * sizeof(struct group_desc))))
|
||||||
|
panic("can't allocate group desc array");
|
||||||
buf = 0;
|
|
||||||
STATICINIT(buf, gd_size);
|
|
||||||
ondisk_group_descs = (struct group_desc *) buf;
|
|
||||||
|
|
||||||
if (!group_descs || !ondisk_group_descs)
|
|
||||||
panic("can't allocate memory for gdt buffer");
|
|
||||||
|
|
||||||
/* s_first_data_block (block number, where superblock is stored)
|
/* s_first_data_block (block number, where superblock is stored)
|
||||||
* is 1 for 1Kb blocks and 0 for larger blocks.
|
* is 1 for 1Kb blocks and 0 for larger blocks.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user