aboutsummaryrefslogtreecommitdiffhomepage
path: root/system/link.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-09-06 19:47:58 +0900
committerOphestra <cat@gensokyo.uk>2025-09-06 19:47:58 +0900
commit6cc2b406a45dee7c3fcb686036efdccc1776368d (patch)
treebc05b1f63856841802d1dc4544ef26e633919c93 /system/link.go
parentfcd0f2ede7e51b92ffbc91e57f6096e29b3b5b7d (diff)
system/link: use syscall dispatcher
This enables hardlink op methods to be instrumented. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system/link.go')
-rw-r--r--system/link.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/system/link.go b/system/link.go
index 8df85fc1..2eb658af 100644
--- a/system/link.go
+++ b/system/link.go
@@ -2,7 +2,6 @@ package system
import (
"fmt"
- "os"
)
// Link calls LinkFileType with the [Process] criteria.
@@ -22,17 +21,17 @@ type hardlinkOp struct {
func (l *hardlinkOp) Type() Enablement { return l.et }
-func (l *hardlinkOp) apply(*I) error {
- msg.Verbose("linking", l)
- return newOpError("hardlink", os.Link(l.src, l.dst), false)
+func (l *hardlinkOp) apply(sys *I) error {
+ sys.verbose("linking", l)
+ return newOpError("hardlink", sys.link(l.src, l.dst), false)
}
-func (l *hardlinkOp) revert(_ *I, ec *Criteria) error {
+func (l *hardlinkOp) revert(sys *I, ec *Criteria) error {
if ec.hasType(l.Type()) {
- msg.Verbosef("removing hard link %q", l.dst)
- return newOpError("hardlink", os.Remove(l.dst), true)
+ sys.verbosef("removing hard link %q", l.dst)
+ return newOpError("hardlink", sys.remove(l.dst), true)
} else {
- msg.Verbosef("skipping hard link %q", l.dst)
+ sys.verbosef("skipping hard link %q", l.dst)
return nil
}
}