mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-13 01:52:08 +00:00
Remove redundant deduplication of search paths for WSL
The GetDriverStorePaths function is implemented so as to remove duplicate driver store paths which means that the additional deduplication (which had a bug) can be removed. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
d59fd3da11
commit
0d0b56816e
@ -54,24 +54,16 @@ func newWSLDriverDiscoverer(logger logger.Interface, driverRoot string, hookCrea
|
||||
if len(driverStorePaths) == 0 {
|
||||
return nil, fmt.Errorf("no driver store paths found")
|
||||
}
|
||||
if len(driverStorePaths) > 1 {
|
||||
logger.Warningf("Found multiple driver store paths: %v", driverStorePaths)
|
||||
}
|
||||
logger.Infof("Using WSL driver store paths: %v", driverStorePaths)
|
||||
|
||||
return newWSLDriverStoreDiscoverer(logger, driverRoot, hookCreator, ldconfigPath, driverStorePaths)
|
||||
}
|
||||
|
||||
// newWSLDriverStoreDiscoverer returns a Discoverer for WSL2 drivers in the driver store associated with a dxcore adapter.
|
||||
func newWSLDriverStoreDiscoverer(logger logger.Interface, driverRoot string, hookCreator discover.HookCreator, ldconfigPath string, driverStorePaths []string) (discover.Discover, error) {
|
||||
var searchPaths []string
|
||||
seen := make(map[string]bool)
|
||||
for _, path := range driverStorePaths {
|
||||
if seen[path] {
|
||||
continue
|
||||
}
|
||||
searchPaths = append(searchPaths, path)
|
||||
}
|
||||
if len(searchPaths) > 1 {
|
||||
logger.Warningf("Found multiple driver store paths: %v", searchPaths)
|
||||
}
|
||||
func newWSLDriverStoreDiscoverer(logger logger.Interface, driverRoot string, hookCreator discover.HookCreator, ldconfigPath string, searchPaths []string) (discover.Discover, error) {
|
||||
searchPaths = append(searchPaths, "/usr/lib/wsl/lib")
|
||||
|
||||
libraries := discover.NewMounts(
|
||||
|
Loading…
Reference in New Issue
Block a user