linuxboot / linuxboot/fiano

How to get the GUID of a module?

Open
#315 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
373
Forks
59
PR merge metrics
No merged PRs in 30d

Description

Hello.

I was wondering what is the best practice to extract a GUID of a module? Right now I use this way:

```go
func (v *visitor) Visit(f fianoUEFI.Firmware) error {
var guid *guid.GUID
switch f := f.(type) {
case *uefi.File:
guid = &f.Header.GUID
case *uefi.FirmwareVolume:
guid = &f.FVName
default:
return f.ApplyChildren(v)
}

fmt.Println(guid.String(), absOffsetOfModule(f, guid), len(f.Buf()))

return f.ApplyChildren(v)
}
```

Is there a better way to do it? It seems it is required to dive into`fiano/pkg/uefi` internals to find a way to extract the value. May be it makes sense to add method `GUID() *guid.GUID` to modules which has GUID?

```go
func (v *visitor) Visit(f fianoUEFI.Firmware) error {
guider, ok := f.(interface{GUID() guid.GUID}) // guider, ok := f.(uefi.GUIDer)
if !ok {
return f.ApplyChildren(v)
}

fmt.Println(guider.GUID().String(), absOffsetOfModule(f, guid), len(f.Buf()))

return f.ApplyChildren(v)
}
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the fiano/pkg/uefi internals and the Firmware implementations shown in the issue, especially uefi.File and uefi.FirmwareVolume. Determine a consistent public GUID access pattern for modules that have one, then verify that the visitor can use it without type-specific internals and that behavior remains correct for both module types.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.