diff ffstools/tiffs-rd/basics.c @ 231:5ceacdbd4490

tiffs IVA: finds the root inode
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 26 Jan 2014 08:11:42 +0000
parents ffaa033e7643
children 73372cfdaf7f
line wrap: on
line diff
--- a/ffstools/tiffs-rd/basics.c	Sun Jan 26 00:34:22 2014 +0000
+++ b/ffstools/tiffs-rd/basics.c	Sun Jan 26 08:11:42 2014 +0000
@@ -12,19 +12,9 @@
 #include <string.h>
 #include <strings.h>
 #include "types.h"
+#include "globals.h"
 
 u8 tiffs_header[6] = {'F', 'f', 's', '#', 0x10, 0x02};
-u8 blank_flash_line[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-			   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
-
-extern char *imgfile;
-extern u32 eraseblk_size;
-extern int total_blocks;
-extern u32 total_ffs_size;
-extern int index_blk_num, root_node_no;
-extern int verbose;
-
-u8 *image, *inode_block;
 
 read_ffs_image()
 {
@@ -109,7 +99,7 @@
 		switch (ptr[8]) {
 		case 0xAB:
 			if (verbose)
-				printf(
+				fprintf(stderr,
 			"Found AB index in erase block #%d (offset %x)\n",
 					i, ptr - image);
 			index_blk_num = i;
@@ -143,5 +133,8 @@
 	read_ffs_image();
 	find_inode_block();
 	printf("Active inode block (AB) is block #%d\n", index_blk_num);
+	alloc_inode_table();
+	find_root_inode();
+	printf("Root inode is #%x\n", root_inode);
 	exit(0);
 }