2015-08-14 15:57:47 +02:00
|
|
|
package restic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
2016-08-21 17:46:23 +02:00
|
|
|
|
2017-07-23 14:21:03 +02:00
|
|
|
"github.com/restic/restic/internal/errors"
|
2015-08-14 15:57:47 +02:00
|
|
|
)
|
|
|
|
|
2021-05-27 21:29:51 +02:00
|
|
|
// mknod is not supported on Windows.
|
|
|
|
func mknod(path string, mode uint32, dev uint64) (err error) {
|
2015-08-16 13:24:21 +02:00
|
|
|
return errors.New("device nodes cannot be created on windows")
|
2015-08-14 15:57:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Windows doesn't need lchown
|
2021-05-27 21:29:51 +02:00
|
|
|
func lchown(path string, uid int, gid int) (err error) {
|
2015-08-14 15:57:47 +02:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error {
|
2017-02-02 12:23:13 +01:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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 15:57:47 +02:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-10-18 23:39:42 +02:00
|
|
|
type statT syscall.Win32FileAttributeData
|
2015-08-14 15:57:47 +02:00
|
|
|
|
2020-10-18 23:39:42 +02:00
|
|
|
func toStatT(i interface{}) (*statT, bool) {
|
2015-08-14 15:57:47 +02:00
|
|
|
s, ok := i.(*syscall.Win32FileAttributeData)
|
|
|
|
if ok && s != nil {
|
2020-10-18 23:39:42 +02:00
|
|
|
return (*statT)(s), true
|
2015-08-14 15:57:47 +02:00
|
|
|
}
|
|
|
|
return nil, false
|
|
|
|
}
|
|
|
|
|
2020-10-18 23:39:42 +02: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 15:57:47 +02:00
|
|
|
|
2020-10-18 23:39:42 +02:00
|
|
|
func (s statT) size() int64 {
|
2015-08-14 15:57:47 +02:00
|
|
|
return int64(s.FileSizeLow) | (int64(s.FileSizeHigh) << 32)
|
|
|
|
}
|
|
|
|
|
2020-10-18 23:39:42 +02:00
|
|
|
func (s statT) atim() syscall.Timespec {
|
2015-08-14 15:57:47 +02:00
|
|
|
return syscall.NsecToTimespec(s.LastAccessTime.Nanoseconds())
|
|
|
|
}
|
|
|
|
|
2020-10-18 23:39:42 +02:00
|
|
|
func (s statT) mtim() syscall.Timespec {
|
2015-08-14 15:57:47 +02:00
|
|
|
return syscall.NsecToTimespec(s.LastWriteTime.Nanoseconds())
|
|
|
|
}
|
|
|
|
|
2020-10-18 23:39:42 +02:00
|
|
|
func (s statT) ctim() syscall.Timespec {
|
2019-05-05 12:45:56 +02: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 15:57:47 +02:00
|
|
|
}
|