[core] 使用rt_memcpy rt_memset代替memcpy memset

This commit is contained in:
Meco Man
2022-01-09 00:23:18 +08:00
committed by Bernard Xiong
parent bb1084556f
commit f89a162ea3
25 changed files with 86 additions and 86 deletions
+4 -4
View File
@@ -55,18 +55,18 @@ int dfs_init(void)
}
/* clear filesystem operations table */
memset((void *)filesystem_operation_table, 0, sizeof(filesystem_operation_table));
rt_memset((void *)filesystem_operation_table, 0, sizeof(filesystem_operation_table));
/* clear filesystem table */
memset(filesystem_table, 0, sizeof(filesystem_table));
rt_memset(filesystem_table, 0, sizeof(filesystem_table));
/* clean fd table */
memset(&_fdtab, 0, sizeof(_fdtab));
rt_memset(&_fdtab, 0, sizeof(_fdtab));
/* create device filesystem lock */
rt_mutex_init(&fslock, "fslock", RT_IPC_FLAG_PRIO);
#ifdef DFS_USING_WORKDIR
/* set current working directory */
memset(working_directory, 0, sizeof(working_directory));
rt_memset(working_directory, 0, sizeof(working_directory));
working_directory[0] = '/';
#endif
+5 -5
View File
@@ -543,11 +543,11 @@ void ls(const char *pathname)
rt_kprintf("Directory %s:\n", path);
do
{
memset(&dirent, 0, sizeof(struct dirent));
rt_memset(&dirent, 0, sizeof(struct dirent));
length = dfs_file_getdents(&fd, &dirent, sizeof(struct dirent));
if (length > 0)
{
memset(&stat, 0, sizeof(struct stat));
rt_memset(&stat, 0, sizeof(struct stat));
/* build full path for each file */
fullpath = dfs_normalize_path(path, dirent.d_name);
@@ -607,7 +607,7 @@ void cat(const char *filename)
do
{
memset(buffer, 0, sizeof(buffer));
rt_memset(buffer, 0, sizeof(buffer));
length = dfs_file_read(&fd, buffer, sizeof(buffer) - 1);
if (length > 0)
{
@@ -692,7 +692,7 @@ static void copydir(const char *src, const char *dst)
do
{
memset(&dirent, 0, sizeof(struct dirent));
rt_memset(&dirent, 0, sizeof(struct dirent));
length = dfs_file_getdents(&cpfd, &dirent, sizeof(struct dirent));
if (length > 0)
@@ -716,7 +716,7 @@ static void copydir(const char *src, const char *dst)
break;
}
memset(&stat, 0, sizeof(struct stat));
rt_memset(&stat, 0, sizeof(struct stat));
if (dfs_file_stat(src_entry_full, &stat) != 0)
{
rt_kprintf("open file: %s failed\n", dirent.d_name);
+4 -4
View File
@@ -323,7 +323,7 @@ int dfs_mount(const char *device_name,
{
/* The underlying device has error, clear the entry. */
dfs_lock();
memset(fs, 0, sizeof(struct dfs_filesystem));
rt_memset(fs, 0, sizeof(struct dfs_filesystem));
goto err1;
}
@@ -339,7 +339,7 @@ int dfs_mount(const char *device_name,
/* mount failed */
dfs_lock();
/* clear filesystem table entry */
memset(fs, 0, sizeof(struct dfs_filesystem));
rt_memset(fs, 0, sizeof(struct dfs_filesystem));
goto err1;
}
@@ -403,7 +403,7 @@ int dfs_unmount(const char *specialfile)
rt_free(fs->path);
/* clear this filesystem table entry */
memset(fs, 0, sizeof(struct dfs_filesystem));
rt_memset(fs, 0, sizeof(struct dfs_filesystem));
dfs_unlock();
rt_free(fullpath);
@@ -590,7 +590,7 @@ int dfs_unmount_device(rt_device_t dev)
rt_free(fs->path);
/* clear this filesystem table entry */
memset(fs, 0, sizeof(struct dfs_filesystem));
rt_memset(fs, 0, sizeof(struct dfs_filesystem));
dfs_unlock();
+1 -1
View File
@@ -639,7 +639,7 @@ DIR *opendir(const char *name)
}
else
{
memset(t, 0, sizeof(DIR));
rt_memset(t, 0, sizeof(DIR));
t->fd = fd;
}