github.com/linuxboot/fiano@v1.2.0/pkg/cbfs/bootblock.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: TypeBootBlock, Name: "CBFSBootBlock", New: NewBootBlock}); err != nil { 14 log.Fatal(err) 15 } 16 } 17 18 func NewBootBlock(f *File) (ReadWriter, error) { 19 r := &BootBlockRecord{File: *f} 20 Debug("Got header %s", r.String()) 21 return r, nil 22 } 23 24 func (r *BootBlockRecord) Read(in io.ReadSeeker) error { 25 return nil 26 } 27 28 func (r *BootBlockRecord) String() string { 29 return recString(r.File.Name, r.RecordStart, r.Type.String(), r.Size, r.File.Compression().String()) 30 } 31 32 func (r *BootBlockRecord) Write(w io.Writer) error { 33 return Write(w, r.FData) 34 } 35 36 func (r *BootBlockRecord) GetFile() *File { 37 return &r.File 38 }