From 45dd051e8ee2e0e18d8ffec99f65878c20bd11e9 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Thu, 30 Jan 2014 22:41:10 +0000 Subject: [PATCH] Remove all darwin specific files and use more generic _unsupported with build tags. Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes (github: creack) --- archive/{stat_darwin.go => stat_unsupported.go} | 1 + .../lxc/{lxc_init_darwin.go => lxc_init_unsupported.go} | 1 + graphdriver/aufs/{mount_darwin.go => mount_unsupported.go} | 1 + graphdriver/btrfs/dummy_unsupported.go | 2 +- pkg/mount/{flags_darwin.go => flags_unsupported.go} | 1 + pkg/mount/{mounter_darwin.go => mounter_unsupported.go} | 1 + pkg/netlink/{netlink_darwin.go => netlink_unsupported.go} | 1 + reflink_copy_darwin.go => reflink_copy_unsupported.go | 1 + utils/fs.go | 6 ++++-- utils/{uname_darwin.go => uname_unsupported.go} | 3 ++- 10 files changed, 14 insertions(+), 4 deletions(-) rename archive/{stat_darwin.go => stat_unsupported.go} (92%) rename execdriver/lxc/{lxc_init_darwin.go => lxc_init_unsupported.go} (78%) rename graphdriver/aufs/{mount_darwin.go => mount_unsupported.go} (89%) rename pkg/mount/{flags_darwin.go => flags_unsupported.go} (78%) rename pkg/mount/{mounter_darwin.go => mounter_unsupported.go} (88%) rename pkg/netlink/{netlink_darwin.go => netlink_unsupported.go} (96%) rename reflink_copy_darwin.go => reflink_copy_unsupported.go (91%) rename utils/{uname_darwin.go => uname_unsupported.go} (52%) diff --git a/archive/stat_darwin.go b/archive/stat_unsupported.go similarity index 92% rename from archive/stat_darwin.go rename to archive/stat_unsupported.go index e041783ec6..6c2d3a04b3 100644 --- a/archive/stat_darwin.go +++ b/archive/stat_unsupported.go @@ -1,3 +1,4 @@ +// +build: !linux !amd64 package archive import "syscall" diff --git a/execdriver/lxc/lxc_init_darwin.go b/execdriver/lxc/lxc_init_unsupported.go similarity index 78% rename from execdriver/lxc/lxc_init_darwin.go rename to execdriver/lxc/lxc_init_unsupported.go index c066fead93..6b19b99285 100644 --- a/execdriver/lxc/lxc_init_darwin.go +++ b/execdriver/lxc/lxc_init_unsupported.go @@ -1,3 +1,4 @@ +// +build: !linux !amd64 package lxc func setHostname(hostname string) error { diff --git a/graphdriver/aufs/mount_darwin.go b/graphdriver/aufs/mount_unsupported.go similarity index 89% rename from graphdriver/aufs/mount_darwin.go rename to graphdriver/aufs/mount_unsupported.go index 62c84fc7c9..24b64226d2 100644 --- a/graphdriver/aufs/mount_darwin.go +++ b/graphdriver/aufs/mount_unsupported.go @@ -1,3 +1,4 @@ +// +build: !linux !amd64 package aufs import "errors" diff --git a/graphdriver/btrfs/dummy_unsupported.go b/graphdriver/btrfs/dummy_unsupported.go index 5efd18081f..6c44615763 100644 --- a/graphdriver/btrfs/dummy_unsupported.go +++ b/graphdriver/btrfs/dummy_unsupported.go @@ -1,3 +1,3 @@ -// +build !linux +// +build !linux !amd64 package btrfs diff --git a/pkg/mount/flags_darwin.go b/pkg/mount/flags_unsupported.go similarity index 78% rename from pkg/mount/flags_darwin.go rename to pkg/mount/flags_unsupported.go index e89d5e703a..d0b59a63bd 100644 --- a/pkg/mount/flags_darwin.go +++ b/pkg/mount/flags_unsupported.go @@ -1,3 +1,4 @@ +// +build: !linux !amd64 package mount func parseOptions(options string) (int, string) { diff --git a/pkg/mount/mounter_darwin.go b/pkg/mount/mounter_unsupported.go similarity index 88% rename from pkg/mount/mounter_darwin.go rename to pkg/mount/mounter_unsupported.go index 7615f94f9e..1dd7458eb0 100644 --- a/pkg/mount/mounter_darwin.go +++ b/pkg/mount/mounter_unsupported.go @@ -1,3 +1,4 @@ +// +build: !linux !amd64 package mount func mount(device, target, mType string, flag uintptr, data string) error { diff --git a/pkg/netlink/netlink_darwin.go b/pkg/netlink/netlink_unsupported.go similarity index 96% rename from pkg/netlink/netlink_darwin.go rename to pkg/netlink/netlink_unsupported.go index 298508ad10..3fa0c1e93f 100644 --- a/pkg/netlink/netlink_darwin.go +++ b/pkg/netlink/netlink_unsupported.go @@ -1,3 +1,4 @@ +// +build: !linux !amd64 package netlink import ( diff --git a/reflink_copy_darwin.go b/reflink_copy_unsupported.go similarity index 91% rename from reflink_copy_darwin.go rename to reflink_copy_unsupported.go index 4f0ea8c4fd..8ad94c4f60 100644 --- a/reflink_copy_darwin.go +++ b/reflink_copy_unsupported.go @@ -1,3 +1,4 @@ +// +build: !linux !amd64 package docker import ( diff --git a/utils/fs.go b/utils/fs.go index e710926210..92864e5e16 100644 --- a/utils/fs.go +++ b/utils/fs.go @@ -24,10 +24,12 @@ func TreeSize(dir string) (size int64, err error) { // Check inode to handle hard links correctly inode := fileInfo.Sys().(*syscall.Stat_t).Ino - if _, exists := data[inode]; exists { + // inode is not a uint64 on all platforms. Cast it to avoid issues. + if _, exists := data[uint64(inode)]; exists { return nil } - data[inode] = false + // inode is not a uint64 on all platforms. Cast it to avoid issues. + data[uint64(inode)] = false size += s diff --git a/utils/uname_darwin.go b/utils/uname_unsupported.go similarity index 52% rename from utils/uname_darwin.go rename to utils/uname_unsupported.go index a875e8c600..79ea51bd86 100644 --- a/utils/uname_darwin.go +++ b/utils/uname_unsupported.go @@ -1,3 +1,4 @@ +// +build: !linux !amd64 package utils import ( @@ -9,5 +10,5 @@ type Utsname struct { } func uname() (*Utsname, error) { - return nil, errors.New("Kernel version detection is not available on darwin") + return nil, errors.New("Kernel version detection is available only on linux") }