| 137 | } |
| 138 | |
| 139 | static int fpt_parse(const char *image_name) |
| 140 | { |
| 141 | struct buffer *input_buff = &fpt.input_buff; |
| 142 | struct buffer fpt_buff; |
| 143 | |
| 144 | if (buffer_from_file(input_buff, image_name)) { |
| 145 | ERROR("Failed to read input file %s\n", image_name); |
| 146 | return -1; |
| 147 | } |
| 148 | |
| 149 | if (get_fpt_buff(input_buff, &fpt_buff)) |
| 150 | return -1; |
| 151 | |
| 152 | fpt.hdr_ops = get_fpt_hdr_ops(&fpt_buff); |
| 153 | if (fpt.hdr_ops == NULL) { |
| 154 | ERROR("FPT header format not supported!\n"); |
| 155 | return -1; |
| 156 | } |
| 157 | |
| 158 | fpt.hdr = fpt.hdr_ops->read(&fpt_buff); |
| 159 | if (!fpt.hdr) { |
| 160 | ERROR("Unable to read FPT header!\n"); |
| 161 | return -1; |
| 162 | } |
| 163 | |
| 164 | return read_fpt_entries(&fpt_buff); |
| 165 | } |
| 166 | |
| 167 | static bool is_partition_valid(const struct fpt_entry *e) |
| 168 | { |
no test coverage detected