pkg/containerfs: drop ContainerFS type alias
Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
parent
e332c41e9d
commit
9ce2b30b81
29 changed files with 48 additions and 70 deletions
|
@ -14,7 +14,6 @@ import (
|
||||||
containerpkg "github.com/docker/docker/container"
|
containerpkg "github.com/docker/docker/container"
|
||||||
"github.com/docker/docker/image"
|
"github.com/docker/docker/image"
|
||||||
"github.com/docker/docker/layer"
|
"github.com/docker/docker/layer"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -26,7 +25,7 @@ const (
|
||||||
// instructions in the builder.
|
// instructions in the builder.
|
||||||
type Source interface {
|
type Source interface {
|
||||||
// Root returns root path for accessing source
|
// Root returns root path for accessing source
|
||||||
Root() containerfs.ContainerFS
|
Root() string
|
||||||
// Close allows to signal that the filesystem tree won't be used anymore.
|
// Close allows to signal that the filesystem tree won't be used anymore.
|
||||||
// For Context implementations using a temporary directory, it is recommended to
|
// For Context implementations using a temporary directory, it is recommended to
|
||||||
// delete the temporary directory in Close().
|
// delete the temporary directory in Close().
|
||||||
|
@ -110,6 +109,6 @@ type ROLayer interface {
|
||||||
// RWLayer is active layer that can be read/modified
|
// RWLayer is active layer that can be read/modified
|
||||||
type RWLayer interface {
|
type RWLayer interface {
|
||||||
Release() error
|
Release() error
|
||||||
Root() containerfs.ContainerFS
|
Root() string
|
||||||
Commit() (ROLayer, error)
|
Commit() (ROLayer, error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ type pathCache interface {
|
||||||
// copyInfo is a data object which stores the metadata about each source file in
|
// copyInfo is a data object which stores the metadata about each source file in
|
||||||
// a copyInstruction
|
// a copyInstruction
|
||||||
type copyInfo struct {
|
type copyInfo struct {
|
||||||
root containerfs.ContainerFS
|
root string
|
||||||
path string
|
path string
|
||||||
hash string
|
hash string
|
||||||
noDecompress bool
|
noDecompress bool
|
||||||
|
|
|
@ -14,7 +14,6 @@ import (
|
||||||
"github.com/docker/docker/image"
|
"github.com/docker/docker/image"
|
||||||
"github.com/docker/docker/layer"
|
"github.com/docker/docker/layer"
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
|
@ -184,7 +183,7 @@ func TestDeepCopyRunConfig(t *testing.T) {
|
||||||
type MockRWLayer struct{}
|
type MockRWLayer struct{}
|
||||||
|
|
||||||
func (l *MockRWLayer) Release() error { return nil }
|
func (l *MockRWLayer) Release() error { return nil }
|
||||||
func (l *MockRWLayer) Root() containerfs.ContainerFS { return "" }
|
func (l *MockRWLayer) Root() string { return "" }
|
||||||
func (l *MockRWLayer) Commit() (builder.ROLayer, error) {
|
func (l *MockRWLayer) Commit() (builder.ROLayer, error) {
|
||||||
return &MockROLayer{
|
return &MockROLayer{
|
||||||
diffID: layer.DiffID(digest.Digest("sha256:1234")),
|
diffID: layer.DiffID(digest.Digest("sha256:1234")),
|
||||||
|
|
|
@ -13,7 +13,6 @@ import (
|
||||||
containerpkg "github.com/docker/docker/container"
|
containerpkg "github.com/docker/docker/container"
|
||||||
"github.com/docker/docker/image"
|
"github.com/docker/docker/image"
|
||||||
"github.com/docker/docker/layer"
|
"github.com/docker/docker/layer"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockBackend implements the builder.Backend interface for unit testing
|
// MockBackend implements the builder.Backend interface for unit testing
|
||||||
|
@ -143,6 +142,6 @@ func (l *mockRWLayer) Commit() (builder.ROLayer, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *mockRWLayer) Root() containerfs.ContainerFS {
|
func (l *mockRWLayer) Root() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type archiveContext struct {
|
type archiveContext struct {
|
||||||
root containerfs.ContainerFS
|
root string
|
||||||
sums tarsum.FileInfoSums
|
sums tarsum.FileInfoSums
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ func FromArchive(tarStream io.Reader) (builder.Source, error) {
|
||||||
return tsc, nil
|
return tsc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *archiveContext) Root() containerfs.ContainerFS {
|
func (c *archiveContext) Root() string {
|
||||||
return c.root
|
return c.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ func (c *archiveContext) Hash(path string) (string, error) {
|
||||||
return path, nil // backwards compat TODO: see if really needed
|
return path, nil // backwards compat TODO: see if really needed
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalize(path string, root containerfs.ContainerFS) (cleanPath, fullPath string, err error) {
|
func normalize(path string, root string) (cleanPath, fullPath string, err error) {
|
||||||
cleanPath = filepath.Clean(string(filepath.Separator) + path)[1:]
|
cleanPath = filepath.Clean(string(filepath.Separator) + path)[1:]
|
||||||
fullPath, err = containerfs.ResolveScopedPath(root, path)
|
fullPath, err = containerfs.ResolveScopedPath(root, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/builder"
|
"github.com/docker/docker/builder"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -105,14 +104,14 @@ func TestProcessShouldLeaveAllFiles(t *testing.T) {
|
||||||
|
|
||||||
// TODO: remove after moving to a separate pkg
|
// TODO: remove after moving to a separate pkg
|
||||||
type stubRemote struct {
|
type stubRemote struct {
|
||||||
root containerfs.ContainerFS
|
root string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *stubRemote) Hash(path string) (string, error) {
|
func (r *stubRemote) Hash(path string) (string, error) {
|
||||||
return "", errors.New("not implemented")
|
return "", errors.New("not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *stubRemote) Root() containerfs.ContainerFS {
|
func (r *stubRemote) Root() string {
|
||||||
return r.root
|
return r.root
|
||||||
}
|
}
|
||||||
func (r *stubRemote) Close() error {
|
func (r *stubRemote) Close() error {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/builder"
|
"github.com/docker/docker/builder"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/docker/pkg/pools"
|
"github.com/docker/docker/pkg/pools"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
@ -16,7 +15,7 @@ import (
|
||||||
// NewLazySource creates a new LazyContext. LazyContext defines a hashed build
|
// NewLazySource creates a new LazyContext. LazyContext defines a hashed build
|
||||||
// context based on a root directory. Individual files are hashed first time
|
// context based on a root directory. Individual files are hashed first time
|
||||||
// they are asked. It is not safe to call methods of LazyContext concurrently.
|
// they are asked. It is not safe to call methods of LazyContext concurrently.
|
||||||
func NewLazySource(root containerfs.ContainerFS) (builder.Source, error) {
|
func NewLazySource(root string) (builder.Source, error) {
|
||||||
return &lazySource{
|
return &lazySource{
|
||||||
root: root,
|
root: root,
|
||||||
sums: make(map[string]string),
|
sums: make(map[string]string),
|
||||||
|
@ -24,11 +23,11 @@ func NewLazySource(root containerfs.ContainerFS) (builder.Source, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type lazySource struct {
|
type lazySource struct {
|
||||||
root containerfs.ContainerFS
|
root string
|
||||||
sums map[string]string
|
sums map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *lazySource) Root() containerfs.ContainerFS {
|
func (c *lazySource) Root() string {
|
||||||
return c.root
|
return c.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +87,7 @@ func (c *lazySource) prepareHash(relPath string, fi os.FileInfo) (string, error)
|
||||||
|
|
||||||
// Rel makes a path relative to base path. Same as `filepath.Rel` but can also
|
// Rel makes a path relative to base path. Same as `filepath.Rel` but can also
|
||||||
// handle UUID paths in windows.
|
// handle UUID paths in windows.
|
||||||
func Rel(basepath containerfs.ContainerFS, targpath string) (string, error) {
|
func Rel(basepath string, targpath string) (string, error) {
|
||||||
// filepath.Rel can't handle UUID paths in windows
|
// filepath.Rel can't handle UUID paths in windows
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
pfx := basepath + `\`
|
pfx := basepath + `\`
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
iradix "github.com/hashicorp/go-immutable-radix"
|
iradix "github.com/hashicorp/go-immutable-radix"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -19,7 +18,7 @@ type hashed interface {
|
||||||
// CachableSource is a source that contains cache records for its contents
|
// CachableSource is a source that contains cache records for its contents
|
||||||
type CachableSource struct {
|
type CachableSource struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
root containerfs.ContainerFS
|
root string
|
||||||
tree *iradix.Tree
|
tree *iradix.Tree
|
||||||
txn *iradix.Txn
|
txn *iradix.Txn
|
||||||
}
|
}
|
||||||
|
@ -145,7 +144,7 @@ func (cs *CachableSource) Hash(path string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Root returns a root directory for the source
|
// Root returns a root directory for the source
|
||||||
func (cs *CachableSource) Root() containerfs.ContainerFS {
|
func (cs *CachableSource) Root() string {
|
||||||
return cs.root
|
return cs.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ type Container struct {
|
||||||
// embed for Container to support states directly.
|
// embed for Container to support states directly.
|
||||||
*State `json:"State"` // Needed for Engine API version <= 1.11
|
*State `json:"State"` // Needed for Engine API version <= 1.11
|
||||||
Root string `json:"-"` // Path to the "home" of the container, including metadata.
|
Root string `json:"-"` // Path to the "home" of the container, including metadata.
|
||||||
BaseFS containerfs.ContainerFS `json:"-"` // interface containing graphdriver mount
|
BaseFS string `json:"-"` // Path to the graphdriver mountpoint
|
||||||
RWLayer layer.RWLayer `json:"-"`
|
RWLayer layer.RWLayer `json:"-"`
|
||||||
ID string
|
ID string
|
||||||
Created time.Time
|
Created time.Time
|
||||||
|
|
|
@ -38,7 +38,6 @@ import (
|
||||||
"github.com/docker/docker/libnetwork/options"
|
"github.com/docker/docker/libnetwork/options"
|
||||||
lntypes "github.com/docker/docker/libnetwork/types"
|
lntypes "github.com/docker/docker/libnetwork/types"
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/parsers"
|
"github.com/docker/docker/pkg/parsers"
|
||||||
"github.com/docker/docker/pkg/parsers/kernel"
|
"github.com/docker/docker/pkg/parsers/kernel"
|
||||||
|
@ -1072,8 +1071,8 @@ func removeDefaultBridgeInterface() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupInitLayer(idMapping idtools.IdentityMapping) func(containerfs.ContainerFS) error {
|
func setupInitLayer(idMapping idtools.IdentityMapping) func(string) error {
|
||||||
return func(initPath containerfs.ContainerFS) error {
|
return func(initPath string) error {
|
||||||
return initlayer.Setup(initPath, idMapping.RootPair())
|
return initlayer.Setup(initPath, idMapping.RootPair())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import (
|
||||||
winlibnetwork "github.com/docker/docker/libnetwork/drivers/windows"
|
winlibnetwork "github.com/docker/docker/libnetwork/drivers/windows"
|
||||||
"github.com/docker/docker/libnetwork/netlabel"
|
"github.com/docker/docker/libnetwork/netlabel"
|
||||||
"github.com/docker/docker/libnetwork/options"
|
"github.com/docker/docker/libnetwork/options"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/parsers"
|
"github.com/docker/docker/pkg/parsers"
|
||||||
"github.com/docker/docker/pkg/parsers/operatingsystem"
|
"github.com/docker/docker/pkg/parsers/operatingsystem"
|
||||||
|
@ -64,7 +63,7 @@ func (daemon *Daemon) parseSecurityOpt(container *container.Container, hostConfi
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupInitLayer(idMapping idtools.IdentityMapping) func(containerfs.ContainerFS) error {
|
func setupInitLayer(idMapping idtools.IdentityMapping) func(string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -351,7 +351,7 @@ func atomicRemove(source string) error {
|
||||||
|
|
||||||
// Get returns the rootfs path for the id.
|
// Get returns the rootfs path for the id.
|
||||||
// This will mount the dir at its given path
|
// This will mount the dir at its given path
|
||||||
func (a *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
func (a *Driver) Get(id, mountLabel string) (string, error) {
|
||||||
a.locker.Lock(id)
|
a.locker.Lock(id)
|
||||||
defer a.locker.Unlock(id)
|
defer a.locker.Unlock(id)
|
||||||
parents, err := a.getParentLayerPaths(id)
|
parents, err := a.getParentLayerPaths(id)
|
||||||
|
|
|
@ -627,7 +627,7 @@ func (d *Driver) Remove(id string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the requested filesystem id.
|
// Get the requested filesystem id.
|
||||||
func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
func (d *Driver) Get(id, mountLabel string) (string, error) {
|
||||||
dir := d.subvolumesDirID(id)
|
dir := d.subvolumesDirID(id)
|
||||||
st, err := os.Stat(dir)
|
st, err := os.Stat(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/docker/docker/daemon/graphdriver"
|
"github.com/docker/docker/daemon/graphdriver"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/docker/pkg/devicemapper"
|
"github.com/docker/docker/pkg/devicemapper"
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
units "github.com/docker/go-units"
|
units "github.com/docker/go-units"
|
||||||
|
@ -175,7 +174,7 @@ func (d *Driver) Remove(id string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get mounts a device with given id into the root filesystem
|
// Get mounts a device with given id into the root filesystem
|
||||||
func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
func (d *Driver) Get(id, mountLabel string) (string, error) {
|
||||||
d.locker.Lock(id)
|
d.locker.Lock(id)
|
||||||
defer d.locker.Unlock(id)
|
defer d.locker.Unlock(id)
|
||||||
mp := path.Join(d.home, "mnt", id)
|
mp := path.Join(d.home, "mnt", id)
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/plugingetter"
|
"github.com/docker/docker/pkg/plugingetter"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -60,7 +59,7 @@ type ProtoDriver interface {
|
||||||
// Get returns the mountpoint for the layered filesystem referred
|
// Get returns the mountpoint for the layered filesystem referred
|
||||||
// to by this id. You can optionally specify a mountLabel or "".
|
// to by this id. You can optionally specify a mountLabel or "".
|
||||||
// Returns the absolute path to the mounted layered filesystem.
|
// Returns the absolute path to the mounted layered filesystem.
|
||||||
Get(id, mountLabel string) (fs containerfs.ContainerFS, err error)
|
Get(id, mountLabel string) (fs string, err error)
|
||||||
// Put releases the system resources for the specified id,
|
// Put releases the system resources for the specified id,
|
||||||
// e.g, unmounting layered filesystem.
|
// e.g, unmounting layered filesystem.
|
||||||
Put(id string) error
|
Put(id string) error
|
||||||
|
|
|
@ -303,7 +303,7 @@ func (d *Driver) Remove(id string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get creates and mounts the required file system for the given id and returns the mount path.
|
// Get creates and mounts the required file system for the given id and returns the mount path.
|
||||||
func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr error) {
|
func (d *Driver) Get(id, mountLabel string) (_ string, retErr error) {
|
||||||
d.locker.Lock(id)
|
d.locker.Lock(id)
|
||||||
defer d.locker.Unlock(id)
|
defer d.locker.Unlock(id)
|
||||||
dir := d.dir(id)
|
dir := d.dir(id)
|
||||||
|
|
|
@ -339,7 +339,7 @@ func (d *Driver) Remove(id string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get creates and mounts the required file system for the given id and returns the mount path.
|
// Get creates and mounts the required file system for the given id and returns the mount path.
|
||||||
func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, err error) {
|
func (d *Driver) Get(id, mountLabel string) (_ string, err error) {
|
||||||
d.locker.Lock(id)
|
d.locker.Lock(id)
|
||||||
defer d.locker.Unlock(id)
|
defer d.locker.Unlock(id)
|
||||||
dir := d.dir(id)
|
dir := d.dir(id)
|
||||||
|
|
|
@ -513,7 +513,7 @@ func (d *Driver) Remove(id string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get creates and mounts the required file system for the given id and returns the mount path.
|
// Get creates and mounts the required file system for the given id and returns the mount path.
|
||||||
func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr error) {
|
func (d *Driver) Get(id, mountLabel string) (_ string, retErr error) {
|
||||||
d.locker.Lock(id)
|
d.locker.Lock(id)
|
||||||
defer d.locker.Unlock(id)
|
defer d.locker.Unlock(id)
|
||||||
dir := d.dir(id)
|
dir := d.dir(id)
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/plugingetter"
|
"github.com/docker/docker/pkg/plugingetter"
|
||||||
"github.com/docker/docker/pkg/plugins"
|
"github.com/docker/docker/pkg/plugins"
|
||||||
|
@ -128,7 +127,7 @@ func (d *graphDriverProxy) Remove(id string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *graphDriverProxy) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
func (d *graphDriverProxy) Get(id, mountLabel string) (string, error) {
|
||||||
args := &graphDriverRequest{
|
args := &graphDriverRequest{
|
||||||
ID: id,
|
ID: id,
|
||||||
MountLabel: mountLabel,
|
MountLabel: mountLabel,
|
||||||
|
|
|
@ -185,7 +185,7 @@ func (d *Driver) Remove(id string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns the directory for the given id.
|
// Get returns the directory for the given id.
|
||||||
func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
func (d *Driver) Get(id, mountLabel string) (string, error) {
|
||||||
dir := d.dir(id)
|
dir := d.dir(id)
|
||||||
if st, err := os.Stat(dir); err != nil {
|
if st, err := os.Stat(dir); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
@ -27,7 +27,6 @@ import (
|
||||||
"github.com/Microsoft/hcsshim/osversion"
|
"github.com/Microsoft/hcsshim/osversion"
|
||||||
"github.com/docker/docker/daemon/graphdriver"
|
"github.com/docker/docker/daemon/graphdriver"
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/ioutils"
|
"github.com/docker/docker/pkg/ioutils"
|
||||||
"github.com/docker/docker/pkg/longpath"
|
"github.com/docker/docker/pkg/longpath"
|
||||||
|
@ -393,7 +392,7 @@ func (d *Driver) GetLayerPath(id string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns the rootfs path for the id. This will mount the dir at its given path.
|
// Get returns the rootfs path for the id. This will mount the dir at its given path.
|
||||||
func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
func (d *Driver) Get(id, mountLabel string) (string, error) {
|
||||||
logrus.Debugf("WindowsGraphDriver Get() id %s mountLabel %s", id, mountLabel)
|
logrus.Debugf("WindowsGraphDriver Get() id %s mountLabel %s", id, mountLabel)
|
||||||
var dir string
|
var dir string
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/daemon/graphdriver"
|
"github.com/docker/docker/daemon/graphdriver"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/parsers"
|
"github.com/docker/docker/pkg/parsers"
|
||||||
zfs "github.com/mistifyio/go-zfs"
|
zfs "github.com/mistifyio/go-zfs"
|
||||||
|
@ -363,7 +362,7 @@ func (d *Driver) Remove(id string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns the mountpoint for the given id after creating the target directories if necessary.
|
// Get returns the mountpoint for the given id after creating the target directories if necessary.
|
||||||
func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr error) {
|
func (d *Driver) Get(id, mountLabel string) (_ string, retErr error) {
|
||||||
d.locker.Lock(id)
|
d.locker.Lock(id)
|
||||||
defer d.locker.Unlock(id)
|
defer d.locker.Unlock(id)
|
||||||
mountpoint := d.mountPath(id)
|
mountpoint := d.mountPath(id)
|
||||||
|
|
|
@ -14,7 +14,6 @@ import (
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
"github.com/docker/docker/image"
|
"github.com/docker/docker/image"
|
||||||
"github.com/docker/docker/layer"
|
"github.com/docker/docker/layer"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/docker/pkg/progress"
|
"github.com/docker/docker/pkg/progress"
|
||||||
"github.com/docker/docker/pkg/streamformatter"
|
"github.com/docker/docker/pkg/streamformatter"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
|
@ -83,10 +82,10 @@ type rwLayer struct {
|
||||||
released bool
|
released bool
|
||||||
layerStore layer.Store
|
layerStore layer.Store
|
||||||
rwLayer layer.RWLayer
|
rwLayer layer.RWLayer
|
||||||
fs containerfs.ContainerFS
|
fs string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *rwLayer) Root() containerfs.ContainerFS {
|
func (l *rwLayer) Root() string {
|
||||||
return l.fs
|
return l.fs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
@ -18,7 +17,7 @@ import (
|
||||||
//
|
//
|
||||||
// This extra layer is used by all containers as the top-most ro layer. It protects
|
// This extra layer is used by all containers as the top-most ro layer. It protects
|
||||||
// the container from unwanted side-effects on the rw layer.
|
// the container from unwanted side-effects on the rw layer.
|
||||||
func Setup(initLayerFs containerfs.ContainerFS, rootIdentity idtools.Identity) error {
|
func Setup(initLayerFs string, rootIdentity idtools.Identity) error {
|
||||||
// Since all paths are local to the container, we can just extract initLayerFs.Path()
|
// Since all paths are local to the container, we can just extract initLayerFs.Path()
|
||||||
initLayer := initLayerFs
|
initLayer := initLayerFs
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import (
|
||||||
|
|
||||||
"github.com/docker/distribution"
|
"github.com/docker/distribution"
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
@ -114,7 +113,7 @@ type RWLayer interface {
|
||||||
|
|
||||||
// Mount mounts the RWLayer and returns the filesystem path
|
// Mount mounts the RWLayer and returns the filesystem path
|
||||||
// to the writable layer.
|
// to the writable layer.
|
||||||
Mount(mountLabel string) (containerfs.ContainerFS, error)
|
Mount(mountLabel string) (string, error)
|
||||||
|
|
||||||
// Unmount unmounts the RWLayer. This should be called
|
// Unmount unmounts the RWLayer. This should be called
|
||||||
// for every mount. If there are multiple mount calls
|
// for every mount. If there are multiple mount calls
|
||||||
|
@ -158,7 +157,7 @@ type Metadata struct {
|
||||||
// writable mount. Changes made here will
|
// writable mount. Changes made here will
|
||||||
// not be included in the Tar stream of the
|
// not be included in the Tar stream of the
|
||||||
// RWLayer.
|
// RWLayer.
|
||||||
type MountInit func(root containerfs.ContainerFS) error
|
type MountInit func(root string) error
|
||||||
|
|
||||||
// CreateRWLayerOpts contains optional arguments to be passed to CreateRWLayer
|
// CreateRWLayerOpts contains optional arguments to be passed to CreateRWLayer
|
||||||
type CreateRWLayerOpts struct {
|
type CreateRWLayerOpts struct {
|
||||||
|
|
|
@ -13,7 +13,6 @@ import (
|
||||||
"github.com/docker/docker/daemon/graphdriver"
|
"github.com/docker/docker/daemon/graphdriver"
|
||||||
"github.com/docker/docker/daemon/graphdriver/vfs"
|
"github.com/docker/docker/daemon/graphdriver/vfs"
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
|
@ -80,7 +79,7 @@ func newTestStore(t *testing.T) (Store, string, func()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type layerInit func(root containerfs.ContainerFS) error
|
type layerInit func(root string) error
|
||||||
|
|
||||||
func createLayer(ls Store, parent ChainID, layerFunc layerInit) (Layer, error) {
|
func createLayer(ls Store, parent ChainID, layerFunc layerInit) (Layer, error) {
|
||||||
containerID := stringid.GenerateRandomID()
|
containerID := stringid.GenerateRandomID()
|
||||||
|
@ -121,7 +120,7 @@ func createLayer(ls Store, parent ChainID, layerFunc layerInit) (Layer, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type FileApplier interface {
|
type FileApplier interface {
|
||||||
ApplyFile(root containerfs.ContainerFS) error
|
ApplyFile(root string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type testFile struct {
|
type testFile struct {
|
||||||
|
@ -138,7 +137,7 @@ func newTestFile(name string, content []byte, perm os.FileMode) FileApplier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tf *testFile) ApplyFile(root containerfs.ContainerFS) error {
|
func (tf *testFile) ApplyFile(root string) error {
|
||||||
fullPath := filepath.Join(root, tf.name)
|
fullPath := filepath.Join(root, tf.name)
|
||||||
if err := os.MkdirAll(filepath.Dir(fullPath), 0755); err != nil {
|
if err := os.MkdirAll(filepath.Dir(fullPath), 0755); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -153,7 +152,7 @@ func (tf *testFile) ApplyFile(root containerfs.ContainerFS) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initWithFiles(files ...FileApplier) layerInit {
|
func initWithFiles(files ...FileApplier) layerInit {
|
||||||
return func(root containerfs.ContainerFS) error {
|
return func(root string) error {
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
if err := f.ApplyFile(root); err != nil {
|
if err := f.ApplyFile(root); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
|
|
||||||
"github.com/containerd/continuity/driver"
|
"github.com/containerd/continuity/driver"
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMountInit(t *testing.T) {
|
func TestMountInit(t *testing.T) {
|
||||||
|
@ -30,7 +29,7 @@ func TestMountInit(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mountInit := func(root containerfs.ContainerFS) error {
|
mountInit := func(root string) error {
|
||||||
return initfile.ApplyFile(root)
|
return initfile.ApplyFile(root)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +89,7 @@ func TestMountSize(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mountInit := func(root containerfs.ContainerFS) error {
|
mountInit := func(root string) error {
|
||||||
return newTestFile("file-init", contentInit, 0777).ApplyFile(root)
|
return newTestFile("file-init", contentInit, 0777).ApplyFile(root)
|
||||||
}
|
}
|
||||||
rwLayerOpts := &CreateRWLayerOpts{
|
rwLayerOpts := &CreateRWLayerOpts{
|
||||||
|
@ -142,7 +141,7 @@ func TestMountChanges(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mountInit := func(root containerfs.ContainerFS) error {
|
mountInit := func(root string) error {
|
||||||
return initfile.ApplyFile(root)
|
return initfile.ApplyFile(root)
|
||||||
}
|
}
|
||||||
rwLayerOpts := &CreateRWLayerOpts{
|
rwLayerOpts := &CreateRWLayerOpts{
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/containerfs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type mountedLayer struct {
|
type mountedLayer struct {
|
||||||
|
@ -100,7 +99,7 @@ type referencedRWLayer struct {
|
||||||
*mountedLayer
|
*mountedLayer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rl *referencedRWLayer) Mount(mountLabel string) (containerfs.ContainerFS, error) {
|
func (rl *referencedRWLayer) Mount(mountLabel string) (string, error) {
|
||||||
return rl.layerStore.driver.Get(rl.mountedLayer.mountID, mountLabel)
|
return rl.layerStore.driver.Get(rl.mountedLayer.mountID, mountLabel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,6 @@ import (
|
||||||
"github.com/moby/sys/symlink"
|
"github.com/moby/sys/symlink"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerFS is that represents a root file system
|
|
||||||
type ContainerFS = string
|
|
||||||
|
|
||||||
// ResolveScopedPath evaluates the given path scoped to the root.
|
// ResolveScopedPath evaluates the given path scoped to the root.
|
||||||
// For example, if root=/a, and path=/b/c, then this function would return /a/b/c.
|
// For example, if root=/a, and path=/b/c, then this function would return /a/b/c.
|
||||||
func ResolveScopedPath(root, path string) (string, error) {
|
func ResolveScopedPath(root, path string) (string, error) {
|
||||||
|
|
Loading…
Reference in a new issue