From b74852116a1cbaffcd713c8b0fe28329905c55bc Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 20 Oct 2015 11:22:00 -0700 Subject: [PATCH] Fix portability issues for arm on raspberry pi --- pkg/disk/type_linux.go | 2 +- .../minio-xl/pkg/cpu/{cpu.go => cpu_amd64.go} | 0 .../minio/minio-xl/pkg/cpu/cpu_arm.go | 32 ++++++++++ ...m_linux.S => sha256-avx-asm_linux_amd64.S} | 0 ..._linux.S => sha256-avx2-asm_linux_amd64.S} | 0 ...linux.S => sha256-ssse3-asm_linux_amd64.S} | 0 ...ha256_darwin.go => sha256_darwin_amd64.go} | 0 ...{sha256_linux.go => sha256_linux_amd64.go} | 4 +- ...nux_test.go => sha256_linux_amd64_test.go} | 0 .../pkg/crypto/sha256/sha256_linux_arm.go | 53 +++++++++++++++++ ...256_windows.go => sha256_windows_amd64.go} | 0 ...ck_linux.go => sha256block_linux_amd64.go} | 0 ...m_linux.S => sha512-avx-asm_linux_amd64.S} | 0 ..._linux.S => sha512-avx2-asm_linux_amd64.S} | 0 ...linux.S => sha512-ssse3-asm_linux_amd64.S} | 0 ...ha512_darwin.go => sha512_darwin_amd64.go} | 0 ...{sha512_linux.go => sha512_linux_amd64.go} | 4 +- ...nux_test.go => sha512_linux_amd64_test.go} | 0 ...{sha512_windows.go => sha512_linux_arm.go} | 0 .../pkg/crypto/sha512/sha512_windows_amd64.go | 58 +++++++++++++++++++ ...ck_linux.go => sha512block_linux_amd64.go} | 0 vendor/vendor.json | 28 ++++----- 22 files changed, 162 insertions(+), 19 deletions(-) rename vendor/github.com/minio/minio-xl/pkg/cpu/{cpu.go => cpu_amd64.go} (100%) create mode 100644 vendor/github.com/minio/minio-xl/pkg/cpu/cpu_arm.go rename vendor/github.com/minio/minio-xl/pkg/crypto/sha256/{sha256-avx-asm_linux.S => sha256-avx-asm_linux_amd64.S} (100%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha256/{sha256-avx2-asm_linux.S => sha256-avx2-asm_linux_amd64.S} (100%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha256/{sha256-ssse3-asm_linux.S => sha256-ssse3-asm_linux_amd64.S} (100%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha256/{sha256_darwin.go => sha256_darwin_amd64.go} (100%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha256/{sha256_linux.go => sha256_linux_amd64.go} (97%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha256/{sha256_linux_test.go => sha256_linux_amd64_test.go} (100%) create mode 100644 vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux_arm.go rename vendor/github.com/minio/minio-xl/pkg/crypto/sha256/{sha256_windows.go => sha256_windows_amd64.go} (100%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha256/{sha256block_linux.go => sha256block_linux_amd64.go} (100%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha512/{sha512-avx-asm_linux.S => sha512-avx-asm_linux_amd64.S} (100%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha512/{sha512-avx2-asm_linux.S => sha512-avx2-asm_linux_amd64.S} (100%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha512/{sha512-ssse3-asm_linux.S => sha512-ssse3-asm_linux_amd64.S} (100%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha512/{sha512_darwin.go => sha512_darwin_amd64.go} (100%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha512/{sha512_linux.go => sha512_linux_amd64.go} (97%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha512/{sha512_linux_test.go => sha512_linux_amd64_test.go} (100%) rename vendor/github.com/minio/minio-xl/pkg/crypto/sha512/{sha512_windows.go => sha512_linux_arm.go} (100%) create mode 100644 vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_windows_amd64.go rename vendor/github.com/minio/minio-xl/pkg/crypto/sha512/{sha512block_linux.go => sha512block_linux_amd64.go} (100%) diff --git a/pkg/disk/type_linux.go b/pkg/disk/type_linux.go index dcf55da9b..4609c90b0 100644 --- a/pkg/disk/type_linux.go +++ b/pkg/disk/type_linux.go @@ -46,7 +46,7 @@ func getFSType(path string) (string, error) { if err != nil { return "", err } - fsTypeHex := strconv.FormatInt(s.Type, 16) + fsTypeHex := strconv.FormatInt(int64(s.Type), 16) fsTypeString, ok := fsType2StringMap[fsTypeHex] if ok == false { return "UNKNOWN", nil diff --git a/vendor/github.com/minio/minio-xl/pkg/cpu/cpu.go b/vendor/github.com/minio/minio-xl/pkg/cpu/cpu_amd64.go similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/cpu/cpu.go rename to vendor/github.com/minio/minio-xl/pkg/cpu/cpu_amd64.go diff --git a/vendor/github.com/minio/minio-xl/pkg/cpu/cpu_arm.go b/vendor/github.com/minio/minio-xl/pkg/cpu/cpu_arm.go new file mode 100644 index 000000000..f2063689b --- /dev/null +++ b/vendor/github.com/minio/minio-xl/pkg/cpu/cpu_arm.go @@ -0,0 +1,32 @@ +/* + * Minio Cloud Storage, (C) 2015 Minio, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cpu + +// HasSSE41 - CPUID instruction verification wrapper for SSE41 extensions +func HasSSE41() bool { + return false +} + +// HasAVX - CPUID instruction verification wrapper for AVX extensions +func HasAVX() bool { + return false +} + +// HasAVX2 - CPUID instruction verification wrapper for AVX2 extensions +func HasAVX2() bool { + return false +} diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-avx-asm_linux.S b/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-avx-asm_linux_amd64.S similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-avx-asm_linux.S rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-avx-asm_linux_amd64.S diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-avx2-asm_linux.S b/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-avx2-asm_linux_amd64.S similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-avx2-asm_linux.S rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-avx2-asm_linux_amd64.S diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-ssse3-asm_linux.S b/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-ssse3-asm_linux_amd64.S similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-ssse3-asm_linux.S rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256-ssse3-asm_linux_amd64.S diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_darwin.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_darwin_amd64.go similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_darwin.go rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_darwin_amd64.go diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux_amd64.go similarity index 97% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux.go rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux_amd64.go index 0c6b44a2f..07bca48f9 100644 --- a/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux.go +++ b/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux_amd64.go @@ -17,10 +17,10 @@ import ( "github.com/minio/minio-xl/pkg/cpu" ) -// The size of a SHA256 checksum in bytes. +// Size - The size of a SHA256 checksum in bytes. const Size = 32 -// The blocksize of SHA256 in bytes. +// BlockSize - The blocksize of SHA256 in bytes. const BlockSize = 64 const ( diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux_test.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux_amd64_test.go similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux_test.go rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux_amd64_test.go diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux_arm.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux_arm.go new file mode 100644 index 000000000..4dc80c1dc --- /dev/null +++ b/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_linux_arm.go @@ -0,0 +1,53 @@ +/* + * Minio Cloud Storage, (C) 2015 Minio, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sha256 + +import ( + "hash" + "io" + + "crypto/sha256" +) + +// Sum256 - single caller sha256 helper +func Sum256(data []byte) []byte { + d := sha256.New() + d.Write(data) + return d.Sum(nil) +} + +// Sum - io.Reader based streaming sha256 helper +func Sum(reader io.Reader) ([]byte, error) { + d := sha256.New() + var err error + for err == nil { + length := 0 + byteBuffer := make([]byte, 1024*1024) + length, err = reader.Read(byteBuffer) + byteBuffer = byteBuffer[0:length] + d.Write(byteBuffer) + } + if err != io.EOF { + return nil, err + } + return d.Sum(nil), nil +} + +// New returns a new hash.Hash computing SHA256. +func New() hash.Hash { + return sha256.New() +} diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_windows.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_windows_amd64.go similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_windows.go rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256_windows_amd64.go diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256block_linux.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256block_linux_amd64.go similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256block_linux.go rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha256/sha256block_linux_amd64.go diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-avx-asm_linux.S b/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-avx-asm_linux_amd64.S similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-avx-asm_linux.S rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-avx-asm_linux_amd64.S diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-avx2-asm_linux.S b/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-avx2-asm_linux_amd64.S similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-avx2-asm_linux.S rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-avx2-asm_linux_amd64.S diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-ssse3-asm_linux.S b/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-ssse3-asm_linux_amd64.S similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-ssse3-asm_linux.S rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512-ssse3-asm_linux_amd64.S diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_darwin.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_darwin_amd64.go similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_darwin.go rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_darwin_amd64.go diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux_amd64.go similarity index 97% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux.go rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux_amd64.go index 6ebe99ca6..390d186f6 100644 --- a/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux.go +++ b/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux_amd64.go @@ -18,10 +18,10 @@ import ( "github.com/minio/minio-xl/pkg/cpu" ) -// The size of a SHA512 checksum in bytes. +// Size - The size of a SHA512 checksum in bytes. const Size = 64 -// The blocksize of SHA512 in bytes. +// BlockSize - The blocksize of SHA512 in bytes. const BlockSize = 128 const ( diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux_test.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux_amd64_test.go similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux_test.go rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux_amd64_test.go diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_windows.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux_arm.go similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_windows.go rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_linux_arm.go diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_windows_amd64.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_windows_amd64.go new file mode 100644 index 000000000..931e1a1a7 --- /dev/null +++ b/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512_windows_amd64.go @@ -0,0 +1,58 @@ +/* + * Minio Cloud Storage, (C) 2014 Minio, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sha512 + +import ( + "hash" + "io" + + "crypto/sha512" +) + +// The size of a SHA512 checksum in bytes. +const ( + Size = sha512.Size +) + +// Sum512 - single caller sha512 helper +func Sum512(data []byte) []byte { + d := sha512.New() + d.Write(data) + return d.Sum(nil) +} + +// Sum - io.Reader based streaming sha512 helper +func Sum(reader io.Reader) ([]byte, error) { + d := sha512.New() + var err error + for err == nil { + length := 0 + byteBuffer := make([]byte, 1024*1024) + length, err = reader.Read(byteBuffer) + byteBuffer = byteBuffer[0:length] + d.Write(byteBuffer) + } + if err != io.EOF { + return nil, err + } + return d.Sum(nil), nil +} + +// New returns a new hash.Hash computing SHA512. +func New() hash.Hash { + return sha512.New() +} diff --git a/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512block_linux.go b/vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512block_linux_amd64.go similarity index 100% rename from vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512block_linux.go rename to vendor/github.com/minio/minio-xl/pkg/crypto/sha512/sha512block_linux_amd64.go diff --git a/vendor/vendor.json b/vendor/vendor.json index 060fcaac2..bba41be3b 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -39,38 +39,38 @@ }, { "path": "github.com/minio/minio-xl/pkg/atomic", - "revision": "fc18620590fdb28b9e371a8cb036e9470c1cf39c", - "revisionTime": "2015-10-16T10:19:00-07:00" + "revision": "a5fc6d2430ba2ebcab31b938ab02a42bac85dc2e", + "revisionTime": "2015-10-20T11:16:42-07:00" }, { "path": "github.com/minio/minio-xl/pkg/cpu", - "revision": "fc18620590fdb28b9e371a8cb036e9470c1cf39c", - "revisionTime": "2015-10-16T10:19:00-07:00" + "revision": "a5fc6d2430ba2ebcab31b938ab02a42bac85dc2e", + "revisionTime": "2015-10-20T11:16:42-07:00" }, { "path": "github.com/minio/minio-xl/pkg/crypto/sha256", - "revision": "fc18620590fdb28b9e371a8cb036e9470c1cf39c", - "revisionTime": "2015-10-16T10:19:00-07:00" + "revision": "a5fc6d2430ba2ebcab31b938ab02a42bac85dc2e", + "revisionTime": "2015-10-20T11:16:42-07:00" }, { "path": "github.com/minio/minio-xl/pkg/crypto/sha512", - "revision": "fc18620590fdb28b9e371a8cb036e9470c1cf39c", - "revisionTime": "2015-10-16T10:19:00-07:00" + "revision": "a5fc6d2430ba2ebcab31b938ab02a42bac85dc2e", + "revisionTime": "2015-10-20T11:16:42-07:00" }, { "path": "github.com/minio/minio-xl/pkg/minhttp", - "revision": "fc18620590fdb28b9e371a8cb036e9470c1cf39c", - "revisionTime": "2015-10-16T10:19:00-07:00" + "revision": "a5fc6d2430ba2ebcab31b938ab02a42bac85dc2e", + "revisionTime": "2015-10-20T11:16:42-07:00" }, { "path": "github.com/minio/minio-xl/pkg/probe", - "revision": "fc18620590fdb28b9e371a8cb036e9470c1cf39c", - "revisionTime": "2015-10-16T10:19:00-07:00" + "revision": "a5fc6d2430ba2ebcab31b938ab02a42bac85dc2e", + "revisionTime": "2015-10-20T11:16:42-07:00" }, { "path": "github.com/minio/minio-xl/pkg/quick", - "revision": "fc18620590fdb28b9e371a8cb036e9470c1cf39c", - "revisionTime": "2015-10-16T10:19:00-07:00" + "revision": "a5fc6d2430ba2ebcab31b938ab02a42bac85dc2e", + "revisionTime": "2015-10-20T11:16:42-07:00" }, { "path": "github.com/rs/cors",