-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
efi: change how HostEnvironment overrides EFI variables #312
Changes from 1 commit
aaba2c5
1c78a22
35d03b3
04110a4
935869c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
package internal_test | ||
|
||
import ( | ||
"context" | ||
_ "embed" | ||
"io" | ||
"os" | ||
|
@@ -39,7 +40,11 @@ type defaultEnvSuite struct{} | |
var _ = Suite(&defaultEnvSuite{}) | ||
|
||
func (s *defaultEnvSuite) TestVarContext(c *C) { | ||
c.Check(DefaultEnv.VarContext(), Equals, efi.DefaultVarContext) | ||
ctx := DefaultEnv.VarContext(context.Background()) | ||
c.Assert(ctx, NotNil) | ||
|
||
expected := efi.WithDefaultVarsBackend(context.Background()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe a good idea to pass something with an attached value already and check it can be retrieved? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added this to the test |
||
c.Check(ctx.Value(efi.VarsBackendKey{}), Equals, expected.Value(efi.VarsBackendKey{})) | ||
} | ||
|
||
func (s *defaultEnvSuite) testReadEventLog(c *C, opts *efitest.LogOptions) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,13 @@ import ( | |
type HostEnvironment interface { | ||
// VarContext returns a context containing a VarsBackend, keyed by efi.VarsBackendKey, | ||
// for interacting with EFI variables via go-efilib. This context can be passed to any | ||
// go-efilib function that interacts with EFI variables. | ||
VarContext() context.Context | ||
// go-efilib function that interacts with EFI variables. Right now, go-efilib doesn't | ||
// support any other uses of the context such as cancelation or deadlines. The efivarfs | ||
// backend will support this eventually for variable writes because it currently implements | ||
// a retry loop that has a potential to race with other processes. Cancelation and / or | ||
// deadlines for sections of code that performs multiple reads using efivarfs may be useful | ||
// in the future because the kernel rate-limits reads per-user. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same about parent |
||
VarContext(parent context.Context) context.Context | ||
|
||
// ReadEventLog reads the TCG event log | ||
ReadEventLog() (*tcglog.Log, error) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the doc say something about parent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the documentation now.