Lines Matching defs:file

120     /// The returned pointer will be stored as the private data for the file.
131 /// `file`. The function is a callback that is part of the VMA initializer. The kernel will do
185 /// A vtable for the file operations of a Rust miscdevice.
191 /// `file` and `inode` must be the file and inode for a file that is undergoing initialization.
192 /// The file must be associated with a `MiscDeviceRegistration<T>`.
193 unsafe extern "C" fn open(inode: *mut bindings::inode, raw_file: *mut bindings::file) -> c_int {
194 // SAFETY: The pointers are valid and for a file being opened.
200 // SAFETY: The open call of a file can access the private data.
210 // * This underlying file is valid for (much longer than) the duration of `T::open`.
211 // * There is no active fdget_pos region on the file on this thread.
212 let file = unsafe { File::from_raw_file(raw_file) };
214 let ptr = match T::open(file, misc) {
220 // of this file's private data. All future accesses to the private data is performed by
221 // other fops_* methods in this file, which all correctly cast the private data to the new
224 // SAFETY: The open call of a file can access the private data.
232 /// `file` and `inode` must be the file and inode for a file that is being released. The file
234 unsafe extern "C" fn release(_inode: *mut bindings::inode, file: *mut bindings::file) -> c_int {
235 // SAFETY: The release call of a file owns the private data.
236 let private = unsafe { (*file).private_data };
237 // SAFETY: The release call of a file owns the private data.
241 // * The file is valid for the duration of this call.
242 // * There is no active fdget_pos region on the file on this thread.
243 T::release(ptr, unsafe { File::from_raw_file(file) });
250 /// `file` must be a valid file that is associated with a `MiscDeviceRegistration<T>`.
251 /// `vma` must be a vma that is currently being mmap'ed with this file.
253 file: *mut bindings::file,
256 // SAFETY: The mmap call of a file can access the private data.
257 let private = unsafe { (*file).private_data };
265 // * The file is valid for the duration of this call.
266 // * There is no active fdget_pos region on the file on this thread.
267 let file = unsafe { File::from_raw_file(file) };
269 match T::mmap(device, file, area) {
277 /// `file` must be a valid file that is associated with a `MiscDeviceRegistration<T>`.
278 unsafe extern "C" fn ioctl(file: *mut bindings::file, cmd: c_uint, arg: c_ulong) -> c_long {
279 // SAFETY: The ioctl call of a file can access the private data.
280 let private = unsafe { (*file).private_data };
281 // SAFETY: Ioctl calls can borrow the private data of the file.
285 // * The file is valid for the duration of this call.
286 // * There is no active fdget_pos region on the file on this thread.
287 let file = unsafe { File::from_raw_file(file) };
289 match T::ioctl(device, file, cmd, arg) {
297 /// `file` must be a valid file that is associated with a `MiscDeviceRegistration<T>`.
300 file: *mut bindings::file,
304 // SAFETY: The compat ioctl call of a file can access the private data.
305 let private = unsafe { (*file).private_data };
306 // SAFETY: Ioctl calls can borrow the private data of the file.
310 // * The file is valid for the duration of this call.
311 // * There is no active fdget_pos region on the file on this thread.
312 let file = unsafe { File::from_raw_file(file) };
314 match T::compat_ioctl(device, file, cmd, arg) {
322 /// - `file` must be a valid file that is associated with a `MiscDeviceRegistration<T>`.
324 unsafe extern "C" fn show_fdinfo(seq_file: *mut bindings::seq_file, file: *mut bindings::file) {
325 // SAFETY: The release call of a file owns the private data.
326 let private = unsafe { (*file).private_data };
327 // SAFETY: Ioctl calls can borrow the private data of the file.
330 // * The file is valid for the duration of this call.
331 // * There is no active fdget_pos region on the file on this thread.
332 let file = unsafe { File::from_raw_file(file) };
337 T::show_fdinfo(device, m, file);