Expand description
The kernel
crate.
This crate contains the kernel APIs that have been ported or wrapped for usage by Rust code in the kernel and is shared by all of them.
In other words, all the rest of the Rust code in the kernel (e.g. kernel
modules written in Rust) depends on core
and this crate.
If you need a kernel C API that is not ported or wrapped yet here, then do so first instead of bypassing this crate.
Re-exports§
Modules§
- Implementation of the kernel’s memory allocation infrastructure.
- Types for working with the block layer.
- Credentials management.
- Generic devices that are part of the kernel’s driver model.
- Kernel errors.
- Firmware abstraction
- Kernel file systems.
- API to safely and fallibly initialize pinned
struct
s using in-place constructors. ioctl()
number definitions.- Logic for static keys.
- A linked list implementation.
- Miscdevice support.
- Networking.
- Kernel page allocation and management.
- Pid namespaces.
- The
kernel
prelude. - Printing facilities.
- Red-black trees.
- Linux Security Modules (LSM).
- Seq file bindings.
- Commonly used sizes.
- String representations.
- Synchronisation primitives.
- Tasks (threads and processes).
- Time related primitives.
- Logic for tracepoints.
- Traits for transmuting types.
- Kernel types.
- Slices to user space memory regions.
- Work queues.
Macros§
- Wrapper around
asm!
configured for use in the kernel. - Asserts that a field on a struct using
#[pin_data]
is marked with#[pin]
ie. that it is structurally pinned. - Creates a new
BStr
from a string literal. - Asserts that a boolean expression is
true
at compile time. - Fails the build if the code path calling
build_error!
can possibly be executed. - Creates a new
CStr
from a string literal. - Produces a pointer to an object from a pointer to one of its fields.
- Returns the currently running task.
- Returns the currently running task’s pid namespace.
- Declare the Rust entry point for a tracepoint.
- Defines getters for a
ListArcField
. - Prints an alert-level message (level 1) prefixed with device information.
- Prints a critical-level message (level 2) prefixed with device information.
- Prints a debug-level message (level 7) prefixed with device information.
- Prints an emergency-level message (level 0) prefixed with device information.
- Prints an error-level message (level 3) prefixed with device information.
- Prints an info-level message (level 6) prefixed with device information.
- Prints a notice-level message (level 5) prefixed with device information.
- Prints a warning-level message (level 4) prefixed with device information.
- A convenience alias for
core::format_args
. - Defines a global lock.
- Implements the
HasListLinks
trait for the given type. - Implements the
HasListLinks
andHasSelfPtr
traits for the given type. - Used to safely implement the
HasWork<T, ID>
trait. - Declares that this type supports
ListArc
. - Implements the
ListItem
trait for the given type. - Construct an in-place initializer for
struct
s. - Create a
KVec
containing the arguments. - Creates a
CondVar
initialiser with the given name and a newly-created lock class. - Creates a
Mutex
initialiser with the given name and a newly-created lock class. - Creates a
PollCondVar
initialiser with the given name and a newly-created lock class. - Creates a
SpinLock
initialiser with the given name and a newly-created lock class. - Creates a
Work
initialiser with the given name and a newly-created lock class. - Construct an in-place, pinned initializer for
struct
s. - Prints an alert-level message (level 1).
- Continues a previous log message in the same line.
- Prints a critical-level message (level 2).
- Prints a debug-level message (level 7).
- Prints an emergency-level message (level 0).
- Prints an error-level message (level 3).
- Prints an info-level message (level 6).
- Prints a notice-level message (level 5).
- Prints a warning-level message (level 4).
- Write to a
SeqFile
with the ordinary Rust formatting syntax. - Initialize and pin a type directly on the stack.
- Initialize and pin a type directly on the stack.
- Static assert (i.e. compile-time assert).
- Branch based on a static key.
- Construct an in-place fallible initializer for
struct
s. - Construct an in-place, fallible pinned initializer for
struct
s.
Structs§
- Equivalent to
THIS_MODULE
in the C API.
Traits§
- A module that is pinned and initialised in-place.
- The top level entrypoint to implementing a kernel module.