Skip to content

Commit 074a455

Browse files
committed
review: check virtiofsd directly instead of looping extra binaries
Only virtiofsd is a supported extra binary today, so drop the loop over all configured entries in favor of checking it directly, as suggested in review. Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>
1 parent c4f768f commit 074a455

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

pkg/unikontainers/urunc_config.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,16 @@ func LoadUruncConfig(path string) (*UruncConfig, error) {
180180
}
181181
cfg.Monitors[name] = mon
182182
}
183-
// Same issue for [extra_binaries.<name>] sections.
184-
defaultBins := defaultExtraBinConfig()
185-
for name, bin := range cfg.ExtraBins {
186-
def, ok := defaultBins[name]
187-
if !ok {
188-
continue
189-
}
183+
// Same issue for [extra_binaries.virtiofsd], the only supported extra binary today.
184+
if bin, ok := cfg.ExtraBins["virtiofsd"]; ok {
185+
def := defaultExtraBinConfig()["virtiofsd"]
190186
if bin.Path == "" {
191187
bin.Path = def.Path
192188
}
193189
if bin.Options == "" {
194190
bin.Options = def.Options
195191
}
196-
cfg.ExtraBins[name] = bin
192+
cfg.ExtraBins["virtiofsd"] = bin
197193
}
198194

199195
return cfg, nil

0 commit comments

Comments
 (0)