Skip to content

Commit

Permalink
Fix the issue where compiling containers-storage with exclude_disk_qu…
Browse files Browse the repository at this point in the history
…ota enabled on the Linux CGO platform results in an error indicating that d.quotaCtl.GetDiskUsage is not defined.

Signed-off-by: Shi Xue <shixue@cestc.com>

Fix the issue where compiling containers-storage with exclude_disk_quota enabled on the Linux CGO platform results in an error indicating that d.quotaCtl.GetDiskUsage is not defined.

Signed-off-by: Shi Xue <shixue@cestc.com>
  • Loading branch information
Shi Xue authored and Shi Yixue committed Jun 23, 2024
1 parent 9a0bef0 commit 2c00a5c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build linux && cgo
// +build linux,cgo
//go:build linux && cgo && !exclude_disk_quota
// +build linux,cgo,!exclude_disk_quota

package overlay

Expand Down
18 changes: 18 additions & 0 deletions drivers/overlay/overlay_disk_quota_unsupported.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//go:build linux && (!cgo || exclude_disk_quota)
// +build linux
// +build !cgo exclude_disk_quota

package overlay

import (
"path"

"github.com/containers/storage/pkg/directory"
)

// ReadWriteDiskUsage returns the disk usage of the writable directory for the ID.
// For Overlay, it attempts to check the XFS quota for size, and falls back to
// finding the size of the "diff" directory.
func (d *Driver) ReadWriteDiskUsage(id string) (*directory.DiskUsage, error) {
return directory.Usage(path.Join(d.dir(id), "diff"))
}
10 changes: 0 additions & 10 deletions drivers/overlay/overlay_nocgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,8 @@ package overlay

import (
"fmt"
"path"

"github.com/containers/storage/pkg/directory"
)

// ReadWriteDiskUsage returns the disk usage of the writable directory for the ID.
// For Overlay, it attempts to check the XFS quota for size, and falls back to
// finding the size of the "diff" directory.
func (d *Driver) ReadWriteDiskUsage(id string) (*directory.DiskUsage, error) {
return directory.Usage(path.Join(d.dir(id), "diff"))
}

func getComposeFsHelper() (string, error) {
return "", fmt.Errorf("composefs not supported on this build")
}
Expand Down

0 comments on commit 2c00a5c

Please sign in to comment.