github.com/shishir-a412ed/docker@v1.3.2-0.20180103180333-fda904911d87/daemon/graphdriver/vfs/quota_linux.go (about)

     1  package 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  }