SPIFFS: Support lseek, stat, fstat
Support for lseek, stat, fstat added. Test extended to covert those functions.
This commit is contained in:
parent
bfa20af855
commit
22654a4de7
3 changed files with 33 additions and 3 deletions
|
@ -253,3 +253,30 @@ int _unlink_r(struct _reent *r, const char *path)
|
|||
{
|
||||
return SPIFFS_remove(&fs, path);
|
||||
}
|
||||
|
||||
int _fstat_r(struct _reent *r, int fd, void *buf)
|
||||
{
|
||||
spiffs_stat s;
|
||||
struct stat *sb = (struct stat*)buf;
|
||||
|
||||
int result = SPIFFS_fstat(&fs, (spiffs_file)(fd - FD_OFFSET), &s);
|
||||
sb->st_size = s.size;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int _stat_r(struct _reent *r, const char *pathname, void *buf)
|
||||
{
|
||||
spiffs_stat s;
|
||||
struct stat *sb = (struct stat*)buf;
|
||||
|
||||
int result = SPIFFS_stat(&fs, pathname, &s);
|
||||
sb->st_size = s.size;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
off_t _lseek_r(struct _reent *r, int fd, off_t offset, int whence)
|
||||
{
|
||||
return SPIFFS_lseek(&fs, (spiffs_file)(fd - FD_OFFSET), offset, whence);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue