From d455d8789d5b35a39a0a179b3af4b423db13bfdd Mon Sep 17 00:00:00 2001 From: Suriyan Ramasami Date: Mon, 17 Nov 2014 14:39:38 -0800 Subject: fs: API changes enabling extra parameter to return size of type loff_t The sandbox/ext4/fat/generic fs commands do not gracefully deal with files greater than 2GB. Negative values are returned in such cases. To handle this, the fs functions have been modified to take an additional parameter of type "* loff_t" which is then populated. The return value of the fs functions are used only for error conditions. Signed-off-by: Suriyan Ramasami Acked-by: Simon Glass [trini: Update board/gdsys/p1022/controlcenterd-id.c, drivers/fpga/zynqpl.c for changes] Signed-off-by: Tom Rini --- fs/fat/fat.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'fs/fat') diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 83d9ce7c57..04a51db6d4 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -1248,16 +1248,9 @@ int fat_exists(const char *filename) return ret == 0; } -int fat_size(const char *filename) +int fat_size(const char *filename, loff_t *size) { - loff_t size; - int ret; - - ret = do_fat_read_at(filename, 0, NULL, 0, LS_NO, 1, &size); - if (ret) - return ret; - else - return size; + return do_fat_read_at(filename, 0, NULL, 0, LS_NO, 1, size); } int file_fat_read_at(const char *filename, loff_t pos, void *buffer, @@ -1280,18 +1273,16 @@ int file_fat_read(const char *filename, void *buffer, int maxsize) return actread; } -int fat_read_file(const char *filename, void *buf, int offset, int len) +int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len, + loff_t *actread) { int ret; - loff_t actread; - ret = file_fat_read_at(filename, offset, buf, len, &actread); - if (ret) { + ret = file_fat_read_at(filename, offset, buf, len, actread); + if (ret) printf("** Unable to read file %s **\n", filename); - return ret; - } - return actread; + return ret; } void fat_close(void) -- cgit v1.2.1