Crate kernel

source ·
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, alloc 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

  • Kernel errors.
  • API to safely and fallibly initialize pinned structs using in-place constructors.
  • ioctl() number definitions
  • Networking.
  • The kernel prelude.
  • Printing facilities.
  • String representations.
  • Synchronisation primitives.
  • Tasks (threads and processes).
  • Kernel types.
  • Work queues.

Macros

  • 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.
  • Returns the currently running task.
  • std::dbg, but using pr_info instead of eprintln.
  • A convenience alias for core::format_args.
  • Used to safely implement the HasWork<T, ID> trait.
  • Construct an in-place initializer for structs.
  • Declares a kernel module for PHYs drivers.
  • 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 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 structs.
  • 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).
  • 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).
  • Construct an in-place fallible initializer for structs.
  • Construct an in-place, fallible pinned initializer for structs.

Structs

Traits

  • The top level entrypoint to implementing a kernel module.
This documentation is an old archive. Please see https://rust.docs.kernel.org instead.