feat: add sync() to vfs

新增sync方法,该方法每次调用,会遍历系统内所有的mount点,调用各个文件系统注册
的sync方法,完成对所有已挂载文件系统的sync操作。

close #I480HV

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: I57ced9c3f7685a448defd17ae56c842796b5668f
This commit is contained in:
Guangyao Ma
2021-08-31 15:50:00 +08:00
parent de8257bc82
commit f67c4dae51
7 changed files with 29 additions and 27 deletions

View File

@@ -444,28 +444,6 @@ char *rindex(const char *s, int c)
return (char *)strrchr(s, c);
}
int (*sd_sync_fn)(int) = NULL;
int (*nand_sync_fn)(void) = NULL;
void set_sd_sync_fn(int (*sync_fn)(int))
{
sd_sync_fn = sync_fn;
}
void sync(void)
{
#ifdef LOSCFG_FS_FAT_CACHE
if (sd_sync_fn != NULL)
{
(void)sd_sync_fn(0);
(void)sd_sync_fn(1);
return;
}
#endif
PRINT_ERR("Unsupport syscall %s\n", __FUNCTION__);
}
static char *ls_get_fullpath(const char *path, struct dirent *pdirent)
{
char *fullpath = NULL;