Lines Matching +full:sync +full:- +full:read

1 // SPDX-License-Identifier: GPL-2.0
35 const unsafe fn new(operations: bindings::file_operations, mode: u16) -> Self { in new()
46 pub(crate) const fn mode(&self) -> u16 { in mode()
52 pub(super) const fn adapt(&self) -> &FileOps<T::Inner> { in adapt()
62 fn deref(&self) -> &Self::Target { in deref()
70 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { in fmt()
81 /// * `file` must point to a live, not-yet-initialized file object.
82 unsafe extern "C" fn writer_open<T: Writer + Sync>( in writer_open()
85 ) -> c_int { in writer_open()
103 unsafe extern "C" fn writer_act<T: Writer + Sync>( in writer_act()
106 ) -> c_int { in writer_act()
122 impl<T: Writer + Sync> ReadFile<T> for T {
125 read: Some(bindings::seq_read),
140 fn read<T: Reader + Sync>(data: &T, buf: *const c_char, count: usize) -> isize { in read() function
155 /// `buf` must be a valid user-space buffer.
156 pub(crate) unsafe extern "C" fn write<T: Reader + Sync>( in write()
161 ) -> isize { in write()
166 read(data, buf, count) in write()
174 impl<T: Writer + Reader + Sync> ReadWriteFile<T> for T {
178 read: Some(bindings::seq_read),
204 ) -> c_int { in write_only_open()
215 /// * `buf` must be a valid user-space buffer.
216 pub(crate) unsafe extern "C" fn write_only_write<T: Reader + Sync>( in write_only_write()
221 ) -> isize { in write_only_write()
225 read(data, buf, count) in write_only_write()
232 impl<T: Reader + Sync> WriteFile<T> for T {
255 ) -> isize { in blob_read()
257 // - `file` is a valid pointer to a `struct file`. in blob_read()
258 // - The type invariant of `FileOps` guarantees that `private_data` points to a valid `T`. in blob_read()
262 // - `ppos` is a valid `file::Offset` pointer. in blob_read()
263 // - We have exclusive access to `ppos`. in blob_read()
268 let ret = || -> Result<isize> { in blob_read()
280 /// Representation of [`FileOps`] for read only binary files.
285 impl<T: BinaryWriter + Sync> BinaryReadFile<T> for T {
288 read: Some(blob_read::<T>),
296 // - The private data of `struct inode` does always contain a pointer to a valid `T`.
297 // - `simple_open()` stores the `struct inode`'s private data in the private data of the
299 // - `blob_read()` re-creates a reference to `T` from the `struct file`'s private data.
300 // - `default_llseek()` does not access the `struct file`'s private data.
310 ) -> isize { in blob_write()
312 // - `file` is a valid pointer to a `struct file`. in blob_write()
313 // - The type invariant of `FileOps` guarantees that `private_data` points to a valid `T`. in blob_write()
317 // - `ppos` is a valid `file::Offset` pointer. in blob_write()
318 // - We have exclusive access to `ppos`. in blob_write()
323 let ret = || -> Result<isize> { in blob_write()
324 let read = this.read_from_slice(&mut reader, pos)?; in blob_write() localVariable
326 Ok(read.try_into()?) in blob_write()
340 impl<T: BinaryReader + Sync> BinaryWriteFile<T> for T {
351 // - The private data of `struct inode` does always contain a pointer to a valid `T`.
352 // - `simple_open()` stores the `struct inode`'s private data in the private data of the
354 // - `blob_write()` re-creates a reference to `T` from the `struct file`'s private data.
355 // - `default_llseek()` does not access the `struct file`'s private data.
360 /// Representation of [`FileOps`] for read/write binary files.
365 impl<T: BinaryWriter + BinaryReader + Sync> BinaryReadWriteFile<T> for T {
368 read: Some(blob_read::<T>),
377 // - The private data of `struct inode` does always contain a pointer to a valid `T`.
378 // - `simple_open()` stores the `struct inode`'s private data in the private data of the
380 // - `blob_read()` re-creates a reference to `T` from the `struct file`'s private data.
381 // - `blob_write()` re-creates a reference to `T` from the `struct file`'s private data.
382 // - `default_llseek()` does not access the `struct file`'s private data.