From 5103adab89a82b87ba8a66df3b8313876502cc5d Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 16 Feb 2023 15:52:39 +0100 Subject: [PATCH] Add mode option to nvcdi API Signed-off-by: Evan Lezar --- pkg/nvcdi/lib.go | 1 + pkg/nvcdi/options.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/pkg/nvcdi/lib.go b/pkg/nvcdi/lib.go index 0ea1797f..592ff186 100644 --- a/pkg/nvcdi/lib.go +++ b/pkg/nvcdi/lib.go @@ -28,6 +28,7 @@ import ( type nvcdilib struct { logger *logrus.Logger nvmllib nvml.Interface + mode string devicelib device.Interface deviceNamer DeviceNamer driverRoot string diff --git a/pkg/nvcdi/options.go b/pkg/nvcdi/options.go index 50b699a6..317cace2 100644 --- a/pkg/nvcdi/options.go +++ b/pkg/nvcdi/options.go @@ -66,3 +66,10 @@ func WithNvmlLib(nvmllib nvml.Interface) Option { l.nvmllib = nvmllib } } + +// WithMode sets the discovery mode for the library +func WithMode(mode string) Option { + return func(l *nvcdilib) { + l.mode = mode + } +}