rt-thread icon indicating copy to clipboard operation
rt-thread copied to clipboard

[refact](netdev): Expose netdev_set_dns and netdev_set_if

Open PlainWaterK opened this issue 9 months ago • 3 comments

[Descriptions]: 1. Make these functions public to avoid code duplication and allow direct usage by other components. 2. Apply clang-format for consistent code style. [Root Cause]:NA [Side Effects]:NA

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

[

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

目前在开发应用代码时,netdev 接口目前需要多次函数调用(netdev_get_by_name, netdev_set_ipaddr等)来完整配置网络设置,这较为低效。因为 netdev_set_if 已经存在但属于静态函数,导致用户需要自己重新实现一个类似于netdev_set_if接口的流程去进行以太网配置。 改进此功能将允许通过单个函数调用直接配置以太网多项属性,从而简化网络配置代码并避免开发者去重复实现。 所以我认为将该函数接口从静态函数变为一个普通函数可能是更合适的,如果有什么理解不到位的地方欢迎大家指正。

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

Convert netdev_set_if and netdev_set_dns from static function to normal

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

  • BSP: cvitek
  • .config: CONFIG_BSP_USING_ETHERNET
  • action:

]

当前拉取/合并请求的状态 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/workflows/bsp_buildings.yml 详细请参考链接BSP自查

PlainWaterK avatar Mar 19 '25 10:03 PlainWaterK

image

supperthomas avatar Mar 23 '25 13:03 supperthomas

感谢PR,请仅提交需要修改的代码。格式化代码可以另起一个PR提交。

supperthomas avatar Mar 23 '25 13:03 supperthomas

感谢PR,请仅提交需要修改的代码。格式化代码可以另起一个PR提交。

May this patch be merged?

PlainWaterK avatar Apr 15 '25 06:04 PlainWaterK

你好,请问该PR是否能够合入主线,麻烦帮忙review一下,如果不可以的话,也请告诉我哪里的设计和代码修改是有问题的,谢谢

PlainWaterK avatar Jul 01 '25 12:07 PlainWaterK

LGTM

kurisaW avatar Jul 08 '25 09:07 kurisaW