-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[FIX][fal]char设备类型补充缺失的入参,适配DFSv2框架 #11112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: componentsReviewers: Maihuanyi Changed Files (Click to expand)
🏷️ Tag: components_falReviewers: illustriousness Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-01-05 13:52 CST)
📝 Review Instructions
|
components/fal/src/fal_rtt.c
Outdated
| #endif | ||
| { | ||
| int ret = 0; | ||
| ssize_t ret = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用rt_ssize_t 吧
components/fal/src/fal_rtt.c
Outdated
|
|
||
| static int char_dev_fread(struct dfs_file *fd, void *buf, rt_size_t count) | ||
| #ifdef RT_USING_DFS_V2 | ||
| static ssize_t char_dev_fread(struct dfs_file *fd, void *buf, size_t count, off_t *pos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这块实现感觉使用#define写会好一些
#ifdef RT_USING_DFS_V2
#define ssize_t char_dev_fread(struct dfs_file *fd, void *buf, size_t count, off_t *pos)
#else
#define ssize_t char_dev_fread(struct dfs_file *fd, void *buf, size_t count)
#endifThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有点没明白,用#define的话,那后续编译过程中ssize_t会用char_dev_fread(struct dfs_file *fd, void *buf, size_t count, off_t *pos)去展开?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有点没明白,用#define的话,那后续编译过程中ssize_t会用char_dev_fread(struct dfs_file *fd, void *buf, size_t count, off_t *pos)去展开?
兼容dfsv1和dfsv2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dfsv1和dfsv2已经通过#ifdef RT_USING_DFS_V2实现
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有点没明白,用#define的话,那后续编译过程中ssize_t会用char_dev_fread(struct dfs_file *fd, void *buf, size_t count, off_t *pos)去展开?
这样可读性会好一些
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有点没明白,用#define的话,那后续编译过程中ssize_t会用char_dev_fread(struct dfs_file *fd, void *buf, size_t count, off_t *pos)去展开?
你可以看下这个代码的实现能不能明白:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是这部分定义吗?这个我能理解,因为R_SCI_SPI_Write和R_SCI_B_SPI_Write入参数量和类型相同,用宏去展开,代码可读性是会更好。
#ifdef R_SCI_B_SPI_H
#define R_SCI_SPI_Write R_SCI_B_SPI_Write
#define R_SCI_SPI_Read R_SCI_B_SPI_Read
#define R_SCI_SPI_WriteRead R_SCI_B_SPI_WriteRead
#define R_SCI_SPI_Open R_SCI_B_SPI_Open
#define R_SCI_SPI_Close R_SCI_B_SPI_Close
#define R_SCI_SPI_CallbackSet R_SCI_B_SPI_CallbackSet
#endif
但目前的情况是dfsv1和dfsv2入参数量不一样,单纯从C编译的角度出发,我没get到修改建议的意图
#ifdef RT_USING_DFS_V2
#define ssize_t char_dev_fread(struct dfs_file *fd, void *buf, size_t count, off_t *pos)
#else
#define ssize_t char_dev_fread(struct dfs_file *fd, void *buf, size_t count)
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是这部分定义吗?这个我能理解,因为R_SCI_SPI_Write和R_SCI_B_SPI_Write入参数量和类型相同,用宏去展开,代码可读性是会更好。
#ifdef R_SCI_B_SPI_H #define R_SCI_SPI_Write R_SCI_B_SPI_Write #define R_SCI_SPI_Read R_SCI_B_SPI_Read #define R_SCI_SPI_WriteRead R_SCI_B_SPI_WriteRead #define R_SCI_SPI_Open R_SCI_B_SPI_Open #define R_SCI_SPI_Close R_SCI_B_SPI_Close #define R_SCI_SPI_CallbackSet R_SCI_B_SPI_CallbackSet #endif但目前的情况是dfsv1和dfsv2入参数量不一样,单纯从C编译的角度出发,我没get到修改建议的意图
#ifdef RT_USING_DFS_V2 #define ssize_t char_dev_fread(struct dfs_file *fd, void *buf, size_t count, off_t *pos) #else #define ssize_t char_dev_fread(struct dfs_file *fd, void *buf, size_t count) #endif
哦哦我看错了,这样可以
[docs][libcpu][arm][cortex-a] add comment for mmu.h (RT-Thread#11104) * [docs][libcpu][arm][cortex-a] add comment for mmu.h * [docs][libcpu][arm][cortex-a] beautify comment for mmu.h * [docs][libcpu][arm][cortex-a] delete extra space at the end of lines [fix] drivers: spi: refactor SPI bit operations into independent configuration - Add RT_USING_SPI_BITOPS as a separate configurable option - Make RT_USING_SOFT_SPI depend on RT_USING_SPI_BITOPS - Adjust build order in SConscript for proper com Signed-off-by: Runcheng Lu <[email protected]> feat:[stm32][can]: Validate CAN filter bank settings and skip invalid items [add][RTduino] Fitter RTduino in frdm-mcxa346 (RT-Thread#11067) * add mcxa346-RTduino [FIX]Locking for dfs_dentry_dump must be consistent with that of all other dentry functions. fix(dfs): align fd API declarations with DFS_USING_POSIX [tools][cmake]:Fix the cmake creation error of scons [FIX][fal]char设备类型补充缺失的入参,适配DFSv2框架 (RT-Thread#11112) * [FIX][fal]补充缺失的入参,适配DFSv2框架 * [FIX][fal]正确声明入参的数据类型 * [chg]按审查建议修改变量类型和代码格式。
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
FAL的char类型设备结构体注册到DFSv2框架存在,实现函数与框架结构体的函数指针入参数量不齐的问题
你的解决方案是什么 (what is your solution)
通过DFSv2宏补齐DFSv2框架注册函数的入参数量
请提供验证的bsp和config (provide the config and bsp)
BSP:
.config:
action:
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up