Documentation
¶
Index ¶
- func KernelCommandLine() (string, error)
- func KeyValues(keys ...string) (map[string]string, error)
- func MockProcCmdline(newPath string) (restore func())
- func RemoveMatchingFilter(cmdline string, match []ArgumentPattern) []string
- func Split(s string) (out []string, err error)
- type Argument
- type ArgumentPattern
- func (kap *ArgumentPattern) MarshalBinary() ([]byte, error)
- func (kap *ArgumentPattern) MarshalText() ([]byte, error)
- func (kap *ArgumentPattern) UnmarshalBinary(data []byte) error
- func (kap *ArgumentPattern) UnmarshalText(data []byte) error
- func (kap *ArgumentPattern) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Matcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KernelCommandLine ¶
KernelCommandLine returns the command line reported by the running kernel.
func KeyValues ¶
KeyValues returns a map of the specified keys to the values set for them in the kernel command line (eg. panic=-1). If the key is missing from the kernel command line, it is omitted from the returned map, but it is added if present even if it has no value.
func MockProcCmdline ¶
func MockProcCmdline(newPath string) (restore func())
MockProcCmdline overrides the path to /proc/cmdline. For use in tests.
func RemoveMatchingFilter ¶
func RemoveMatchingFilter(cmdline string, match []ArgumentPattern) []string
RemoveMatchingFilter parses a kernel command line and remove arguments that matches match patterns.
func Split ¶
Split tries to split the string comprising full or a part of a kernel command line into a list of individual arguments. Returns an error when the input string is incorrectly formatted.
See https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html for details.
Types ¶
type Argument ¶
Argument represents a parsed kernel argument.
func Parse ¶
Parse parses a kernel command line, returning a slice with the arguments in the same order as in cmdline. Note that kernel arguments can be repeated. We follow the same algorithm as in linux kernel's function lib/cmdline.c:next_arg as far as possible. TODO Replace Split with this eventually
func (*Argument) UnmarshalYAML ¶
UnmarshalYAML implements the Unmarshaler interface.
type ArgumentPattern ¶
type ArgumentPattern struct {
// contains filtered or unexported fields
}
ArgumentPattern represents a pattern which can match a Argument This is intended to be used with Matcher
func NewAnyPattern ¶
func NewAnyPattern(param string) ArgumentPattern
This constructor is needed mainly for test instead of unmarshaling from yaml
func NewConstantPattern ¶
func NewConstantPattern(param string, value string) ArgumentPattern
This constructor is needed mainly for test instead of unmarshaling from yaml
func (*ArgumentPattern) MarshalBinary ¶
func (kap *ArgumentPattern) MarshalBinary() ([]byte, error)
func (*ArgumentPattern) MarshalText ¶
func (kap *ArgumentPattern) MarshalText() ([]byte, error)
func (*ArgumentPattern) UnmarshalBinary ¶
func (kap *ArgumentPattern) UnmarshalBinary(data []byte) error
func (*ArgumentPattern) UnmarshalText ¶
func (kap *ArgumentPattern) UnmarshalText(data []byte) error
func (*ArgumentPattern) UnmarshalYAML ¶
func (kap *ArgumentPattern) UnmarshalYAML(unmarshal func(interface{}) error) error