Bug 10087

Summary: RMC: RMC Project - reduce memory copying
Product: [Build System, Metadata & Runtime] BSPs Reporter: Jianxun Zhang <jianxun.zhang>
Component: bsps-meta-intelAssignee: Ng, Wei Tee <wei.tee.ng>
Status: RESOLVED OBSOLETE QA Contact:
Severity: enhancement    
Priority: Low CC: bluelightning, rebecca.swee.fun.chang, sgw, todor.minchev, tom.zanussi
Version: 2.2   
Target Milestone: 2.4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on: 10086    
Bug Blocks:    

Description Jianxun Zhang 2016-08-04 20:43:51 UTC
Sometimes what a RMC client wants is just fetch a file blob and treat content as a string. But in this case a client has to re-alloc memory to add a '\0' at the end of string.

I think RMC library can always alloc one extra byte of true length of file blob, and always set '\0' in the last byte. The true length of file blob will be still returned without +1 to be compatible for other scenarios.

With this trick, clients won't need to copy the content when they only want to read string.

Freeing memory allocated by RMC API shouldn't be affected since free functions don't take length.
Comment 1 Jianxun Zhang 2016-10-31 20:05:57 UTC
This task depends on the major change tracked in 10086.
Comment 2 Todor Minchev 2017-03-20 16:29:01 UTC
Performance can be also improved in write_fingerprint_file (src/rmc.c). Please see the TODO comment.
Comment 3 Todor Minchev 2017-05-22 16:55:09 UTC
Does not apply to RMC2.