File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ unsafe extern "C" fn release_callback<T: FileOperations>(
113
113
file : * mut bindings:: file ,
114
114
) -> c_types:: c_int {
115
115
let ptr = mem:: replace ( & mut ( * file) . private_data , ptr:: null_mut ( ) ) ;
116
- drop ( T :: Wrapper :: from_pointer ( ptr as _ ) ) ;
116
+ T :: release ( T :: Wrapper :: from_pointer ( ptr as _ ) , & File :: from_ptr ( file ) ) ;
117
117
0
118
118
}
119
119
@@ -223,6 +223,11 @@ pub trait FileOperations: Sync + Sized {
223
223
/// pointer in `struct file_operations`.
224
224
fn open ( ) -> KernelResult < Self :: Wrapper > ;
225
225
226
+ /// Cleans up after the last reference to the file goes away. Note that the object is moved, so
227
+ /// it will be freed automatically unless the implemention moves it elsewhere. Corresponds to
228
+ /// the `release` function pointer in `struct file_operations`.
229
+ fn release ( _obj : Self :: Wrapper , _file : & File ) { }
230
+
226
231
/// Reads data from this file to userspace. Corresponds to the `read`
227
232
/// function pointer in `struct file_operations`.
228
233
const READ : ReadFn < Self > = None ;
You can’t perform that action at this time.
0 commit comments