[U-Boot] File system API: Read file size without reading file contents

Frank Bormann fbormann at yahoo.com
Thu Jan 23 00:01:11 CET 2014


Hi All,

I would like to read a configuration file from an ext4 disk partition in u-boot and parse its contents. In order to malloc a buffer of sufficient size to read the entire file contents, I would need to know the file size before actually reading it.

As far as I understand, the current struct fstype_info API does not allow me to do that (other than parsing the ls output). While the read function does in fact return the file size, it does so only after the file was already read into memory. Lower level functions for ext4 such as ext4fs_open() do however provide this information before reading the file contents. Unless there is something that I have missed, how would you feel about me adding a .size function to the struct fstype_info API to expose this information on the top-level API?

Thanks,
Frank



More information about the U-Boot mailing list