Lines Matching full:file
16 fs::File,
114 /// The returned pointer will be stored as the private data for the file.
115 fn open(_file: &File, _misc: &MiscDeviceRegistration<Self>) -> Result<Self::Ptr>; in open() argument
118 fn release(device: Self::Ptr, _file: &File) { in release() argument
129 _file: &File, in ioctl() argument
146 _file: &File, in compat_ioctl() argument
157 _file: &File, in show_fdinfo() argument
163 /// A vtable for the file operations of a Rust miscdevice.
169 /// `file` and `inode` must be the file and inode for a file that is undergoing initialization.
170 /// The file must be associated with a `MiscDeviceRegistration<T>`.
171 unsafe extern "C" fn open(inode: *mut bindings::inode, raw_file: *mut bindings::file) -> c_int { in open()
172 // SAFETY: The pointers are valid and for a file being opened. in open()
178 // SAFETY: The open call of a file can access the private data. in open()
188 // * This underlying file is valid for (much longer than) the duration of `T::open`. in open()
189 // * There is no active fdget_pos region on the file on this thread. in open()
190 let file = unsafe { File::from_raw_file(raw_file) }; in open() localVariable
192 let ptr = match T::open(file, misc) { in open()
198 // of this file's private data. All future accesses to the private data is performed by in open()
199 // other fops_* methods in this file, which all correctly cast the private data to the new in open()
202 // SAFETY: The open call of a file can access the private data. in open()
210 /// `file` and `inode` must be the file and inode for a file that is being released. The file
212 unsafe extern "C" fn release(_inode: *mut bindings::inode, file: *mut bindings::file) -> c_int { in release()
213 // SAFETY: The release call of a file owns the private data. in release()
214 let private = unsafe { (*file).private_data }; in release()
215 // SAFETY: The release call of a file owns the private data. in release()
219 // * The file is valid for the duration of this call. in release()
220 // * There is no active fdget_pos region on the file on this thread. in release()
221 T::release(ptr, unsafe { File::from_raw_file(file) }); in release()
228 /// `file` must be a valid file that is associated with a `MiscDeviceRegistration<T>`.
229 unsafe extern "C" fn ioctl(file: *mut bindings::file, cmd: c_uint, arg: c_ulong) -> c_long { in ioctl() argument
230 // SAFETY: The ioctl call of a file can access the private data. in ioctl()
231 let private = unsafe { (*file).private_data }; in ioctl()
232 // SAFETY: Ioctl calls can borrow the private data of the file. in ioctl()
236 // * The file is valid for the duration of this call. in ioctl()
237 // * There is no active fdget_pos region on the file on this thread. in ioctl()
238 let file = unsafe { File::from_raw_file(file) }; in ioctl() localVariable
240 match T::ioctl(device, file, cmd, arg) { in ioctl()
248 /// `file` must be a valid file that is associated with a `MiscDeviceRegistration<T>`.
251 file: *mut bindings::file, in compat_ioctl() argument
255 // SAFETY: The compat ioctl call of a file can access the private data. in compat_ioctl()
256 let private = unsafe { (*file).private_data }; in compat_ioctl()
257 // SAFETY: Ioctl calls can borrow the private data of the file. in compat_ioctl()
261 // * The file is valid for the duration of this call. in compat_ioctl()
262 // * There is no active fdget_pos region on the file on this thread. in compat_ioctl()
263 let file = unsafe { File::from_raw_file(file) }; in compat_ioctl() localVariable
265 match T::compat_ioctl(device, file, cmd, arg) { in compat_ioctl()
273 /// - `file` must be a valid file that is associated with a `MiscDeviceRegistration<T>`.
275 unsafe extern "C" fn show_fdinfo(seq_file: *mut bindings::seq_file, file: *mut bindings::file) { in show_fdinfo() argument
276 // SAFETY: The release call of a file owns the private data. in show_fdinfo()
277 let private = unsafe { (*file).private_data }; in show_fdinfo()
278 // SAFETY: Ioctl calls can borrow the private data of the file. in show_fdinfo()
281 // * The file is valid for the duration of this call. in show_fdinfo()
282 // * There is no active fdget_pos region on the file on this thread. in show_fdinfo()
283 let file = unsafe { File::from_raw_file(file) }; in show_fdinfo() localVariable
288 T::show_fdinfo(device, m, file); in show_fdinfo()