@@ -33,14 +33,28 @@ import (
3333 "github.com/NVIDIA/nvidia-container-toolkit/internal/discover"
3434 "github.com/NVIDIA/nvidia-container-toolkit/internal/edits"
3535 "github.com/NVIDIA/nvidia-container-toolkit/internal/platform-support/tegra"
36+ "github.com/NVIDIA/nvidia-container-toolkit/internal/platform-support/tegra/csv"
3637)
3738
38- type csvlib nvcdilib
39+ type csvOptions struct {
40+ Files []string
41+ IgnorePatterns []string
42+ }
3943
44+ type csvlib nvcdilib
4045type mixedcsvlib nvcdilib
4146
4247var _ deviceSpecGeneratorFactory = (* csvlib )(nil )
4348
49+ // asCSVLib sets any CSV-specific defaults and casts the nvcdilib instance as a
50+ // *csvlib.
51+ func (l * nvcdilib ) asCSVLib () * csvlib {
52+ if len (l .csv .Files ) == 0 {
53+ l .csv .Files = csv .DefaultFileList ()
54+ }
55+ return (* csvlib )(l )
56+ }
57+
4458// DeviceSpecGenerators creates a set of generators for the specified set of
4559// devices.
4660// If NVML is not available or the disable-multiple-csv-devices feature flag is
@@ -171,7 +185,7 @@ func (l *csvDeviceGenerator) deviceNodeDiscoverer() (discover.Discover, error) {
171185
172186func (l * csvDeviceGenerator ) deviceNodeMountSpecs () tegra.MountSpecPathsByTyper {
173187 mountSpecs := tegra .Transform (
174- tegra .MountSpecsFromCSVFiles (l .logger , l .csvFiles ... ),
188+ tegra .MountSpecsFromCSVFiles (l .logger , l .csv . Files ... ),
175189 // We remove non-device nodes.
176190 tegra .OnlyDeviceNodes (),
177191 )
@@ -388,10 +402,10 @@ func isIntegratedGPU(d nvml.Device) (bool, error) {
388402func (l * csvlib ) driverDiscoverer () (discover.Discover , error ) {
389403 mountSpecs := tegra .Transform (
390404 tegra .Transform (
391- tegra .MountSpecsFromCSVFiles (l .logger , l .csvFiles ... ),
405+ tegra .MountSpecsFromCSVFiles (l .logger , l .csv . Files ... ),
392406 tegra .WithoutDeviceNodes (),
393407 ),
394- tegra .IgnoreSymlinkMountSpecsByPattern (l .csvIgnorePatterns ... ),
408+ tegra .IgnoreSymlinkMountSpecsByPattern (l .csv . IgnorePatterns ... ),
395409 )
396410 driverDiscoverer , err := tegra .New (
397411 tegra .WithLogger (l .logger ),
0 commit comments