github.com/linuxboot/fiano@v1.2.0/pkg/cbfs/fsp.go (about) 1 // Copyright 2018-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 cbfs 6 7 import ( 8 "io" 9 "log" 10 ) 11 12 func init() { 13 if err := RegisterFileReader(&SegReader{Type: TypeFSP, Name: "fsp", New: NewFSP}); err != nil { 14 log.Fatal(err) 15 } 16 } 17 18 // NewFSP returns a ReadWriter interface for the CBFS type TypeFSP 19 func NewFSP(f *File) (ReadWriter, error) { 20 rec := &FSPRecord{File: *f} 21 return rec, nil 22 } 23 24 func (r *FSPRecord) Read(in io.ReadSeeker) error { 25 return nil 26 } 27 28 func (r *FSPRecord) String() string { 29 return recString(r.File.Name, r.RecordStart, r.Type.String(), r.Size, r.File.Compression().String()) 30 } 31 32 func (r *FSPRecord) Write(w io.Writer) error { 33 return Write(w, r.FData) 34 } 35 36 // File returns a pointer to the corresponding File 37 func (r *FSPRecord) GetFile() *File { 38 return &r.File 39 }