Solomon Hykes authored on 2013/11/08 08:58:03
Showing 7 changed files
... ...
@@ -1,9 +1,9 @@
1 1
 package archive
2 2
 
3 3
 import (
4
-	"path/filepath"
5 4
 	"log"
6 5
 	"os"
6
+	"path/filepath"
7 7
 	"strings"
8 8
 )
9 9
 
... ...
@@ -56,4 +56,3 @@ func ApplyLayer(dest string, layer Archive) error {
56 56
 	}
57 57
 	return nil
58 58
 }
59
-
... ...
@@ -7,9 +7,9 @@ import (
7 7
 	"flag"
8 8
 	"fmt"
9 9
 	"github.com/dotcloud/docker/archive"
10
+	"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
10 11
 	"github.com/dotcloud/docker/term"
11 12
 	"github.com/dotcloud/docker/utils"
12
-	"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
13 13
 	"github.com/kr/pty"
14 14
 	"io"
15 15
 	"io/ioutil"
... ...
@@ -26,8 +26,8 @@ import (
26 26
 )
27 27
 
28 28
 type Container struct {
29
-	root string	// Path to the "home" of the container, including metadata.
30
-	rootfs string	// Path to the root filesystem of the container.
29
+	root   string // Path to the "home" of the container, including metadata.
30
+	rootfs string // Path to the root filesystem of the container.
31 31
 
32 32
 	ID string
33 33
 
... ...
@@ -23,11 +23,11 @@ var (
23 23
 )
24 24
 
25 25
 type DevInfo struct {
26
-	Hash          string       `json:"-"`
27
-	DeviceId      int          `json:"device_id"`
28
-	Size          uint64       `json:"size"`
29
-	TransactionId uint64       `json:"transaction_id"`
30
-	Initialized   bool         `json:"initialized"`
26
+	Hash          string     `json:"-"`
27
+	DeviceId      int        `json:"device_id"`
28
+	Size          uint64     `json:"size"`
29
+	TransactionId uint64     `json:"transaction_id"`
30
+	Initialized   bool       `json:"initialized"`
31 31
 	devices       *DeviceSet `json:"-"`
32 32
 }
33 33
 
... ...
@@ -48,16 +48,16 @@ type DeviceSet struct {
48 48
 }
49 49
 
50 50
 type DiskUsage struct {
51
-	Used uint64
51
+	Used  uint64
52 52
 	Total uint64
53 53
 }
54 54
 
55 55
 type Status struct {
56
-	PoolName string
57
-	DataLoopback string
56
+	PoolName         string
57
+	DataLoopback     string
58 58
 	MetadataLoopback string
59
-	Data DiskUsage
60
-	Metadata DiskUsage
59
+	Data             DiskUsage
60
+	Metadata         DiskUsage
61 61
 }
62 62
 
63 63
 func getDevName(name string) string {
... ...
@@ -349,11 +349,11 @@ func (devices *DeviceSet) log(level int, file string, line int, dmError int, mes
349 349
 	utils.Debugf("libdevmapper(%d): %s:%d (%d) %s", level, file, line, dmError, message)
350 350
 }
351 351
 
352
-func major (device uint64) uint64 {
353
-	return  (device >> 8) & 0xfff
352
+func major(device uint64) uint64 {
353
+	return (device >> 8) & 0xfff
354 354
 }
355 355
 
356
-func minor (device uint64) uint64 {
356
+func minor(device uint64) uint64 {
357 357
 	return (device & 0xff) | ((device >> 12) & 0xfff00)
358 358
 }
359 359
 
... ...
@@ -798,22 +798,22 @@ func (devices *DeviceSet) Status() *Status {
798 798
 	devices.Lock()
799 799
 	defer devices.Unlock()
800 800
 
801
-	status := &Status {}
801
+	status := &Status{}
802 802
 
803 803
 	if err := devices.ensureInit(); err != nil {
804 804
 		return status
805 805
 	}
806 806
 
807 807
 	status.PoolName = devices.getPoolName()
808
-	status.DataLoopback = path.Join( devices.loopbackDir(), "data")
809
-	status.MetadataLoopback = path.Join( devices.loopbackDir(), "metadata")
808
+	status.DataLoopback = path.Join(devices.loopbackDir(), "data")
809
+	status.MetadataLoopback = path.Join(devices.loopbackDir(), "metadata")
810 810
 
811 811
 	_, totalSizeInSectors, _, params, err := getStatus(devices.getPoolName())
812 812
 	if err == nil {
813 813
 		var transactionId, dataUsed, dataTotal, metadataUsed, metadataTotal uint64
814 814
 		if _, err := fmt.Sscanf(params, "%d %d/%d %d/%d", &transactionId, &metadataUsed, &metadataTotal, &dataUsed, &dataTotal); err == nil {
815 815
 			// Convert from blocks to bytes
816
-			blockSizeInSectors := totalSizeInSectors / dataTotal;
816
+			blockSizeInSectors := totalSizeInSectors / dataTotal
817 817
 
818 818
 			status.Data.Used = dataUsed * blockSizeInSectors * 512
819 819
 			status.Data.Total = dataTotal * blockSizeInSectors * 512
... ...
@@ -3,8 +3,8 @@ package docker
3 3
 import (
4 4
 	"fmt"
5 5
 	"github.com/dotcloud/docker/archive"
6
-	"github.com/dotcloud/docker/utils"
7 6
 	"github.com/dotcloud/docker/graphdriver"
7
+	"github.com/dotcloud/docker/utils"
8 8
 	"io"
9 9
 	"io/ioutil"
10 10
 	"os"
... ...
@@ -33,7 +33,6 @@ func NewGraph(root string, driver graphdriver.Driver) (*Graph, error) {
33 33
 		return nil, err
34 34
 	}
35 35
 
36
-
37 36
 	graph := &Graph{
38 37
 		Root:    abspath,
39 38
 		idIndex: utils.NewTruncIndex(),
... ...
@@ -5,10 +5,10 @@ import (
5 5
 	"container/list"
6 6
 	"database/sql"
7 7
 	"fmt"
8
+	_ "github.com/dotcloud/docker/devmapper"
8 9
 	"github.com/dotcloud/docker/gograph"
9
-	"github.com/dotcloud/docker/utils"
10 10
 	"github.com/dotcloud/docker/graphdriver"
11
-	_ "github.com/dotcloud/docker/devmapper"
11
+	"github.com/dotcloud/docker/utils"
12 12
 	"io"
13 13
 	"io/ioutil"
14 14
 	"log"
... ...
@@ -682,7 +682,6 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
682 682
 		return nil, err
683 683
 	}
684 684
 
685
-
686 685
 	runtime := &Runtime{
687 686
 		repository:     runtimeRepo,
688 687
 		containers:     list.New(),
... ...
@@ -694,7 +693,7 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
694 694
 		volumes:        volumes,
695 695
 		config:         config,
696 696
 		containerGraph: graph,
697
-		driver:		driver,
697
+		driver:         driver,
698 698
 	}
699 699
 
700 700
 	if err := runtime.restore(); err != nil {
... ...
@@ -9,9 +9,9 @@ import (
9 9
 	"github.com/dotcloud/docker/auth"
10 10
 	"github.com/dotcloud/docker/engine"
11 11
 	"github.com/dotcloud/docker/gograph"
12
+	"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
12 13
 	"github.com/dotcloud/docker/registry"
13 14
 	"github.com/dotcloud/docker/utils"
14
-	"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
15 15
 	"io"
16 16
 	"io/ioutil"
17 17
 	"log"
... ...
@@ -25,10 +25,10 @@ import (
25 25
 	"fmt"
26 26
 	"github.com/dotcloud/docker/namesgenerator"
27 27
 	"github.com/dotcloud/docker/utils"
28
-	"strconv"
29 28
 	"io"
30 29
 	"io/ioutil"
31 30
 	"os"
31
+	"strconv"
32 32
 	"strings"
33 33
 	"syscall"
34 34
 )