github.com/linuxboot/fiano@v1.2.0/pkg/cbfs/bootsplash.go (about)

     1  // Copyright 2022 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: TypeBootSplash, Name: "bootsplash", New: NewBootSplash}); err != nil {
    14  		log.Fatal(err)
    15  	}
    16  }
    17  
    18  // NewBootSplash returns a ReadWriter interface for the CBFS type TypeBootSplash
    19  func NewBootSplash(f *File) (ReadWriter, error) {
    20  	rec := &BootSplashRecord{File: *f}
    21  	return rec, nil
    22  }
    23  
    24  func (r *BootSplashRecord) Read(in io.ReadSeeker) error {
    25  	return nil
    26  }
    27  
    28  func (r *BootSplashRecord) String() string {
    29  	return recString(r.File.Name, r.RecordStart, r.Type.String(), r.Size, r.File.Compression().String())
    30  }
    31  
    32  func (r *BootSplashRecord) 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 *BootSplashRecord) GetFile() *File {
    38  	return &r.File
    39  }