Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/nvcdi/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ func populateOptions(opts ...Option) *options {
mode: ModeAuto,
driverRoot: "/",
nvidiaCDIHookPath: "/usr/bin/nvidia-cdi-hook",
csv: csvOptions{
CompatContainerRoot: defaultOrinCompatContainerRoot,
},
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by removing this, o.csv is now initialized as nil, right?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or maybe not because of this type definition (not a pointer):

csv csvOptions

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's just an embeded struct, it is not a pointer. This means that the default value for the o.csv.CompatContainerRoot field is now "".

}
for _, opt := range opts {
opt(o)
Expand Down Expand Up @@ -109,6 +106,10 @@ func populateOptions(opts ...Option) *options {
o.csv.Files = csv.DefaultFileList()
}

if o.mode == ModeCSV && o.csv.CompatContainerRoot == "" {
o.csv.CompatContainerRoot = defaultOrinCompatContainerRoot
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so o.csv is never a nil pointer dereference, yes?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. The csv member is NOT a pointer type. It is an embeded struct.

}

if o.mode == ModeManagement {
// For management mode we explicitly disable the hooks that enable CUDA
// compatibility and disable device node modifications.
Expand Down