kernel/object/capability/mod.rs
1//! Capability traits for KernelObject resources
2//!
3//! This module defines capability traits that represent the operations
4//! that can be performed on different types of kernel objects.
5
6pub mod stream;
7pub mod file;
8
9use crate::object::KernelObject;
10
11// Re-export stream types for backward compatibility
12pub use stream::{StreamError, StreamOps};
13
14// Re-export file types for backward compatibility
15pub use file::{FileObject, SeekFrom};
16
17/// Clone operations capability
18///
19/// This trait represents the ability to properly clone an object
20/// with custom semantics. Objects that need special cloning behavior
21/// (like pipes that need to update reader/writer counts) should implement this.
22///
23/// The presence of this capability indicates that the object needs custom
24/// clone semantics beyond simple Arc::clone.
25pub trait CloneOps: Send + Sync {
26 /// Perform a custom clone operation and return the cloned object
27 ///
28 /// This method should handle any object-specific cloning logic,
29 /// such as incrementing reference counts for pipes or other shared resources.
30 /// Returns the cloned object as a KernelObject.
31 fn custom_clone(&self) -> KernelObject;
32}