github.com/linuxboot/fiano@v1.2.0/pkg/intel/metadata/fit/get_entries.go (about)

     1  // Copyright 2017-2021 the LinuxBoot Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package fit
     6  
     7  import (
     8  	"fmt"
     9  	"io"
    10  
    11  	"github.com/xaionaro-go/bytesextra"
    12  )
    13  
    14  // GetEntries returns parsed FIT-entries
    15  func GetEntries(firmware []byte) (Entries, error) {
    16  	return GetEntriesFrom(bytesextra.NewReadWriteSeeker(firmware))
    17  }
    18  
    19  // GetEntriesFrom returns parsed FIT-entries
    20  func GetEntriesFrom(firmware io.ReadSeeker) (Entries, error) {
    21  	table, err := GetTableFrom(firmware)
    22  	if err != nil {
    23  		return nil, fmt.Errorf("unable to get FIT table: %w", err)
    24  	}
    25  
    26  	return table.GetEntriesFrom(firmware), nil
    27  }