2015-08-14 13:57:47 +00:00
|
|
|
package restic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
2016-08-21 15:46:23 +00:00
|
|
|
|
2017-07-23 12:21:03 +00:00
|
|
|
"github.com/restic/restic/internal/errors"
|
2015-08-14 13:57:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// mknod() creates a filesystem node (file, device
|
|
|
|
// special file, or named pipe) named pathname, with attributes
|
|
|
|
// specified by mode and dev.
|
|
|
|
var mknod = func(path string, mode uint32, dev int) (err error) {
|
2015-08-16 11:24:21 +00:00
|
|
|
return errors.New("device nodes cannot be created on windows")
|
2015-08-14 13:57:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Windows doesn't need lchown
|
|
|
|
var lchown = func(path string, uid int, gid int) (err error) {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error {
|
2017-02-02 11:23:13 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-03-06 14:41:49 +00:00
|
|
|
func (node Node) device() int {
|
|
|
|
return int(node.Device)
|
|
|
|
}
|
|
|
|
|
2017-02-02 11:23:13 +00:00
|
|
|
// 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 {
|
2015-08-14 13:57:47 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-10-18 21:39:42 +00:00
|
|
|
type statT syscall.Win32FileAttributeData
|
2015-08-14 13:57:47 +00:00
|
|
|
|
2020-10-18 21:39:42 +00:00
|
|
|
func toStatT(i interface{}) (*statT, bool) {
|
2015-08-14 13:57:47 +00:00
|
|
|
s, ok := i.(*syscall.Win32FileAttributeData)
|
|
|
|
if ok && s != nil {
|
2020-10-18 21:39:42 +00:00
|
|
|
return (*statT)(s), true
|
2015-08-14 13:57:47 +00:00
|
|
|
}
|
|
|
|
return nil, false
|
|
|
|
}
|
|
|
|
|
2020-10-18 21:39:42 +00:00
|
|
|
func (s statT) dev() uint64 { return 0 }
|
|
|
|
func (s statT) ino() uint64 { return 0 }
|
|
|
|
func (s statT) nlink() uint64 { return 0 }
|
|
|
|
func (s statT) uid() uint32 { return 0 }
|
|
|
|
func (s statT) gid() uint32 { return 0 }
|
|
|
|
func (s statT) rdev() uint64 { return 0 }
|
2015-08-14 13:57:47 +00:00
|
|
|
|
2020-10-18 21:39:42 +00:00
|
|
|
func (s statT) size() int64 {
|
2015-08-14 13:57:47 +00:00
|
|
|
return int64(s.FileSizeLow) | (int64(s.FileSizeHigh) << 32)
|
|
|
|
}
|
|
|
|
|
2020-10-18 21:39:42 +00:00
|
|
|
func (s statT) atim() syscall.Timespec {
|
2015-08-14 13:57:47 +00:00
|
|
|
return syscall.NsecToTimespec(s.LastAccessTime.Nanoseconds())
|
|
|
|
}
|
|
|
|
|
2020-10-18 21:39:42 +00:00
|
|
|
func (s statT) mtim() syscall.Timespec {
|
2015-08-14 13:57:47 +00:00
|
|
|
return syscall.NsecToTimespec(s.LastWriteTime.Nanoseconds())
|
|
|
|
}
|
|
|
|
|
2020-10-18 21:39:42 +00:00
|
|
|
func (s statT) ctim() syscall.Timespec {
|
2019-05-05 10:45:56 +00:00
|
|
|
// Windows does not have the concept of a "change time" in the sense Unix uses it, so we're using the LastWriteTime here.
|
|
|
|
return syscall.NsecToTimespec(s.LastWriteTime.Nanoseconds())
|
2015-08-14 13:57:47 +00:00
|
|
|
}
|