* [U-Boot] File system API: Read file size without reading file contents
@ 2014-01-22 23:01 Frank Bormann
2014-01-23 2:59 ` Simon Glass
0 siblings, 1 reply; 2+ messages in thread
From: Frank Bormann @ 2014-01-22 23:01 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [U-Boot] File system API: Read file size without reading file contents
2014-01-22 23:01 [U-Boot] File system API: Read file size without reading file contents Frank Bormann
@ 2014-01-23 2:59 ` Simon Glass
0 siblings, 0 replies; 2+ messages in thread
From: Simon Glass @ 2014-01-23 2:59 UTC (permalink / raw)
To: u-boot
+Stephen
Hi Frank,
On 22 January 2014 16:01, Frank Bormann <fbormann@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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-23 2:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-22 23:01 [U-Boot] File system API: Read file size without reading file contents Frank Bormann
2014-01-23 2:59 ` Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.