Add root to mounts type

This change adds a root member to the mounts type that is used to
perform most of the lookups for files and devices. This allows
for consistent handling of relative paths.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2022-07-15 16:42:06 +02:00
parent acc0afbb7a
commit 34e80abdea
6 changed files with 87 additions and 57 deletions

View File

@@ -36,17 +36,19 @@ func NewGDSDiscoverer(logger *logrus.Logger, root string) (Discover, error) {
root,
)
udev := &mounts{
logger: logger,
lookup: lookup.NewDirectoryLocator(logger, root),
required: []string{"/run/udev"},
}
udev := NewMounts(
logger,
lookup.NewDirectoryLocator(logger, root),
root,
[]string{"/run/udev"},
)
cufile := &mounts{
logger: logger,
lookup: lookup.NewFileLocator(logger, root),
required: []string{"/etc/cufile.json"},
}
cufile := NewMounts(
logger,
lookup.NewFileLocator(logger, root),
root,
[]string{"/etc/cufile.json"},
)
d := gdsDeviceDiscoverer{
logger: logger,