aboutsummaryrefslogtreecommitdiff
path: root/libflash/file.c
AgeCommit message (Collapse)AuthorFilesLines
2016-08-02flash: Make size 64 bit safeMichael Neuling1-7/+7
This makes the size of flash 64 bit safe so that we can have flash devices greater than 4GB. This is especially useful for mambo disks passed through to Linux. Fortunately the device tree interface and the linux device driver are 64bit safe so no changes are required there. Userspace gard and flash tools are also updated to ensure "make check" still passes. Signed-off-by: Michael Neuling <mikey@neuling.org> Reviewed-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-05-18libflash: fix bug on reading truncated flash fileStewart Smith1-1/+1
If we had a truncated file where libflash would attempt to read past the end, instead of erroring out, we'd get stuck in an infinite loop. Why? Because we weren't acknowledging that read() returns 0 on EOF. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com>
2016-01-15libflash/blocklevel: Add keep_alive parameterCyril Bur1-19/+75
Currently the file backend will keep a file descriptor open until the structure is destroyed. This is undesirable for daemons and long running processes that only have a very occasional need to access the file. Keeping the file open requires users of blocklevel to close and reinit their structures every time, doing is isn't disastrous but can easily be managed at the interface level. This has been done at the blocklevel_device interface so as to provide minimal changes to arch_flash_init(). At the moment there isn't a need for the actually flash driver to be able to do this, this remains unimplmented there. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-11-09Free bl_prot_range on file_exit_close()Samuel Mendoza-Jonas1-0/+1
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Reviewed-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-06-23libflash/file: Add a file access backend to for the blocklevel interface.Cyril Bur1-0/+294
Currently libflash reads from files by using the dodgy file_flash.c which implements a very flash hardware themed interface but subverts it to read, write and erase from a file descriptor. With the introduction of this file backend, this will no longer be needed. Reviewed-By: Alistair Popple <alistair@popple.id.au> Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>