Browse code

mount: move the MakePrivate to pkg/mount

The logic is unrelated to graphdriver.

Signed-off-by: Vincent Batts <vbatts@redhat.com>

Vincent Batts authored on 2014/10/31 06:04:56
Showing 5 changed files
... ...
@@ -98,7 +98,7 @@ func Init(root string, options []string) (graphdriver.Driver, error) {
98 98
 		return nil, err
99 99
 	}
100 100
 
101
-	if err := graphdriver.MakePrivate(root); err != nil {
101
+	if err := mountpk.MakePrivate(root); err != nil {
102 102
 		return nil, err
103 103
 	}
104 104
 
... ...
@@ -40,7 +40,7 @@ func Init(home string, options []string) (graphdriver.Driver, error) {
40 40
 		return nil, err
41 41
 	}
42 42
 
43
-	if err := graphdriver.MakePrivate(home); err != nil {
43
+	if err := mount.MakePrivate(home); err != nil {
44 44
 		return nil, err
45 45
 	}
46 46
 
... ...
@@ -34,7 +34,7 @@ func Init(home string, options []string) (graphdriver.Driver, error) {
34 34
 		return nil, err
35 35
 	}
36 36
 
37
-	if err := graphdriver.MakePrivate(home); err != nil {
37
+	if err := mount.MakePrivate(home); err != nil {
38 38
 		return nil, err
39 39
 	}
40 40
 
... ...
@@ -7,7 +7,6 @@ import (
7 7
 	"path"
8 8
 
9 9
 	"github.com/docker/docker/pkg/archive"
10
-	"github.com/docker/docker/pkg/mount"
11 10
 )
12 11
 
13 12
 type FsMagic uint64
... ...
@@ -139,18 +138,3 @@ func New(root string, options []string) (driver Driver, err error) {
139 139
 	}
140 140
 	return nil, fmt.Errorf("No supported storage backend found")
141 141
 }
142
-
143
-func MakePrivate(mountPoint string) error {
144
-	mounted, err := mount.Mounted(mountPoint)
145
-	if err != nil {
146
-		return err
147
-	}
148
-
149
-	if !mounted {
150
-		if err := mount.Mount(mountPoint, mountPoint, "none", "bind,rw"); err != nil {
151
-			return err
152
-		}
153
-	}
154
-
155
-	return mount.ForceMount("", mountPoint, "none", "private")
156
-}
157 142
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+// +build linux
1
+
2
+package mount
3
+
4
+func MakePrivate(mountPoint string) error {
5
+	mounted, err := Mounted(mountPoint)
6
+	if err != nil {
7
+		return err
8
+	}
9
+
10
+	if !mounted {
11
+		if err := Mount(mountPoint, mountPoint, "none", "bind,rw"); err != nil {
12
+			return err
13
+		}
14
+	}
15
+
16
+	return ForceMount("", mountPoint, "none", "private")
17
+}