Initial commit
Proof-of-concept implementation. Bugs will occur.
This commit is contained in:
40
vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_darwin.go
generated
vendored
Normal file
40
vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_darwin.go
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright 2018 the Go-FUSE Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package utimens
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/hanwen/go-fuse/v2/fuse"
|
||||
)
|
||||
|
||||
// timeToTimeval converts time.Time to syscall.Timeval
|
||||
func timeToTimeval(t *time.Time) syscall.Timeval {
|
||||
// Note: This does not use syscall.NsecToTimespec because
|
||||
// that does not work properly for times before 1970,
|
||||
// see https://github.com/golang/go/issues/12777
|
||||
var tv syscall.Timeval
|
||||
tv.Usec = int32(t.Nanosecond() / 1000)
|
||||
tv.Sec = t.Unix()
|
||||
return tv
|
||||
}
|
||||
|
||||
// Fill converts a and m to a syscall.Timeval slice that can be passed
|
||||
// to syscall.Utimes. Missing values (if any) are taken from attr
|
||||
func Fill(a *time.Time, m *time.Time, attr *fuse.Attr) []syscall.Timeval {
|
||||
if a == nil {
|
||||
a2 := time.Unix(int64(attr.Atime), int64(attr.Atimensec))
|
||||
a = &a2
|
||||
}
|
||||
if m == nil {
|
||||
m2 := time.Unix(int64(attr.Mtime), int64(attr.Mtimensec))
|
||||
m = &m2
|
||||
}
|
||||
tv := make([]syscall.Timeval, 2)
|
||||
tv[0] = timeToTimeval(a)
|
||||
tv[1] = timeToTimeval(m)
|
||||
return tv
|
||||
}
|
||||
7
vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_linux.go
generated
vendored
Normal file
7
vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_linux.go
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2018 the Go-FUSE Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package utimens
|
||||
|
||||
// placeholder file so this package exists on all platforms.
|
||||
Reference in New Issue
Block a user