MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / dfs_tmpfs_stat

Function dfs_tmpfs_stat

components/dfs/dfs_v1/filesystems/tmpfs/dfs_tmpfs.c:483–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481}
482
483int dfs_tmpfs_stat(struct dfs_filesystem *fs,
484 const char *path,
485 struct stat *st)
486{
487 rt_size_t size;
488 struct tmpfs_file *d_file;
489 struct tmpfs_sb *superblock;
490
491 superblock = (struct tmpfs_sb *)fs->data;
492 d_file = dfs_tmpfs_lookup(superblock, path, &size);
493
494 if (d_file == NULL)
495 return -ENOENT;
496
497 st->st_dev = (dev_t)dfs_filesystem_lookup(fs->path);
498 st->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH |
499 S_IWUSR | S_IWGRP | S_IWOTH;
500 if (d_file->type == TMPFS_TYPE_DIR)
501 {
502 st->st_mode &= ~S_IFREG;
503 st->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
504 }
505
506 st->st_size = d_file->size;
507 st->st_mtime = 0;
508
509 return RT_EOK;
510}
511
512int dfs_tmpfs_getdents(struct dfs_file *file,
513 struct dirent *dirp,

Callers

nothing calls this directly

Calls 2

dfs_filesystem_lookupFunction · 0.85
dfs_tmpfs_lookupFunction · 0.70

Tested by

no test coverage detected