xref: /DragonOS/kernel/src/filesystem/sysfs/file.rs (revision 0dd8ff43325b494ea777dbe6e552fdc77b9dabc8)
1 #![allow(dead_code)]
2 use super::Attribute;
3 
4 #[derive(Debug)]
5 pub struct SysKernFilePriv {
6     attribute: Option<&'static dyn Attribute>,
7     // todo: 增加bin attribute,它和attribute二选一,只能有一个为Some
8 }
9 
10 impl SysKernFilePriv {
11     pub fn new(attribute: Option<&'static dyn Attribute>) -> Self {
12         if attribute.is_none() {
13             panic!("attribute can't be None");
14         }
15         return Self { attribute };
16     }
17 
18     pub fn attribute(&self) -> Option<&'static dyn Attribute> {
19         self.attribute
20     }
21 }
22