AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
memdev.c File Reference

The memory devices: the character devices of major 1, as on Linux. More...

#include <core/system.h>
#include <core/module.h>
#include <dev/dev.h>
#include <memdev.h>

Go to the source code of this file.

Functions

struct dev * memdev_mux (struct devid *dd)
 Picks the driver of a memory device, by its minor.
int memdev_probe ()
 Registers the memory devices, as character devices of major 1.

Variables

struct dev memdev

Detailed Description

The memory devices: the character devices of major 1, as on Linux.

Each minor is a device of its own, with its own driver: /dev/null (3), /dev/zero (5), /dev/random and /dev/urandom (8, 9) and /dev/kmsg (11). memdev_mux() picks the driver by minor. The other minors Linux has (/dev/mem, /dev/port, /dev/full, ...) aren't there.

Definition in file memdev.c.

Function Documentation

◆ memdev_mux()

struct dev * memdev_mux ( struct devid * dd)

Picks the driver of a memory device, by its minor.

Parameters
ddthe device's number
Returns
its driver, or NULL for a minor that has none

Definition at line 25 of file memdev.c.

References kmsgdev, memdev_mux(), devid::minor, NULL, nulldev, randomdev, and zerodev.

Referenced by memdev_mux().

◆ memdev_probe()

int memdev_probe ( )

Registers the memory devices, as character devices of major 1.

Returns
0

Definition at line 59 of file memdev.c.

References kdev_chrdev_register(), memdev, and memdev_probe().

Referenced by memdev_probe().

Variable Documentation

◆ memdev

struct dev memdev
Initial value:
= {
.name = "memdev",
.mux = memdev_mux,
}
struct dev * memdev_mux(struct devid *dd)
Picks the driver of a memory device, by its minor.
Definition memdev.c:25

Definition at line 17 of file memdev.c.

Referenced by memdev_probe().