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

Function flashrom_host_read

util/cbfstool/flashrom.c:79–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79int flashrom_host_read(struct buffer *buffer, const char *region)
80{
81 char *tmpfile;
82 char region_param[PATH_MAX];
83 int rv;
84
85 if (create_temp_file(&tmpfile) != 0)
86 return -1;
87 if (region)
88 snprintf(region_param, sizeof(region_param), "%s:%s", region,
89 tmpfile);
90 const char *const argv[] = {
91 FLASHROM_EXEC_NAME,
92 "-p",
93 FLASHROM_PROGRAMMER_INTERNAL_AP,
94 "-r",
95 region ? "-i" : tmpfile,
96 region ? region_param : NULL,
97 NULL,
98 };
99 rv = run_flashrom(argv);
100 if (!rv)
101 rv = buffer_from_file(buffer, tmpfile);
102
103 unlink(tmpfile);
104 free(tmpfile);
105
106 return rv;
107}
108
109int flashrom_host_write(struct buffer *buffer, const char *region)
110{

Callers 1

elog_readFunction · 0.85

Calls 5

create_temp_fileFunction · 0.85
run_flashromFunction · 0.85
buffer_from_fileFunction · 0.85
snprintfFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected