From ff71dcb0126bf8924e5b1b3a9e30debb223e50d0 Mon Sep 17 00:00:00 2001 From: shaojinchun Date: Fri, 8 Jan 2021 11:52:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9cromfs=E7=9A=84lseek?= =?UTF-8?q?=E5=87=BD=E6=95=B0offset=E7=B1=BB=E5=9E=8B=E4=B8=BAoff=5Ft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/filesystems/cromfs/dfs_cromfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dfs/filesystems/cromfs/dfs_cromfs.c b/components/dfs/filesystems/cromfs/dfs_cromfs.c index 099d5a31da..b47292cbaa 100644 --- a/components/dfs/filesystems/cromfs/dfs_cromfs.c +++ b/components/dfs/filesystems/cromfs/dfs_cromfs.c @@ -688,7 +688,7 @@ static int dfs_cromfs_read(struct dfs_fd *file, void *buf, size_t count) return length; } -static int dfs_cromfs_lseek(struct dfs_fd *file, rt_off_t offset) +static int dfs_cromfs_lseek(struct dfs_fd *file, off_t offset) { if (offset <= file->size) { -- Gitee From b3c904121e894c7b70f3b9dac4d4b3d6e6c0900d Mon Sep 17 00:00:00 2001 From: shaojinchun Date: Fri, 8 Jan 2021 14:31:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=80=E5=A4=84dirent?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=87=8A=E6=94=BE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/filesystems/cromfs/dfs_cromfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/dfs/filesystems/cromfs/dfs_cromfs.c b/components/dfs/filesystems/cromfs/dfs_cromfs.c index b47292cbaa..bbd1255db8 100644 --- a/components/dfs/filesystems/cromfs/dfs_cromfs.c +++ b/components/dfs/filesystems/cromfs/dfs_cromfs.c @@ -929,7 +929,10 @@ static int dfs_cromfs_getdents(struct dfs_fd *file, struct dirent *dirp, uint32_ result = rt_mutex_take(&ci->lock, RT_WAITING_FOREVER); if (result != RT_EOK) + { + free(dirent); return -EINTR; + } di_mem = cromfs_dirent_cache_get(ci, fi->partition_pos, fi->size); if (di_mem) memcpy(dirent, di_mem, fi->size); -- Gitee From 578bcbca26c32c236ef1a77256f6adabc6be57d5 Mon Sep 17 00:00:00 2001 From: shaojinchun Date: Fri, 8 Jan 2021 14:34:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=AD=A3dfs=5Fcromfs=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/filesystems/cromfs/dfs_cromfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/dfs/filesystems/cromfs/dfs_cromfs.c b/components/dfs/filesystems/cromfs/dfs_cromfs.c index bbd1255db8..8584779826 100644 --- a/components/dfs/filesystems/cromfs/dfs_cromfs.c +++ b/components/dfs/filesystems/cromfs/dfs_cromfs.c @@ -341,7 +341,7 @@ static uint32_t cromfs_blk_read_bytes(cromfs_info *ci, uint32_t pos, void *buf, start_blk++; if (sector_nr) { - ret_len = rt_device_read(ci->device, start_blk, buf + off_s, sector_nr); + ret_len = rt_device_read(ci->device, start_blk, (char*)buf + off_s, sector_nr); if (ret_len != sector_nr) goto end; start_blk += sector_nr; @@ -351,7 +351,7 @@ static uint32_t cromfs_blk_read_bytes(cromfs_info *ci, uint32_t pos, void *buf, ret_len = rt_device_read(ci->device, start_blk, block_buff, 1); if (ret_len != 1) goto end; - memcpy(buf + off_s, block_buff, size); + memcpy((char*)buf + off_s, block_buff, size); } ret = size_bak; end: @@ -676,7 +676,7 @@ static int dfs_cromfs_read(struct dfs_fd *file, void *buf, size_t count) return 0; di_mem = cromfs_dirent_cache_get(ci, fi->partition_pos, fi->size); if (di_mem) - memcpy(buf, di_mem + file->pos, length); + memcpy(buf, (char*)di_mem + file->pos, length); rt_mutex_release(&ci->lock); if (!di_mem) return 0; -- Gitee