From d2ec1f3eaac98e693414e46fe236edf140c5e6f0 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Thu, 1 Oct 2015 06:46:52 +0000 Subject: [PATCH] [DFS] remove st_blksize in the struct stat --- bsp/efm32/copy_this_file_dfs_elm.c | 1 - bsp/simulator/drivers/dfs_win32.c | 2 -- components/dfs/filesystems/devfs/devfs.c | 6 ++---- components/dfs/filesystems/elmfat/dfs_elm.c | 1 - components/dfs/filesystems/jffs2/dfs_jffs2.c | 3 +-- components/dfs/filesystems/nfs/dfs_nfs.c | 1 - components/dfs/filesystems/ramfs/dfs_ramfs.c | 1 - components/dfs/filesystems/romfs/dfs_romfs.c | 1 - components/dfs/filesystems/uffs/dfs_uffs.c | 3 +-- components/dfs/include/dfs_def.h | 1 - components/dfs/src/dfs_file.c | 1 - components/dfs/src/dfs_posix.c | 1 - components/external/SQLite-3.8.1/src/os_rtthread.c | 2 +- 13 files changed, 5 insertions(+), 19 deletions(-) diff --git a/bsp/efm32/copy_this_file_dfs_elm.c b/bsp/efm32/copy_this_file_dfs_elm.c index eea9ff7e6d..2f648750c9 100644 --- a/bsp/efm32/copy_this_file_dfs_elm.c +++ b/bsp/efm32/copy_this_file_dfs_elm.c @@ -641,7 +641,6 @@ int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st) st->st_size = file_info.fsize; st->st_mtime = file_info.ftime; - st->st_blksize = 512; } #if _USE_LFN diff --git a/bsp/simulator/drivers/dfs_win32.c b/bsp/simulator/drivers/dfs_win32.c index 8d6e7b0305..a0ebcf5e6e 100644 --- a/bsp/simulator/drivers/dfs_win32.c +++ b/bsp/simulator/drivers/dfs_win32.c @@ -505,8 +505,6 @@ static int dfs_win32_stat(struct dfs_filesystem *fs, const char *path, struct st st->st_mtime = time_tmp.QuadPart; } - st->st_blksize = 0; - FindClose(hFind); return 0; diff --git a/components/dfs/filesystems/devfs/devfs.c b/components/dfs/filesystems/devfs/devfs.c index 1f4569558f..fcbb738572 100644 --- a/components/dfs/filesystems/devfs/devfs.c +++ b/components/dfs/filesystems/devfs/devfs.c @@ -213,8 +213,7 @@ int dfs_device_fs_stat(struct dfs_filesystem *fs, const char *path, struct stat st->st_size = 0; st->st_mtime = 0; - st->st_blksize = 512; - + return DFS_STATUS_OK; } else @@ -238,8 +237,7 @@ int dfs_device_fs_stat(struct dfs_filesystem *fs, const char *path, struct stat st->st_size = 0; st->st_mtime = 0; - st->st_blksize = 512; - + return DFS_STATUS_OK; } } diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c index 3658a5dc80..ca2c082972 100644 --- a/components/dfs/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/filesystems/elmfat/dfs_elm.c @@ -738,7 +738,6 @@ int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st) st->st_mode &= ~(DFS_S_IWUSR | DFS_S_IWGRP | DFS_S_IWOTH); st->st_size = file_info.fsize; - st->st_blksize = 512; /* get st_mtime. */ { diff --git a/components/dfs/filesystems/jffs2/dfs_jffs2.c b/components/dfs/filesystems/jffs2/dfs_jffs2.c index 6516797544..78c7730136 100644 --- a/components/dfs/filesystems/jffs2/dfs_jffs2.c +++ b/components/dfs/filesystems/jffs2/dfs_jffs2.c @@ -331,7 +331,7 @@ static int dfs_jffs2_open(struct dfs_fd* file) return jffs2_result_to_dfs(result); } - /* save this pointer, it will be used when calling read()£¬write(), + /* save this pointer, it will be used when calling read()��write(), flush(), lessk(), and will be rt_free when calling close()*/ file->data = jffs2_file; file->pos = jffs2_file->f_offset; @@ -686,7 +686,6 @@ static int dfs_jffs2_stat(struct dfs_filesystem* fs, const char *path, struct st st->st_dev = 0; st->st_size = s.st_size; st->st_mtime = s.st_mtime; - st->st_blksize = 1;//fixme: what's this field? return 0; } diff --git a/components/dfs/filesystems/nfs/dfs_nfs.c b/components/dfs/filesystems/nfs/dfs_nfs.c index 7ff5fef5f7..4bf96c2aeb 100644 --- a/components/dfs/filesystems/nfs/dfs_nfs.c +++ b/components/dfs/filesystems/nfs/dfs_nfs.c @@ -850,7 +850,6 @@ int nfs_stat(struct dfs_filesystem *fs, const char *path, struct stat *st) st->st_size = info->size; st->st_mtime = info->mtime.seconds; - st->st_blksize = 512; xdr_free((xdrproc_t)xdr_GETATTR3res, (char *)&res); xdr_free((xdrproc_t)xdr_nfs_fh3, (char *)handle); diff --git a/components/dfs/filesystems/ramfs/dfs_ramfs.c b/components/dfs/filesystems/ramfs/dfs_ramfs.c index fecebe4688..7533b6f192 100644 --- a/components/dfs/filesystems/ramfs/dfs_ramfs.c +++ b/components/dfs/filesystems/ramfs/dfs_ramfs.c @@ -292,7 +292,6 @@ int dfs_ramfs_stat(struct dfs_filesystem *fs, st->st_size = dirent->size; st->st_mtime = 0; - st->st_blksize = 512; return DFS_STATUS_OK; } diff --git a/components/dfs/filesystems/romfs/dfs_romfs.c b/components/dfs/filesystems/romfs/dfs_romfs.c index 65fc331466..1dd41b41eb 100644 --- a/components/dfs/filesystems/romfs/dfs_romfs.c +++ b/components/dfs/filesystems/romfs/dfs_romfs.c @@ -245,7 +245,6 @@ int dfs_romfs_stat(struct dfs_filesystem *fs, const char *path, struct stat *st) st->st_size = dirent->size; st->st_mtime = 0; - st->st_blksize = 512; return DFS_STATUS_OK; } diff --git a/components/dfs/filesystems/uffs/dfs_uffs.c b/components/dfs/filesystems/uffs/dfs_uffs.c index faaee0990e..87517aaaf5 100644 --- a/components/dfs/filesystems/uffs/dfs_uffs.c +++ b/components/dfs/filesystems/uffs/dfs_uffs.c @@ -347,7 +347,7 @@ static int dfs_uffs_open(struct dfs_fd* file) return uffs_result_to_dfs(uffs_get_error()); } - /* save this pointer, it will be used when calling read()£¬write(), + /* save this pointer, it will be used when calling read()��write(), * flush(), seek(), and will be free when calling close()*/ file->data = (void *)fd; @@ -619,7 +619,6 @@ static int dfs_uffs_stat(struct dfs_filesystem* fs, const char *path, struct sta st->st_mtime = s.st_mtime; mtd = RT_MTD_NAND_DEVICE(fs->dev_id); - st->st_blksize = mtd->page_size; return 0; } diff --git a/components/dfs/include/dfs_def.h b/components/dfs/include/dfs_def.h index a73ff4ec8b..e509c4a3da 100644 --- a/components/dfs/include/dfs_def.h +++ b/components/dfs/include/dfs_def.h @@ -261,7 +261,6 @@ struct stat rt_uint16_t st_mode; rt_uint32_t st_size; rt_time_t st_mtime; - rt_uint32_t st_blksize; }; struct statfs diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c index aebe2996c6..752933b66f 100644 --- a/components/dfs/src/dfs_file.c +++ b/components/dfs/src/dfs_file.c @@ -392,7 +392,6 @@ int dfs_file_stat(const char *path, struct stat *buf) buf->st_size = 0; buf->st_mtime = 0; - buf->st_blksize = 512; /* release full path */ rt_free(fullpath); diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c index c379d5c969..52a9139d80 100644 --- a/components/dfs/src/dfs_posix.c +++ b/components/dfs/src/dfs_posix.c @@ -368,7 +368,6 @@ int fstat(int fildes, struct stat *buf) buf->st_size = d->size; buf->st_mtime = 0; - buf->st_blksize = 512; fd_put(d); diff --git a/components/external/SQLite-3.8.1/src/os_rtthread.c b/components/external/SQLite-3.8.1/src/os_rtthread.c index fb51b53685..6d57ed7098 100644 --- a/components/external/SQLite-3.8.1/src/os_rtthread.c +++ b/components/external/SQLite-3.8.1/src/os_rtthread.c @@ -1728,7 +1728,7 @@ static int fcntlSizeHint(rtthreadFile *pFile, i64 nByte){ ** is the same technique used by glibc to implement posix_fallocate() ** on systems that do not have a real fallocate() system call. */ - int nBlk = buf.st_blksize; /* File-system block size */ + int nBlk = 4096; // no blksize in RT-Thread, use 4096. /* File-system block size */ i64 iWrite; /* Next offset to write to */ if( robust_ftruncate(pFile->h, nSize) ){