rust/kernel/prelude.rs

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

File Facts

System
Linux kernel
Corpus path
rust/kernel/prelude.rs
Extension
.rs
Size
1847 bytes
Lines
121
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

// SPDX-License-Identifier: GPL-2.0

//! The `kernel` prelude.
//!
//! These are the most common items used by Rust code in the kernel,
//! intended to be imported by all Rust code, for convenience.
//!
//! # Examples
//!
//! ```
//! use kernel::prelude::*;
//! ```

#[doc(no_inline)]
pub use core::{
    mem::{
        align_of,
        align_of_val,
        size_of,
        size_of_val, //
    },
    pin::Pin, //
};

#[doc(no_inline)]
pub use ::ffi::{
    c_char,
    c_int,
    c_long,
    c_longlong,
    c_schar,
    c_short,
    c_uchar,
    c_uint,
    c_ulong,
    c_ulonglong,
    c_ushort,
    c_void,
    CStr, //
};

#[doc(no_inline)]
pub use macros::{
    export,
    fmt,
    kunit_tests,
    module,
    vtable, //
};

#[doc(no_inline)]
pub use pin_init::{
    init,
    pin_data,
    pin_init,
    pinned_drop,
    InPlaceWrite,
    Init,
    PinInit,
    Zeroable, //
};

#[doc(no_inline)]
pub use zerocopy::FromBytes;

#[doc(no_inline)]
pub use zerocopy_derive::FromBytes;

#[doc(no_inline)]
pub use super::{
    alloc::{
        flags::*,
        Box,
        KBox,
        KVBox,
        KVVec,
        KVec,
        VBox,
        VVec,
        Vec, //
    },
    build_assert::{
        build_assert,
        build_error,
        const_assert,
        static_assert, //
    },
    current,
    dev_alert,
    dev_crit,

Annotation

Implementation Notes