Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HeaderLime ¶
func HeaderLime(start, end uint64) interface{}
HeaderLime is a PageHeaderProviderFunc that returns a DefaultHeader struct
func SetLogLevel ¶
func SetLogLevel(lvl LogLvl)
SetupLogging sets logging level on the logger using the specified LogLvl value
Types ¶
type DefaultHeader ¶
type DefaultHeader struct { Magic uint32 // magic (0x4C694D45 for LiME) Version uint32 // version (always 1 for LiME) StartAddr uint64 // start address EndAddr uint64 // end address // contains filtered or unexported fields }
DefaultHeader is the default header struct value. This header can be used in conjunction with a PageHeaderProviderFunc to provide a custom header format to be used by the reader
type PageHeaderProviderFunc ¶
type PageHeaderProviderFunc func(start, end uint64) interface{}
PageHeaderProviderFunc should be used to provide a page header
type PageWriterFunc ¶
type PageWriterFunc func(io.Writer) io.WriteCloser
PageWriterFunc can be used to add special handling of page contents, such as page-level compression. This applies to a Reader in-line as data is read. Note: use of this should nearly always be avoided.
type Reader ¶
type Reader struct { // PageHeaderProvider is a function that returns a custom header structure to be applied // prepended before each memory "page" that is read PageHeaderProvider PageHeaderProviderFunc // PageHandler allows for page-level compression, or other custom handling of pages // Note: this should really not be used, and exists only for compatibility with other // tools. In most cases, the returned io.Reader should be used for compression instead PageHandler PageWriterFunc // WithProgress should be set to false if progress should not be reported during // the reading of memory. The default when calling NewReader is true. WithProgress bool // ByteOrder should be either binary.LittleEndian or binary.BigEndian. // This determines the byte order applied to pager headers. The default // when calling NewReader is binary.LittleEndian. ByteOrder binary.ByteOrder // contains filtered or unexported fields }
Reader implements the io.ReadCloser interface Its values can also used as "options" for the resulting Reader returned by the Probe() and NewReader() functions.
func NewReader ¶
NewReader tries to open the specified memory source for reading. Source should be one of: SourceKcore (/proc/kcore), SourceCrash (/dev/crash), or SourceMem (/dev/mem). Optional options can be provided for the resulting Reader.
Example:
// Omit headers from the resulting image (raw) and suppress progress reader, err := memr.NewReader(memr.SourceKcore, func(m *memr.Reader) { m.WithProgress = false m.PageHeaderProvider = nil })
func Probe ¶
Probe enumerates all available memory sources and returns the first valid reader. Current sources are: /proc/kcore, /dev/crash, /dev/mem. Optional options can be provided for the resulting Reader. See NewReader for usage of custom options.
func (*Reader) Close ¶
Close satisfies the io.Closer interface. This should be called after all reading is complete to close the underlying input file. It also signals the progress bar to flush its output. Without calling this, you will likely see incorrect progress output upon completion.