Support NetBSD without fuse

This commit is contained in:
Iku Iwasa 2018-06-16 15:48:45 +09:00
parent 393a7266c9
commit f080142137
17 changed files with 44 additions and 5 deletions

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View file

@ -66,7 +66,7 @@ func isSymlink(fi os.FileInfo) bool {
func sameModTime(fi1, fi2 os.FileInfo) bool { func sameModTime(fi1, fi2 os.FileInfo) bool {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin", "freebsd", "openbsd": case "darwin", "freebsd", "openbsd", "netbsd":
if isSymlink(fi1) && isSymlink(fi2) { if isSymlink(fi1) && isSymlink(fi2) {
return true return true
} }

View file

@ -1,4 +1,4 @@
// +build freebsd darwin // +build freebsd darwin netbsd
package fs package fs

View file

@ -1,4 +1,4 @@
// +build !windows,!darwin,!freebsd // +build !windows,!darwin,!freebsd,!netbsd
package fs package fs

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows

View file

@ -0,0 +1,27 @@
package restic
import "syscall"
func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error {
return nil
}
func (s statUnix) atim() syscall.Timespec { return s.Atimespec }
func (s statUnix) mtim() syscall.Timespec { return s.Mtimespec }
func (s statUnix) ctim() syscall.Timespec { return s.Ctimespec }
// Getxattr retrieves extended attribute data associated with path.
func Getxattr(path, name string) ([]byte, error) {
return nil, nil
}
// Listxattr retrieves a list of names of extended attributes associated with the
// given path in the file system.
func Listxattr(path string) ([]string, error) {
return nil, nil
}
// Setxattr associates name and data together as an attribute of path.
func Setxattr(path, name string, data []byte) error {
return nil
}

View file

@ -210,7 +210,7 @@ func TestNodeRestoreAt(t *testing.T) {
"%v: GID doesn't match (%v != %v)", test.Type, test.GID, n2.GID) "%v: GID doesn't match (%v != %v)", test.Type, test.GID, n2.GID)
if test.Type != "symlink" { if test.Type != "symlink" {
// On OpenBSD only root can set sticky bit (see sticky(8)). // On OpenBSD only root can set sticky bit (see sticky(8)).
if runtime.GOOS != "openbsd" && test.Name == "testSticky" { if runtime.GOOS != "openbsd" && runtime.GOOS != "netbsd" && test.Name == "testSticky" {
rtest.Assert(t, test.Mode == n2.Mode, rtest.Assert(t, test.Mode == n2.Mode,
"%v: mode doesn't match (0%o != 0%o)", test.Type, test.Mode, n2.Mode) "%v: mode doesn't match (0%o != 0%o)", test.Type, test.Mode, n2.Mode)
} }
@ -228,7 +228,7 @@ func AssertFsTimeEqual(t *testing.T, label string, nodeType string, t1 time.Time
// Go currently doesn't support setting timestamps of symbolic links on darwin and bsd // Go currently doesn't support setting timestamps of symbolic links on darwin and bsd
if nodeType == "symlink" { if nodeType == "symlink" {
switch runtime.GOOS { switch runtime.GOOS {
case "darwin", "freebsd", "openbsd": case "darwin", "freebsd", "openbsd", "netbsd":
return return
} }
} }

View file

@ -1,3 +1,4 @@
// +build !netbsd
// +build !openbsd // +build !openbsd
// +build !solaris // +build !solaris
// +build !windows // +build !windows