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§
- alloc
- Implementation of the kernel’s memory allocation infrastructure.
- block
- Types for working with the block layer.
- device
- Generic devices that are part of the kernel’s driver model.
- error
- Kernel errors.
- firmware
- Firmware abstraction
- init
- API to safely and fallibly initialize pinned
structs using in-place constructors. - ioctl
ioctl()number definitions.- list
- A linked list implementation.
- net
- Networking.
- page
- Kernel page allocation and management.
- prelude
- The
kernelprelude. - Printing facilities.
- rbtree
- Red-black trees.
- sizes
- Commonly used sizes.
- str
- String representations.
- sync
- Synchronisation primitives.
- task
- Tasks (threads and processes).
- time
- Time related primitives.
- types
- Kernel types.
- uaccess
- Slices to user space memory regions.
- workqueue
- Work queues.
Macros§
- assert_
pinned - Asserts that a field on a struct using
#[pin_data]is marked with#[pin]ie. that it is structurally pinned. - b_str
- Creates a new
BStrfrom a string literal. - build_
assert - Asserts that a boolean expression is
trueat compile time. - build_
error - Fails the build if the code path calling
build_error!can possibly be executed. - c_str
- Creates a new
CStrfrom a string literal. - container_
of - Produces a pointer to an object from a pointer to one of its fields.
- current
- Returns the currently running task.
- dbg
std::dbg, but usingpr_infoinstead ofeprintln.- define_
list_ arc_ field_ getter - Defines getters for a
ListArcField. - fmt
- A convenience alias for
core::format_args. - impl_
has_ list_ links - Implements the
HasListLinkstrait for the given type. - impl_
has_ list_ links_ self_ ptr - Implements the
HasListLinksandHasSelfPtrtraits for the given type. - impl_
has_ work - Used to safely implement the
HasWork<T, ID>trait. - impl_
list_ arc_ safe - Declares that this type supports
ListArc. - impl_
list_ item - Implements the
ListItemtrait for the given type. - init
- Construct an in-place initializer for
structs. - kvec
- Create a
KVeccontaining the arguments. - new_
condvar - Creates a
CondVarinitialiser with the given name and a newly-created lock class. - new_
mutex - Creates a
Mutexinitialiser with the given name and a newly-created lock class. - new_
spinlock - Creates a
SpinLockinitialiser with the given name and a newly-created lock class. - new_
work - Creates a
Workinitialiser with the given name and a newly-created lock class. - pin_
init - Construct an in-place, pinned initializer for
structs. - pr_
alert - Prints an alert-level message (level 1).
- pr_cont
- Continues a previous log message in the same line.
- pr_crit
- Prints a critical-level message (level 2).
- pr_
debug - Prints a debug-level message (level 7).
- pr_
emerg - Prints an emergency-level message (level 0).
- pr_err
- Prints an error-level message (level 3).
- pr_info
- Prints an info-level message (level 6).
- pr_
notice - Prints a notice-level message (level 5).
- pr_warn
- Prints a warning-level message (level 4).
- stack_
pin_ init - Initialize and pin a type directly on the stack.
- stack_
try_ pin_ init - Initialize and pin a type directly on the stack.
- static_
assert - Static assert (i.e. compile-time assert).
- try_
init - Construct an in-place fallible initializer for
structs. - try_
pin_ init - Construct an in-place, fallible pinned initializer for
structs.
Structs§
- This
Module - Equivalent to
THIS_MODULEin the C API.
Traits§
- Module
- The top level entrypoint to implementing a kernel module.