Drop the constructor and redundant string() type-casts.
Signed-off-by: Cory Snider <csnider@mirantis.com>
| ... | ... |
@@ -291,7 +291,7 @@ func (s *snapshotter) Mounts(ctx context.Context, key string) (snapshot.Mountabl |
| 291 | 291 |
return nil, nil, err |
| 292 | 292 |
} |
| 293 | 293 |
return []mount.Mount{{
|
| 294 |
- Source: string(rootfs), |
|
| 294 |
+ Source: rootfs, |
|
| 295 | 295 |
Type: "bind", |
| 296 | 296 |
Options: []string{"rbind"},
|
| 297 | 297 |
}}, func() error {
|
| ... | ... |
@@ -312,7 +312,7 @@ func (s *snapshotter) Mounts(ctx context.Context, key string) (snapshot.Mountabl |
| 312 | 312 |
return nil, nil, err |
| 313 | 313 |
} |
| 314 | 314 |
return []mount.Mount{{
|
| 315 |
- Source: string(rootfs), |
|
| 315 |
+ Source: rootfs, |
|
| 316 | 316 |
Type: "bind", |
| 317 | 317 |
Options: []string{"rbind"},
|
| 318 | 318 |
}}, func() error {
|
| ... | ... |
@@ -45,7 +45,7 @@ type copyInfo struct {
|
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 | 47 |
func (c copyInfo) fullPath() (string, error) {
|
| 48 |
- return containerfs.ResolveScopedPath(string(c.root), c.path) |
|
| 48 |
+ return containerfs.ResolveScopedPath(c.root, c.path) |
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
func newCopyInfoFromSource(source builder.Source, path string, hash string) copyInfo {
|
| ... | ... |
@@ -159,7 +159,7 @@ func (o *copier) getCopyInfoForSourcePath(orig, dest string) ([]copyInfo, error) |
| 159 | 159 |
} |
| 160 | 160 |
path = unnamedFilename |
| 161 | 161 |
} |
| 162 |
- o.tmpPaths = append(o.tmpPaths, string(remote.Root())) |
|
| 162 |
+ o.tmpPaths = append(o.tmpPaths, remote.Root()) |
|
| 163 | 163 |
|
| 164 | 164 |
hash, err := remote.Hash(path) |
| 165 | 165 |
ci := newCopyInfoFromSource(remote, path, hash) |
| ... | ... |
@@ -202,7 +202,7 @@ func (o *copier) calcCopyInfo(origPath string, allowWildcards bool) ([]copyInfo, |
| 202 | 202 |
|
| 203 | 203 |
o.source, err = remotecontext.NewLazySource(rwLayer.Root()) |
| 204 | 204 |
if err != nil {
|
| 205 |
- return nil, errors.Wrapf(err, "failed to create context for copy from %s", string(rwLayer.Root())) |
|
| 205 |
+ return nil, errors.Wrapf(err, "failed to create context for copy from %s", rwLayer.Root()) |
|
| 206 | 206 |
} |
| 207 | 207 |
} |
| 208 | 208 |
|
| ... | ... |
@@ -259,7 +259,7 @@ func (o *copier) storeInPathCache(im *imageMount, path string, hash string) {
|
| 259 | 259 |
func (o *copier) copyWithWildcards(origPath string) ([]copyInfo, error) {
|
| 260 | 260 |
root := o.source.Root() |
| 261 | 261 |
var copyInfos []copyInfo |
| 262 |
- if err := filepath.Walk(string(root), func(path string, info os.FileInfo, err error) error {
|
|
| 262 |
+ if err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
|
|
| 263 | 263 |
if err != nil {
|
| 264 | 264 |
return err |
| 265 | 265 |
} |
| ... | ... |
@@ -442,7 +442,7 @@ func downloadSource(output io.Writer, stdout io.Writer, srcURL string) (remote b |
| 442 | 442 |
return |
| 443 | 443 |
} |
| 444 | 444 |
|
| 445 |
- lc, err := remotecontext.NewLazySource(containerfs.NewLocalContainerFS(tmpDir)) |
|
| 445 |
+ lc, err := remotecontext.NewLazySource(tmpDir) |
|
| 446 | 446 |
return lc, filename, err |
| 447 | 447 |
} |
| 448 | 448 |
|
| ... | ... |
@@ -147,7 +147,7 @@ func (b *Builder) performCopy(req dispatchRequest, inst copyInstruction) error {
|
| 147 | 147 |
// translated (if necessary because of user namespaces), and replace |
| 148 | 148 |
// the root pair with the chown pair for copy operations |
| 149 | 149 |
if inst.chownStr != "" {
|
| 150 |
- identity, err = parseChownFlag(b, state, inst.chownStr, string(destInfo.root), b.idMapping) |
|
| 150 |
+ identity, err = parseChownFlag(b, state, inst.chownStr, destInfo.root, b.idMapping) |
|
| 151 | 151 |
if err != nil {
|
| 152 | 152 |
if b.options.Platform != "windows" {
|
| 153 | 153 |
return errors.Wrapf(err, "unable to convert uid/gid chown string to host mapping") |
| ... | ... |
@@ -20,7 +20,7 @@ type archiveContext struct {
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 | 22 |
func (c *archiveContext) Close() error {
|
| 23 |
- return os.RemoveAll(string(c.root)) |
|
| 23 |
+ return os.RemoveAll(c.root) |
|
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 | 26 |
func convertPathError(err error, cleanpath string) error {
|
| ... | ... |
@@ -53,7 +53,7 @@ func FromArchive(tarStream io.Reader) (builder.Source, error) {
|
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 | 55 |
// Assume local file system. Since it's coming from a tar file. |
| 56 |
- tsc := &archiveContext{root: containerfs.NewLocalContainerFS(root)}
|
|
| 56 |
+ tsc := &archiveContext{root: root}
|
|
| 57 | 57 |
|
| 58 | 58 |
// Make sure we clean-up upon error. In the happy case the caller |
| 59 | 59 |
// is expected to manage the clean-up |
| ... | ... |
@@ -100,7 +100,7 @@ func (c *archiveContext) Hash(path string) (string, error) {
|
| 100 | 100 |
return "", err |
| 101 | 101 |
} |
| 102 | 102 |
|
| 103 |
- rel, err := filepath.Rel(string(c.root), fullpath) |
|
| 103 |
+ rel, err := filepath.Rel(c.root, fullpath) |
|
| 104 | 104 |
if err != nil {
|
| 105 | 105 |
return "", convertPathError(err, cleanpath) |
| 106 | 106 |
} |
| ... | ... |
@@ -117,7 +117,7 @@ func (c *archiveContext) Hash(path string) (string, error) {
|
| 117 | 117 |
|
| 118 | 118 |
func normalize(path string, root containerfs.ContainerFS) (cleanPath, fullPath string, err error) {
|
| 119 | 119 |
cleanPath = filepath.Clean(string(filepath.Separator) + path)[1:] |
| 120 |
- fullPath, err = containerfs.ResolveScopedPath(string(root), path) |
|
| 120 |
+ fullPath, err = containerfs.ResolveScopedPath(root, path) |
|
| 121 | 121 |
if err != nil {
|
| 122 | 122 |
return "", "", errors.Wrapf(err, "forbidden path outside the build context: %s (%s)", path, cleanPath) |
| 123 | 123 |
} |
| ... | ... |
@@ -176,7 +176,7 @@ func StatAt(remote builder.Source, path string) (os.FileInfo, error) {
|
| 176 | 176 |
|
| 177 | 177 |
// FullPath is a helper for getting a full path for a path from a source |
| 178 | 178 |
func FullPath(remote builder.Source, path string) (string, error) {
|
| 179 |
- fullPath, err := containerfs.ResolveScopedPath(string(remote.Root()), path) |
|
| 179 |
+ fullPath, err := containerfs.ResolveScopedPath(remote.Root(), path) |
|
| 180 | 180 |
if err != nil {
|
| 181 | 181 |
if runtime.GOOS == "windows" {
|
| 182 | 182 |
return "", fmt.Errorf("failed to resolve scoped path %s (%s): %s. Possible cause is a forbidden path outside the build context", path, fullPath, err)
|
| ... | ... |
@@ -53,7 +53,7 @@ func checkDirectory(t *testing.T, dir string, expectedFiles []string) {
|
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 | 55 |
func executeProcess(t *testing.T, contextDir string) {
|
| 56 |
- modifiableCtx := &stubRemote{root: containerfs.NewLocalContainerFS(contextDir)}
|
|
| 56 |
+ modifiableCtx := &stubRemote{root: contextDir}
|
|
| 57 | 57 |
|
| 58 | 58 |
err := removeDockerfile(modifiableCtx, builder.DefaultDockerfileName) |
| 59 | 59 |
|
| ... | ... |
@@ -119,5 +119,5 @@ func (r *stubRemote) Close() error {
|
| 119 | 119 |
return errors.New("not implemented")
|
| 120 | 120 |
} |
| 121 | 121 |
func (r *stubRemote) Remove(p string) error {
|
| 122 |
- return os.Remove(filepath.Join(string(r.root), p)) |
|
| 122 |
+ return os.Remove(filepath.Join(r.root, p)) |
|
| 123 | 123 |
} |
| ... | ... |
@@ -66,7 +66,7 @@ func (c *lazySource) Hash(path string) (string, error) {
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 | 68 |
func (c *lazySource) prepareHash(relPath string, fi os.FileInfo) (string, error) {
|
| 69 |
- p := filepath.Join(string(c.root), relPath) |
|
| 69 |
+ p := filepath.Join(c.root, relPath) |
|
| 70 | 70 |
h, err := NewFileHash(p, relPath, fi) |
| 71 | 71 |
if err != nil {
|
| 72 | 72 |
return "", errors.Wrapf(err, "failed to create hash for %s", relPath) |
| ... | ... |
@@ -91,7 +91,7 @@ func (c *lazySource) prepareHash(relPath string, fi os.FileInfo) (string, error) |
| 91 | 91 |
func Rel(basepath containerfs.ContainerFS, targpath string) (string, error) {
|
| 92 | 92 |
// filepath.Rel can't handle UUID paths in windows |
| 93 | 93 |
if runtime.GOOS == "windows" {
|
| 94 |
- pfx := string(basepath) + `\` |
|
| 94 |
+ pfx := basepath + `\` |
|
| 95 | 95 |
if strings.HasPrefix(targpath, pfx) {
|
| 96 | 96 |
p := strings.TrimPrefix(targpath, pfx) |
| 97 | 97 |
if p == "" {
|
| ... | ... |
@@ -100,5 +100,5 @@ func Rel(basepath containerfs.ContainerFS, targpath string) (string, error) {
|
| 100 | 100 |
return p, nil |
| 101 | 101 |
} |
| 102 | 102 |
} |
| 103 |
- return filepath.Rel(string(basepath), targpath) |
|
| 103 |
+ return filepath.Rel(basepath, targpath) |
|
| 104 | 104 |
} |
| ... | ... |
@@ -28,7 +28,7 @@ type CachableSource struct {
|
| 28 | 28 |
func NewCachableSource(root string) *CachableSource {
|
| 29 | 29 |
ts := &CachableSource{
|
| 30 | 30 |
tree: iradix.New(), |
| 31 |
- root: containerfs.NewLocalContainerFS(root), |
|
| 31 |
+ root: root, |
|
| 32 | 32 |
} |
| 33 | 33 |
return ts |
| 34 | 34 |
} |
| ... | ... |
@@ -67,7 +67,7 @@ func (cs *CachableSource) Scan() error {
|
| 67 | 67 |
return err |
| 68 | 68 |
} |
| 69 | 69 |
txn := iradix.New().Txn() |
| 70 |
- err = filepath.Walk(string(cs.root), func(path string, info os.FileInfo, err error) error {
|
|
| 70 |
+ err = filepath.Walk(cs.root, func(path string, info os.FileInfo, err error) error {
|
|
| 71 | 71 |
if err != nil {
|
| 72 | 72 |
return errors.Wrapf(err, "failed to walk %s", path) |
| 73 | 73 |
} |
| ... | ... |
@@ -35,7 +35,7 @@ func TestCloseRootDirectory(t *testing.T) {
|
| 35 | 35 |
t.Fatalf("Error while executing Close: %s", err)
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 |
- _, err = os.Stat(string(src.Root())) |
|
| 38 |
+ _, err = os.Stat(src.Root()) |
|
| 39 | 39 |
|
| 40 | 40 |
if !errors.Is(err, os.ErrNotExist) {
|
| 41 | 41 |
t.Fatal("Directory should not exist at this point")
|
| ... | ... |
@@ -118,7 +118,7 @@ func TestRemoveDirectory(t *testing.T) {
|
| 118 | 118 |
|
| 119 | 119 |
src := makeTestArchiveContext(t, contextDir) |
| 120 | 120 |
|
| 121 |
- _, err = os.Stat(filepath.Join(string(src.Root()), relativePath)) |
|
| 121 |
+ _, err = os.Stat(filepath.Join(src.Root(), relativePath)) |
|
| 122 | 122 |
if err != nil {
|
| 123 | 123 |
t.Fatalf("Statting %s shouldn't fail: %+v", relativePath, err)
|
| 124 | 124 |
} |
| ... | ... |
@@ -129,7 +129,7 @@ func TestRemoveDirectory(t *testing.T) {
|
| 129 | 129 |
t.Fatalf("Error when executing Remove: %s", err)
|
| 130 | 130 |
} |
| 131 | 131 |
|
| 132 |
- _, err = os.Stat(filepath.Join(string(src.Root()), relativePath)) |
|
| 132 |
+ _, err = os.Stat(filepath.Join(src.Root(), relativePath)) |
|
| 133 | 133 |
if !errors.Is(err, os.ErrNotExist) {
|
| 134 | 134 |
t.Fatalf("Directory should not exist at this point: %+v ", err)
|
| 135 | 135 |
} |
| ... | ... |
@@ -64,7 +64,7 @@ func (container *Container) StatPath(resolvedPath, absPath string) (stat *types. |
| 64 | 64 |
return nil, err |
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 |
- linkTarget, err = filepath.Rel(string(container.BaseFS), hostPath) |
|
| 67 |
+ linkTarget, err = filepath.Rel(container.BaseFS, hostPath) |
|
| 68 | 68 |
if err != nil {
|
| 69 | 69 |
return nil, err |
| 70 | 70 |
} |
| ... | ... |
@@ -304,13 +304,13 @@ func (container *Container) GetResourcePath(path string) (string, error) {
|
| 304 | 304 |
} |
| 305 | 305 |
// IMPORTANT - These are paths on the OS where the daemon is running, hence |
| 306 | 306 |
// any filepath operations must be done in an OS agnostic way. |
| 307 |
- r, e := containerfs.ResolveScopedPath(string(container.BaseFS), containerfs.CleanScopedPath(path)) |
|
| 307 |
+ r, e := containerfs.ResolveScopedPath(container.BaseFS, containerfs.CleanScopedPath(path)) |
|
| 308 | 308 |
|
| 309 | 309 |
// Log this here on the daemon side as there's otherwise no indication apart |
| 310 | 310 |
// from the error being propagated all the way back to the client. This makes |
| 311 | 311 |
// debugging significantly easier and clearly indicates the error comes from the daemon. |
| 312 | 312 |
if e != nil {
|
| 313 |
- logrus.Errorf("Failed to ResolveScopedPath BaseFS %s path %s %s\n", string(container.BaseFS), path, e)
|
|
| 313 |
+ logrus.Errorf("Failed to ResolveScopedPath BaseFS %s path %s %s\n", container.BaseFS, path, e)
|
|
| 314 | 314 |
} |
| 315 | 315 |
return r, e |
| 316 | 316 |
} |
| ... | ... |
@@ -246,7 +246,7 @@ func (daemon *Daemon) containerArchivePath(container *container.Container, path |
| 246 | 246 |
} |
| 247 | 247 |
opts := archive.TarResourceRebaseOpts(sourceBase, filepath.Base(absPath)) |
| 248 | 248 |
|
| 249 |
- data, err := archivePath(driver, sourceDir, opts, string(container.BaseFS)) |
|
| 249 |
+ data, err := archivePath(driver, sourceDir, opts, container.BaseFS) |
|
| 250 | 250 |
if err != nil {
|
| 251 | 251 |
return nil, nil, err |
| 252 | 252 |
} |
| ... | ... |
@@ -333,14 +333,14 @@ func (daemon *Daemon) containerExtractToDir(container *container.Container, path |
| 333 | 333 |
// a volume file path. |
| 334 | 334 |
var baseRel string |
| 335 | 335 |
if strings.HasPrefix(resolvedPath, `\\?\Volume{`) {
|
| 336 |
- if strings.HasPrefix(resolvedPath, string(driver)) {
|
|
| 337 |
- baseRel = resolvedPath[len(string(driver)):] |
|
| 336 |
+ if strings.HasPrefix(resolvedPath, driver) {
|
|
| 337 |
+ baseRel = resolvedPath[len(driver):] |
|
| 338 | 338 |
if baseRel[:1] == `\` {
|
| 339 | 339 |
baseRel = baseRel[1:] |
| 340 | 340 |
} |
| 341 | 341 |
} |
| 342 | 342 |
} else {
|
| 343 |
- baseRel, err = filepath.Rel(string(driver), resolvedPath) |
|
| 343 |
+ baseRel, err = filepath.Rel(driver, resolvedPath) |
|
| 344 | 344 |
} |
| 345 | 345 |
if err != nil {
|
| 346 | 346 |
return err |
| ... | ... |
@@ -372,7 +372,7 @@ func (daemon *Daemon) containerExtractToDir(container *container.Container, path |
| 372 | 372 |
} |
| 373 | 373 |
} |
| 374 | 374 |
|
| 375 |
- if err := extractArchive(driver, content, resolvedPath, options, string(container.BaseFS)); err != nil {
|
|
| 375 |
+ if err := extractArchive(driver, content, resolvedPath, options, container.BaseFS); err != nil {
|
|
| 376 | 376 |
return err |
| 377 | 377 |
} |
| 378 | 378 |
|
| ... | ... |
@@ -434,7 +434,7 @@ func (daemon *Daemon) containerCopy(container *container.Container, resource str |
| 434 | 434 |
archv, err := archivePath(driver, basePath, &archive.TarOptions{
|
| 435 | 435 |
Compression: archive.Uncompressed, |
| 436 | 436 |
IncludeFiles: filter, |
| 437 |
- }, string(container.BaseFS)) |
|
| 437 |
+ }, container.BaseFS) |
|
| 438 | 438 |
if err != nil {
|
| 439 | 439 |
return nil, err |
| 440 | 440 |
} |
| ... | ... |
@@ -61,10 +61,10 @@ func (daemon *Daemon) containerExport(container *container.Container) (arch io.R |
| 61 | 61 |
return nil, err |
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 |
- archv, err := archivePath(basefs, string(basefs), &archive.TarOptions{
|
|
| 64 |
+ archv, err := archivePath(basefs, basefs, &archive.TarOptions{
|
|
| 65 | 65 |
Compression: archive.Uncompressed, |
| 66 | 66 |
IDMap: daemon.idMapping, |
| 67 |
- }, string(basefs)) |
|
| 67 |
+ }, basefs) |
|
| 68 | 68 |
if err != nil {
|
| 69 | 69 |
rwlayer.Unmount() |
| 70 | 70 |
return nil, err |
| ... | ... |
@@ -370,7 +370,7 @@ func (a *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
| 370 | 370 |
} |
| 371 | 371 |
} |
| 372 | 372 |
if count := a.ctr.Increment(m); count > 1 {
|
| 373 |
- return containerfs.NewLocalContainerFS(m), nil |
|
| 373 |
+ return m, nil |
|
| 374 | 374 |
} |
| 375 | 375 |
|
| 376 | 376 |
// If a dir does not have a parent ( no layers )do not try to mount |
| ... | ... |
@@ -384,7 +384,7 @@ func (a *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
| 384 | 384 |
a.pathCacheLock.Lock() |
| 385 | 385 |
a.pathCache[id] = m |
| 386 | 386 |
a.pathCacheLock.Unlock() |
| 387 |
- return containerfs.NewLocalContainerFS(m), nil |
|
| 387 |
+ return m, nil |
|
| 388 | 388 |
} |
| 389 | 389 |
|
| 390 | 390 |
// Put unmounts and updates list of active mounts. |
| ... | ... |
@@ -43,14 +43,6 @@ func testInit(dir string, t testing.TB) graphdriver.Driver {
|
| 43 | 43 |
return d |
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 |
-func driverGet(d *Driver, id string, mntLabel string) (string, error) {
|
|
| 47 |
- mnt, err := d.Get(id, mntLabel) |
|
| 48 |
- if err != nil {
|
|
| 49 |
- return "", err |
|
| 50 |
- } |
|
| 51 |
- return string(mnt), nil |
|
| 52 |
-} |
|
| 53 |
- |
|
| 54 | 46 |
func newDriver(t testing.TB) *Driver {
|
| 55 | 47 |
if err := os.MkdirAll(tmp, 0755); err != nil {
|
| 56 | 48 |
t.Fatal(err) |
| ... | ... |
@@ -180,7 +172,7 @@ func TestGetWithoutParent(t *testing.T) {
|
| 180 | 180 |
t.Fatal(err) |
| 181 | 181 |
} |
| 182 | 182 |
expected := path.Join(tmp, "diff", "1") |
| 183 |
- if string(diffPath) != expected {
|
|
| 183 |
+ if diffPath != expected {
|
|
| 184 | 184 |
t.Fatalf("Expected path %s got %s", expected, diffPath)
|
| 185 | 185 |
} |
| 186 | 186 |
} |
| ... | ... |
@@ -262,8 +254,8 @@ func TestMountWithParent(t *testing.T) {
|
| 262 | 262 |
} |
| 263 | 263 |
|
| 264 | 264 |
expected := path.Join(tmp, "mnt", "2") |
| 265 |
- if string(mntPath) != expected {
|
|
| 266 |
- t.Fatalf("Expected %s got %s", expected, string(mntPath))
|
|
| 265 |
+ if mntPath != expected {
|
|
| 266 |
+ t.Fatalf("Expected %s got %s", expected, mntPath)
|
|
| 267 | 267 |
} |
| 268 | 268 |
} |
| 269 | 269 |
|
| ... | ... |
@@ -323,7 +315,7 @@ func TestGetDiff(t *testing.T) {
|
| 323 | 323 |
t.Fatal(err) |
| 324 | 324 |
} |
| 325 | 325 |
|
| 326 |
- diffPath, err := driverGet(d, "1", "") |
|
| 326 |
+ diffPath, err := d.Get("1", "")
|
|
| 327 | 327 |
if err != nil {
|
| 328 | 328 |
t.Fatal(err) |
| 329 | 329 |
} |
| ... | ... |
@@ -367,7 +359,7 @@ func TestChanges(t *testing.T) {
|
| 367 | 367 |
} |
| 368 | 368 |
}() |
| 369 | 369 |
|
| 370 |
- mntPoint, err := driverGet(d, "2", "") |
|
| 370 |
+ mntPoint, err := d.Get("2", "")
|
|
| 371 | 371 |
if err != nil {
|
| 372 | 372 |
t.Fatal(err) |
| 373 | 373 |
} |
| ... | ... |
@@ -406,7 +398,7 @@ func TestChanges(t *testing.T) {
|
| 406 | 406 |
if err := d.CreateReadWrite("3", "2", nil); err != nil {
|
| 407 | 407 |
t.Fatal(err) |
| 408 | 408 |
} |
| 409 |
- mntPoint, err = driverGet(d, "3", "") |
|
| 409 |
+ mntPoint, err = d.Get("3", "")
|
|
| 410 | 410 |
if err != nil {
|
| 411 | 411 |
t.Fatal(err) |
| 412 | 412 |
} |
| ... | ... |
@@ -452,7 +444,7 @@ func TestDiffSize(t *testing.T) {
|
| 452 | 452 |
t.Fatal(err) |
| 453 | 453 |
} |
| 454 | 454 |
|
| 455 |
- diffPath, err := driverGet(d, "1", "") |
|
| 455 |
+ diffPath, err := d.Get("1", "")
|
|
| 456 | 456 |
if err != nil {
|
| 457 | 457 |
t.Fatal(err) |
| 458 | 458 |
} |
| ... | ... |
@@ -494,7 +486,7 @@ func TestChildDiffSize(t *testing.T) {
|
| 494 | 494 |
t.Fatal(err) |
| 495 | 495 |
} |
| 496 | 496 |
|
| 497 |
- diffPath, err := driverGet(d, "1", "") |
|
| 497 |
+ diffPath, err := d.Get("1", "")
|
|
| 498 | 498 |
if err != nil {
|
| 499 | 499 |
t.Fatal(err) |
| 500 | 500 |
} |
| ... | ... |
@@ -595,7 +587,7 @@ func TestApplyDiff(t *testing.T) {
|
| 595 | 595 |
t.Fatal(err) |
| 596 | 596 |
} |
| 597 | 597 |
|
| 598 |
- diffPath, err := driverGet(d, "1", "") |
|
| 598 |
+ diffPath, err := d.Get("1", "")
|
|
| 599 | 599 |
if err != nil {
|
| 600 | 600 |
t.Fatal(err) |
| 601 | 601 |
} |
| ... | ... |
@@ -630,7 +622,7 @@ func TestApplyDiff(t *testing.T) {
|
| 630 | 630 |
|
| 631 | 631 |
// Ensure that the file is in the mount point for id 3 |
| 632 | 632 |
|
| 633 |
- mountPoint, err := driverGet(d, "3", "") |
|
| 633 |
+ mountPoint, err := d.Get("3", "")
|
|
| 634 | 634 |
if err != nil {
|
| 635 | 635 |
t.Fatal(err) |
| 636 | 636 |
} |
| ... | ... |
@@ -673,7 +665,7 @@ func testMountMoreThan42Layers(t *testing.T, mountPath string) {
|
| 673 | 673 |
err := d.CreateReadWrite(current, parent, nil) |
| 674 | 674 |
assert.NilError(t, err, "current layer %d", i) |
| 675 | 675 |
|
| 676 |
- point, err := driverGet(d, current, "") |
|
| 676 |
+ point, err := d.Get(current, "") |
|
| 677 | 677 |
assert.NilError(t, err, "current layer %d", i) |
| 678 | 678 |
|
| 679 | 679 |
f, err := os.Create(path.Join(point, current)) |
| ... | ... |
@@ -689,7 +681,7 @@ func testMountMoreThan42Layers(t *testing.T, mountPath string) {
|
| 689 | 689 |
} |
| 690 | 690 |
|
| 691 | 691 |
// Perform the actual mount for the top most image |
| 692 |
- point, err := driverGet(d, last, "") |
|
| 692 |
+ point, err := d.Get(last, "") |
|
| 693 | 693 |
assert.NilError(t, err) |
| 694 | 694 |
files, err := os.ReadDir(point) |
| 695 | 695 |
assert.NilError(t, err) |
| ... | ... |
@@ -649,7 +649,7 @@ func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
| 649 | 649 |
} |
| 650 | 650 |
} |
| 651 | 651 |
|
| 652 |
- return containerfs.NewLocalContainerFS(dir), nil |
|
| 652 |
+ return dir, nil |
|
| 653 | 653 |
} |
| 654 | 654 |
|
| 655 | 655 |
// Put is not implemented for BTRFS as there is no cleanup required for the id. |
| ... | ... |
@@ -36,14 +36,12 @@ func TestBtrfsSubvolDelete(t *testing.T) {
|
| 36 | 36 |
} |
| 37 | 37 |
defer graphtest.PutDriver(t) |
| 38 | 38 |
|
| 39 |
- dirFS, err := d.Get("test", "")
|
|
| 39 |
+ dir, err := d.Get("test", "")
|
|
| 40 | 40 |
if err != nil {
|
| 41 | 41 |
t.Fatal(err) |
| 42 | 42 |
} |
| 43 | 43 |
defer d.Put("test")
|
| 44 | 44 |
|
| 45 |
- dir := string(dirFS) |
|
| 46 |
- |
|
| 47 | 45 |
if err := subvolCreate(dir, "subvoltest"); err != nil {
|
| 48 | 46 |
t.Fatal(err) |
| 49 | 47 |
} |
| ... | ... |
@@ -181,7 +181,7 @@ func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
| 181 | 181 |
mp := path.Join(d.home, "mnt", id) |
| 182 | 182 |
rootFs := path.Join(mp, "rootfs") |
| 183 | 183 |
if count := d.ctr.Increment(mp); count > 1 {
|
| 184 |
- return containerfs.NewLocalContainerFS(rootFs), nil |
|
| 184 |
+ return rootFs, nil |
|
| 185 | 185 |
} |
| 186 | 186 |
|
| 187 | 187 |
root := d.idMap.RootPair() |
| ... | ... |
@@ -219,7 +219,7 @@ func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
| 219 | 219 |
} |
| 220 | 220 |
} |
| 221 | 221 |
|
| 222 |
- return containerfs.NewLocalContainerFS(rootFs), nil |
|
| 222 |
+ return rootFs, nil |
|
| 223 | 223 |
} |
| 224 | 224 |
|
| 225 | 225 |
// Put unmounts a device and removes it. |
| ... | ... |
@@ -50,7 +50,7 @@ func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch io.ReadCloser, err err |
| 50 | 50 |
if err != nil {
|
| 51 | 51 |
return nil, err |
| 52 | 52 |
} |
| 53 |
- layerFs := string(layerRootFs) |
|
| 53 |
+ layerFs := layerRootFs |
|
| 54 | 54 |
|
| 55 | 55 |
defer func() {
|
| 56 | 56 |
if err != nil {
|
| ... | ... |
@@ -70,14 +70,12 @@ func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch io.ReadCloser, err err |
| 70 | 70 |
}), nil |
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 |
- parentRootFs, err := driver.Get(parent, "") |
|
| 73 |
+ parentFs, err := driver.Get(parent, "") |
|
| 74 | 74 |
if err != nil {
|
| 75 | 75 |
return nil, err |
| 76 | 76 |
} |
| 77 | 77 |
defer driver.Put(parent) |
| 78 | 78 |
|
| 79 |
- parentFs := string(parentRootFs) |
|
| 80 |
- |
|
| 81 | 79 |
changes, err := archive.ChangesDirs(layerFs, parentFs) |
| 82 | 80 |
if err != nil {
|
| 83 | 81 |
return nil, err |
| ... | ... |
@@ -106,22 +104,20 @@ func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch io.ReadCloser, err err |
| 106 | 106 |
func (gdw *NaiveDiffDriver) Changes(id, parent string) ([]archive.Change, error) {
|
| 107 | 107 |
driver := gdw.ProtoDriver |
| 108 | 108 |
|
| 109 |
- layerRootFs, err := driver.Get(id, "") |
|
| 109 |
+ layerFs, err := driver.Get(id, "") |
|
| 110 | 110 |
if err != nil {
|
| 111 | 111 |
return nil, err |
| 112 | 112 |
} |
| 113 | 113 |
defer driver.Put(id) |
| 114 | 114 |
|
| 115 |
- layerFs := string(layerRootFs) |
|
| 116 | 115 |
parentFs := "" |
| 117 | 116 |
|
| 118 | 117 |
if parent != "" {
|
| 119 |
- parentRootFs, err := driver.Get(parent, "") |
|
| 118 |
+ parentFs, err = driver.Get(parent, "") |
|
| 120 | 119 |
if err != nil {
|
| 121 | 120 |
return nil, err |
| 122 | 121 |
} |
| 123 | 122 |
defer driver.Put(parent) |
| 124 |
- parentFs = string(parentRootFs) |
|
| 125 | 123 |
} |
| 126 | 124 |
|
| 127 | 125 |
return archive.ChangesDirs(layerFs, parentFs) |
| ... | ... |
@@ -140,7 +136,7 @@ func (gdw *NaiveDiffDriver) ApplyDiff(id, parent string, diff io.Reader) (size i |
| 140 | 140 |
} |
| 141 | 141 |
defer driver.Put(id) |
| 142 | 142 |
|
| 143 |
- layerFs := string(layerRootFs) |
|
| 143 |
+ layerFs := layerRootFs |
|
| 144 | 144 |
options := &archive.TarOptions{IDMap: gdw.idMap}
|
| 145 | 145 |
start := time.Now().UTC() |
| 146 | 146 |
logrus.WithField("id", id).Debug("Start untar layer")
|
| ... | ... |
@@ -169,5 +165,5 @@ func (gdw *NaiveDiffDriver) DiffSize(id, parent string) (size int64, err error) |
| 169 | 169 |
} |
| 170 | 170 |
defer driver.Put(id) |
| 171 | 171 |
|
| 172 |
- return archive.ChangesSize(string(layerFs), changes), nil |
|
| 172 |
+ return archive.ChangesSize(layerFs, changes), nil |
|
| 173 | 173 |
} |
| ... | ... |
@@ -316,14 +316,14 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e |
| 316 | 316 |
if err != nil {
|
| 317 | 317 |
// If no lower, just return diff directory |
| 318 | 318 |
if os.IsNotExist(err) {
|
| 319 |
- return containerfs.NewLocalContainerFS(diffDir), nil |
|
| 319 |
+ return diffDir, nil |
|
| 320 | 320 |
} |
| 321 | 321 |
return "", err |
| 322 | 322 |
} |
| 323 | 323 |
|
| 324 | 324 |
mergedDir := path.Join(dir, mergedDirName) |
| 325 | 325 |
if count := d.ctr.Increment(mergedDir); count > 1 {
|
| 326 |
- return containerfs.NewLocalContainerFS(mergedDir), nil |
|
| 326 |
+ return mergedDir, nil |
|
| 327 | 327 |
} |
| 328 | 328 |
defer func() {
|
| 329 | 329 |
if retErr != nil {
|
| ... | ... |
@@ -380,7 +380,7 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e |
| 380 | 380 |
return "", errors.Wrapf(err, "using mount program %s: %s", binary, output) |
| 381 | 381 |
} |
| 382 | 382 |
|
| 383 |
- return containerfs.NewLocalContainerFS(mergedDir), nil |
|
| 383 |
+ return mergedDir, nil |
|
| 384 | 384 |
} |
| 385 | 385 |
|
| 386 | 386 |
// Put unmounts the mount path created for the give id. |
| ... | ... |
@@ -250,7 +250,7 @@ func DriverBenchDeepLayerRead(b *testing.B, layerCount int, drivername string, d |
| 250 | 250 |
for i := 0; i < b.N; i++ {
|
| 251 | 251 |
|
| 252 | 252 |
// Read content |
| 253 |
- c, err := os.ReadFile(filepath.Join(string(root), "testfile.txt")) |
|
| 253 |
+ c, err := os.ReadFile(filepath.Join(root, "testfile.txt")) |
|
| 254 | 254 |
if err != nil {
|
| 255 | 255 |
b.Fatal(err) |
| 256 | 256 |
} |
| ... | ... |
@@ -96,10 +96,10 @@ func DriverTestCreateEmpty(t testing.TB, drivername string, driverOptions ...str |
| 96 | 96 |
dir, err := driver.Get("empty", "")
|
| 97 | 97 |
assert.NilError(t, err) |
| 98 | 98 |
|
| 99 |
- verifyFile(t, string(dir), 0755|os.ModeDir, 0, 0) |
|
| 99 |
+ verifyFile(t, dir, 0755|os.ModeDir, 0, 0) |
|
| 100 | 100 |
|
| 101 | 101 |
// Verify that the directory is empty |
| 102 |
- fis, err := readDir(string(dir)) |
|
| 102 |
+ fis, err := readDir(dir) |
|
| 103 | 103 |
assert.NilError(t, err) |
| 104 | 104 |
assert.Check(t, is.Len(fis, 0)) |
| 105 | 105 |
|
| ... | ... |
@@ -324,19 +324,19 @@ func DriverTestSetQuota(t *testing.T, drivername string, required bool) {
|
| 324 | 324 |
quota := uint64(50 * units.MiB) |
| 325 | 325 |
|
| 326 | 326 |
// Try to write a file smaller than quota, and ensure it works |
| 327 |
- err = writeRandomFile(path.Join(string(mountPath), "smallfile"), quota/2) |
|
| 327 |
+ err = writeRandomFile(path.Join(mountPath, "smallfile"), quota/2) |
|
| 328 | 328 |
if err != nil {
|
| 329 | 329 |
t.Fatal(err) |
| 330 | 330 |
} |
| 331 |
- defer os.Remove(path.Join(string(mountPath), "smallfile")) |
|
| 331 |
+ defer os.Remove(path.Join(mountPath, "smallfile")) |
|
| 332 | 332 |
|
| 333 | 333 |
// Try to write a file bigger than quota. We've already filled up half the quota, so hitting the limit should be easy |
| 334 |
- err = writeRandomFile(path.Join(string(mountPath), "bigfile"), quota) |
|
| 334 |
+ err = writeRandomFile(path.Join(mountPath, "bigfile"), quota) |
|
| 335 | 335 |
if err == nil {
|
| 336 | 336 |
t.Fatalf("expected write to fail(), instead had success")
|
| 337 | 337 |
} |
| 338 | 338 |
if pathError, ok := err.(*os.PathError); ok && pathError.Err != unix.EDQUOT && pathError.Err != unix.ENOSPC {
|
| 339 |
- os.Remove(path.Join(string(mountPath), "bigfile")) |
|
| 339 |
+ os.Remove(path.Join(mountPath, "bigfile")) |
|
| 340 | 340 |
t.Fatalf("expect write() to fail with %v or %v, got %v", unix.EDQUOT, unix.ENOSPC, pathError.Err)
|
| 341 | 341 |
} |
| 342 | 342 |
} |
| ... | ... |
@@ -36,17 +36,17 @@ func addFiles(drv graphdriver.Driver, layer string, seed int64) error {
|
| 36 | 36 |
} |
| 37 | 37 |
defer drv.Put(layer) |
| 38 | 38 |
|
| 39 |
- if err := os.WriteFile(filepath.Join(string(root), "file-a"), randomContent(64, seed), 0755); err != nil {
|
|
| 39 |
+ if err := os.WriteFile(filepath.Join(root, "file-a"), randomContent(64, seed), 0755); err != nil {
|
|
| 40 | 40 |
return err |
| 41 | 41 |
} |
| 42 |
- if err := os.MkdirAll(filepath.Join(string(root), "dir-b"), 0755); err != nil {
|
|
| 42 |
+ if err := os.MkdirAll(filepath.Join(root, "dir-b"), 0755); err != nil {
|
|
| 43 | 43 |
return err |
| 44 | 44 |
} |
| 45 |
- if err := os.WriteFile(filepath.Join(string(root), "dir-b", "file-b"), randomContent(128, seed+1), 0755); err != nil {
|
|
| 45 |
+ if err := os.WriteFile(filepath.Join(root, "dir-b", "file-b"), randomContent(128, seed+1), 0755); err != nil {
|
|
| 46 | 46 |
return err |
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 |
- return os.WriteFile(filepath.Join(string(root), "file-c"), randomContent(128*128, seed+2), 0755) |
|
| 49 |
+ return os.WriteFile(filepath.Join(root, "file-c"), randomContent(128*128, seed+2), 0755) |
|
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 | 52 |
func checkFile(drv graphdriver.Driver, layer, filename string, content []byte) error {
|
| ... | ... |
@@ -56,7 +56,7 @@ func checkFile(drv graphdriver.Driver, layer, filename string, content []byte) e |
| 56 | 56 |
} |
| 57 | 57 |
defer drv.Put(layer) |
| 58 | 58 |
|
| 59 |
- fileContent, err := os.ReadFile(filepath.Join(string(root), filename)) |
|
| 59 |
+ fileContent, err := os.ReadFile(filepath.Join(root, filename)) |
|
| 60 | 60 |
if err != nil {
|
| 61 | 61 |
return err |
| 62 | 62 |
} |
| ... | ... |
@@ -75,7 +75,7 @@ func addFile(drv graphdriver.Driver, layer, filename string, content []byte) err |
| 75 | 75 |
} |
| 76 | 76 |
defer drv.Put(layer) |
| 77 | 77 |
|
| 78 |
- return os.WriteFile(filepath.Join(string(root), filename), content, 0755) |
|
| 78 |
+ return os.WriteFile(filepath.Join(root, filename), content, 0755) |
|
| 79 | 79 |
} |
| 80 | 80 |
|
| 81 | 81 |
func addDirectory(drv graphdriver.Driver, layer, dir string) error {
|
| ... | ... |
@@ -85,7 +85,7 @@ func addDirectory(drv graphdriver.Driver, layer, dir string) error {
|
| 85 | 85 |
} |
| 86 | 86 |
defer drv.Put(layer) |
| 87 | 87 |
|
| 88 |
- return os.MkdirAll(filepath.Join(string(root), dir), 0755) |
|
| 88 |
+ return os.MkdirAll(filepath.Join(root, dir), 0755) |
|
| 89 | 89 |
} |
| 90 | 90 |
|
| 91 | 91 |
func removeAll(drv graphdriver.Driver, layer string, names ...string) error {
|
| ... | ... |
@@ -96,7 +96,7 @@ func removeAll(drv graphdriver.Driver, layer string, names ...string) error {
|
| 96 | 96 |
defer drv.Put(layer) |
| 97 | 97 |
|
| 98 | 98 |
for _, filename := range names {
|
| 99 |
- if err := os.RemoveAll(filepath.Join(string(root), filename)); err != nil {
|
|
| 99 |
+ if err := os.RemoveAll(filepath.Join(root, filename)); err != nil {
|
|
| 100 | 100 |
return err |
| 101 | 101 |
} |
| 102 | 102 |
} |
| ... | ... |
@@ -110,8 +110,8 @@ func checkFileRemoved(drv graphdriver.Driver, layer, filename string) error {
|
| 110 | 110 |
} |
| 111 | 111 |
defer drv.Put(layer) |
| 112 | 112 |
|
| 113 |
- if _, err := os.Stat(filepath.Join(string(root), filename)); err == nil {
|
|
| 114 |
- return fmt.Errorf("file still exists: %s", filepath.Join(string(root), filename))
|
|
| 113 |
+ if _, err := os.Stat(filepath.Join(root, filename)); err == nil {
|
|
| 114 |
+ return fmt.Errorf("file still exists: %s", filepath.Join(root, filename))
|
|
| 115 | 115 |
} else if !os.IsNotExist(err) {
|
| 116 | 116 |
return err |
| 117 | 117 |
} |
| ... | ... |
@@ -127,7 +127,7 @@ func addManyFiles(drv graphdriver.Driver, layer string, count int, seed int64) e |
| 127 | 127 |
defer drv.Put(layer) |
| 128 | 128 |
|
| 129 | 129 |
for i := 0; i < count; i += 100 {
|
| 130 |
- dir := filepath.Join(string(root), fmt.Sprintf("directory-%d", i))
|
|
| 130 |
+ dir := filepath.Join(root, fmt.Sprintf("directory-%d", i))
|
|
| 131 | 131 |
if err := os.MkdirAll(dir, 0755); err != nil {
|
| 132 | 132 |
return err |
| 133 | 133 |
} |
| ... | ... |
@@ -152,7 +152,7 @@ func changeManyFiles(drv graphdriver.Driver, layer string, count int, seed int64 |
| 152 | 152 |
var changes []archive.Change |
| 153 | 153 |
for i := 0; i < count; i += 100 {
|
| 154 | 154 |
archiveRoot := fmt.Sprintf("/directory-%d", i)
|
| 155 |
- if err := os.MkdirAll(filepath.Join(string(root), archiveRoot), 0755); err != nil {
|
|
| 155 |
+ if err := os.MkdirAll(filepath.Join(root, archiveRoot), 0755); err != nil {
|
|
| 156 | 156 |
return nil, err |
| 157 | 157 |
} |
| 158 | 158 |
for j := 0; i+j < count && j < 100; j++ {
|
| ... | ... |
@@ -168,21 +168,21 @@ func changeManyFiles(drv graphdriver.Driver, layer string, count int, seed int64 |
| 168 | 168 |
case 0: |
| 169 | 169 |
change.Path = filepath.Join(archiveRoot, fmt.Sprintf("file-%d", i+j))
|
| 170 | 170 |
change.Kind = archive.ChangeModify |
| 171 |
- if err := os.WriteFile(filepath.Join(string(root), change.Path), randomContent(64, seed+int64(i+j)), 0755); err != nil {
|
|
| 171 |
+ if err := os.WriteFile(filepath.Join(root, change.Path), randomContent(64, seed+int64(i+j)), 0755); err != nil {
|
|
| 172 | 172 |
return nil, err |
| 173 | 173 |
} |
| 174 | 174 |
// Add file |
| 175 | 175 |
case 1: |
| 176 | 176 |
change.Path = filepath.Join(archiveRoot, fmt.Sprintf("file-%d-%d", seed, i+j))
|
| 177 | 177 |
change.Kind = archive.ChangeAdd |
| 178 |
- if err := os.WriteFile(filepath.Join(string(root), change.Path), randomContent(64, seed+int64(i+j)), 0755); err != nil {
|
|
| 178 |
+ if err := os.WriteFile(filepath.Join(root, change.Path), randomContent(64, seed+int64(i+j)), 0755); err != nil {
|
|
| 179 | 179 |
return nil, err |
| 180 | 180 |
} |
| 181 | 181 |
// Remove file |
| 182 | 182 |
case 2: |
| 183 | 183 |
change.Path = filepath.Join(archiveRoot, fmt.Sprintf("file-%d", i+j))
|
| 184 | 184 |
change.Kind = archive.ChangeDelete |
| 185 |
- if err := os.Remove(filepath.Join(string(root), change.Path)); err != nil {
|
|
| 185 |
+ if err := os.Remove(filepath.Join(root, change.Path)); err != nil {
|
|
| 186 | 186 |
return nil, err |
| 187 | 187 |
} |
| 188 | 188 |
} |
| ... | ... |
@@ -201,7 +201,7 @@ func checkManyFiles(drv graphdriver.Driver, layer string, count int, seed int64) |
| 201 | 201 |
defer drv.Put(layer) |
| 202 | 202 |
|
| 203 | 203 |
for i := 0; i < count; i += 100 {
|
| 204 |
- dir := filepath.Join(string(root), fmt.Sprintf("directory-%d", i))
|
|
| 204 |
+ dir := filepath.Join(root, fmt.Sprintf("directory-%d", i))
|
|
| 205 | 205 |
for j := 0; i+j < count && j < 100; j++ {
|
| 206 | 206 |
file := filepath.Join(dir, fmt.Sprintf("file-%d", i+j))
|
| 207 | 207 |
fileContent, err := os.ReadFile(file) |
| ... | ... |
@@ -254,10 +254,10 @@ func addLayerFiles(drv graphdriver.Driver, layer, parent string, i int) error {
|
| 254 | 254 |
} |
| 255 | 255 |
defer drv.Put(layer) |
| 256 | 256 |
|
| 257 |
- if err := os.WriteFile(filepath.Join(string(root), "top-id"), []byte(layer), 0755); err != nil {
|
|
| 257 |
+ if err := os.WriteFile(filepath.Join(root, "top-id"), []byte(layer), 0755); err != nil {
|
|
| 258 | 258 |
return err |
| 259 | 259 |
} |
| 260 |
- layerDir := filepath.Join(string(root), fmt.Sprintf("layer-%d", i))
|
|
| 260 |
+ layerDir := filepath.Join(root, fmt.Sprintf("layer-%d", i))
|
|
| 261 | 261 |
if err := os.MkdirAll(layerDir, 0755); err != nil {
|
| 262 | 262 |
return err |
| 263 | 263 |
} |
| ... | ... |
@@ -291,7 +291,7 @@ func checkManyLayers(drv graphdriver.Driver, layer string, count int) error {
|
| 291 | 291 |
} |
| 292 | 292 |
defer drv.Put(layer) |
| 293 | 293 |
|
| 294 |
- layerIDBytes, err := os.ReadFile(filepath.Join(string(root), "top-id")) |
|
| 294 |
+ layerIDBytes, err := os.ReadFile(filepath.Join(root, "top-id")) |
|
| 295 | 295 |
if err != nil {
|
| 296 | 296 |
return err |
| 297 | 297 |
} |
| ... | ... |
@@ -301,7 +301,7 @@ func checkManyLayers(drv graphdriver.Driver, layer string, count int) error {
|
| 301 | 301 |
} |
| 302 | 302 |
|
| 303 | 303 |
for i := count; i > 0; i-- {
|
| 304 |
- layerDir := filepath.Join(string(root), fmt.Sprintf("layer-%d", i))
|
|
| 304 |
+ layerDir := filepath.Join(root, fmt.Sprintf("layer-%d", i))
|
|
| 305 | 305 |
|
| 306 | 306 |
thisLayerIDBytes, err := os.ReadFile(filepath.Join(layerDir, "layer-id")) |
| 307 | 307 |
if err != nil {
|
| ... | ... |
@@ -45,11 +45,11 @@ func createBase(t testing.TB, driver graphdriver.Driver, name string) {
|
| 45 | 45 |
assert.NilError(t, err) |
| 46 | 46 |
defer driver.Put(name) |
| 47 | 47 |
|
| 48 |
- subdir := filepath.Join(string(dirFS), "a subdir") |
|
| 48 |
+ subdir := filepath.Join(dirFS, "a subdir") |
|
| 49 | 49 |
assert.NilError(t, os.Mkdir(subdir, 0705|os.ModeSticky)) |
| 50 | 50 |
assert.NilError(t, contdriver.LocalDriver.Lchown(subdir, 1, 2)) |
| 51 | 51 |
|
| 52 |
- file := filepath.Join(string(dirFS), "a file") |
|
| 52 |
+ file := filepath.Join(dirFS, "a file") |
|
| 53 | 53 |
err = os.WriteFile(file, []byte("Some data"), 0222|os.ModeSetuid)
|
| 54 | 54 |
assert.NilError(t, err) |
| 55 | 55 |
} |
| ... | ... |
@@ -59,13 +59,13 @@ func verifyBase(t testing.TB, driver graphdriver.Driver, name string) {
|
| 59 | 59 |
assert.NilError(t, err) |
| 60 | 60 |
defer driver.Put(name) |
| 61 | 61 |
|
| 62 |
- subdir := filepath.Join(string(dirFS), "a subdir") |
|
| 62 |
+ subdir := filepath.Join(dirFS, "a subdir") |
|
| 63 | 63 |
verifyFile(t, subdir, 0705|os.ModeDir|os.ModeSticky, 1, 2) |
| 64 | 64 |
|
| 65 |
- file := filepath.Join(string(dirFS), "a file") |
|
| 65 |
+ file := filepath.Join(dirFS, "a file") |
|
| 66 | 66 |
verifyFile(t, file, 0222|os.ModeSetuid, 0, 0) |
| 67 | 67 |
|
| 68 |
- files, err := readDir(string(dirFS)) |
|
| 68 |
+ files, err := readDir(dirFS) |
|
| 69 | 69 |
assert.NilError(t, err) |
| 70 | 70 |
assert.Check(t, is.Len(files, 2)) |
| 71 | 71 |
} |
| ... | ... |
@@ -349,12 +349,12 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, err erro |
| 349 | 349 |
// If id has a root, just return it |
| 350 | 350 |
rootDir := path.Join(dir, "root") |
| 351 | 351 |
if _, err := os.Stat(rootDir); err == nil {
|
| 352 |
- return containerfs.NewLocalContainerFS(rootDir), nil |
|
| 352 |
+ return rootDir, nil |
|
| 353 | 353 |
} |
| 354 | 354 |
|
| 355 | 355 |
mergedDir := path.Join(dir, "merged") |
| 356 | 356 |
if count := d.ctr.Increment(mergedDir); count > 1 {
|
| 357 |
- return containerfs.NewLocalContainerFS(mergedDir), nil |
|
| 357 |
+ return mergedDir, nil |
|
| 358 | 358 |
} |
| 359 | 359 |
defer func() {
|
| 360 | 360 |
if err != nil {
|
| ... | ... |
@@ -391,7 +391,7 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, err erro |
| 391 | 391 |
if err := root.Chown(path.Join(workDir, "work")); err != nil {
|
| 392 | 392 |
return "", err |
| 393 | 393 |
} |
| 394 |
- return containerfs.NewLocalContainerFS(mergedDir), nil |
|
| 394 |
+ return mergedDir, nil |
|
| 395 | 395 |
} |
| 396 | 396 |
|
| 397 | 397 |
// Put unmounts the mount path created for the give id. |
| ... | ... |
@@ -526,14 +526,14 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e |
| 526 | 526 |
if err != nil {
|
| 527 | 527 |
// If no lower, just return diff directory |
| 528 | 528 |
if os.IsNotExist(err) {
|
| 529 |
- return containerfs.NewLocalContainerFS(diffDir), nil |
|
| 529 |
+ return diffDir, nil |
|
| 530 | 530 |
} |
| 531 | 531 |
return "", err |
| 532 | 532 |
} |
| 533 | 533 |
|
| 534 | 534 |
mergedDir := path.Join(dir, mergedDirName) |
| 535 | 535 |
if count := d.ctr.Increment(mergedDir); count > 1 {
|
| 536 |
- return containerfs.NewLocalContainerFS(mergedDir), nil |
|
| 536 |
+ return mergedDir, nil |
|
| 537 | 537 |
} |
| 538 | 538 |
defer func() {
|
| 539 | 539 |
if retErr != nil {
|
| ... | ... |
@@ -613,7 +613,7 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e |
| 613 | 613 |
} |
| 614 | 614 |
} |
| 615 | 615 |
|
| 616 |
- return containerfs.NewLocalContainerFS(mergedDir), nil |
|
| 616 |
+ return mergedDir, nil |
|
| 617 | 617 |
} |
| 618 | 618 |
|
| 619 | 619 |
// Put unmounts the mount path created for the give id. |
| ... | ... |
@@ -141,7 +141,7 @@ func (d *graphDriverProxy) Get(id, mountLabel string) (containerfs.ContainerFS, |
| 141 | 141 |
if ret.Err != "" {
|
| 142 | 142 |
err = errors.New(ret.Err) |
| 143 | 143 |
} |
| 144 |
- return containerfs.NewLocalContainerFS(d.p.ScopedPath(ret.Dir)), err |
|
| 144 |
+ return d.p.ScopedPath(ret.Dir), err |
|
| 145 | 145 |
} |
| 146 | 146 |
|
| 147 | 147 |
func (d *graphDriverProxy) Put(id string) error {
|
| ... | ... |
@@ -172,7 +172,7 @@ func (d *Driver) create(id, parent string, size uint64) error {
|
| 172 | 172 |
if err != nil {
|
| 173 | 173 |
return fmt.Errorf("%s: %s", parent, err)
|
| 174 | 174 |
} |
| 175 |
- return CopyDir(string(parentDir), dir) |
|
| 175 |
+ return CopyDir(parentDir, dir) |
|
| 176 | 176 |
} |
| 177 | 177 |
|
| 178 | 178 |
func (d *Driver) dir(id string) string {
|
| ... | ... |
@@ -192,7 +192,7 @@ func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
| 192 | 192 |
} else if !st.IsDir() {
|
| 193 | 193 |
return "", fmt.Errorf("%s: not a directory", dir)
|
| 194 | 194 |
} |
| 195 |
- return containerfs.NewLocalContainerFS(dir), nil |
|
| 195 |
+ return dir, nil |
|
| 196 | 196 |
} |
| 197 | 197 |
|
| 198 | 198 |
// Put is a noop for vfs that return nil for the error, since this driver has no runtime resources to clean up. |
| ... | ... |
@@ -402,7 +402,7 @@ func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
| 402 | 402 |
return "", err |
| 403 | 403 |
} |
| 404 | 404 |
if count := d.ctr.Increment(rID); count > 1 {
|
| 405 |
- return containerfs.NewLocalContainerFS(d.cache[rID]), nil |
|
| 405 |
+ return d.cache[rID], nil |
|
| 406 | 406 |
} |
| 407 | 407 |
|
| 408 | 408 |
// Getting the layer paths must be done outside of the lock. |
| ... | ... |
@@ -447,7 +447,7 @@ func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
| 447 | 447 |
dir = d.dir(id) |
| 448 | 448 |
} |
| 449 | 449 |
|
| 450 |
- return containerfs.NewLocalContainerFS(dir), nil |
|
| 450 |
+ return dir, nil |
|
| 451 | 451 |
} |
| 452 | 452 |
|
| 453 | 453 |
// Put adds a new layer to the driver. |
| ... | ... |
@@ -651,7 +651,7 @@ func (d *Driver) DiffSize(id, parent string) (size int64, err error) {
|
| 651 | 651 |
} |
| 652 | 652 |
defer d.Put(id) |
| 653 | 653 |
|
| 654 |
- return archive.ChangesSize(string(layerFs), changes), nil |
|
| 654 |
+ return archive.ChangesSize(layerFs, changes), nil |
|
| 655 | 655 |
} |
| 656 | 656 |
|
| 657 | 657 |
// GetMetadata returns custom driver information. |
| ... | ... |
@@ -368,7 +368,7 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e |
| 368 | 368 |
defer d.locker.Unlock(id) |
| 369 | 369 |
mountpoint := d.mountPath(id) |
| 370 | 370 |
if count := d.ctr.Increment(mountpoint); count > 1 {
|
| 371 |
- return containerfs.NewLocalContainerFS(mountpoint), nil |
|
| 371 |
+ return mountpoint, nil |
|
| 372 | 372 |
} |
| 373 | 373 |
defer func() {
|
| 374 | 374 |
if retErr != nil {
|
| ... | ... |
@@ -404,7 +404,7 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e |
| 404 | 404 |
return "", fmt.Errorf("error modifying zfs mountpoint (%s) directory ownership: %v", mountpoint, err)
|
| 405 | 405 |
} |
| 406 | 406 |
|
| 407 |
- return containerfs.NewLocalContainerFS(mountpoint), nil |
|
| 407 |
+ return mountpoint, nil |
|
| 408 | 408 |
} |
| 409 | 409 |
|
| 410 | 410 |
// Put removes the existing mountpoint for the given id if it exists. |
| ... | ... |
@@ -20,7 +20,7 @@ import ( |
| 20 | 20 |
// the container from unwanted side-effects on the rw layer. |
| 21 | 21 |
func Setup(initLayerFs containerfs.ContainerFS, rootIdentity idtools.Identity) error {
|
| 22 | 22 |
// Since all paths are local to the container, we can just extract initLayerFs.Path() |
| 23 |
- initLayer := string(initLayerFs) |
|
| 23 |
+ initLayer := initLayerFs |
|
| 24 | 24 |
|
| 25 | 25 |
for pth, typ := range map[string]string{
|
| 26 | 26 |
"/dev/pts": "dir", |
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
// excludeByIsolation is a platform specific helper function to support PS |
| 10 | 10 |
// filtering by Isolation. This is a Windows-only concept, so is a no-op on Unix. |
| 11 | 11 |
func excludeByIsolation(container *container.Snapshot, ctx *listContext) iterationAction {
|
| 12 |
- i := strings.ToLower(string(container.HostConfig.Isolation)) |
|
| 12 |
+ i := strings.ToLower(container.HostConfig.Isolation) |
|
| 13 | 13 |
if i == "" {
|
| 14 | 14 |
i = "default" |
| 15 | 15 |
} |
| ... | ... |
@@ -730,7 +730,7 @@ func WithCommonOptions(daemon *Daemon, c *container.Container) coci.SpecOpts {
|
| 730 | 730 |
} |
| 731 | 731 |
if !daemon.UsesSnapshotter() {
|
| 732 | 732 |
s.Root = &specs.Root{
|
| 733 |
- Path: string(c.BaseFS), |
|
| 733 |
+ Path: c.BaseFS, |
|
| 734 | 734 |
Readonly: c.HostConfig.ReadonlyRootfs, |
| 735 | 735 |
} |
| 736 | 736 |
} |
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
"github.com/docker/docker/daemon/config" |
| 11 | 11 |
"github.com/docker/docker/daemon/network" |
| 12 | 12 |
"github.com/docker/docker/libnetwork" |
| 13 |
- "github.com/docker/docker/pkg/containerfs" |
|
| 14 | 13 |
"gotest.tools/v3/assert" |
| 15 | 14 |
is "gotest.tools/v3/assert/cmp" |
| 16 | 15 |
"gotest.tools/v3/skip" |
| ... | ... |
@@ -36,7 +35,7 @@ func setupFakeDaemon(t *testing.T, c *container.Container) *Daemon {
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
c.Root = root |
| 39 |
- c.BaseFS = containerfs.NewLocalContainerFS(rootfs) |
|
| 39 |
+ c.BaseFS = rootfs |
|
| 40 | 40 |
|
| 41 | 41 |
if c.Config == nil {
|
| 42 | 42 |
c.Config = new(containertypes.Config) |
| ... | ... |
@@ -240,7 +240,7 @@ func (daemon *Daemon) createSpecWindowsFields(c *container.Container, s *specs.S |
| 240 | 240 |
return errors.New("createSpecWindowsFields: BaseFS of container " + c.ID + " is unexpectedly empty")
|
| 241 | 241 |
} |
| 242 | 242 |
|
| 243 |
- s.Root.Path = string(c.BaseFS) // This is not set for Hyper-V containers |
|
| 243 |
+ s.Root.Path = c.BaseFS // This is not set for Hyper-V containers |
|
| 244 | 244 |
if !strings.HasSuffix(s.Root.Path, `\`) {
|
| 245 | 245 |
s.Root.Path = s.Root.Path + `\` // Ensure a correctly formatted volume GUID path \\?\Volume{GUID}\
|
| 246 | 246 |
} |
| ... | ... |
@@ -219,7 +219,7 @@ func setupPlugin(t *testing.T, ec map[string]*graphEventsCounter, ext string, mu |
| 219 | 219 |
respond(w, err) |
| 220 | 220 |
return |
| 221 | 221 |
} |
| 222 |
- respond(w, &graphDriverResponse{Dir: string(dir)})
|
|
| 222 |
+ respond(w, &graphDriverResponse{Dir: dir})
|
|
| 223 | 223 |
}) |
| 224 | 224 |
|
| 225 | 225 |
mux.HandleFunc("/GraphDriver.Put", func(w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -786,5 +786,5 @@ func (n *naiveDiffPathDriver) DiffGetter(id string) (graphdriver.FileGetCloser, |
| 786 | 786 |
if err != nil {
|
| 787 | 787 |
return nil, err |
| 788 | 788 |
} |
| 789 |
- return &fileGetPutter{storage.NewPathFileGetter(string(p)), n.Driver, id}, nil
|
|
| 789 |
+ return &fileGetPutter{storage.NewPathFileGetter(p), n.Driver, id}, nil
|
|
| 790 | 790 |
} |
| ... | ... |
@@ -139,7 +139,7 @@ func newTestFile(name string, content []byte, perm os.FileMode) FileApplier {
|
| 139 | 139 |
} |
| 140 | 140 |
|
| 141 | 141 |
func (tf *testFile) ApplyFile(root containerfs.ContainerFS) error {
|
| 142 |
- fullPath := filepath.Join(string(root), tf.name) |
|
| 142 |
+ fullPath := filepath.Join(root, tf.name) |
|
| 143 | 143 |
if err := os.MkdirAll(filepath.Dir(fullPath), 0755); err != nil {
|
| 144 | 144 |
return err |
| 145 | 145 |
} |
| ... | ... |
@@ -267,7 +267,7 @@ func TestMountAndRegister(t *testing.T) {
|
| 267 | 267 |
t.Fatal(err) |
| 268 | 268 |
} |
| 269 | 269 |
|
| 270 |
- b, err := os.ReadFile(filepath.Join(string(path2), "testfile.txt")) |
|
| 270 |
+ b, err := os.ReadFile(filepath.Join(path2, "testfile.txt")) |
|
| 271 | 271 |
if err != nil {
|
| 272 | 272 |
t.Fatal(err) |
| 273 | 273 |
} |
| ... | ... |
@@ -375,7 +375,7 @@ func TestStoreRestore(t *testing.T) {
|
| 375 | 375 |
t.Fatal(err) |
| 376 | 376 |
} |
| 377 | 377 |
|
| 378 |
- if err := os.WriteFile(filepath.Join(string(pathFS), "testfile.txt"), []byte("nothing here"), 0644); err != nil {
|
|
| 378 |
+ if err := os.WriteFile(filepath.Join(pathFS, "testfile.txt"), []byte("nothing here"), 0644); err != nil {
|
|
| 379 | 379 |
t.Fatal(err) |
| 380 | 380 |
} |
| 381 | 381 |
|
| ... | ... |
@@ -409,20 +409,20 @@ func TestStoreRestore(t *testing.T) {
|
| 409 | 409 |
|
| 410 | 410 |
if mountPath, err := m2.Mount(""); err != nil {
|
| 411 | 411 |
t.Fatal(err) |
| 412 |
- } else if string(pathFS) != string(mountPath) {
|
|
| 413 |
- t.Fatalf("Unexpected path %s, expected %s", string(mountPath), string(pathFS))
|
|
| 412 |
+ } else if pathFS != mountPath {
|
|
| 413 |
+ t.Fatalf("Unexpected path %s, expected %s", mountPath, pathFS)
|
|
| 414 | 414 |
} |
| 415 | 415 |
|
| 416 | 416 |
if mountPath, err := m2.Mount(""); err != nil {
|
| 417 | 417 |
t.Fatal(err) |
| 418 |
- } else if string(pathFS) != string(mountPath) {
|
|
| 419 |
- t.Fatalf("Unexpected path %s, expected %s", string(mountPath), string(pathFS))
|
|
| 418 |
+ } else if pathFS != mountPath {
|
|
| 419 |
+ t.Fatalf("Unexpected path %s, expected %s", mountPath, pathFS)
|
|
| 420 | 420 |
} |
| 421 | 421 |
if err := m2.Unmount(); err != nil {
|
| 422 | 422 |
t.Fatal(err) |
| 423 | 423 |
} |
| 424 | 424 |
|
| 425 |
- b, err := os.ReadFile(filepath.Join(string(pathFS), "testfile.txt")) |
|
| 425 |
+ b, err := os.ReadFile(filepath.Join(pathFS, "testfile.txt")) |
|
| 426 | 426 |
if err != nil {
|
| 427 | 427 |
t.Fatal(err) |
| 428 | 428 |
} |
| ... | ... |
@@ -597,7 +597,7 @@ func tarFromFiles(files ...FileApplier) ([]byte, error) {
|
| 597 | 597 |
defer os.RemoveAll(td) |
| 598 | 598 |
|
| 599 | 599 |
for _, f := range files {
|
| 600 |
- if err := f.ApplyFile(containerfs.NewLocalContainerFS(td)); err != nil {
|
|
| 600 |
+ if err := f.ApplyFile(td); err != nil {
|
|
| 601 | 601 |
return nil, err |
| 602 | 602 |
} |
| 603 | 603 |
} |
| ... | ... |
@@ -47,12 +47,12 @@ func TestMountInit(t *testing.T) {
|
| 47 | 47 |
t.Fatal(err) |
| 48 | 48 |
} |
| 49 | 49 |
|
| 50 |
- fi, err := os.Stat(filepath.Join(string(pathFS), "testfile.txt")) |
|
| 50 |
+ fi, err := os.Stat(filepath.Join(pathFS, "testfile.txt")) |
|
| 51 | 51 |
if err != nil {
|
| 52 | 52 |
t.Fatal(err) |
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 |
- f, err := os.Open(filepath.Join(string(pathFS), "testfile.txt")) |
|
| 55 |
+ f, err := os.Open(filepath.Join(pathFS, "testfile.txt")) |
|
| 56 | 56 |
if err != nil {
|
| 57 | 57 |
t.Fatal(err) |
| 58 | 58 |
} |
| ... | ... |
@@ -107,7 +107,7 @@ func TestMountSize(t *testing.T) {
|
| 107 | 107 |
t.Fatal(err) |
| 108 | 108 |
} |
| 109 | 109 |
|
| 110 |
- if err := os.WriteFile(filepath.Join(string(pathFS), "file2"), content2, 0755); err != nil {
|
|
| 110 |
+ if err := os.WriteFile(filepath.Join(pathFS, "file2"), content2, 0755); err != nil {
|
|
| 111 | 111 |
t.Fatal(err) |
| 112 | 112 |
} |
| 113 | 113 |
|
| ... | ... |
@@ -159,23 +159,23 @@ func TestMountChanges(t *testing.T) {
|
| 159 | 159 |
t.Fatal(err) |
| 160 | 160 |
} |
| 161 | 161 |
|
| 162 |
- if err := driver.LocalDriver.Lchmod(filepath.Join(string(pathFS), "testfile1.txt"), 0755); err != nil {
|
|
| 162 |
+ if err := driver.LocalDriver.Lchmod(filepath.Join(pathFS, "testfile1.txt"), 0755); err != nil {
|
|
| 163 | 163 |
t.Fatal(err) |
| 164 | 164 |
} |
| 165 | 165 |
|
| 166 |
- if err := os.WriteFile(filepath.Join(string(pathFS), "testfile1.txt"), []byte("mount data!"), 0755); err != nil {
|
|
| 166 |
+ if err := os.WriteFile(filepath.Join(pathFS, "testfile1.txt"), []byte("mount data!"), 0755); err != nil {
|
|
| 167 | 167 |
t.Fatal(err) |
| 168 | 168 |
} |
| 169 | 169 |
|
| 170 |
- if err := os.Remove(filepath.Join(string(pathFS), "testfile2.txt")); err != nil {
|
|
| 170 |
+ if err := os.Remove(filepath.Join(pathFS, "testfile2.txt")); err != nil {
|
|
| 171 | 171 |
t.Fatal(err) |
| 172 | 172 |
} |
| 173 | 173 |
|
| 174 |
- if err := driver.LocalDriver.Lchmod(filepath.Join(string(pathFS), "testfile3.txt"), 0755); err != nil {
|
|
| 174 |
+ if err := driver.LocalDriver.Lchmod(filepath.Join(pathFS, "testfile3.txt"), 0755); err != nil {
|
|
| 175 | 175 |
t.Fatal(err) |
| 176 | 176 |
} |
| 177 | 177 |
|
| 178 |
- if err := os.WriteFile(filepath.Join(string(pathFS), "testfile4.txt"), []byte("mount data!"), 0644); err != nil {
|
|
| 178 |
+ if err := os.WriteFile(filepath.Join(pathFS, "testfile4.txt"), []byte("mount data!"), 0644); err != nil {
|
|
| 179 | 179 |
t.Fatal(err) |
| 180 | 180 |
} |
| 181 | 181 |
|
| ... | ... |
@@ -250,7 +250,7 @@ func TestMountApply(t *testing.T) {
|
| 250 | 250 |
t.Fatal(err) |
| 251 | 251 |
} |
| 252 | 252 |
|
| 253 |
- f, err := os.Open(filepath.Join(string(pathFS), "newfile.txt")) |
|
| 253 |
+ f, err := os.Open(filepath.Join(pathFS, "newfile.txt")) |
|
| 254 | 254 |
if err != nil {
|
| 255 | 255 |
t.Fatal(err) |
| 256 | 256 |
} |
| ... | ... |
@@ -186,7 +186,7 @@ func (aSpace *addrSpace) UnmarshalJSON(data []byte) error {
|
| 186 | 186 |
|
| 187 | 187 |
aSpace.scope = datastore.LocalScope |
| 188 | 188 |
s := m["Scope"].(string) |
| 189 |
- if s == string(datastore.GlobalScope) {
|
|
| 189 |
+ if s == datastore.GlobalScope {
|
|
| 190 | 190 |
aSpace.scope = datastore.GlobalScope |
| 191 | 191 |
} |
| 192 | 192 |
|
| ... | ... |
@@ -7,13 +7,7 @@ import ( |
| 7 | 7 |
) |
| 8 | 8 |
|
| 9 | 9 |
// ContainerFS is that represents a root file system |
| 10 |
-type ContainerFS string |
|
| 11 |
- |
|
| 12 |
-// NewLocalContainerFS is a helper function to implement daemon's Mount interface |
|
| 13 |
-// when the graphdriver mount point is a local path on the machine. |
|
| 14 |
-func NewLocalContainerFS(path string) ContainerFS {
|
|
| 15 |
- return ContainerFS(path) |
|
| 16 |
-} |
|
| 10 |
+type ContainerFS = string |
|
| 17 | 11 |
|
| 18 | 12 |
// ResolveScopedPath evaluates the given path scoped to the root. |
| 19 | 13 |
// For example, if root=/a, and path=/b/c, then this function would return /a/b/c. |
| ... | ... |
@@ -12,7 +12,6 @@ import ( |
| 12 | 12 |
"github.com/docker/docker/api/types" |
| 13 | 13 |
"github.com/docker/docker/daemon/initlayer" |
| 14 | 14 |
"github.com/docker/docker/errdefs" |
| 15 |
- "github.com/docker/docker/pkg/containerfs" |
|
| 16 | 15 |
"github.com/docker/docker/pkg/idtools" |
| 17 | 16 |
"github.com/docker/docker/pkg/plugins" |
| 18 | 17 |
"github.com/docker/docker/pkg/stringid" |
| ... | ... |
@@ -55,7 +54,7 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
|
| 55 | 55 |
} |
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 |
- rootFS := containerfs.NewLocalContainerFS(filepath.Join(pm.config.Root, p.PluginObj.ID, rootFSFileName)) |
|
| 58 |
+ rootFS := filepath.Join(pm.config.Root, p.PluginObj.ID, rootFSFileName) |
|
| 59 | 59 |
if err := initlayer.Setup(rootFS, idtools.Identity{UID: 0, GID: 0}); err != nil {
|
| 60 | 60 |
return errors.WithStack(err) |
| 61 | 61 |
} |