[FIX][fal]char设备类型补充缺失的入参,适配DFSv2框架 (#11112)
Some checks failed
RT-Thread BSP Static Build Check / 🔍 Summary of Git Diff Changes (push) Has been cancelled
RT-Thread BSP Static Build Check / ${{ matrix.legs.RTT_BSP }} (push) Has been cancelled
RT-Thread BSP Static Build Check / collect-artifacts (push) Has been cancelled
doc_doxygen / doxygen_doc generate (push) Has been cancelled
doc_doxygen / deploy (push) Has been cancelled
pkgs_test / change (push) Has been cancelled
utest_auto_run / A9 :components/dfs.cfg (push) Has been cancelled
utest_auto_run / A9 :components/lwip.cfg (push) Has been cancelled
utest_auto_run / A9 :components/netdev.cfg (push) Has been cancelled
utest_auto_run / A9 :components/sal.cfg (push) Has been cancelled
utest_auto_run / A9 :cpp11/cpp11.cfg (push) Has been cancelled
utest_auto_run / AARCH64-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / A9-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / XUANTIE-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64 :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64-smp :default.cfg (push) Has been cancelled
utest_auto_run / A9 :default.cfg (push) Has been cancelled
utest_auto_run / A9-smp :default.cfg (push) Has been cancelled
utest_auto_run / RISCV :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-smp :default.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / RISCV :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/ipc.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/kernel_basic.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/mem.cfg (push) Has been cancelled
ToolsCI / Tools (push) Has been cancelled

* [FIX][fal]补充缺失的入参,适配DFSv2框架

* [FIX][fal]正确声明入参的数据类型

* [chg]按审查建议修改变量类型和代码格式。
This commit is contained in:
AngryProton
2026-01-06 17:12:55 +08:00
committed by GitHub
parent 96bce36533
commit 3d8114bcfe

View File

@@ -435,42 +435,56 @@ static int char_dev_fopen(struct dfs_file *fd)
return RT_EOK;
}
static int char_dev_fread(struct dfs_file *fd, void *buf, rt_size_t count)
#ifdef RT_USING_DFS_V2
static rt_ssize_t char_dev_fread(struct dfs_file *fd, void *buf, size_t count, off_t *pos)
#else
static rt_ssize_t char_dev_fread(struct dfs_file *fd, void *buf, size_t count)
#endif
{
int ret = 0;
rt_ssize_t ret = 0;
struct fal_char_device *part = (struct fal_char_device *) fd->vnode->data;
#ifndef RT_USING_DFS_V2
off_t *pos = &(fd->pos);
#endif
RT_ASSERT(part != RT_NULL);
if (DFS_FILE_POS(fd) + count > part->fal_part->len)
count = part->fal_part->len - DFS_FILE_POS(fd);
if (*pos + count > part->fal_part->len)
count = part->fal_part->len - *pos;
ret = fal_partition_read(part->fal_part, DFS_FILE_POS(fd), buf, count);
ret = fal_partition_read(part->fal_part, *pos, buf, count);
if (ret != (int)(count))
if (ret != (rt_ssize_t)(count))
return 0;
DFS_FILE_POS(fd) += ret;
*pos += ret;
return ret;
}
static int char_dev_fwrite(struct dfs_file *fd, const void *buf, rt_size_t count)
#ifdef RT_USING_DFS_V2
static rt_ssize_t char_dev_fwrite(struct dfs_file *fd, const void *buf, size_t count, off_t *pos)
#else
static rt_ssize_t char_dev_fwrite(struct dfs_file *fd, const void *buf, size_t count)
#endif
{
int ret = 0;
rt_ssize_t ret = 0;
struct fal_char_device *part = (struct fal_char_device *) fd->vnode->data;
#ifndef RT_USING_DFS_V2
off_t *pos = &(fd->pos);
#endif
RT_ASSERT(part != RT_NULL);
if (DFS_FILE_POS(fd) + count > part->fal_part->len)
count = part->fal_part->len - DFS_FILE_POS(fd);
if (*pos + count > part->fal_part->len)
count = part->fal_part->len - *pos;
ret = fal_partition_write(part->fal_part, DFS_FILE_POS(fd), buf, count);
ret = fal_partition_write(part->fal_part, *pos, buf, count);
if (ret != (int) count)
if (ret != (rt_ssize_t) count)
return 0;
DFS_FILE_POS(fd) += ret;
*pos += ret;
return ret;
}