u-root: github.com/u-root/u-root/pkg/cmdline Index | Files

package cmdline

import "github.com/u-root/u-root/pkg/cmdline"

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

Package Files

cmdline.go filters.go

func ContainsFlag Uses

func ContainsFlag(flag string) bool

ContainsFlag verifies that the kernel cmdline has a flag set

func Flag Uses

func Flag(flag string) (string, bool)

Flag returns the a flag, and whether it was set

func FlagsForModule Uses

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 Uses

func FullCmdLine() string

FullCmdLine returns the full, raw cmdline string

func GetInitFlagMap Uses

func GetInitFlagMap() map[string]string

GetInitFlagMap gets the init flags as a map

func GetUinitArgs Uses

func GetUinitArgs() []string

GetUinitArgs gets the uinit argvs.

type CmdLine Uses

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 Uses

func NewCmdLine() CmdLine

NewCmdLine returns a populated CmdLine struct

type Filter Uses

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

Filter represents and kernel commandline filter

func NewUpdateFilter Uses

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

Package cmdline imports 8 packages (graph) and is imported by 19 packages. Updated 2020-02-26. Refresh now. Tools for package owners.