From 247f73b6f14520fd422a0e344779542d87e78d49 Mon Sep 17 00:00:00 2001 From: Mark Laing Date: Wed, 25 Sep 2024 10:11:07 +0100 Subject: [PATCH] lxd/fsmonitor/drivers: Use driver names where applicable. Signed-off-by: Mark Laing --- lxd/fsmonitor/drivers/driver_fanotify.go | 2 +- lxd/fsmonitor/drivers/driver_inotify.go | 2 +- lxd/fsmonitor/drivers/load.go | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lxd/fsmonitor/drivers/driver_fanotify.go b/lxd/fsmonitor/drivers/driver_fanotify.go index dc3582a4b446..bed7c2baa9bb 100644 --- a/lxd/fsmonitor/drivers/driver_fanotify.go +++ b/lxd/fsmonitor/drivers/driver_fanotify.go @@ -76,7 +76,7 @@ func (d *fanotify) eventMask() (uint64, error) { // DriverName returns the name of the driver. func (d *fanotify) DriverName() string { - return "fanotify" + return fsmonitor.DriverNameFANotify } func (d *fanotify) load(ctx context.Context) error { diff --git a/lxd/fsmonitor/drivers/driver_inotify.go b/lxd/fsmonitor/drivers/driver_inotify.go index 6df7b47bff14..e2f0fdbbb6c8 100644 --- a/lxd/fsmonitor/drivers/driver_inotify.go +++ b/lxd/fsmonitor/drivers/driver_inotify.go @@ -75,7 +75,7 @@ func (d *inotify) eventMask() (uint32, error) { // DriverName returns the name of the driver. func (d *inotify) DriverName() string { - return "inotify" + return fsmonitor.DriverNameINotify } func (d *inotify) load(ctx context.Context) error { diff --git a/lxd/fsmonitor/drivers/load.go b/lxd/fsmonitor/drivers/load.go index 143ffd60715e..dc98e8fe4101 100644 --- a/lxd/fsmonitor/drivers/load.go +++ b/lxd/fsmonitor/drivers/load.go @@ -11,8 +11,8 @@ import ( ) var drivers = map[string]func() driver{ - "inotify": func() driver { return &inotify{} }, - "fanotify": func() driver { return &fanotify{} }, + fsmonitor.DriverNameINotify: func() driver { return &inotify{} }, + fsmonitor.DriverNameFANotify: func() driver { return &fanotify{} }, } // Load returns a new fsmonitor.FSMonitor with an applicable Driver. @@ -46,10 +46,10 @@ func Load(ctx context.Context, path string, events ...fsmonitor.Event) (fsmonito return startMonitor(driverName) } - driver, err := startMonitor("fanotify") + driver, err := startMonitor(fsmonitor.DriverNameFANotify) if err != nil { logger.Warn("Failed to initialize fanotify, falling back on inotify", logger.Ctx{"err": err}) - driver, err = startMonitor("inotify") + driver, err = startMonitor(fsmonitor.DriverNameINotify) if err != nil { return nil, err }