Browse code

Remove all darwin specific files and use more generic _unsupported with build tags. Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)

Guillaume J. Charmes authored on 2014/01/31 07:41:10
Showing 18 changed files
1 1
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-package archive
2
-
3
-import "syscall"
4
-
5
-func getLastAccess(stat *syscall.Stat_t) syscall.Timespec {
6
-	return stat.Atimespec
7
-}
8
-
9
-func getLastModification(stat *syscall.Stat_t) syscall.Timespec {
10
-	return stat.Mtimespec
11
-}
12
-
13
-func LUtimesNano(path string, ts []syscall.Timespec) error {
14
-	return nil
15
-}
16 1
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+// +build: !linux !amd64
1
+package archive
2
+
3
+import "syscall"
4
+
5
+func getLastAccess(stat *syscall.Stat_t) syscall.Timespec {
6
+	return stat.Atimespec
7
+}
8
+
9
+func getLastModification(stat *syscall.Stat_t) syscall.Timespec {
10
+	return stat.Mtimespec
11
+}
12
+
13
+func LUtimesNano(path string, ts []syscall.Timespec) error {
14
+	return nil
15
+}
0 16
deleted file mode 100644
... ...
@@ -1,5 +0,0 @@
1
-package lxc
2
-
3
-func setHostname(hostname string) error {
4
-	panic("Not supported on darwin")
5
-}
6 1
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+// +build: !linux !amd64
1
+package lxc
2
+
3
+func setHostname(hostname string) error {
4
+	panic("Not supported on darwin")
5
+}
0 6
deleted file mode 100644
... ...
@@ -1,9 +0,0 @@
1
-package aufs
2
-
3
-import "errors"
4
-
5
-const MsRemount = 0
6
-
7
-func mount(source string, target string, fstype string, flags uintptr, data string) (err error) {
8
-	return errors.New("mount is not implemented on darwin")
9
-}
10 1
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+// +build: !linux !amd64
1
+package aufs
2
+
3
+import "errors"
4
+
5
+const MsRemount = 0
6
+
7
+func mount(source string, target string, fstype string, flags uintptr, data string) (err error) {
8
+	return errors.New("mount is not implemented on darwin")
9
+}
... ...
@@ -1,3 +1,3 @@
1
-// +build !linux
1
+// +build !linux !amd64
2 2
 
3 3
 package btrfs
