Fix build issues on BSDs in pkg/cpu (#7116)

Also add a cross compile script to test always cross
compilation for some well known platforms and architectures
, we support out of box compilation of these platforms even
if we don't make an official release build.

This script is to avoid regressions in this area when we
add platform dependent code.
This commit is contained in:
Harshavardhana
2019-01-22 09:27:23 +05:30
committed by Nitish Tiwari
parent 5353edcc38
commit 8e0910ab3e
9 changed files with 53 additions and 40 deletions

View File

@@ -39,7 +39,7 @@ const (
SHA256 BitrotAlgorithm = 1 + iota
// HighwayHash256 represents the HighwayHash-256 hash function
HighwayHash256
// HighwayHash256 represents the Streaming HighwayHash-256 hash function
// HighwayHash256S represents the Streaming HighwayHash-256 hash function
HighwayHash256S
// BLAKE2b512 represents the BLAKE2b-512 hash function
BLAKE2b512

View File

@@ -93,10 +93,12 @@ func (e *Erasure) DecodeDataAndParityBlocks(ctx context.Context, data [][]byte)
return nil
}
// ShardSize - returns actual shared size from erasure blockSize.
func (e *Erasure) ShardSize() int64 {
return ceilFrac(e.blockSize, int64(e.dataBlocks))
}
// ShardFileSize - returns final erasure size from original size.
func (e *Erasure) ShardFileSize(totalLength int64) int64 {
if totalLength == 0 {
return 0
@@ -107,6 +109,7 @@ func (e *Erasure) ShardFileSize(totalLength int64) int64 {
return numShards*e.ShardSize() + lastShardSize
}
// ShardFileTillOffset - returns the effectiv eoffset where erasure reading begins.
func (e *Erasure) ShardFileTillOffset(startOffset, length, totalLength int64) int64 {
shardSize := e.ShardSize()
shardFileSize := e.ShardFileSize(totalLength)

View File

@@ -1015,7 +1015,7 @@ func (s *posix) ReadFileStream(volume, path string, offset, length int64) (io.Re
if _, err = file.Seek(offset, io.SeekStart); err != nil {
return nil, err
}
return &posixLimitedReader{io.LimitedReader{file, length}}, nil
return &posixLimitedReader{io.LimitedReader{R: file, N: length}}, nil
}
// CreateFile - creates the file.