FreeCalypso > hg > freecalypso-sw
comparison 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 |
comparison
equal
deleted
inserted
replaced
230:ffaa033e7643 | 231:5ceacdbd4490 |
---|---|
10 #include <stdlib.h> | 10 #include <stdlib.h> |
11 #include <unistd.h> | 11 #include <unistd.h> |
12 #include <string.h> | 12 #include <string.h> |
13 #include <strings.h> | 13 #include <strings.h> |
14 #include "types.h" | 14 #include "types.h" |
15 #include "globals.h" | |
15 | 16 |
16 u8 tiffs_header[6] = {'F', 'f', 's', '#', 0x10, 0x02}; | 17 u8 tiffs_header[6] = {'F', 'f', 's', '#', 0x10, 0x02}; |
17 u8 blank_flash_line[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
18 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; | |
19 | |
20 extern char *imgfile; | |
21 extern u32 eraseblk_size; | |
22 extern int total_blocks; | |
23 extern u32 total_ffs_size; | |
24 extern int index_blk_num, root_node_no; | |
25 extern int verbose; | |
26 | |
27 u8 *image, *inode_block; | |
28 | 18 |
29 read_ffs_image() | 19 read_ffs_image() |
30 { | 20 { |
31 int fd; | 21 int fd; |
32 struct stat st; | 22 struct stat st; |
107 continue; | 97 continue; |
108 } | 98 } |
109 switch (ptr[8]) { | 99 switch (ptr[8]) { |
110 case 0xAB: | 100 case 0xAB: |
111 if (verbose) | 101 if (verbose) |
112 printf( | 102 fprintf(stderr, |
113 "Found AB index in erase block #%d (offset %x)\n", | 103 "Found AB index in erase block #%d (offset %x)\n", |
114 i, ptr - image); | 104 i, ptr - image); |
115 index_blk_num = i; | 105 index_blk_num = i; |
116 inode_block = ptr; | 106 inode_block = ptr; |
117 abcnt++; | 107 abcnt++; |
141 cmd_fsinfo() | 131 cmd_fsinfo() |
142 { | 132 { |
143 read_ffs_image(); | 133 read_ffs_image(); |
144 find_inode_block(); | 134 find_inode_block(); |
145 printf("Active inode block (AB) is block #%d\n", index_blk_num); | 135 printf("Active inode block (AB) is block #%d\n", index_blk_num); |
136 alloc_inode_table(); | |
137 find_root_inode(); | |
138 printf("Root inode is #%x\n", root_inode); | |
146 exit(0); | 139 exit(0); |
147 } | 140 } |