pkg/containerfs: simplify ContainerFS type

Iterate towards dropping the type entirely.

Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
Cory Snider
2022-09-23 12:25:19 -04:00
parent be4f4644a8
commit 95824f2b5f
44 changed files with 159 additions and 174 deletions

View File

@@ -399,7 +399,7 @@ func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
rID, err := d.resolveID(id)
if err != nil {
return nil, err
return "", err
}
if count := d.ctr.Increment(rID); count > 1 {
return containerfs.NewLocalContainerFS(d.cache[rID]), nil
@@ -409,19 +409,19 @@ func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
layerChain, err := d.getLayerChain(rID)
if err != nil {
d.ctr.Decrement(rID)
return nil, err
return "", err
}
if err := hcsshim.ActivateLayer(d.info, rID); err != nil {
d.ctr.Decrement(rID)
return nil, err
return "", err
}
if err := hcsshim.PrepareLayer(d.info, rID, layerChain); err != nil {
d.ctr.Decrement(rID)
if err2 := hcsshim.DeactivateLayer(d.info, rID); err2 != nil {
logrus.Warnf("Failed to Deactivate %s: %s", id, err)
}
return nil, err
return "", err
}
mountPath, err := hcsshim.GetLayerMountPath(d.info, rID)
@@ -433,7 +433,7 @@ func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
if err2 := hcsshim.DeactivateLayer(d.info, rID); err2 != nil {
logrus.Warnf("Failed to Deactivate %s: %s", id, err)
}
return nil, err
return "", err
}
d.cacheMu.Lock()
d.cache[rID] = mountPath
@@ -651,7 +651,7 @@ func (d *Driver) DiffSize(id, parent string) (size int64, err error) {
}
defer d.Put(id)
return archive.ChangesSize(layerFs.Path(), changes), nil
return archive.ChangesSize(string(layerFs), changes), nil
}
// GetMetadata returns custom driver information.