Trait kernel::file::OpenAdapter
source · [−]pub trait OpenAdapter<T: Sync> {
unsafe fn convert(_inode: *mut inode, _file: *mut file) -> *const T;
}
Expand description
Trait for extracting file open arguments from kernel data structures.
This is meant to be implemented by registration managers.
Required Methods
sourceunsafe fn convert(_inode: *mut inode, _file: *mut file) -> *const T
unsafe fn convert(_inode: *mut inode, _file: *mut file) -> *const T
Converts untyped data stored in [struct inode
] and [struct file
] (when [struct file_operations::open
] is called) into the given type. For example, for miscdev
devices, a pointer to the registered [struct miscdev
] is stored in [struct file::private_data
].
Safety
This function must be called only when [struct file_operations::open
] is being called for
a file that was registered by the implementer. The returned pointer must be valid and
not-null.