Skip to content

Commit

Permalink
fix builds on freebsd
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar committed Dec 15, 2022
1 parent 61a5414 commit 62b44a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/storage/fs/owncloudsql/owncloudsql_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func (fs *owncloudsqlfs) GetQuota(ctx context.Context, ref *provider.Reference)
if err != nil {
return 0, 0, 0, err
}
total := stat.Blocks * uint64(stat.Bsize) // Total data blocks in filesystem
used := (stat.Blocks - stat.Bavail) * uint64(stat.Bsize) // Free blocks available to unprivileged user
total := stat.Blocks * uint64(stat.Bsize) // Total data blocks in filesystem
used := (stat.Blocks - uint64(stat.Bavail)) * uint64(stat.Bsize) // Free blocks available to unprivileged user
remaining := total - used
return total, used, remaining, nil
}
7 changes: 5 additions & 2 deletions pkg/storage/utils/decomposedfs/node/node_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@

package node

import "syscall"
import (
"syscall"
)

// GetAvailableSize stats the filesystem and return the available bytes
func GetAvailableSize(path string) (uint64, error) {
Expand All @@ -30,5 +32,6 @@ func GetAvailableSize(path string) (uint64, error) {
if err != nil {
return 0, err
}
return stat.Bavail * uint64(stat.Bsize), nil

return uint64(stat.Bavail) * uint64(stat.Bsize), nil
}
6 changes: 3 additions & 3 deletions pkg/storage/utils/localfs/localfs_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func (fs *localfs) GetQuota(ctx context.Context, ref *provider.Reference) (uint6
if err != nil {
return 0, 0, 0, err
}
total := stat.Blocks * uint64(stat.Bsize) // Total data blocks in filesystem
used := (stat.Blocks - stat.Bavail) * uint64(stat.Bsize) // Free blocks available to unprivileged user
remaining := stat.Bavail * uint64(stat.Bsize)
total := stat.Blocks * uint64(stat.Bsize) // Total data blocks in filesystem
used := (stat.Blocks - uint64(stat.Bavail)) * uint64(stat.Bsize) // Free blocks available to unprivileged user
remaining := uint64(stat.Bavail) * uint64(stat.Bsize)
return total, used, remaining, nil
}

0 comments on commit 62b44a5

Please sign in to comment.