xref: /DragonOS/kernel/src/filesystem/sysfs/dir.rs (revision b7b843beddea12cdedda90f6129b7c9980876112)
1 #![allow(dead_code)]
2 use alloc::sync::Arc;
3 
4 use crate::driver::base::device::KObject;
5 
6 use super::AttributeGroup;
7 
8 #[derive(Debug)]
9 pub struct SysKernDirPriv {
10     kobj: Arc<dyn KObject>,
11     attribute_group: Option<&'static dyn AttributeGroup>,
12 }
13 
14 impl SysKernDirPriv {
15     pub fn new(
16         kobj: Arc<dyn KObject>,
17         attribute_group: Option<&'static dyn AttributeGroup>,
18     ) -> Self {
19         Self {
20             kobj,
21             attribute_group,
22         }
23     }
24 
25     pub fn kobj(&self) -> Arc<dyn KObject> {
26         self.kobj.clone()
27     }
28 
29     pub fn attribute_group(&self) -> Option<&'static dyn AttributeGroup> {
30         self.attribute_group
31     }
32 }
33