mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-30 08:07:59 +00:00
sandbox: implement exists() function
This hooks into the generic "file exists" support added in an earlier patch, and provides an implementation for the sandbox test environment. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
e5e897c01b
commit
0a30aa1e7e
3 changed files with 10 additions and 1 deletions
2
fs/fs.c
2
fs/fs.c
|
@ -114,7 +114,7 @@ static struct fstype_info fstypes[] = {
|
||||||
.probe = sandbox_fs_set_blk_dev,
|
.probe = sandbox_fs_set_blk_dev,
|
||||||
.close = sandbox_fs_close,
|
.close = sandbox_fs_close,
|
||||||
.ls = sandbox_fs_ls,
|
.ls = sandbox_fs_ls,
|
||||||
.exists = fs_exists_unsupported,
|
.exists = sandbox_fs_exists,
|
||||||
.read = fs_read_sandbox,
|
.read = fs_read_sandbox,
|
||||||
.write = fs_write_sandbox,
|
.write = fs_write_sandbox,
|
||||||
},
|
},
|
||||||
|
|
|
@ -72,6 +72,14 @@ int sandbox_fs_ls(const char *dirname)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sandbox_fs_exists(const char *filename)
|
||||||
|
{
|
||||||
|
ssize_t sz;
|
||||||
|
|
||||||
|
sz = os_get_filesize(filename);
|
||||||
|
return sz >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
void sandbox_fs_close(void)
|
void sandbox_fs_close(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ long sandbox_fs_read_at(const char *filename, unsigned long pos,
|
||||||
|
|
||||||
void sandbox_fs_close(void);
|
void sandbox_fs_close(void);
|
||||||
int sandbox_fs_ls(const char *dirname);
|
int sandbox_fs_ls(const char *dirname);
|
||||||
|
int sandbox_fs_exists(const char *filename);
|
||||||
int fs_read_sandbox(const char *filename, void *buf, int offset, int len);
|
int fs_read_sandbox(const char *filename, void *buf, int offset, int len);
|
||||||
int fs_write_sandbox(const char *filename, void *buf, int offset, int len);
|
int fs_write_sandbox(const char *filename, void *buf, int offset, int len);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue