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

The kernel's command line: the arguments the boot loader passed, such as root=/dev/hda2 or apic=off. More...

#include <core/system.h>
#include <core/string.h>
#include <core/kargs.h>
#include <aquila/errno.h>

Go to the source code of this file.

Data Structures

struct  [struct].kargs

Macros

#define MAX_ARGS   128

Functions

int kargs_parse (const char *_cmdline)
 Splits the kernel's command line into arguments, at boot.
int kargs_get (const char *key, const char **value)
 Looks up an argument of the kernel's command line.

Variables

static struct  kargs [MAX_ARGS]
static int kargc

Detailed Description

The kernel's command line: the arguments the boot loader passed, such as root=/dev/hda2 or apic=off.

The command line is split once at boot into key or key=value arguments, and the rest of the kernel looks them up by key.

Definition in file kargs.c.

Macro Definition Documentation

◆ MAX_ARGS

#define MAX_ARGS   128

Definition at line 15 of file kargs.c.

Referenced by kargs_parse().

Function Documentation

◆ kargs_get()

int kargs_get ( const char * key,
const char ** value )

Looks up an argument of the kernel's command line.

Parameters
keythe argument's name
valueif not NULL, set to the argument's value, or to NULL if it has none (key alone rather than key=value)
Returns
0 if the argument was given, or -1 if it wasn't

Definition at line 73 of file kargs.c.

References kargc, kargs, and kargs_get().

Referenced by ata_probe(), earlycon_reinit(), i8042_init(), kargs_get(), kmain(), netif_config(), x86_apic_setup(), x86_clock_init(), x86_pit_period_set(), and x86_smp_init().

◆ kargs_parse()

int kargs_parse ( const char * _cmdline)

Splits the kernel's command line into arguments, at boot.

Parameters
_cmdlinethe command line, as the boot loader passed it
Returns
how many arguments there are, or -ENOMEM if there was no memory to split them

Definition at line 31 of file kargs.c.

References kargc, kargs, kargs_parse(), MAX_ARGS, NULL, and printk().

Referenced by aarch64_init(), kargs_parse(), and x86_cpu_init().

Variable Documentation

◆ kargc

int kargc
static

Definition at line 22 of file kargs.c.

Referenced by kargs_get(), and kargs_parse().

◆ kargs

struct [struct].kargs kargs[MAX_ARGS]

Referenced by kargs_get(), and kargs_parse().