diff --git a/node.go b/node.go index 3060d54fb..8f1ce8de5 100644 --- a/node.go +++ b/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) diff --git a/node_darwin.go b/node_darwin.go index 1d4a22927..e699f16d1 100644 --- a/node_darwin.go +++ b/node_darwin.go @@ -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()) } diff --git a/node_linux.go b/node_linux.go index 0be72c24b..0d5eb171d 100644 --- a/node_linux.go +++ b/node_linux.go @@ -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()) diff --git a/node_openbsd.go b/node_openbsd.go index 99651b719..a577ab754 100644 --- a/node_openbsd.go +++ b/node_openbsd.go @@ -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())