1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon/graphdriver/vfs/quota_linux.go
Sebastiaan van Stijn 2f1c382a6d
golangci-lint: update to v1.49.0
Remove the "deadcode", "structcheck", and "varcheck" linters, as they are
deprecated:

    WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused.
    WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused.
    WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused.
    WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-23 23:31:27 +02:00

36 lines
810 B
Go

package vfs // import "github.com/docker/docker/daemon/graphdriver/vfs"
import (
"github.com/docker/docker/quota"
"github.com/sirupsen/logrus"
)
type driverQuota struct {
quotaCtl *quota.Control
quotaOpt quota.Quota
}
func setupDriverQuota(driver *Driver) {
if quotaCtl, err := quota.NewControl(driver.home); err == nil {
driver.quotaCtl = quotaCtl
} else if err != quota.ErrQuotaNotSupported {
logrus.Warnf("Unable to setup quota: %v\n", err)
}
}
func (d *Driver) setQuotaOpt(size uint64) error {
d.quotaOpt.Size = size
return nil
}
func (d *Driver) getQuotaOpt() uint64 {
return d.quotaOpt.Size
}
func (d *Driver) setupQuota(dir string, size uint64) error {
return d.quotaCtl.SetQuota(dir, quota.Quota{Size: size})
}
func (d *Driver) quotaSupported() bool {
return d.quotaCtl != nil
}