Documentation
¶
Overview ¶
Package fmap parses flash maps.
Index ¶
- Constants
- Variables
- func FlagNames(flags uint16) string
- func Read(f io.Reader) (*FMap, *Metadata, error)
- func Write(f io.WriteSeeker, fmap *FMap, m *Metadata) error
- type Area
- type FMap
- func (f *FMap) Checksum(r io.ReaderAt, h hash.Hash) ([]byte, error)
- func (f *FMap) IndexOfArea(name string) int
- func (f *FMap) ReadArea(r io.ReaderAt, i int) ([]byte, error)
- func (f *FMap) ReadAreaByName(r io.ReaderAt, name string) ([]byte, error)
- func (f *FMap) WriteArea(r io.WriterAt, i int, data []byte) error
- func (f *FMap) WriteAreaByName(r io.WriterAt, name string, data []byte) error
- type Header
- type Metadata
- type String
Constants ¶
View Source
const ( FmapAreaStatic = 1 << iota FmapAreaCompressed FmapAreaReadOnly )
Flags which can be applied to Area.Flags.
Variables ¶
View Source
var Signature = []byte("__FMAP__")
Signature of the fmap structure.
Functions ¶
Types ¶
type FMap ¶
FMap structure serializable using encoding.Binary.
func (*FMap) IndexOfArea ¶ added in v1.0.1
IndexOfArea returns the index of an area in the fmap given its name. If no names match, -1 is returned.
func (*FMap) ReadArea ¶
ReadArea reads an area from the flash image as a byte array given its index.
func (*FMap) ReadAreaByName ¶ added in v1.0.1
ReadAreaByName is the same as ReadArea but uses the area's name.
type Header ¶
type Header struct { Signature [8]uint8 VerMajor uint8 VerMinor uint8 Base uint64 Size uint32 Name String NAreas uint16 }
Header describes the flash part.
type Metadata ¶
type Metadata struct {
Start uint64
}
Metadata contains additional data not part of the FMap.
type String ¶
type String struct {
Value [32]uint8
}
String wraps around byte array to give us more control over how strings are serialized.
func (*String) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*String) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
Click to show internal directories.
Click to hide internal directories.