mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -05:00
committed by
Dee Koder
parent
f460eceb6d
commit
8d59f35523
@@ -29,13 +29,13 @@ func GetInfo(path string) (info Info, err error) {
|
||||
if err != nil {
|
||||
return Info{}, err
|
||||
}
|
||||
fsReservedBlocks := uint64(s.Bfree) - uint64(s.Bavail)
|
||||
reservedBlocks := uint64(s.Bfree) - uint64(s.Bavail)
|
||||
info = Info{
|
||||
Total: uint64(s.Bsize) * (uint64(s.Blocks) - fsReservedBlocks),
|
||||
Total: uint64(s.Bsize) * (uint64(s.Blocks) - reservedBlocks),
|
||||
Free: uint64(s.Bsize) * uint64(s.Bavail),
|
||||
Files: uint64(s.Files),
|
||||
Ffree: uint64(s.Ffree),
|
||||
FSType: getFSType(s.Fstypename),
|
||||
FSType: getFSType(s.Fstypename[:]),
|
||||
}
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build netbsd solaris
|
||||
// +build netbsd
|
||||
|
||||
/*
|
||||
* Minio Cloud Storage, (C) 2017 Minio, Inc.
|
||||
|
||||
@@ -29,10 +29,10 @@ func GetInfo(path string) (info Info, err error) {
|
||||
if err != nil {
|
||||
return Info{}, err
|
||||
}
|
||||
fsReservedBlocks := uint64(s.Bfree) - uint64(s.Bavail)
|
||||
reservedBlocks := uint64(s.Bfree) - uint64(s.Bavail)
|
||||
info = Info{
|
||||
Total: uint64(s.Bsize) * (uint64(s.Blocks) - fsReservedBlocks),
|
||||
Free: uint64(s.Bsize) * uint64(s.Bavail),
|
||||
Total: uint64(s.Frsize) * (uint64(s.Blocks) - reservedBlocks),
|
||||
Free: uint64(s.Frsize) * uint64(s.Bavail),
|
||||
Files: uint64(s.Files),
|
||||
Ffree: uint64(s.Ffree),
|
||||
FSType: getFSType(int64(s.Type)),
|
||||
|
||||
@@ -29,13 +29,13 @@ func GetInfo(path string) (info Info, err error) {
|
||||
if err != nil {
|
||||
return Info{}, err
|
||||
}
|
||||
fsReservedBlocks := uint64(s.F_bfree) - uint64(s.F_bavail)
|
||||
reservedBlocks := uint64(s.F_bfree) - uint64(s.F_bavail)
|
||||
info = Info{
|
||||
Total: uint64(s.F_bsize) * (uint64(s.F_blocks) - fsReservedBlocks),
|
||||
Total: uint64(s.F_bsize) * (uint64(s.F_blocks) - reservedBlocks),
|
||||
Free: uint64(s.F_bsize) * uint64(s.F_bavail),
|
||||
Files: uint64(s.F_files),
|
||||
Ffree: uint64(s.F_ffree),
|
||||
FSType: getFSType(s.F_fstypename),
|
||||
FSType: getFSType(s.F_fstypename[:]),
|
||||
}
|
||||
return info, nil
|
||||
}
|
||||
|
||||
40
pkg/disk/stat_solaris.go
Normal file
40
pkg/disk/stat_solaris.go
Normal file
@@ -0,0 +1,40 @@
|
||||
// +build solaris
|
||||
|
||||
/*
|
||||
* Minio Cloud Storage, (C) 2017 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 disk
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// GetInfo returns total and free bytes available in a directory, e.g. `/`.
|
||||
func GetInfo(path string) (info Info, err error) {
|
||||
s := unix.Statvfs_t{}
|
||||
if err = unix.Statvfs(path, &s); err != nil {
|
||||
return Info{}, err
|
||||
}
|
||||
reservedBlocks := uint64(s.Bfree) - uint64(s.Bavail)
|
||||
info = Info{
|
||||
Total: uint64(s.Frsize) * (uint64(s.Blocks) - reservedBlocks),
|
||||
Free: uint64(s.Frsize) * uint64(s.Bavail),
|
||||
Files: uint64(s.Files),
|
||||
Ffree: uint64(s.Ffree),
|
||||
FSType: getFSType(s.Fstr[:]),
|
||||
}
|
||||
return info, nil
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build darwin freebsd dragonfly openbsd
|
||||
// +build darwin freebsd dragonfly openbsd solaris
|
||||
|
||||
/*
|
||||
* Minio Cloud Storage, (C) 2017 Minio, Inc.
|
||||
@@ -19,9 +19,9 @@
|
||||
package disk
|
||||
|
||||
// getFSType returns the filesystem type of the underlying mounted filesystem
|
||||
func getFSType(fstype [16]int8) string {
|
||||
b := make([]byte, len(fstype[:]))
|
||||
for i, v := range fstype[:] {
|
||||
func getFSType(fstype []int8) string {
|
||||
b := make([]byte, len(fstype))
|
||||
for i, v := range fstype {
|
||||
b[i] = byte(v)
|
||||
}
|
||||
return string(b)
|
||||
|
||||
Reference in New Issue
Block a user