Skip to content

Commit 9ce2b30

Browse files
committed
pkg/containerfs: drop ContainerFS type alias
Signed-off-by: Cory Snider <[email protected]>
1 parent e332c41 commit 9ce2b30

29 files changed

Lines changed: 48 additions & 70 deletions

File tree

builder/builder.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
containerpkg "github.com/docker/docker/container"
1515
"github.com/docker/docker/image"
1616
"github.com/docker/docker/layer"
17-
"github.com/docker/docker/pkg/containerfs"
1817
)
1918

2019
const (
@@ -26,7 +25,7 @@ const (
2625
// instructions in the builder.
2726
type Source interface {
2827
// Root returns root path for accessing source
29-
Root() containerfs.ContainerFS
28+
Root() string
3029
// Close allows to signal that the filesystem tree won't be used anymore.
3130
// For Context implementations using a temporary directory, it is recommended to
3231
// delete the temporary directory in Close().
@@ -110,6 +109,6 @@ type ROLayer interface {
110109
// RWLayer is active layer that can be read/modified
111110
type RWLayer interface {
112111
Release() error
113-
Root() containerfs.ContainerFS
112+
Root() string
114113
Commit() (ROLayer, error)
115114
}

builder/dockerfile/copy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type pathCache interface {
3838
// copyInfo is a data object which stores the metadata about each source file in
3939
// a copyInstruction
4040
type copyInfo struct {
41-
root containerfs.ContainerFS
41+
root string
4242
path string
4343
hash string
4444
noDecompress bool

builder/dockerfile/internals_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/docker/docker/image"
1515
"github.com/docker/docker/layer"
1616
"github.com/docker/docker/pkg/archive"
17-
"github.com/docker/docker/pkg/containerfs"
1817
"github.com/docker/go-connections/nat"
1918
"github.com/opencontainers/go-digest"
2019
"gotest.tools/v3/assert"
@@ -183,8 +182,8 @@ func TestDeepCopyRunConfig(t *testing.T) {
183182

184183
type MockRWLayer struct{}
185184

186-
func (l *MockRWLayer) Release() error { return nil }
187-
func (l *MockRWLayer) Root() containerfs.ContainerFS { return "" }
185+
func (l *MockRWLayer) Release() error { return nil }
186+
func (l *MockRWLayer) Root() string { return "" }
188187
func (l *MockRWLayer) Commit() (builder.ROLayer, error) {
189188
return &MockROLayer{
190189
diffID: layer.DiffID(digest.Digest("sha256:1234")),

builder/dockerfile/mockbackend_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
containerpkg "github.com/docker/docker/container"
1414
"github.com/docker/docker/image"
1515
"github.com/docker/docker/layer"
16-
"github.com/docker/docker/pkg/containerfs"
1716
)
1817

1918
// MockBackend implements the builder.Backend interface for unit testing
@@ -143,6 +142,6 @@ func (l *mockRWLayer) Commit() (builder.ROLayer, error) {
143142
return nil, nil
144143
}
145144

146-
func (l *mockRWLayer) Root() containerfs.ContainerFS {
145+
func (l *mockRWLayer) Root() string {
147146
return ""
148147
}

builder/remotecontext/archive.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
type archiveContext struct {
18-
root containerfs.ContainerFS
18+
root string
1919
sums tarsum.FileInfoSums
2020
}
2121

@@ -82,7 +82,7 @@ func FromArchive(tarStream io.Reader) (builder.Source, error) {
8282
return tsc, nil
8383
}
8484

85-
func (c *archiveContext) Root() containerfs.ContainerFS {
85+
func (c *archiveContext) Root() string {
8686
return c.root
8787
}
8888

@@ -115,7 +115,7 @@ func (c *archiveContext) Hash(path string) (string, error) {
115115
return path, nil // backwards compat TODO: see if really needed
116116
}
117117

118-
func normalize(path string, root containerfs.ContainerFS) (cleanPath, fullPath string, err error) {
118+
func normalize(path string, root string) (cleanPath, fullPath string, err error) {
119119
cleanPath = filepath.Clean(string(filepath.Separator) + path)[1:]
120120
fullPath, err = containerfs.ResolveScopedPath(root, path)
121121
if err != nil {

builder/remotecontext/detect_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"testing"
1010

1111
"github.com/docker/docker/builder"
12-
"github.com/docker/docker/pkg/containerfs"
1312
)
1413

1514
const (
@@ -105,14 +104,14 @@ func TestProcessShouldLeaveAllFiles(t *testing.T) {
105104

106105
// TODO: remove after moving to a separate pkg
107106
type stubRemote struct {
108-
root containerfs.ContainerFS
107+
root string
109108
}
110109

111110
func (r *stubRemote) Hash(path string) (string, error) {
112111
return "", errors.New("not implemented")
113112
}
114113

115-
func (r *stubRemote) Root() containerfs.ContainerFS {
114+
func (r *stubRemote) Root() string {
116115
return r.root
117116
}
118117
func (r *stubRemote) Close() error {

builder/remotecontext/lazycontext.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,26 @@ import (
88
"strings"
99

1010
"github.com/docker/docker/builder"
11-
"github.com/docker/docker/pkg/containerfs"
1211
"github.com/docker/docker/pkg/pools"
1312
"github.com/pkg/errors"
1413
)
1514

1615
// NewLazySource creates a new LazyContext. LazyContext defines a hashed build
1716
// context based on a root directory. Individual files are hashed first time
1817
// they are asked. It is not safe to call methods of LazyContext concurrently.
19-
func NewLazySource(root containerfs.ContainerFS) (builder.Source, error) {
18+
func NewLazySource(root string) (builder.Source, error) {
2019
return &lazySource{
2120
root: root,
2221
sums: make(map[string]string),
2322
}, nil
2423
}
2524

2625
type lazySource struct {
27-
root containerfs.ContainerFS
26+
root string
2827
sums map[string]string
2928
}
3029

31-
func (c *lazySource) Root() containerfs.ContainerFS {
30+
func (c *lazySource) Root() string {
3231
return c.root
3332
}
3433

@@ -88,7 +87,7 @@ func (c *lazySource) prepareHash(relPath string, fi os.FileInfo) (string, error)
8887

8988
// Rel makes a path relative to base path. Same as `filepath.Rel` but can also
9089
// handle UUID paths in windows.
91-
func Rel(basepath containerfs.ContainerFS, targpath string) (string, error) {
90+
func Rel(basepath string, targpath string) (string, error) {
9291
// filepath.Rel can't handle UUID paths in windows
9392
if runtime.GOOS == "windows" {
9493
pfx := basepath + `\`

builder/remotecontext/tarsum.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"path/filepath"
66
"sync"
77

8-
"github.com/docker/docker/pkg/containerfs"
98
iradix "github.com/hashicorp/go-immutable-radix"
109
"github.com/opencontainers/go-digest"
1110
"github.com/pkg/errors"
@@ -19,7 +18,7 @@ type hashed interface {
1918
// CachableSource is a source that contains cache records for its contents
2019
type CachableSource struct {
2120
mu sync.Mutex
22-
root containerfs.ContainerFS
21+
root string
2322
tree *iradix.Tree
2423
txn *iradix.Txn
2524
}
@@ -145,7 +144,7 @@ func (cs *CachableSource) Hash(path string) (string, error) {
145144
}
146145

147146
// Root returns a root directory for the source
148-
func (cs *CachableSource) Root() containerfs.ContainerFS {
147+
func (cs *CachableSource) Root() string {
149148
return cs.root
150149
}
151150

container/container.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ type ExitStatus struct {
6161
type Container struct {
6262
StreamConfig *stream.Config
6363
// embed for Container to support states directly.
64-
*State `json:"State"` // Needed for Engine API version <= 1.11
65-
Root string `json:"-"` // Path to the "home" of the container, including metadata.
66-
BaseFS containerfs.ContainerFS `json:"-"` // interface containing graphdriver mount
67-
RWLayer layer.RWLayer `json:"-"`
64+
*State `json:"State"` // Needed for Engine API version <= 1.11
65+
Root string `json:"-"` // Path to the "home" of the container, including metadata.
66+
BaseFS string `json:"-"` // Path to the graphdriver mountpoint
67+
RWLayer layer.RWLayer `json:"-"`
6868
ID string
6969
Created time.Time
7070
Managed bool

daemon/daemon_unix.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import (
3838
"github.com/docker/docker/libnetwork/options"
3939
lntypes "github.com/docker/docker/libnetwork/types"
4040
"github.com/docker/docker/opts"
41-
"github.com/docker/docker/pkg/containerfs"
4241
"github.com/docker/docker/pkg/idtools"
4342
"github.com/docker/docker/pkg/parsers"
4443
"github.com/docker/docker/pkg/parsers/kernel"
@@ -1072,8 +1071,8 @@ func removeDefaultBridgeInterface() {
10721071
}
10731072
}
10741073

1075-
func setupInitLayer(idMapping idtools.IdentityMapping) func(containerfs.ContainerFS) error {
1076-
return func(initPath containerfs.ContainerFS) error {
1074+
func setupInitLayer(idMapping idtools.IdentityMapping) func(string) error {
1075+
return func(initPath string) error {
10771076
return initlayer.Setup(initPath, idMapping.RootPair())
10781077
}
10791078
}

0 commit comments

Comments
 (0)