mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +00:00
node: Move unix-specific functions back to node.go
This commit is contained in:
parent
39c4b7cce2
commit
1723be5a50
12
node.go
12
node.go
@ -208,6 +208,18 @@ func (node Node) createSymlinkAt(path string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (node *Node) createDevAt(path string) error {
|
||||
return syscall.Mknod(path, syscall.S_IFBLK|0600, int(node.Device))
|
||||
}
|
||||
|
||||
func (node *Node) createCharDevAt(path string) error {
|
||||
return syscall.Mknod(path, syscall.S_IFCHR|0600, int(node.Device))
|
||||
}
|
||||
|
||||
func (node *Node) createFifoAt(path string) error {
|
||||
return syscall.Mkfifo(path, 0600)
|
||||
}
|
||||
|
||||
func (node Node) MarshalJSON() ([]byte, error) {
|
||||
type nodeJSON Node
|
||||
nj := nodeJSON(node)
|
||||
|
@ -10,18 +10,6 @@ func (node *Node) OpenForReading() (*os.File, error) {
|
||||
return os.Open(node.path)
|
||||
}
|
||||
|
||||
func (node *Node) createDevAt(path string) error {
|
||||
return syscall.Mknod(path, syscall.S_IFBLK|0600, int(node.Device))
|
||||
}
|
||||
|
||||
func (node *Node) createCharDevAt(path string) error {
|
||||
return syscall.Mknod(path, syscall.S_IFCHR|0600, int(node.Device))
|
||||
}
|
||||
|
||||
func (node *Node) createFifoAt(path string) error {
|
||||
return syscall.Mkfifo(path, 0600)
|
||||
}
|
||||
|
||||
func changeTime(stat *syscall.Stat_t) time.Time {
|
||||
return time.Unix(stat.Ctimespec.Unix())
|
||||
}
|
||||
|
@ -14,18 +14,6 @@ func (node *Node) OpenForReading() (*os.File, error) {
|
||||
return file, err
|
||||
}
|
||||
|
||||
func (node *Node) createDevAt(path string) error {
|
||||
return syscall.Mknod(path, syscall.S_IFBLK|0600, int(node.Device))
|
||||
}
|
||||
|
||||
func (node *Node) createCharDevAt(path string) error {
|
||||
return syscall.Mknod(path, syscall.S_IFCHR|0600, int(node.Device))
|
||||
}
|
||||
|
||||
func (node *Node) createFifoAt(path string) error {
|
||||
return syscall.Mkfifo(path, 0600)
|
||||
}
|
||||
|
||||
func (node *Node) fillTimes(stat *syscall.Stat_t) {
|
||||
node.ChangeTime = time.Unix(stat.Ctim.Unix())
|
||||
node.AccessTime = time.Unix(stat.Atim.Unix())
|
||||
|
@ -14,18 +14,6 @@ func (node *Node) OpenForReading() (*os.File, error) {
|
||||
return file, err
|
||||
}
|
||||
|
||||
func (node *Node) createDevAt(path string) error {
|
||||
return syscall.Mknod(path, syscall.S_IFBLK|0600, int(node.Device))
|
||||
}
|
||||
|
||||
func (node *Node) createCharDevAt(path string) error {
|
||||
return syscall.Mknod(path, syscall.S_IFCHR|0600, int(node.Device))
|
||||
}
|
||||
|
||||
func (node *Node) createFifoAt(path string) error {
|
||||
return syscall.Mkfifo(path, 0600)
|
||||
}
|
||||
|
||||
func (node *Node) fillTimes(stat *syscall.Stat_t) {
|
||||
node.ChangeTime = time.Unix(stat.Ctim.Unix())
|
||||
node.AccessTime = time.Unix(stat.Atim.Unix())
|
||||
|
Loading…
Reference in New Issue
Block a user