github.com/lazyboychen7/engine@v17.12.1-ce-rc2+incompatible/daemon/graphdriver/vfs/quota_linux.go (about)

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