Skip to content

Commit 368fa25

Browse files
committed
stofuse: fix build on Darwin
1 parent d300842 commit 368fa25

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

pkg/stofuse/collectionadapter.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,10 @@ func (a *changedFileInWorkdir) Setattr(ctx context.Context, req *fuse.SetattrReq
471471
}
472472
}
473473

474-
existingATime := timespecToTime(existing.Sys().(*syscall.Stat_t).Atim)
474+
existingATime, ok := accessTimeFromStatt(existing.Sys().(*syscall.Stat_t))
475+
if !ok {
476+
return fuse.EIO
477+
}
475478

476479
// TODO: use herbis times
477480

pkg/stofuse/os_darwin.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package stofuse
2+
3+
// os-specific abstractions (Darwin)
4+
5+
import (
6+
"syscall"
7+
"time"
8+
)
9+
10+
// darwin doesn't seem to have field `Atim` in `syscall.Stat_t`
11+
func accessTimeFromStatt(stat *syscall.Stat_t) (time.Time, bool) {
12+
return time.Time{}, false
13+
}

pkg/stofuse/os_linux.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package stofuse
2+
3+
// os-specific abstractions (Linux)
4+
5+
import (
6+
"syscall"
7+
"time"
8+
)
9+
10+
func accessTimeFromStatt(stat *syscall.Stat_t) (time.Time, bool) {
11+
return timespecToTime(stat.Atim), true
12+
}

0 commit comments

Comments
 (0)