Z8 zfs-apply-devices: cache and log devices converged by their stable names, after their checks

Builds: design 42 zfs-owns-zfs §17
This commit is contained in:
2026-11-13 00:32:06 +01:00
parent a10bf45ed9
commit 2fb1e5c4ea
5 changed files with 775 additions and 4 deletions
+4 -1
View File
@@ -8,6 +8,7 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"sync"
"syscall"
@@ -111,6 +112,8 @@ type Machine struct {
Now func() time.Time
// ReadFile reads a kernel file (the ARC's counters).
ReadFile func(path string) ([]byte, error)
// Resolve follows a link to its kernel path (a declared device's name under /dev/disk/by-id).
Resolve func(path string) (string, error)
// Emit publishes an event as this module (the record of an act); nil where nothing can be published.
Emit func(eventType string, body any) error
// States is the module's states on the bus (§26); nil where this process reaches none.
@@ -122,7 +125,7 @@ type Machine struct {
// Here is the machine this process runs on.
func Here() *Machine {
return &Machine{Run: ExecRunner, UID: os.Getuid(), Now: time.Now, ReadFile: os.ReadFile, Errors: LoadErrorMemory(ErrorsFile)}
return &Machine{Run: ExecRunner, UID: os.Getuid(), Now: time.Now, ReadFile: os.ReadFile, Resolve: filepath.EvalSymlinks, Errors: LoadErrorMemory(ErrorsFile)}
}
// NotApplicable is the answer of a machine without ZFS: the module does not apply here.