Skip to content
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

实现内核通知链 notifier chain #316

Merged
merged 11 commits into from
Aug 6, 2023

Conversation

ccrysisa
Copy link
Contributor

@ccrysisa ccrysisa commented Aug 3, 2023

No description provided.

use core::ffi::c_void;

/// @brief 通知链中注册的回调函数类型
type NotifierFnT = fn(Arc<NotifierBlock>, u64, *mut c_void) -> i32;
Copy link
Member

Choose a reason for hiding this comment

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

这个我觉得不要用裸指针的c_void,这个不好。也许可把notifierblock弄成trait,具有2个方法

  • call()
  • priority()

/// return 返回最后一次回调函数的返回值
// TODO: 未加入 RCU 锁的操作?
// TODO: 增加 NOTIFIER_STOP_MASK 相关功能
pub fn call_chain(&self, val: u64, v: *mut c_void, nr_to_call: i32, nr_calls: *mut i32) -> i32 {
Copy link
Member

Choose a reason for hiding this comment

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

这里不要这样写,我感觉不需要任何unsafe

@ccrysisa ccrysisa force-pushed the patch-notifier-chain branch from 1663877 to 38aa4c1 Compare August 4, 2023 09:46
@fslongjin fslongjin merged commit 729a96e into DragonOS-Community:master Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants