cmdline

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2025 License: BSD-3-Clause Imports: 7 Imported by: 195

Documentation

Overview

Package cmdline is parser for kernel command-line args from /proc/cmdline.

It's conformant with https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html, though making 'var_name' and 'var-name' equivalent may need to be done separately.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Consoles added in v0.15.0

func Consoles() []string

Consoles returns the list of all `console=` values in the kernel command line.

func ContainsFlag

func ContainsFlag(flag string) bool

ContainsFlag verifies that the kernel cmdline has a flag set

func Flag

func Flag(flag string) (string, bool)

Flag returns the value of a flag, and whether it was set

func FlagsForModule

func FlagsForModule(name string) string

FlagsForModule gets all flags for a designated module and returns them as a space-seperated string designed to be passed to insmod Note that similarly to flags, module names with - and _ are treated the same.

func FullCmdLine

func FullCmdLine() string

FullCmdLine returns the full, raw cmdline string

func GetInitFlagMap

func GetInitFlagMap() map[string]string

GetInitFlagMap gets the uroot init flags as a map

func GetUinitArgs

func GetUinitArgs() []string

GetUinitArgs gets the uinit argvs.

Types

type CmdLine

type CmdLine struct {
	Raw   string
	AsMap map[string]string
	Err   error
}

CmdLine lets people view the raw & parsed /proc/cmdline in one place

func NewCmdLine

func NewCmdLine() *CmdLine

NewCmdLine returns a populated CmdLine struct

func (*CmdLine) Consoles added in v0.15.0

func (c *CmdLine) Consoles() []string

Consoles returns the list of all `console=` values in the kernel command line.

func (*CmdLine) ContainsFlag added in v0.10.0

func (c *CmdLine) ContainsFlag(flag string) bool

ContainsFlag verifies that the kernel cmdline has a flag set

func (*CmdLine) Flag added in v0.10.0

func (c *CmdLine) Flag(flag string) (string, bool)

Flag returns the value of a flag, and whether it was set

func (*CmdLine) FlagsForModule added in v0.10.0

func (c *CmdLine) FlagsForModule(name string) string

FlagsForModule gets all flags for a designated module and returns them as a space-seperated string designed to be passed to insmod Note that similarly to flags, module names with - and _ are treated the same.

func (*CmdLine) GetInitFlagMap added in v0.10.0

func (c *CmdLine) GetInitFlagMap() map[string]string

GetInitFlagMap gets the uroot init flags as a map

func (*CmdLine) GetUinitArgs added in v0.10.0

func (c *CmdLine) GetUinitArgs() []string

GetUinitArgs gets the uinit argvs.

type Filter

type Filter interface {
	// Update filters given a space-separated kernel commandline
	Update(c *CmdLine, cmdline string) string
}

Filter represents and kernel commandline filter

func NewUpdateFilter

func NewUpdateFilter(appendCmd string, removeVar, reuseVar []string) Filter

NewUpdateFilter return a kernel command line Filter that: removes variables listed in 'removeVar', append extra parameters from the 'appendCmd' and append variables listed in 'reuseVar' using the value from the running kernel

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL