From 33c7b056eabe04d4a40dc22bba32e7dd2bd4eafc Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Tue, 7 Feb 2023 12:07:05 +0100 Subject: [PATCH] Add ipcMounts type Signed-off-by: Evan Lezar --- internal/discover/ipc.go | 15 +++++++++++++-- internal/discover/mounts.go | 5 +++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/internal/discover/ipc.go b/internal/discover/ipc.go index 22156a7f..80c5fb7e 100644 --- a/internal/discover/ipc.go +++ b/internal/discover/ipc.go @@ -21,9 +21,11 @@ import ( "github.com/sirupsen/logrus" ) +type ipcMounts mounts + // NewIPCDiscoverer creats a discoverer for NVIDIA IPC sockets. func NewIPCDiscoverer(logger *logrus.Logger, driverRoot string) (Discover, error) { - d := NewMounts( + d := newMounts( logger, lookup.NewFileLocator( lookup.WithLogger(logger), @@ -37,5 +39,14 @@ func NewIPCDiscoverer(logger *logrus.Logger, driverRoot string) (Discover, error }, ) - return d, nil + return (*ipcMounts)(d), nil +} + +func (d *ipcMounts) Mounts() ([]Mount, error) { + mounts, err := (*mounts)(d).Mounts() + if err != nil { + return nil, err + } + + return mounts, nil } diff --git a/internal/discover/mounts.go b/internal/discover/mounts.go index 1c9d27ff..e60ecba0 100644 --- a/internal/discover/mounts.go +++ b/internal/discover/mounts.go @@ -43,6 +43,11 @@ var _ Discover = (*mounts)(nil) // NewMounts creates a discoverer for the required mounts using the specified locator. func NewMounts(logger *logrus.Logger, lookup lookup.Locator, root string, required []string) Discover { + return newMounts(logger, lookup, root, required) +} + +// newMounts creates a discoverer for the required mounts using the specified locator. +func newMounts(logger *logrus.Logger, lookup lookup.Locator, root string, required []string) *mounts { return &mounts{ logger: logger, lookup: lookup,