path: root/fs
diff options
authorMax Krummenacher <>2015-08-05 17:16:58 +0200
committerTom Rini <>2015-08-13 07:19:35 -0400
commit7a3e70cfd88cc8062a106ed07bade5a38f146758 (patch)
treeff698da26a585f7beb20b1e14101f0cff3fb90e1 /fs
parentf06b454b1c4420d1698fa1c62b8dd0bab060b691 (diff)
fs/fs.c: read up to EOF when len would read past EOF allows for reading files in chunks from the shell. When this feature is used to read past the end of a file an error was returned instead of returning the bytes read up to the end of file. Thus the following fails in the shell: offset = 0 len = chunksize do read file, offset, len write data until bytes_read < len The patch changes the behaviour to printing an informational message and returning the actual read number of bytes aka read(2) behaviour for convenient use in U-Boot scripts. Signed-off-by: Max Krummenacher <> Signed-off-by: Marcel Ziswiler <> Acked-by: Marek Vasut <> Signed-off-by: Stefan Agner <> Signed-off-by: Marcel Ziswiler <>
Diffstat (limited to 'fs')
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/fs.c b/fs/fs.c
index ac0897d94a..827b143e85 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -301,10 +301,8 @@ int fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,
/* If we requested a specific number of bytes, check we got it */
- if (ret == 0 && len && *actread != len) {
- printf("** Unable to read file %s **\n", filename);
- ret = -1;
- }
+ if (ret == 0 && len && *actread != len)
+ printf("** %s shorter than offset + len **\n", filename);
return ret;
OpenPOWER on IntegriCloud