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

Simon Glass sjg at chromium.org
Thu Jan 23 03:59:48 CET 2014


+Stephen

Hi Frank,

On 22 January 2014 16:01, Frank Bormann <fbormann at yahoo.com> wrote:

> 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?
>

Perhaps .filesize, but this sounds reasonable to me.

Regards,
Simon


>
> Thanks,
> Frank
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>


More information about the U-Boot mailing list