MCPcopy Create free account
hub / github.com/coreboot/coreboot / write_regions

Function write_regions

util/ifdtool/ifdtool.c:1179–1204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1177}
1178
1179static void write_regions(char *image, int size)
1180{
1181 unsigned int i;
1182 const struct frba *frba = find_frba(image, size);
1183
1184 if (!frba)
1185 exit(EXIT_FAILURE);
1186
1187 for (i = 0; i < max_regions; i++) {
1188 struct region region = get_region(frba, i);
1189 dump_region(i, frba);
1190 if (region.size > 0) {
1191 int region_fd;
1192 region_fd = open(region_names[i].filename,
1193 O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
1194 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
1195 if (region_fd < 0) {
1196 perror("Error while trying to open file");
1197 exit(EXIT_FAILURE);
1198 }
1199 if (write(region_fd, image + region.base, region.size) != region.size)
1200 perror("Error while writing");
1201 close(region_fd);
1202 }
1203 }
1204}
1205
1206static void validate_layout(char *image, int size)
1207{

Callers 1

mainFunction · 0.85

Calls 6

find_frbaFunction · 0.85
exitFunction · 0.85
get_regionFunction · 0.85
dump_regionFunction · 0.85
perrorFunction · 0.85
writeFunction · 0.85

Tested by

no test coverage detected