github.com/linuxboot/fiano@v1.2.0/pkg/intel/metadata/cbnt/cbntbootpolicy/txt_control_flags_manifestcodegen.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  //go:build !manifestcodegen
     6  // +build !manifestcodegen
     7  
     8  // Code generated by "menifestcodegen". DO NOT EDIT.
     9  // To reproduce: go run github.com/linuxboot/fiano/pkg/intel/metadata/common/manifestcodegen/cmd/manifestcodegen github.com/linuxboot/fiano/pkg/intel/metadata/cbnt/cbntbootpolicy
    10  
    11  package cbntbootpolicy
    12  
    13  import (
    14  	"encoding/binary"
    15  	"fmt"
    16  	"io"
    17  	"strings"
    18  
    19  	"github.com/linuxboot/fiano/pkg/intel/metadata/cbnt"
    20  	"github.com/linuxboot/fiano/pkg/intel/metadata/common/pretty"
    21  )
    22  
    23  var (
    24  	// Just to avoid errors in "import" above in case if it wasn't used below
    25  	_ = binary.LittleEndian
    26  	_ = (fmt.Stringer)(nil)
    27  	_ = (io.Reader)(nil)
    28  	_ = pretty.Header
    29  	_ = strings.Join
    30  	_ = cbnt.StructInfo{}
    31  )
    32  
    33  // PrettyString returns the bits of the flags in an easy-to-read format.
    34  func (v BackupActionPolicy) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string {
    35  	return v.String()
    36  }
    37  
    38  // TotalSize returns the total size measured through binary.Size.
    39  func (v BackupActionPolicy) TotalSize() uint64 {
    40  	return uint64(binary.Size(v))
    41  }
    42  
    43  // WriteTo writes the BackupActionPolicy into 'w' in binary format.
    44  func (v BackupActionPolicy) WriteTo(w io.Writer) (int64, error) {
    45  	return int64(v.TotalSize()), binary.Write(w, binary.LittleEndian, v)
    46  }
    47  
    48  // ReadFrom reads the BackupActionPolicy from 'r' in binary format.
    49  func (v BackupActionPolicy) ReadFrom(r io.Reader) (int64, error) {
    50  	return int64(v.TotalSize()), binary.Read(r, binary.LittleEndian, v)
    51  }
    52  
    53  // PrettyString returns the bits of the flags in an easy-to-read format.
    54  func (v ExecutionProfile) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string {
    55  	return v.String()
    56  }
    57  
    58  // TotalSize returns the total size measured through binary.Size.
    59  func (v ExecutionProfile) TotalSize() uint64 {
    60  	return uint64(binary.Size(v))
    61  }
    62  
    63  // WriteTo writes the ExecutionProfile into 'w' in binary format.
    64  func (v ExecutionProfile) WriteTo(w io.Writer) (int64, error) {
    65  	return int64(v.TotalSize()), binary.Write(w, binary.LittleEndian, v)
    66  }
    67  
    68  // ReadFrom reads the ExecutionProfile from 'r' in binary format.
    69  func (v ExecutionProfile) ReadFrom(r io.Reader) (int64, error) {
    70  	return int64(v.TotalSize()), binary.Read(r, binary.LittleEndian, v)
    71  }
    72  
    73  // PrettyString returns the bits of the flags in an easy-to-read format.
    74  func (v MemoryScrubbingPolicy) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string {
    75  	return v.String()
    76  }
    77  
    78  // TotalSize returns the total size measured through binary.Size.
    79  func (v MemoryScrubbingPolicy) TotalSize() uint64 {
    80  	return uint64(binary.Size(v))
    81  }
    82  
    83  // WriteTo writes the MemoryScrubbingPolicy into 'w' in binary format.
    84  func (v MemoryScrubbingPolicy) WriteTo(w io.Writer) (int64, error) {
    85  	return int64(v.TotalSize()), binary.Write(w, binary.LittleEndian, v)
    86  }
    87  
    88  // ReadFrom reads the MemoryScrubbingPolicy from 'r' in binary format.
    89  func (v MemoryScrubbingPolicy) ReadFrom(r io.Reader) (int64, error) {
    90  	return int64(v.TotalSize()), binary.Read(r, binary.LittleEndian, v)
    91  }
    92  
    93  // PrettyString returns the bits of the flags in an easy-to-read format.
    94  func (v ResetAUXControl) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string {
    95  	return v.String()
    96  }
    97  
    98  // TotalSize returns the total size measured through binary.Size.
    99  func (v ResetAUXControl) TotalSize() uint64 {
   100  	return uint64(binary.Size(v))
   101  }
   102  
   103  // WriteTo writes the ResetAUXControl into 'w' in binary format.
   104  func (v ResetAUXControl) WriteTo(w io.Writer) (int64, error) {
   105  	return int64(v.TotalSize()), binary.Write(w, binary.LittleEndian, v)
   106  }
   107  
   108  // ReadFrom reads the ResetAUXControl from 'r' in binary format.
   109  func (v ResetAUXControl) ReadFrom(r io.Reader) (int64, error) {
   110  	return int64(v.TotalSize()), binary.Read(r, binary.LittleEndian, v)
   111  }
   112  
   113  // PrettyString returns the bits of the flags in an easy-to-read format.
   114  func (v TXTControlFlags) PrettyString(depth uint, withHeader bool, opts ...pretty.Option) string {
   115  	var lines []string
   116  	if withHeader {
   117  		lines = append(lines, pretty.Header(depth, "TXT Control Flags", v))
   118  	}
   119  	lines = append(lines, pretty.SubValue(depth+1, "Execution Profile", "", v.ExecutionProfile(), opts...)...)
   120  	lines = append(lines, pretty.SubValue(depth+1, "Memory Scrubbing Policy", "", v.MemoryScrubbingPolicy(), opts...)...)
   121  	lines = append(lines, pretty.SubValue(depth+1, "Backup Action Policy", "", v.BackupActionPolicy(), opts...)...)
   122  	if v.IsSACMRequestedToExtendStaticPCRs() {
   123  		lines = append(lines, pretty.SubValue(depth+1, "Is SACM Requested To Extend Static PC Rs", "Default setting. S-ACM is requested to extend static PCRs", true, opts...)...)
   124  	} else {
   125  		lines = append(lines, pretty.SubValue(depth+1, "Is SACM Requested To Extend Static PC Rs", "S-ACM is not requested to extend static PCRs", false, opts...)...)
   126  	}
   127  	lines = append(lines, pretty.SubValue(depth+1, "Reset AUX Control", "", v.ResetAUXControl(), opts...)...)
   128  	return strings.Join(lines, "\n")
   129  }
   130  
   131  // TotalSize returns the total size measured through binary.Size.
   132  func (v TXTControlFlags) TotalSize() uint64 {
   133  	return uint64(binary.Size(v))
   134  }
   135  
   136  // WriteTo writes the TXTControlFlags into 'w' in binary format.
   137  func (v TXTControlFlags) WriteTo(w io.Writer) (int64, error) {
   138  	return int64(v.TotalSize()), binary.Write(w, binary.LittleEndian, v)
   139  }
   140  
   141  // ReadFrom reads the TXTControlFlags from 'r' in binary format.
   142  func (v TXTControlFlags) ReadFrom(r io.Reader) (int64, error) {
   143  	return int64(v.TotalSize()), binary.Read(r, binary.LittleEndian, v)
   144  }