mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
Merge branch 'CNT-3580/inject-egl-wayland' into 'main'
Add egl_external_platform.d/10_nvidia_wayland.json to graphics mounts See merge request nvidia/container-toolkit/container-toolkit!252
This commit is contained in:
commit
ebf1772068
@ -26,7 +26,10 @@ import (
|
|||||||
func NewIPCDiscoverer(logger *logrus.Logger, root string) (discover.Discover, error) {
|
func NewIPCDiscoverer(logger *logrus.Logger, root string) (discover.Discover, error) {
|
||||||
d := discover.NewMounts(
|
d := discover.NewMounts(
|
||||||
logger,
|
logger,
|
||||||
lookup.NewFileLocator(logger, root),
|
lookup.NewFileLocator(
|
||||||
|
lookup.WithLogger(logger),
|
||||||
|
lookup.WithRoot(root),
|
||||||
|
),
|
||||||
root,
|
root,
|
||||||
[]string{
|
[]string{
|
||||||
"/var/run/nvidia-persistenced/socket",
|
"/var/run/nvidia-persistenced/socket",
|
||||||
|
@ -45,7 +45,10 @@ func NewGDSDiscoverer(logger *logrus.Logger, root string) (Discover, error) {
|
|||||||
|
|
||||||
cufile := NewMounts(
|
cufile := NewMounts(
|
||||||
logger,
|
logger,
|
||||||
lookup.NewFileLocator(logger, root),
|
lookup.NewFileLocator(
|
||||||
|
lookup.WithLogger(logger),
|
||||||
|
lookup.WithRoot(root),
|
||||||
|
),
|
||||||
root,
|
root,
|
||||||
[]string{"/etc/cufile.json"},
|
[]string{"/etc/cufile.json"},
|
||||||
)
|
)
|
||||||
|
@ -70,17 +70,18 @@ func NewGraphicsMountsDiscoverer(logger *logrus.Logger, root string) (Discover,
|
|||||||
|
|
||||||
jsonMounts := NewMounts(
|
jsonMounts := NewMounts(
|
||||||
logger,
|
logger,
|
||||||
lookup.NewFileLocator(logger, root),
|
lookup.NewFileLocator(
|
||||||
|
lookup.WithLogger(logger),
|
||||||
|
lookup.WithRoot(root),
|
||||||
|
lookup.WithSearchPaths("/etc", "/usr/share"),
|
||||||
|
),
|
||||||
root,
|
root,
|
||||||
[]string{
|
[]string{
|
||||||
// TODO: We should handle this more cleanly
|
"glvnd/egl_vendor.d/10_nvidia.json",
|
||||||
"/etc/glvnd/egl_vendor.d/10_nvidia.json",
|
"vulkan/icd.d/nvidia_icd.json",
|
||||||
"/etc/vulkan/icd.d/nvidia_icd.json",
|
"vulkan/implicit_layer.d/nvidia_layers.json",
|
||||||
"/etc/vulkan/implicit_layer.d/nvidia_layers.json",
|
"egl/egl_external_platform.d/15_nvidia_gbm.json",
|
||||||
"/usr/share/glvnd/egl_vendor.d/10_nvidia.json",
|
"egl/egl_external_platform.d/10_nvidia_wayland.json",
|
||||||
"/usr/share/vulkan/icd.d/nvidia_icd.json",
|
|
||||||
"/usr/share/vulkan/implicit_layer.d/nvidia_layers.json",
|
|
||||||
"/usr/share/egl/egl_external_platform.d/15_nvidia_gbm.json",
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -164,7 +165,10 @@ func (d drmDevicesByPath) getSpecificLinkArgs(devices []Device) ([]string, error
|
|||||||
selectedDevices[filepath.Base(d.HostPath)] = true
|
selectedDevices[filepath.Base(d.HostPath)] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
linkLocator := lookup.NewFileLocator(d.logger, d.root)
|
linkLocator := lookup.NewFileLocator(
|
||||||
|
lookup.WithLogger(d.logger),
|
||||||
|
lookup.WithRoot(d.root),
|
||||||
|
)
|
||||||
candidates, err := linkLocator.Locate("/dev/dri/by-path/pci-*-*")
|
candidates, err := linkLocator.Locate("/dev/dri/by-path/pci-*-*")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
d.logger.Warningf("Failed to locate by-path links: %v; ignoring", err)
|
d.logger.Warningf("Failed to locate by-path links: %v; ignoring", err)
|
||||||
|
@ -19,7 +19,6 @@ package lookup
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
@ -31,13 +30,12 @@ const (
|
|||||||
// NewCharDeviceLocator creates a Locator that can be used to find char devices at the specified root. A logger is
|
// NewCharDeviceLocator creates a Locator that can be used to find char devices at the specified root. A logger is
|
||||||
// also specified.
|
// also specified.
|
||||||
func NewCharDeviceLocator(logger *logrus.Logger, root string) Locator {
|
func NewCharDeviceLocator(logger *logrus.Logger, root string) Locator {
|
||||||
l := file{
|
return NewFileLocator(
|
||||||
logger: logger,
|
WithLogger(logger),
|
||||||
prefixes: []string{root, filepath.Join(root, devRoot)},
|
WithRoot(root),
|
||||||
filter: assertCharDevice,
|
WithSearchPaths("", devRoot),
|
||||||
}
|
WithFilter(assertCharDevice),
|
||||||
|
)
|
||||||
return &l
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// assertCharDevice checks whether the specified path is a char device and returns an error if this is not the case.
|
// assertCharDevice checks whether the specified path is a char device and returns an error if this is not the case.
|
||||||
|
55
internal/lookup/device_test.go
Normal file
55
internal/lookup/device_test.go
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/**
|
||||||
|
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
package lookup
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testlog "github.com/sirupsen/logrus/hooks/test"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestCharDeviceLocator(t *testing.T) {
|
||||||
|
logger, _ := testlog.NewNullLogger()
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
root string
|
||||||
|
expectedPrefixes []string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
root: "",
|
||||||
|
expectedPrefixes: []string{"", "/dev"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/",
|
||||||
|
expectedPrefixes: []string{"/", "/dev"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/some/root",
|
||||||
|
expectedPrefixes: []string{"/some/root", "/some/root/dev"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, tc := range testCases {
|
||||||
|
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
|
||||||
|
f := NewCharDeviceLocator(logger, tc.root).(*file)
|
||||||
|
|
||||||
|
require.EqualValues(t, tc.expectedPrefixes, f.prefixes)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -26,13 +26,11 @@ import (
|
|||||||
// NewDirectoryLocator creates a Locator that can be used to find directories at the specified root. A logger
|
// NewDirectoryLocator creates a Locator that can be used to find directories at the specified root. A logger
|
||||||
// is also specified.
|
// is also specified.
|
||||||
func NewDirectoryLocator(logger *log.Logger, root string) Locator {
|
func NewDirectoryLocator(logger *log.Logger, root string) Locator {
|
||||||
l := file{
|
return NewFileLocator(
|
||||||
logger: logger,
|
WithLogger(logger),
|
||||||
prefixes: []string{root},
|
WithRoot(root),
|
||||||
filter: assertDirectory,
|
WithFilter(assertDirectory),
|
||||||
}
|
)
|
||||||
|
|
||||||
return &l
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// assertDirectory checks wither the specified path is a directory.
|
// assertDirectory checks wither the specified path is a directory.
|
||||||
|
@ -19,7 +19,6 @@ package lookup
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
@ -33,17 +32,21 @@ type executable struct {
|
|||||||
func NewExecutableLocator(logger *log.Logger, root string) Locator {
|
func NewExecutableLocator(logger *log.Logger, root string) Locator {
|
||||||
paths := GetPaths(root)
|
paths := GetPaths(root)
|
||||||
|
|
||||||
var prefixes []string
|
return newExecutableLocator(logger, root, paths...)
|
||||||
for _, dir := range paths {
|
}
|
||||||
prefixes = append(prefixes, filepath.Join(root, dir))
|
|
||||||
}
|
func newExecutableLocator(logger *log.Logger, root string, paths ...string) *executable {
|
||||||
|
f := newFileLocator(
|
||||||
|
WithLogger(logger),
|
||||||
|
WithRoot(root),
|
||||||
|
WithSearchPaths(paths...),
|
||||||
|
WithFilter(assertExecutable),
|
||||||
|
)
|
||||||
|
|
||||||
l := executable{
|
l := executable{
|
||||||
file: file{
|
file: *f,
|
||||||
logger: logger,
|
|
||||||
prefixes: prefixes,
|
|
||||||
filter: assertExecutable,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &l
|
return &l
|
||||||
}
|
}
|
||||||
|
|
||||||
|
77
internal/lookup/executable_test.go
Normal file
77
internal/lookup/executable_test.go
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
package lookup
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testlog "github.com/sirupsen/logrus/hooks/test"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestExecutableLocator(t *testing.T) {
|
||||||
|
logger, _ := testlog.NewNullLogger()
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
root string
|
||||||
|
paths []string
|
||||||
|
expectedPrefixes []string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
root: "",
|
||||||
|
expectedPrefixes: []string{""},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "",
|
||||||
|
paths: []string{"/"},
|
||||||
|
expectedPrefixes: []string{"/"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "",
|
||||||
|
paths: []string{"/", "/bin"},
|
||||||
|
expectedPrefixes: []string{"/", "/bin"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/",
|
||||||
|
expectedPrefixes: []string{"/"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/",
|
||||||
|
paths: []string{"/"},
|
||||||
|
expectedPrefixes: []string{"/"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/",
|
||||||
|
paths: []string{"/", "/bin"},
|
||||||
|
expectedPrefixes: []string{"/", "/bin"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/some/path",
|
||||||
|
paths: []string{"/", "/bin"},
|
||||||
|
expectedPrefixes: []string{"/some/path", "/some/path/bin"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, tc := range testCases {
|
||||||
|
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
|
||||||
|
e := newExecutableLocator(logger, tc.root, tc.paths...)
|
||||||
|
|
||||||
|
require.EqualValues(t, tc.expectedPrefixes, e.prefixes)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -28,26 +28,98 @@ import (
|
|||||||
// prefixes. The validity of a file is determined by a filter function.
|
// prefixes. The validity of a file is determined by a filter function.
|
||||||
type file struct {
|
type file struct {
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
|
root string
|
||||||
prefixes []string
|
prefixes []string
|
||||||
filter func(string) error
|
filter func(string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFileLocator creates a Locator that can be used to find files at the specified root. A logger
|
// Option defines a function for passing options to the NewFileLocator() call
|
||||||
// can also be specified.
|
type Option func(*file)
|
||||||
func NewFileLocator(logger *log.Logger, root string) Locator {
|
|
||||||
l := newFileLocator(logger, root)
|
|
||||||
|
|
||||||
return &l
|
// WithRoot sets the root for the file locator
|
||||||
|
func WithRoot(root string) Option {
|
||||||
|
return func(f *file) {
|
||||||
|
f.root = root
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newFileLocator(logger *log.Logger, root string) file {
|
// WithLogger sets the logger for the file locator
|
||||||
return file{
|
func WithLogger(logger *log.Logger) Option {
|
||||||
logger: logger,
|
return func(f *file) {
|
||||||
prefixes: []string{root},
|
f.logger = logger
|
||||||
filter: assertFile,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithSearchPaths sets the search paths for the file locator.
|
||||||
|
func WithSearchPaths(paths ...string) Option {
|
||||||
|
return func(f *file) {
|
||||||
|
f.prefixes = paths
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithFilter sets the filter for the file locator
|
||||||
|
// The filter is called for each candidate file and candidates that return nil are considered.
|
||||||
|
func WithFilter(assert func(string) error) Option {
|
||||||
|
return func(f *file) {
|
||||||
|
f.filter = assert
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFileLocator creates a Locator that can be used to find files with the specified options.
|
||||||
|
func NewFileLocator(opts ...Option) Locator {
|
||||||
|
return newFileLocator(opts...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func newFileLocator(opts ...Option) *file {
|
||||||
|
f := &file{}
|
||||||
|
for _, opt := range opts {
|
||||||
|
opt(f)
|
||||||
|
}
|
||||||
|
if f.logger == nil {
|
||||||
|
f.logger = log.StandardLogger()
|
||||||
|
}
|
||||||
|
if f.filter == nil {
|
||||||
|
f.filter = assertFile
|
||||||
|
}
|
||||||
|
// Since the `Locate` implementations rely on the root already being specified we update
|
||||||
|
// the prefixes to include the root.
|
||||||
|
f.prefixes = getSearchPrefixes(f.root, f.prefixes...)
|
||||||
|
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
// getSearchPrefixes generates a list of unique paths to be searched by a file locator.
|
||||||
|
//
|
||||||
|
// For each of the unique prefixes <p> specified, the path <root><p> is searched, where <root> is the
|
||||||
|
// specified root. If no prefixes are specified, <root> is returned as the only search prefix.
|
||||||
|
//
|
||||||
|
// Note that an empty root is equivalent to searching relative to the current working directory, and
|
||||||
|
// if the root filesystem should be searched instead, root should be specified as "/" explicitly.
|
||||||
|
//
|
||||||
|
// Also, a prefix of "" forces the root to be included in returned set of paths. This means that if
|
||||||
|
// the root in addition to another prefix must be searched the function should be called with:
|
||||||
|
//
|
||||||
|
// getSearchPrefixes("/root", "", "another/path")
|
||||||
|
//
|
||||||
|
// and will result in the search paths []{"/root", "/root/another/path"} being returned.
|
||||||
|
func getSearchPrefixes(root string, prefixes ...string) []string {
|
||||||
|
seen := make(map[string]bool)
|
||||||
|
var uniquePrefixes []string
|
||||||
|
for _, p := range prefixes {
|
||||||
|
if seen[p] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
seen[p] = true
|
||||||
|
uniquePrefixes = append(uniquePrefixes, filepath.Join(root, p))
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(uniquePrefixes) == 0 {
|
||||||
|
uniquePrefixes = append(uniquePrefixes, root)
|
||||||
|
}
|
||||||
|
|
||||||
|
return uniquePrefixes
|
||||||
|
}
|
||||||
|
|
||||||
var _ Locator = (*file)(nil)
|
var _ Locator = (*file)(nil)
|
||||||
|
|
||||||
// Locate attempts to find files with names matching the specified pattern.
|
// Locate attempts to find files with names matching the specified pattern.
|
||||||
|
82
internal/lookup/file_test.go
Normal file
82
internal/lookup/file_test.go
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/**
|
||||||
|
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
package lookup
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetSearchPrefixes(t *testing.T) {
|
||||||
|
testCases := []struct {
|
||||||
|
root string
|
||||||
|
prefixes []string
|
||||||
|
expectedPrefixes []string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
root: "",
|
||||||
|
expectedPrefixes: []string{""},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/",
|
||||||
|
expectedPrefixes: []string{"/"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/some/root",
|
||||||
|
expectedPrefixes: []string{"/some/root"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "",
|
||||||
|
prefixes: []string{"foo", "bar"},
|
||||||
|
expectedPrefixes: []string{"foo", "bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/",
|
||||||
|
prefixes: []string{"foo", "bar"},
|
||||||
|
expectedPrefixes: []string{"/foo", "/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/",
|
||||||
|
prefixes: []string{"/foo", "/bar"},
|
||||||
|
expectedPrefixes: []string{"/foo", "/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/some/root",
|
||||||
|
prefixes: []string{"foo", "bar"},
|
||||||
|
expectedPrefixes: []string{"/some/root/foo", "/some/root/bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "",
|
||||||
|
prefixes: []string{"foo", "bar", "bar", "foo"},
|
||||||
|
expectedPrefixes: []string{"foo", "bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: "/some/root",
|
||||||
|
prefixes: []string{"foo", "bar", "foo", "bar"},
|
||||||
|
expectedPrefixes: []string{"/some/root/foo", "/some/root/bar"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, tc := range testCases {
|
||||||
|
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
|
||||||
|
prefixes := getSearchPrefixes(tc.root, tc.prefixes...)
|
||||||
|
require.EqualValues(t, tc.expectedPrefixes, prefixes)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -35,8 +35,9 @@ type symlink struct {
|
|||||||
// NewSymlinkChainLocator creats a locator that can be used for locating files through symlinks.
|
// NewSymlinkChainLocator creats a locator that can be used for locating files through symlinks.
|
||||||
// A logger can also be specified.
|
// A logger can also be specified.
|
||||||
func NewSymlinkChainLocator(logger *logrus.Logger, root string) Locator {
|
func NewSymlinkChainLocator(logger *logrus.Logger, root string) Locator {
|
||||||
|
f := newFileLocator(WithLogger(logger), WithRoot(root))
|
||||||
l := symlinkChain{
|
l := symlinkChain{
|
||||||
file: newFileLocator(logger, root),
|
file: *f,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &l
|
return &l
|
||||||
@ -45,8 +46,9 @@ func NewSymlinkChainLocator(logger *logrus.Logger, root string) Locator {
|
|||||||
// NewSymlinkLocator creats a locator that can be used for locating files through symlinks.
|
// NewSymlinkLocator creats a locator that can be used for locating files through symlinks.
|
||||||
// A logger can also be specified.
|
// A logger can also be specified.
|
||||||
func NewSymlinkLocator(logger *logrus.Logger, root string) Locator {
|
func NewSymlinkLocator(logger *logrus.Logger, root string) Locator {
|
||||||
|
f := newFileLocator(WithLogger(logger), WithRoot(root))
|
||||||
l := symlink{
|
l := symlink{
|
||||||
file: newFileLocator(logger, root),
|
file: *f,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &l
|
return &l
|
||||||
|
@ -33,7 +33,7 @@ func NewTegraPlatformFiles(logger *logrus.Logger) (oci.SpecModifier, error) {
|
|||||||
|
|
||||||
tegraSystemMounts := discover.NewMounts(
|
tegraSystemMounts := discover.NewMounts(
|
||||||
logger,
|
logger,
|
||||||
lookup.NewFileLocator(logger, ""),
|
lookup.NewFileLocator(lookup.WithLogger(logger)),
|
||||||
"",
|
"",
|
||||||
[]string{
|
[]string{
|
||||||
"/etc/nv_tegra_release",
|
"/etc/nv_tegra_release",
|
||||||
|
Loading…
Reference in New Issue
Block a user