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

Function read_member

util/cbfstool/ifwitool.c:381–403  ·  view source on GitHub ↗

* Read header/entry members in little-endian format. * Returns the offset up to which the read was performed. */

Source from the content-addressed store, hash-verified

379 * Returns the offset up to which the read was performed.
380*/
381static size_t read_member(void *src, size_t offset, size_t size_bytes,
382 void *dst)
383{
384 switch (size_bytes) {
385 case 1:
386 *(uint8_t *)dst = read_at_le8(src, offset);
387 break;
388 case 2:
389 *(uint16_t *)dst = read_at_le16(src, offset);
390 break;
391 case 4:
392 *(uint32_t *)dst = read_at_le32(src, offset);
393 break;
394 case 8:
395 *(uint64_t *)dst = read_at_le64(src, offset);
396 break;
397 default:
398 ERROR("Read size not supported %zd\n", size_bytes);
399 exit(-1);
400 }
401
402 return (offset + size_bytes);
403}
404
405/*
406 * Convert to little endian format.

Callers 3

bpdt_read_headerFunction · 0.70
bpdt_read_entriesFunction · 0.70
parse_subpart_dirFunction · 0.70

Calls 5

read_at_le8Function · 0.85
read_at_le16Function · 0.85
read_at_le32Function · 0.85
read_at_le64Function · 0.85
exitFunction · 0.85

Tested by

no test coverage detected