Commit 345e4f7 1 parent 3a583d6 commit 345e4f7 Copy full SHA for 345e4f7
File tree 3 files changed +56
-0
lines changed
3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module github.com/linuxboot/fiano
3
3
go 1.16
4
4
5
5
require (
6
+ github.com/orangecms/PSP-Entry-Types v1.0.1 // indirect
6
7
github.com/spf13/pflag v1.0.5
7
8
github.com/u-root/u-root v0.0.0-20210724144310-637617c480d4
8
9
github.com/ulikunitz/xz v0.5.10
Original file line number Diff line number Diff line change @@ -86,6 +86,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
86
86
github.com/modern-go/reflect2 v1.0.1 /go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0 =
87
87
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223 /go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U =
88
88
github.com/opentracing/opentracing-go v1.0.2 /go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o =
89
+ github.com/orangecms/PSP-Entry-Types v1.0.1 h1:CTJ/+esmVshvkpNbOAcdZGf/I/hUh3fo6PUwtBwxmpA =
90
+ github.com/orangecms/PSP-Entry-Types v1.0.1 /go.mod h1:gveQh8FM6402D5v+xtvRHYwecihTLmxPQDZJTFjpqSo =
89
91
github.com/orangecms/go-framebuffer v0.0.0-20200613202404-a0700d90c330 /go.mod h1:3Myb/UszJY32F2G7yGkUtcW/ejHpjlGfYLim7cv2uKA =
90
92
github.com/pborman/getopt/v2 v2.1.0 /go.mod h1:4NtW75ny4eBw9fO1bhtNdYTlZKYX5/tBLtsOpwKIKd0 =
91
93
github.com/pelletier/go-toml v1.2.0 /go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic =
Original file line number Diff line number Diff line change
1
+ package manifest
2
+
3
+ import (
4
+ "encoding/json"
5
+ "fmt"
6
+
7
+ pspentries "github.com/orangecms/PSP-Entry-Types"
8
+ )
9
+
10
+ var knownTypes = pspentries .Types ()
11
+
12
+ func (t BIOSDirectoryTableEntryType ) MarshalJSON () ([]byte , error ) {
13
+ for _ , knownType := range knownTypes {
14
+ if knownType .Type == uint32 (t ) {
15
+ name := knownType .Name
16
+ if name == "" {
17
+ name = knownType .ProposedName
18
+ }
19
+ if name == "" {
20
+ return json .Marshal (fmt .Sprintf ("0x%x" , t ))
21
+ }
22
+ return json .Marshal (name )
23
+ }
24
+ }
25
+ return json .Marshal (fmt .Sprintf ("0x%x" , t ))
26
+ }
27
+
28
+ /*
29
+ TODO: extend information, also for PSPDirectoryTableEntry
30
+ func (e BIOSDirectoryTableEntry) MarshalJSON() json.RawMessage {
31
+ info := TypeInfo{
32
+ Name: name,
33
+ Comment: knownType.Comment,
34
+ }
35
+ entry.TypeInfo = &info
36
+ }
37
+ */
38
+
39
+ func (t PSPDirectoryTableEntryType ) MarshalJSON () ([]byte , error ) {
40
+ for _ , knownType := range knownTypes {
41
+ if knownType .Type == uint32 (t ) {
42
+ name := knownType .Name
43
+ if name == "" {
44
+ name = knownType .ProposedName
45
+ }
46
+ if name == "" {
47
+ return json .Marshal (fmt .Sprintf ("0x%x" , t ))
48
+ }
49
+ return json .Marshal (name )
50
+ }
51
+ }
52
+ return json .Marshal (fmt .Sprintf ("0x%x" , t ))
53
+ }
You can’t perform that action at this time.
0 commit comments