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