annotate ffstools/tiffs-rd/decode.c @ 834:c458e33060bf

ffstools/tiaud: prep for adding support for new AEC
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 30 Jul 2021 00:10:13 +0000
parents ed983d4040a8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
726
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This C module implements the decode command, displaying certain
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * FFS files in a developer-friendly decoded form.
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/types.h>
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <string.h>
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <strings.h>
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <unistd.h>
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "types.h"
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include "struct.h"
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include "globals.h"
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include "pathname.h"
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 extern void write_afcdac_ascii();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 extern void write_stdmap_ascii();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 extern void write_adccal_table();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 extern void write_afcparams_table();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 extern void write_tx_ramps_table();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 extern void write_tx_levels_table();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 extern void write_tx_calchan_table();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 extern void write_tx_caltemp_table();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 extern void write_rx_calchan_table();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 extern void write_rx_caltemp_table();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 extern void write_rx_agcparams_table();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28
727
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
29 static void
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
30 pcm_IMEI_decode(bin, outf)
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
31 u8 *bin;
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
32 FILE *outf;
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
33 {
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
34 u8 rev[8];
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
35 unsigned n;
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
36
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
37 for (n = 0; n < 8; n++)
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
38 rev[n] = ((bin[n] & 0xF0) >> 4) | ((bin[n] & 0x0F) << 4);
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
39 fprintf(outf, "%02X%02X%02X%02X-%02X%02X%02X-%02X\n", rev[0], rev[1],
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
40 rev[2], rev[3], rev[4], rev[5], rev[6], rev[7]);
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
41 }
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
42
726
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 static struct map {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 char *req_name;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 char *pathname;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 int need_band;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 unsigned size;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 void (*decode_func)();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 } map_table[] = {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 {"adccal", "/sys/adccal", 0, 36, write_adccal_table},
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 {"afcdac", "/gsm/rf/afcdac", 0, 2, write_afcdac_ascii},
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 {"afcparams", "/gsm/rf/afcparams", 0, 24, write_afcparams_table},
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 {"stdmap", "/gsm/rf/stdmap", 0, 2, write_stdmap_ascii},
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 {"tx-ramps", "/gsm/rf/tx/ramps.%s", 1, 512, write_tx_ramps_table},
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 {"tx-levels", "/gsm/rf/tx/levels.%s", 1, 128, write_tx_levels_table},
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 {"tx-calchan", "/gsm/rf/tx/calchan.%s", 1, 128, write_tx_calchan_table},
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 {"tx-caltemp", "/gsm/rf/tx/caltemp.%s", 1, 40, write_tx_caltemp_table},
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 {"rx-calchan", "/gsm/rf/rx/calchan.%s", 1, 40, write_rx_calchan_table},
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 {"rx-caltemp", "/gsm/rf/rx/caltemp.%s", 1, 44, write_rx_caltemp_table},
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 {"rx-agcparams", "/gsm/rf/rx/agcparams.%s", 1, 8, write_rx_agcparams_table},
727
ed983d4040a8 tiffs IVA: decode pcm-IMEI added
Mychaela Falconia <falcon@freecalypso.org>
parents: 726
diff changeset
61 {"pcm-IMEI", "/pcm/IMEI", 0, 8, pcm_IMEI_decode},
726
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 {0, 0, 0, 0, 0}
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 };
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 static u8 file_read_buf[512];
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 static unsigned file_expected_size;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 static unsigned file_read_ptr;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 static void
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 read_chunk(ch)
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 struct chunkinfo *ch;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 if (!ch->len)
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 return;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 if (file_read_ptr + ch->len > file_expected_size) {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 fprintf(stderr, "error: FFS file is longer than expected\n");
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 exit(1);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 }
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 bcopy(ch->start, file_read_buf + file_read_ptr, ch->len);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 file_read_ptr += ch->len;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 }
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 static void
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 segment_read_callback(inf, opaque)
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 struct inode_info *inf;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 u_long opaque;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 struct chunkinfo chi;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 size_extra_chunk(inf, &chi);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 read_chunk(&chi);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 }
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 cmd_decode(argc, argv)
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 char **argv;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 struct map *map;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 char pathname[PATHNAME_BUF_SIZE];
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 int headino;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 struct inode_info *inf;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 struct chunkinfo chi;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 if (argc < 2) {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 usage: fprintf(stderr, "usage: decode file-keyword [band]\n");
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 exit(1);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 }
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 for (map = map_table; map->req_name; map++)
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 if (!strcmp(map->req_name, argv[1]))
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 break;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 if (!map->req_name) {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 fprintf(stderr, "error: file keyword \"%s\" not known\n",
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 argv[1]);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 exit(1);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 }
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 if (map->need_band) {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 if (argc < 3) {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 fprintf(stderr,
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 "error: band not specified for %s table\n",
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 map->req_name);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 exit(1);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 }
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 if (argc > 3)
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 goto usage;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 if (strlen(argv[2]) > 7) {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 fprintf(stderr,
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 "error: band name argument is too long\n");
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 exit(1);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 }
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 sprintf(pathname, map->pathname, argv[2]);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 } else {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 if (argc > 2)
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 goto usage;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 strcpy(pathname, map->pathname);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 }
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 file_expected_size = map->size;
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 read_ffs_image();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 find_inode_block();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 alloc_inode_table();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 find_root_inode();
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 headino = find_pathname(pathname);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 inf = inode_info[headino];
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 if (inf->type != 0xF1) {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 fprintf(stderr, "error: FFS object is not a regular file\n");
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 exit(1);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 }
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 size_head_chunk(inf, &chi);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 read_chunk(&chi);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 iterate_seg_file(headino, segment_read_callback, 0L, 0, 0);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 if (file_read_ptr < file_expected_size) {
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 fprintf(stderr, "error: FFS file is shorter than expected\n");
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 exit(1);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 }
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 map->decode_func(file_read_buf, stdout);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 exit(0);
d68275d47a32 tiffs IVA: decode command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 }