|
|
@ -1,7 +1,7 @@ |
|
|
|
// +build netbsd
|
|
|
|
// +build netbsd
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* MinIO Cloud Storage, (C) 2017 MinIO, Inc. |
|
|
|
* MinIO Cloud Storage, (C) 2020 MinIO, Inc. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
@ -18,7 +18,23 @@ |
|
|
|
|
|
|
|
|
|
|
|
package disk |
|
|
|
package disk |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
|
|
|
"golang.org/x/sys/unix" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// GetInfo returns total and free bytes available in a directory, e.g. `/`.
|
|
|
|
// GetInfo returns total and free bytes available in a directory, e.g. `/`.
|
|
|
|
func GetInfo(path string) (info Info, err error) { |
|
|
|
func GetInfo(path string) (info Info, err error) { |
|
|
|
return Info{}, nil |
|
|
|
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: string(s.Fstypename[:]), |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return info, nil |
|
|
|
} |
|
|
|
} |