rust/kernel/seq_file.rs

Source file repositories/reference/linux-study-clean/rust/kernel/seq_file.rs

File Facts

System
Linux kernel
Corpus path
rust/kernel/seq_file.rs
Extension
.rs
Size
1772 bytes
Lines
54
Domain
Rust Kernel Layer
Bucket
Rust API Membrane
Inferred role
Rust Kernel Layer: implementation source
Status
source implementation candidate

Why This File Exists

Rust-side wrappers and abstractions around kernel C APIs, ownership contracts, allocation, synchronization, and module integration.

Dependency Surface

Detected Declarations

Annotated Snippet

pub fn call_printf(&self, args: fmt::Arguments<'_>) {
        // SAFETY: Passing a void pointer to `Arguments` is valid for `%pA`.
        unsafe {
            bindings::seq_printf(
                self.inner.get(),
                c"%pA".as_char_ptr(),
                core::ptr::from_ref(&args).cast::<crate::ffi::c_void>(),
            );
        }
    }
}

/// Write to a [`SeqFile`] with the ordinary Rust formatting syntax.
#[macro_export]
macro_rules! seq_print {
    ($m:expr, $($arg:tt)+) => (
        $m.call_printf($crate::prelude::fmt!($($arg)+))
    );
}
pub use seq_print;

Annotation

Implementation Notes