Skip to content

Conversation

@ibvqeibob
Copy link

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

  • components/lwp/lwp_shm.c 中的 lwp 共享内存相关接口补充 Doxygen 注释,方便后续自动生成文档,也方便新同学和使用者理解这些 API 的作用和用法。
  • 该 PR 只涉及注释和文档相关内容,不修改任何功能逻辑。

你的解决方案是什么 (what is your solution)

  • 为以下对外 API 添加 Doxygen 注释:
    • lwp_shmget
    • lwp_shmrm
    • lwp_shmat
    • lwp_shm_ref_inc
    • lwp_shm_ref_dec
    • lwp_shmdt
    • lwp_shminfo
    • list_shm
  • struct lwp_shm_struct 添加结构体简介以及各字段的说明。
  • 保留原有逻辑不变,仅将原来的普通注释整理为 Doxygen 风格注释。

请提供验证的bsp和config (provide the config and bsp)

  • BSP:

    • 本 PR 为内核组件注释/文档类改动,与具体 BSP 无关,未依赖特定板卡环境。
    • 在本地默认配置下完成了编译,未发现编译错误。
  • .config:

    • 本 PR 未修改任何 Kconfig 选项或 .config 配置。
  • action:

    • 本 PR 仅修改注释,未新增独立 CI 配置,预期使用仓库默认的 CI 检查。
      ]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

@CLAassistant
Copy link

CLAassistant commented Nov 6, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!

为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  • 将目标分支设置为 \ Set the target branch to:feature/add-doxygen-lwp
  • 设置PR number为 \ Set the PR number to:10900
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将自动推送至你的分支。
    The formatted code will be automatically pushed to your branch.

完成后,提交将自动更新至 feature/add-doxygen-lwp 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the feature/add-doxygen-lwp branch automatically, and the related Pull Request will be updated.

如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!

@github-actions github-actions bot added RT-Smart RT-Thread Smart related PR or issues component: lwp Component labels Nov 6, 2025
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

📌 Code Review Assignment

🏷️ Tag: components

Reviewers: Maihuanyi

Changed Files (Click to expand)
  • components/lwp/lwp_shm.c

🏷️ Tag: components_lwp

Reviewers: xu18838022837

Changed Files (Click to expand)
  • components/lwp/lwp_shm.c

📊 Current Review Status (Last Updated: 2025-11-07 10:36 CST)

  • Maihuanyi Pending Review
  • xu18838022837 Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@ibvqeibob
Copy link
Author

ibvqeibob commented Nov 6, 2025 via email

@supperthomas supperthomas requested a review from Copilot November 6, 2025 02:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive Doxygen-style documentation comments to the LWP (Light Weight Process) shared memory management APIs in RT-Thread. The changes improve code maintainability by documenting the purpose, parameters, and return values of public functions and data structures.

Key Changes

  • Added detailed Doxygen documentation for the lwp_shm_struct control block
  • Documented all public shared memory APIs (lwp_shmget, lwp_shmrm, lwp_shmat, lwp_shmdt, lwp_shminfo, list_shm)
  • Documented reference counting functions (lwp_shm_ref_inc, lwp_shm_ref_dec)

Comment on lines +548 to +554
/**
* @brief Print information of all shared memory segments.
*
* This function prints the key, physical address, size and id of each
* shared memory segment to the console. It is exported as the Finsh/Msh
* command @c list_shm for debugging and inspection.
*/
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Documentation/文档]: The documentation mentions the function is 'exported as the Finsh/Msh command', but there is no corresponding export macro visible in this diff. Please verify that the MSH_CMD_EXPORT or FINSH_FUNCTION_EXPORT macro exists for this function, or update the documentation to reflect the actual export mechanism.

English: The documentation claims this function is exported as a Finsh/Msh command, but no export macro is shown in the changes. Either the documentation should clarify where/how the export happens, or verify the export macro exists elsewhere in the file.

中文: 文档声明此函数作为 Finsh/Msh 命令导出,但改动中未显示导出宏。文档应该说明导出在何处/如何发生,或验证导出宏在文件其他位置存在。

Copilot uses AI. Check for mistakes.
int ref;
size_t key;
struct rt_mem_obj mem_obj; /**< Memory object interface used by aspace/varea */
size_t addr; /**< Physical address of the shared memory; used as next pointer in the free list when unused */
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Documentation/文档]: The documentation for the addr field describes it as 'Physical address' and also mentions it is 'used as next pointer in the free list when unused'. This dual-purpose nature could be more clearly documented by specifying that the type is size_t (not a pointer type). Consider clarifying whether this holds a physical address value or should be cast when used as a linked list pointer.

English: The addr field documentation indicates it serves two purposes: storing a physical address when in use, and acting as a next pointer in the free list when unused. Since the type is size_t rather than a pointer type, the documentation should clarify how the dual usage is implemented (e.g., 'stored as integer value and cast to pointer for free list operations').

中文: addr 字段文档表明它有两个用途:使用时存储物理地址,未使用时作为空闲链表的 next 指针。由于类型是 size_t 而非指针类型,文档应该说明如何实现双重用途(例如,'存储为整数值,在空闲链表操作时强制转换为指针')。

Suggested change
size_t addr; /**< Physical address of the shared memory; used as next pointer in the free list when unused */
size_t addr; /**< Physical address of the shared memory when in use; when unused, stores the index of the next free item in the free list as an integer value (size_t). Interpretation depends on context; no pointer type is used, so casting may be required for free list operations. */

Copilot uses AI. Check for mistakes.
Add Doxygen-style comments for the lwp shared memory public APIs
in components/lwp/lwp_shm.c and the related control structure.
This change is documentation-only and does not modify any runtime
behavior or logic.

Signed-off-by: ibvqeibob <2601187225@qq.com>
@ibvqeibob ibvqeibob force-pushed the feature/add-doxygen-lwp branch from e688e35 to efdfec4 Compare November 6, 2025 07:08
@ibvqeibob ibvqeibob marked this pull request as draft November 6, 2025 09:38
@ibvqeibob ibvqeibob marked this pull request as ready for review November 6, 2025 09:40
@Rbb666 Rbb666 requested a review from unicornx November 6, 2025 09:54
@Rbb666 Rbb666 closed this Nov 7, 2025
@Rbb666 Rbb666 reopened this Nov 7, 2025
@ibvqeibob
Copy link
Author

我看了一下 Static code analysis 的日志,报错来自
src/libc/libm/.../w_ypowf1.c 里的一条 #error,跟本 PR 修改的 components/lwp/lwp_shm.c 没有关系。
本次改动只是补充注释,不影响功能逻辑。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: lwp Component RT-Smart RT-Thread Smart related PR or issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants