Lines Matching +full:sync +full:- +full:write

1 // SPDX-License-Identifier: GPL-2.0
44 const unsafe fn new(operations: bindings::file_operations, mode: u16) -> Self {
55 pub(crate) const fn mode(&self) -> u16 {
61 pub(super) const fn adapt(&self) -> &FileOps<T::Inner> {
71 fn deref(&self) -> &Self::Target {
79 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
80 self.0.write(f)
90 /// * `file` must point to a live, not-yet-initialized file object.
91 unsafe extern "C" fn writer_open<T: Writer + Sync>(
94 ) -> c_int {
112 unsafe extern "C" fn writer_act<T: Writer + Sync>(
115 ) -> c_int {
131 impl<T: Writer + Sync> ReadFile<T> for T {
148 fn read<T: Reader + Sync>(data: &T, buf: *const c_char, count: usize) -> isize {
163 /// `buf` must be a valid user-space buffer.
164 pub(crate) unsafe extern "C" fn write<T: Reader + Sync>(
169 ) -> isize {
182 impl<T: Writer + Reader + Sync> ReadWriteFile<T> for T {
187 write: Some(write::<T>),
193 // and `write`.
197 // `write` only requires that the file's private data pointer points to `seq_file`
211 ) -> c_int {
222 /// * `buf` must be a valid user-space buffer.
223 pub(crate) unsafe extern "C" fn write_only_write<T: Reader + Sync>(
228 ) -> isize {
239 impl<T: Reader + Sync> WriteFile<T> for T {
243 write: Some(write_only_write::<T>),
261 ) -> isize {
263 // - `file` is a valid pointer to a `struct file`.
264 // - The type invariant of `FileOps` guarantees that `private_data` points to a valid `T`.
268 // - `ppos` is a valid `file::Offset` pointer.
269 // - We have exclusive access to `ppos`.
274 let ret = || -> Result<isize> {
291 impl<T: BinaryWriter + Sync> BinaryReadFile<T> for T {
301 // - The private data of `struct inode` does always contain a pointer to a valid `T`.
302 // - `simple_open()` stores the `struct inode`'s private data in the private data of the
304 // - `blob_read()` re-creates a reference to `T` from the `struct file`'s private data.
305 // - `default_llseek()` does not access the `struct file`'s private data.
315 ) -> isize {
317 // - `file` is a valid pointer to a `struct file`.
318 // - The type invariant of `FileOps` guarantees that `private_data` points to a valid `T`.
322 // - `ppos` is a valid `file::Offset` pointer.
323 // - We have exclusive access to `ppos`.
328 let ret = || -> Result<isize> {
340 /// Representation of [`FileOps`] for write only binary files.
345 impl<T: BinaryReader + Sync> BinaryWriteFile<T> for T {
348 write: Some(blob_write::<T>),
355 // - The private data of `struct inode` does always contain a pointer to a valid `T`.
356 // - `simple_open()` stores the `struct inode`'s private data in the private data of the
358 // - `blob_write()` re-creates a reference to `T` from the `struct file`'s private data.
359 // - `default_llseek()` does not access the `struct file`'s private data.
364 /// Representation of [`FileOps`] for read/write binary files.
369 impl<T: BinaryWriter + BinaryReader + Sync> BinaryReadWriteFile<T> for T {
373 write: Some(blob_write::<T>),
380 // - The private data of `struct inode` does always contain a pointer to a valid `T`.
381 // - `simple_open()` stores the `struct inode`'s private data in the private data of the
383 // - `blob_read()` re-creates a reference to `T` from the `struct file`'s private data.
384 // - `blob_write()` re-creates a reference to `T` from the `struct file`'s private data.
385 // - `default_llseek()` does not access the `struct file`'s private data.