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

Function fmap_create

util/cbfstool/flashmap/fmap.c:254–271  ·  view source on GitHub ↗

allocate and initialize a new fmap structure */

Source from the content-addressed store, hash-verified

252
253/* allocate and initialize a new fmap structure */
254struct fmap *fmap_create(uint64_t base, uint32_t size, uint8_t *name)
255{
256 struct fmap *fmap;
257
258 fmap = malloc(sizeof(*fmap));
259 if (!fmap)
260 return NULL;
261
262 memset(fmap, 0, sizeof(*fmap));
263 memcpy(&fmap->signature, FMAP_SIGNATURE, strlen(FMAP_SIGNATURE));
264 fmap->ver_major = FMAP_VER_MAJOR;
265 fmap->ver_minor = FMAP_VER_MINOR;
266 fmap->base = htole64(base);
267 fmap->size = htole32(size);
268 memccpy(&fmap->name, name, '\0', FMAP_STRLEN);
269
270 return fmap;
271}
272
273/* free memory used by an fmap structure */
274void fmap_destroy(struct fmap *fmap) {

Callers 2

fmap_create_testFunction · 0.85
fmap_from_fmdFunction · 0.85

Calls 4

strlenFunction · 0.85
mallocFunction · 0.50
memsetFunction · 0.50
memcpyFunction · 0.50

Tested by 1

fmap_create_testFunction · 0.68