[refact](netdev): Expose netdev_set_dns and netdev_set_if #10128
+183
−169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[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)
]
当前拉取/合并请求的状态 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