github.com/rita33cool1/iot-system-gateway@v0.0.0-20200911033302-e65bde238cc5/docker-engine/daemon/graphdriver/vfs/quota_linux.go (about)

     1  package vfs // import "github.com/docker/docker/daemon/graphdriver/vfs"
     2  
     3  import (
     4  	"github.com/docker/docker/daemon/graphdriver/quota"
     5  	"github.com/sirupsen/logrus"
     6  )
     7  
     8  type driverQuota struct {
     9  	quotaCtl *quota.Control
    10  }
    11  
    12  func setupDriverQuota(driver *Driver) {
    13  	if quotaCtl, err := quota.NewControl(driver.home); err == nil {
    14  		driver.quotaCtl = quotaCtl
    15  	} else if err != quota.ErrQuotaNotSupported {
    16  		logrus.Warnf("Unable to setup quota: %v\n", err)
    17  	}
    18  }
    19  
    20  func (d *Driver) setupQuota(dir string, size uint64) error {
    21  	return d.quotaCtl.SetQuota(dir, quota.Quota{Size: size})
    22  }
    23  
    24  func (d *Driver) quotaSupported() bool {
    25  	return d.quotaCtl != nil
    26  }