Merge pull request #743 from flandr/fix-osx

Fix OS X build
master
Anand Babu (AB) Periasamy 9 years ago
commit 8af5933b07
  1. 6
      pkg/crypto/sha256/sha256_darwin.go
  2. 6
      pkg/crypto/sha512/sha512_darwin.go
  3. 12
      pkg/donut/disk/disk.go
  4. 10
      pkg/utils/scsi/mountinfo.go
  5. 23
      pkg/utils/scsi/mountinfo_darwin.go
  6. 18
      pkg/utils/scsi/scsi-common.go
  7. 6
      pkg/utils/scsi/scsi.go
  8. 23
      pkg/utils/scsi/scsi_darwin.go
  9. 2
      pkg/utils/scsi/scsi_test.go

@ -17,6 +17,7 @@
package sha256 package sha256
import ( import (
"hash"
"io" "io"
"crypto/sha256" "crypto/sha256"
@ -45,3 +46,8 @@ func Sum(reader io.Reader) ([]byte, error) {
} }
return d.Sum(nil), nil return d.Sum(nil), nil
} }
// New returns a new hash.Hash computing SHA256.
func New() hash.Hash {
return sha256.New()
}

@ -17,6 +17,7 @@
package sha512 package sha512
import ( import (
"hash"
"io" "io"
"crypto/sha512" "crypto/sha512"
@ -61,3 +62,8 @@ func SumStream(reader io.Reader) ([sha512.Size]byte, error) {
copy(returnValue[:], sumSlice) copy(returnValue[:], sumSlice)
return returnValue, err return returnValue, err
} }
// New returns a new hash.Hash computing SHA512.
func New() hash.Hash {
return sha512.New()
}

@ -63,8 +63,8 @@ func New(diskPath string) (Disk, error) {
disk.fsInfo["MountPoint"] = disk.path disk.fsInfo["MountPoint"] = disk.path
return disk, nil return disk, nil
} }
return Disk{}, iodine.New(UnsupportedFilesystem{Type: strconv.FormatInt(s.Type, 10)}, return Disk{}, iodine.New(UnsupportedFilesystem{Type: strconv.FormatInt(int64(s.Type), 10)},
map[string]string{"Type": strconv.FormatInt(s.Type, 10)}) map[string]string{"Type": strconv.FormatInt(int64(s.Type), 10)})
} }
// GetPath - get root disk path // GetPath - get root disk path
@ -82,10 +82,10 @@ func (disk Disk) GetFSInfo() map[string]string {
if err != nil { if err != nil {
return nil return nil
} }
disk.fsInfo["Total"] = formatBytes(s.Bsize * int64(s.Blocks)) disk.fsInfo["Total"] = formatBytes(int64(s.Bsize) * int64(s.Blocks))
disk.fsInfo["Free"] = formatBytes(s.Bsize * int64(s.Bfree)) disk.fsInfo["Free"] = formatBytes(int64(s.Bsize) * int64(s.Bfree))
disk.fsInfo["TotalB"] = strconv.FormatInt(s.Bsize*int64(s.Blocks), 10) disk.fsInfo["TotalB"] = strconv.FormatInt(int64(s.Bsize)*int64(s.Blocks), 10)
disk.fsInfo["FreeB"] = strconv.FormatInt(s.Bsize*int64(s.Bfree), 10) disk.fsInfo["FreeB"] = strconv.FormatInt(int64(s.Bsize)*int64(s.Bfree), 10)
return disk.fsInfo return disk.fsInfo
} }

@ -31,16 +31,6 @@ import (
"github.com/minio/minio/pkg/iodine" "github.com/minio/minio/pkg/iodine"
) )
// Mountinfo container to capture /etc/mtab mount structure
type Mountinfo struct {
FSName string /* name of mounted filesystem */
Dir string /* filesystem path prefix */
Type string /* mount type (see mntent.h) */
Opts string /* mount options (see mntent.h) */
Freq int /* dump frequency in days */
Passno int /* pass number on parallel fsck */
}
var supportedFSType = map[string]bool{ var supportedFSType = map[string]bool{
"ext4": true, "ext4": true,
"xfs": true, "xfs": true,

@ -0,0 +1,23 @@
/*
* Mini Object 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 scsi
// GetMountInfo - get mount info map
func GetMountInfo() (map[string]Mountinfo, error) {
// Stub implementation; returns an empty map
return make(map[string]Mountinfo), nil
}

@ -1,5 +1,3 @@
// +build linux,amd64
/* /*
* Mini Object Storage, (C) 2014 Minio, Inc. * Mini Object Storage, (C) 2014 Minio, Inc.
* *
@ -25,6 +23,22 @@ import (
"strings" "strings"
) )
// Attributes Scsi device attributes
type Attributes map[string]string
// Disks is a list of scsis disks and attributes
type Disks map[string]Attributes
// Mountinfo container to capture /etc/mtab mount structure
type Mountinfo struct {
FSName string /* name of mounted filesystem */
Dir string /* filesystem path prefix */
Type string /* mount type (see mntent.h) */
Opts string /* mount options (see mntent.h) */
Freq int /* dump frequency in days */
Passno int /* pass number on parallel fsck */
}
func getattrs(scsiAttrPath string, scsiAttrList []string) map[string]string { func getattrs(scsiAttrPath string, scsiAttrList []string) map[string]string {
attrMap := make(map[string]string) attrMap := make(map[string]string)
for _, attr := range scsiAttrList { for _, attr := range scsiAttrList {

@ -28,12 +28,6 @@ import (
// NOTE : supporting virtio based scsi devices is out of scope for this implementation // NOTE : supporting virtio based scsi devices is out of scope for this implementation
// Attributes Scsi device attributes
type Attributes map[string]string
// Disks is a list of scsis disks and attributes
type Disks map[string]Attributes
// Get get disk scsi params // Get get disk scsi params
func (d Disks) Get(disk string) Attributes { func (d Disks) Get(disk string) Attributes {
return d[disk] return d[disk]

@ -0,0 +1,23 @@
/*
* Minimalist Object 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 scsi
// GetDisks - get system devices list
func GetDisks() (Disks, error) {
// Stub implementation; returns empty disk information
return Disks{}, nil
}

@ -1,5 +1,3 @@
// +build linux,amd64
/* /*
* Minimalist Object Storage, (C) 2015 Minio, Inc. * Minimalist Object Storage, (C) 2015 Minio, Inc.
* *

Loading…
Cancel
Save