瀏覽代碼

Make golint happy.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Daniel Nephin 8 年之前
父節點
當前提交
eb4c4b7ecf
共有 2 個文件被更改,包括 11 次插入11 次删除
  1. 2 2
      daemon/graphdriver/overlay2/overlay.go
  2. 9 9
      daemon/graphdriver/quota/projectquota.go

+ 2 - 2
daemon/graphdriver/overlay2/overlay.go

@@ -89,7 +89,7 @@ type Driver struct {
 	uidMaps  []idtools.IDMap
 	gidMaps  []idtools.IDMap
 	ctr      *graphdriver.RefCounter
-	quotaCtl *quota.QuotaCtl
+	quotaCtl *quota.Control
 	options  overlayOptions
 }
 
@@ -164,7 +164,7 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
 
 	if backingFs == "xfs" {
 		// Try to enable project quota support over xfs.
-		if d.quotaCtl, err = quota.NewQuotaCtl(home); err == nil {
+		if d.quotaCtl, err = quota.NewControl(home); err == nil {
 			projectQuotaSupported = true
 		}
 	}

+ 9 - 9
daemon/graphdriver/quota/projectquota.go

@@ -66,15 +66,15 @@ type Quota struct {
 	Size uint64
 }
 
-// QuotaCtl - Context to be used by storage driver (e.g. overlay)
+// Control - Context to be used by storage driver (e.g. overlay)
 // who wants to apply project quotas to container dirs
-type QuotaCtl struct {
+type Control struct {
 	backingFsBlockDev string
 	nextProjectID     uint32
 	quotas            map[string]uint32
 }
 
-// NewQuotaCtl - initialize project quota support.
+// NewControl - initialize project quota support.
 // Test to make sure that quota can be set on a test dir and find
 // the first project id to be used for the next container create.
 //
@@ -96,7 +96,7 @@ type QuotaCtl struct {
 // on it. If that works, continue to scan existing containers to map allocated
 // project ids.
 //
-func NewQuotaCtl(basePath string) (*QuotaCtl, error) {
+func NewControl(basePath string) (*Control, error) {
 	//
 	// Get project id of parent dir as minimal id to be used by driver
 	//
@@ -125,7 +125,7 @@ func NewQuotaCtl(basePath string) (*QuotaCtl, error) {
 		return nil, err
 	}
 
-	q := QuotaCtl{
+	q := Control{
 		backingFsBlockDev: backingFsBlockDev,
 		nextProjectID:     minProjectID + 1,
 		quotas:            make(map[string]uint32),
@@ -139,13 +139,13 @@ func NewQuotaCtl(basePath string) (*QuotaCtl, error) {
 		return nil, err
 	}
 
-	logrus.Debugf("NewQuotaCtl(%s): nextProjectID = %d", basePath, q.nextProjectID)
+	logrus.Debugf("NewControl(%s): nextProjectID = %d", basePath, q.nextProjectID)
 	return &q, nil
 }
 
 // SetQuota - assign a unique project id to directory and set the quota limits
 // for that project id
-func (q *QuotaCtl) SetQuota(targetPath string, quota Quota) error {
+func (q *Control) SetQuota(targetPath string, quota Quota) error {
 
 	projectID, ok := q.quotas[targetPath]
 	if !ok {
@@ -196,7 +196,7 @@ func setProjectQuota(backingFsBlockDev string, projectID uint32, quota Quota) er
 }
 
 // GetQuota - get the quota limits of a directory that was configured with SetQuota
-func (q *QuotaCtl) GetQuota(targetPath string, quota *Quota) error {
+func (q *Control) GetQuota(targetPath string, quota *Quota) error {
 
 	projectID, ok := q.quotas[targetPath]
 	if !ok {
@@ -268,7 +268,7 @@ func setProjectID(targetPath string, projectID uint32) error {
 
 // findNextProjectID - find the next project id to be used for containers
 // by scanning driver home directory to find used project ids
-func (q *QuotaCtl) findNextProjectID(home string) error {
+func (q *Control) findNextProjectID(home string) error {
 	files, err := ioutil.ReadDir(home)
 	if err != nil {
 		return fmt.Errorf("read directory failed : %s", home)