2018-06-13 14:36:15 +02:00
|
|
|
#include "devoptab_sd.h"
|
2018-05-27 13:11:45 +02:00
|
|
|
|
|
|
|
int
|
|
|
|
__wut_fs_fstat(struct _reent *r,
|
|
|
|
void *fd,
|
|
|
|
struct stat *st)
|
|
|
|
{
|
|
|
|
FSStatus rc;
|
|
|
|
FSStat fsstat;
|
|
|
|
__wut_fs_file_t *file = (__wut_fs_file_t *)fd;
|
|
|
|
|
|
|
|
// Set up command block
|
|
|
|
FSCmdBlock fsCmd;
|
|
|
|
FSInitCmdBlock(&fsCmd);
|
|
|
|
|
2018-06-13 14:36:15 +02:00
|
|
|
rc = FSGetStatFile(__wut_devoptab_sd_client, &fsCmd, file->fd, &fsstat, -1);
|
2018-05-27 13:11:45 +02:00
|
|
|
|
|
|
|
if (rc >= 0) {
|
|
|
|
memset(st, 0, sizeof(struct stat));
|
|
|
|
st->st_size = fsstat.size;
|
|
|
|
st->st_uid = fsstat.owner;
|
|
|
|
st->st_gid = fsstat.group;
|
|
|
|
st->st_nlink = 1;
|
|
|
|
st->st_mode = fsstat.mode;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
r->_errno = __wut_fs_translate_error(rc);
|
|
|
|
return -1;
|
|
|
|
}
|