MCPcopy Create free account
hub / github.com/containers/common / Mountpoint

Method Mountpoint

libimage/image.go:731–753  ·  view source on GitHub ↗

Mountpoint returns the path to image's mount point. The path is empty if the image is not mounted.

()

Source from the content-addressed store, hash-verified

729// Mountpoint returns the path to image's mount point. The path is empty if
730// the image is not mounted.
731func (i *Image) Mountpoint() (string, error) {
732 mountedTimes, err := i.runtime.store.Mounted(i.TopLayer())
733 if err != nil || mountedTimes == 0 {
734 if errors.Cause(err) == storage.ErrLayerUnknown {
735 // Can happen, Podman did it, but there's no
736 // explanation why.
737 err = nil
738 }
739 return "", err
740 }
741
742 layer, err := i.runtime.store.Layer(i.TopLayer())
743 if err != nil {
744 return "", err
745 }
746
747 mountPoint, err := filepath.EvalSymlinks(layer.MountPoint)
748 if err != nil {
749 return "", err
750 }
751
752 return mountPoint, nil
753}
754
755// Unmount the image. Use force to ignore the reference counter and forcefully
756// unmount.

Callers 1

TestImageFunctionsFunction · 0.80

Calls 1

TopLayerMethod · 0.95

Tested by 1

TestImageFunctionsFunction · 0.64