aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Aleaxander <Aleaxander@gmail.com>2009-05-16 08:41:40 +0800
committerLiu Aleaxander <Aleaxander@gmail.com>2009-05-16 08:41:40 +0800
commit8cfa4e68e2d62fd86b4603b27c71e3eaf54b6f68 (patch)
tree358a45918d92eea0af0da3f044e876b63d0ebd0b
parentfdae58f8e25461c8e44c15afd6172ca5428ca8d2 (diff)
downloaddevel-8cfa4e68e2d62fd86b4603b27c71e3eaf54b6f68.tar.gz
devel-8cfa4e68e2d62fd86b4603b27c71e3eaf54b6f68.tar.xz
devel-8cfa4e68e2d62fd86b4603b27c71e3eaf54b6f68.zip
modify the init_fs() function
-rw-r--r--extlinux.c10
-rw-r--r--main.c3
2 files changed, 6 insertions, 7 deletions
diff --git a/extlinux.c b/extlinux.c
index 62bd080..ed5e413 100644
--- a/extlinux.c
+++ b/extlinux.c
@@ -79,7 +79,7 @@ __u32 CurrentGetC = (__u32) &GetCStack[getc_file_size * MAX_GETC];
-extern struct ext2_super_block sb;
+struct ext2_super_block sb;
struct ext2_inode ThisInode;
struct open_file_t Files[MAX_OPEN];
@@ -854,19 +854,19 @@ int ext2_read(struct open_file_t *file, char *buf, int size, int *have_more)
/**
* init. the fs meta data
*/
-void init_fs(struct ext2_super_block *sb)
+void init_fs()
{
/* read the super block */
- getlinsec(sb, 2, 2);
+ getlinsec(&sb, 2, 2);
- ClustBytesShift = sb->s_log_block_size + 10;
+ ClustBytesShift = sb.s_log_block_size + 10;
ClustSize = 1 << ClustBytesShift;
ClustShift = ClustBytesShift - SECTOR_SHIFT;
blk_size = ClustSize;
DescPerBlock = blk_size / ( 1 << ext2_group_desc_lg2size);
- InodePerBlock = blk_size / sb->s_inode_size;
+ InodePerBlock = blk_size / sb.s_inode_size;
SecPerClust = ClustSize >> SECTOR_SHIFT;
ClustMask = SecPerClust - 1;
diff --git a/main.c b/main.c
index 9d1cb3c..372c324 100644
--- a/main.c
+++ b/main.c
@@ -15,7 +15,6 @@
-struct ext2_super_block sb;
int fd;
@@ -114,7 +113,7 @@ int main(int argc, char *argv[])
return 0;
}
- init_fs(&sb);
+ init_fs();
file = (struct open_file_t *)ext2_open(filename);
if ( ! file ) {