...
1
2
3
4
19
20 package fstest
21
22 import (
23 "path/filepath"
24 "time"
25
26 "github.com/containerd/continuity/sysx"
27 "golang.org/x/sys/unix"
28 )
29
30
31 func SetXAttr(name, key, value string) Applier {
32 return applyFn(func(root string) error {
33 path := filepath.Join(root, name)
34 return sysx.LSetxattr(path, key, []byte(value), 0)
35 })
36 }
37
38
39 func Lchtimes(name string, atime, mtime time.Time) Applier {
40 return applyFn(func(root string) error {
41 path := filepath.Join(root, name)
42 at := unix.NsecToTimespec(atime.UnixNano())
43 mt := unix.NsecToTimespec(mtime.UnixNano())
44 utimes := [2]unix.Timespec{at, mt}
45 return unix.UtimesNanoAt(unix.AT_FDCWD, path, utimes[0:], unix.AT_SYMLINK_NOFOLLOW)
46 })
47 }
48
49 func Base() Applier {
50 return applyFn(func(root string) error {
51
52 return nil
53 })
54 }
55
View as plain text