Skip to content

实现内核通知链 notifier chain#316

Merged
fslongjin merged 11 commits intoDragonOS-Community:masterfrom
ccrysisa:patch-notifier-chain
Aug 6, 2023
Merged

实现内核通知链 notifier chain#316
fslongjin merged 11 commits intoDragonOS-Community:masterfrom
ccrysisa:patch-notifier-chain

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

@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.

2 participants