Solomon Hykes há 11 anos atrás
pai
commit
f1127b9308
7 ficheiros alterados com 27 adições e 30 exclusões
  1. 1 2
      archive/diff.go
  2. 3 3
      container.go
  3. 17 17
      devmapper/deviceset.go
  4. 1 2
      graph.go
  5. 3 4
      runtime.go
  6. 1 1
      server.go
  7. 1 1
      utils.go

+ 1 - 2
archive/diff.go

@@ -1,9 +1,9 @@
 package archive
 
 import (
-	"path/filepath"
 	"log"
 	"os"
+	"path/filepath"
 	"strings"
 )
 
@@ -56,4 +56,3 @@ func ApplyLayer(dest string, layer Archive) error {
 	}
 	return nil
 }
-

+ 3 - 3
container.go

@@ -7,9 +7,9 @@ import (
 	"flag"
 	"fmt"
 	"github.com/dotcloud/docker/archive"
+	"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
 	"github.com/dotcloud/docker/term"
 	"github.com/dotcloud/docker/utils"
-	"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
 	"github.com/kr/pty"
 	"io"
 	"io/ioutil"
@@ -26,8 +26,8 @@ import (
 )
 
 type Container struct {
-	root string	// Path to the "home" of the container, including metadata.
-	rootfs string	// Path to the root filesystem of the container.
+	root   string // Path to the "home" of the container, including metadata.
+	rootfs string // Path to the root filesystem of the container.
 
 	ID string
 

+ 17 - 17
devmapper/deviceset.go

@@ -23,11 +23,11 @@ var (
 )
 
 type DevInfo struct {
-	Hash          string       `json:"-"`
-	DeviceId      int          `json:"device_id"`
-	Size          uint64       `json:"size"`
-	TransactionId uint64       `json:"transaction_id"`
-	Initialized   bool         `json:"initialized"`
+	Hash          string     `json:"-"`
+	DeviceId      int        `json:"device_id"`
+	Size          uint64     `json:"size"`
+	TransactionId uint64     `json:"transaction_id"`
+	Initialized   bool       `json:"initialized"`
 	devices       *DeviceSet `json:"-"`
 }
 
@@ -48,16 +48,16 @@ type DeviceSet struct {
 }
 
 type DiskUsage struct {
-	Used uint64
+	Used  uint64
 	Total uint64
 }
 
 type Status struct {
-	PoolName string
-	DataLoopback string
+	PoolName         string
+	DataLoopback     string
 	MetadataLoopback string
-	Data DiskUsage
-	Metadata DiskUsage
+	Data             DiskUsage
+	Metadata         DiskUsage
 }
 
 func getDevName(name string) string {
@@ -349,11 +349,11 @@ func (devices *DeviceSet) log(level int, file string, line int, dmError int, mes
 	utils.Debugf("libdevmapper(%d): %s:%d (%d) %s", level, file, line, dmError, message)
 }
 
-func major (device uint64) uint64 {
-	return  (device >> 8) & 0xfff
+func major(device uint64) uint64 {
+	return (device >> 8) & 0xfff
 }
 
-func minor (device uint64) uint64 {
+func minor(device uint64) uint64 {
 	return (device & 0xff) | ((device >> 12) & 0xfff00)
 }
 
@@ -798,22 +798,22 @@ func (devices *DeviceSet) Status() *Status {
 	devices.Lock()
 	defer devices.Unlock()
 
-	status := &Status {}
+	status := &Status{}
 
 	if err := devices.ensureInit(); err != nil {
 		return status
 	}
 
 	status.PoolName = devices.getPoolName()
-	status.DataLoopback = path.Join( devices.loopbackDir(), "data")
-	status.MetadataLoopback = path.Join( devices.loopbackDir(), "metadata")
+	status.DataLoopback = path.Join(devices.loopbackDir(), "data")
+	status.MetadataLoopback = path.Join(devices.loopbackDir(), "metadata")
 
 	_, totalSizeInSectors, _, params, err := getStatus(devices.getPoolName())
 	if err == nil {
 		var transactionId, dataUsed, dataTotal, metadataUsed, metadataTotal uint64
 		if _, err := fmt.Sscanf(params, "%d %d/%d %d/%d", &transactionId, &metadataUsed, &metadataTotal, &dataUsed, &dataTotal); err == nil {
 			// Convert from blocks to bytes
-			blockSizeInSectors := totalSizeInSectors / dataTotal;
+			blockSizeInSectors := totalSizeInSectors / dataTotal
 
 			status.Data.Used = dataUsed * blockSizeInSectors * 512
 			status.Data.Total = dataTotal * blockSizeInSectors * 512

+ 1 - 2
graph.go

@@ -3,8 +3,8 @@ package docker
 import (
 	"fmt"
 	"github.com/dotcloud/docker/archive"
-	"github.com/dotcloud/docker/utils"
 	"github.com/dotcloud/docker/graphdriver"
+	"github.com/dotcloud/docker/utils"
 	"io"
 	"io/ioutil"
 	"os"
@@ -33,7 +33,6 @@ func NewGraph(root string, driver graphdriver.Driver) (*Graph, error) {
 		return nil, err
 	}
 
-
 	graph := &Graph{
 		Root:    abspath,
 		idIndex: utils.NewTruncIndex(),

+ 3 - 4
runtime.go

@@ -5,10 +5,10 @@ import (
 	"container/list"
 	"database/sql"
 	"fmt"
+	_ "github.com/dotcloud/docker/devmapper"
 	"github.com/dotcloud/docker/gograph"
-	"github.com/dotcloud/docker/utils"
 	"github.com/dotcloud/docker/graphdriver"
-	_ "github.com/dotcloud/docker/devmapper"
+	"github.com/dotcloud/docker/utils"
 	"io"
 	"io/ioutil"
 	"log"
@@ -682,7 +682,6 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
 		return nil, err
 	}
 
-
 	runtime := &Runtime{
 		repository:     runtimeRepo,
 		containers:     list.New(),
@@ -694,7 +693,7 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
 		volumes:        volumes,
 		config:         config,
 		containerGraph: graph,
-		driver:		driver,
+		driver:         driver,
 	}
 
 	if err := runtime.restore(); err != nil {

+ 1 - 1
server.go

@@ -9,9 +9,9 @@ import (
 	"github.com/dotcloud/docker/auth"
 	"github.com/dotcloud/docker/engine"
 	"github.com/dotcloud/docker/gograph"
+	"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
 	"github.com/dotcloud/docker/registry"
 	"github.com/dotcloud/docker/utils"
-	"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
 	"io"
 	"io/ioutil"
 	"log"

+ 1 - 1
utils.go

@@ -25,10 +25,10 @@ import (
 	"fmt"
 	"github.com/dotcloud/docker/namesgenerator"
 	"github.com/dotcloud/docker/utils"
-	"strconv"
 	"io"
 	"io/ioutil"
 	"os"
+	"strconv"
 	"strings"
 	"syscall"
 )