4 4
deleted file mode 100644
... ...
@@ -1,5 +0,0 @@
1
-package mount
2
-
3
-func parseOptions(options string) (int, string) {
4
-	panic("Not implemented")
5
-}
6 1
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+// +build: !linux !amd64
1
+package mount
2
+
3
+func parseOptions(options string) (int, string) {
4
+	panic("Not implemented")
5
+}
0 6
deleted file mode 100644
... ...
@@ -1,9 +0,0 @@
1
-package mount
2
-
3
-func mount(device, target, mType string, flag uintptr, data string) error {
4
-	panic("Not implemented")
5
-}
6
-
7
-func unmount(target string, flag int) error {
8
-	panic("Not implemented")
9
-}
10 1
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+// +build: !linux !amd64
1
+package mount
2
+
3
+func mount(device, target, mType string, flag uintptr, data string) error {
4
+	panic("Not implemented")
5
+}
6
+
7
+func unmount(target string, flag int) error {
8
+	panic("Not implemented")
9
+}
0 10
deleted file mode 100644
... ...
@@ -1,31 +0,0 @@
1
-package netlink
2
-
3
-import (
4
-	"fmt"
5
-	"net"
6
-)
7
-
8
-func NetworkGetRoutes() ([]Route, error) {
9
-	return nil, fmt.Errorf("Not implemented")
10
-}
11
-
12
-func NetworkLinkAdd(name string, linkType string) error {
13
-	return fmt.Errorf("Not implemented")
14
-}
15
-
16
-func NetworkLinkUp(iface *net.Interface) error {
17
-	return fmt.Errorf("Not implemented")
18
-}
19
-
20
-func NetworkLinkAddIp(iface *net.Interface, ip net.IP, ipNet *net.IPNet) error {
21
-	return fmt.Errorf("Not implemented")
22
-}
23
-
24
-func AddDefaultGw(ip net.IP) error {
25
-	return fmt.Errorf("Not implemented")
26
-
27
-}
28
-
29
-func NetworkSetMTU(iface *net.Interface, mtu int) error {
30
-	return fmt.Errorf("Not implemented")
31
-}
32 1
new file mode 100644
... ...
@@ -0,0 +1,32 @@
0
+// +build: !linux !amd64
1
+package netlink
2
+
3
+import (
4
+	"fmt"
5
+	"net"
6
+)
7
+
8
+func NetworkGetRoutes() ([]Route, error) {
9
+	return nil, fmt.Errorf("Not implemented")
10
+}
11
+
12
+func NetworkLinkAdd(name string, linkType string) error {
13
+	return fmt.Errorf("Not implemented")
14
+}
15
+
16
+func NetworkLinkUp(iface *net.Interface) error {
17
+	return fmt.Errorf("Not implemented")
18
+}
19
+
20
+func NetworkLinkAddIp(iface *net.Interface, ip net.IP, ipNet *net.IPNet) error {
21
+	return fmt.Errorf("Not implemented")
22
+}
23
+
24
+func AddDefaultGw(ip net.IP) error {
25
+	return fmt.Errorf("Not implemented")
26
+
27
+}
28
+
29
+func NetworkSetMTU(iface *net.Interface, mtu int) error {
30
+	return fmt.Errorf("Not implemented")
31
+}
0 32
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-package docker
2
-
3
-import (
4
-	"io"
5
-	"os"
6
-)
7
-
8
-func CopyFile(dstFile, srcFile *os.File) error {
9
-	// No BTRFS reflink suppport, Fall back to normal copy
10
-
11
-	// FIXME: Check the return of Copy and compare with dstFile.Stat().Size
12
-	_, err := io.Copy(dstFile, srcFile)
13
-	return err
14
-}
15 1
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+// +build: !linux !amd64
1
+package docker
2
+
3
+import (
4
+	"io"
5
+	"os"
6
+)
7
+
8
+func CopyFile(dstFile, srcFile *os.File) error {
9
+	// No BTRFS reflink suppport, Fall back to normal copy
10
+
11
+	// FIXME: Check the return of Copy and compare with dstFile.Stat().Size
12
+	_, err := io.Copy(dstFile, srcFile)
13
+	return err
14
+}
... ...
@@ -24,10 +24,12 @@ func TreeSize(dir string) (size int64, err error) {
24 24
 
25 25
 		// Check inode to handle hard links correctly
26 26
 		inode := fileInfo.Sys().(*syscall.Stat_t).Ino
27
-		if _, exists := data[inode]; exists {
27
+		// inode is not a uint64 on all platforms. Cast it to avoid issues.
28
+		if _, exists := data[uint64(inode)]; exists {
28 29
 			return nil
29 30
 		}
30
-		data[inode] = false
31
+		// inode is not a uint64 on all platforms. Cast it to avoid issues.
32
+		data[uint64(inode)] = false
31 33
 
32 34
 		size += s
33 35
 
34 36
deleted file mode 100644
... ...
@@ -1,13 +0,0 @@
1
-package utils
2
-
3
-import (
4
-	"errors"
5
-)
6
-
7
-type Utsname struct {
8
-	Release [65]byte
9
-}
10
-
11
-func uname() (*Utsname, error) {
12
-	return nil, errors.New("Kernel version detection is not available on darwin")
13
-}
14 1
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+// +build: !linux !amd64
1
+package utils
2
+
3
+import (
4
+	"errors"
5
+)
6
+
7
+type Utsname struct {
8
+	Release [65]byte
9
+}
10
+
11
+func uname() (*Utsname, error) {
12
+	return nil, errors.New("Kernel version detection is available only on linux")
13
+}