1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

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 <suriyan.r@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
[trini: Update board/gdsys/p1022/controlcenterd-id.c,
drivers/fpga/zynqpl.c for changes]
Signed-off-by: Tom Rini <trini@ti.com>
This commit is contained in:
Suriyan Ramasami
2014-11-17 14:39:38 -08:00
committed by Tom Rini
parent 96b1046d1c
commit d455d8789d
11 changed files with 138 additions and 122 deletions

View File

@@ -103,46 +103,35 @@ int sandbox_fs_exists(const char *filename)
return ret == 0;
}
int sandbox_fs_size(const char *filename)
int sandbox_fs_size(const char *filename, loff_t *size)
{
loff_t size;
int ret;
ret = os_get_filesize(filename, &size);
if (ret)
return ret;
else
return size;
return os_get_filesize(filename, size);
}
void sandbox_fs_close(void)
{
}
int fs_read_sandbox(const char *filename, void *buf, int offset, int len)
int fs_read_sandbox(const char *filename, void *buf, loff_t offset, loff_t len,
loff_t *actread)
{
int ret;
loff_t actread;
ret = sandbox_fs_read_at(filename, offset, buf, len, &actread);
if (ret) {
ret = sandbox_fs_read_at(filename, offset, buf, len, actread);
if (ret)
printf("** Unable to read file %s **\n", filename);
return ret;
}
return actread;
return ret;
}
int fs_write_sandbox(const char *filename, void *buf, int offset, int len)
int fs_write_sandbox(const char *filename, void *buf, loff_t offset,
loff_t len, loff_t *actwrite)
{
int ret;
loff_t actwrite;
ret = sandbox_fs_write_at(filename, offset, buf, len, &actwrite);
if (ret) {
ret = sandbox_fs_write_at(filename, offset, buf, len, actwrite);
if (ret)
printf("** Unable to write file %s **\n", filename);
return ret;
}
return actwrite;
return ret;
}