1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

vfs / treewide: Remove manual zeroing of vfs stat buffers

This commit is contained in:
chrysn 2022-02-12 12:31:38 +01:00
parent 4e84c19281
commit 2cb4b70458
5 changed files with 1 additions and 10 deletions

View File

@ -307,8 +307,6 @@ static int _fstat(vfs_file_t *filp, struct stat *buf)
FILINFO fi;
FRESULT res;
memset(buf, 0, sizeof(*buf));
res = f_stat(fs_desc->abs_path_str_buff, &fi);
if (res != FR_OK) {

View File

@ -227,7 +227,6 @@ static int _statvfs(vfs_mount_t *mountp, const char *restrict path, struct statv
return -EFAULT;
}
spiffs_desc_t *fs_desc = mountp->private_data;
memset(buf, 0, sizeof(*buf));
uint32_t total;
uint32_t used;
@ -347,8 +346,6 @@ static int _fstat(vfs_file_t *filp, struct stat *buf)
spiffs_stat stat;
s32_t ret;
memset(buf, 0, sizeof(*buf));
ret = SPIFFS_fstat(&fs_desc->fs, filp->private_data.value, &stat);
if (ret < 0) {

View File

@ -144,7 +144,6 @@ static int constfs_statvfs(vfs_mount_t *mountp, const char *restrict path, struc
}
constfs_t *fs = mountp->private_data;
/* clear out the stat buffer first */
memset(buf, 0, sizeof(*buf));
buf->f_bsize = sizeof(uint8_t); /* block size */
buf->f_frsize = sizeof(uint8_t); /* fundamental block size */
fsblkcnt_t f_blocks = 0;
@ -309,8 +308,7 @@ static int constfs_closedir(vfs_DIR *dirp)
static void _constfs_write_stat(const constfs_file_t *fp, struct stat *restrict buf)
{
/* clear out the stat buffer first */
memset(buf, 0, sizeof(*buf));
/* buffer is cleared by vfs already */
buf->st_nlink = 1;
buf->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
buf->st_size = fp->size;

View File

@ -328,7 +328,6 @@ static int socket_close(vfs_file_t *filp)
static inline int socket_fstat(vfs_file_t *filp, struct stat *buf)
{
(void)filp;
memset(buf, 0, sizeof(struct stat));
buf->st_mode |= (S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO);
buf->st_blksize = SOCKET_BLKSIZE;
return 0;

View File

@ -1046,7 +1046,6 @@ int vfs_sysop_stat_from_fstat(vfs_mount_t *mountp, const char *restrict path, st
if (err < 0) {
return err;
}
memset(buf, 0, sizeof(*buf));
err = f_op->fstat(&opened, buf);
f_op->close(&opened);
return err;