Mountpoint returns the path to image's mount point. The path is empty if the image is not mounted.
()
| 729 | // Mountpoint returns the path to image's mount point. The path is empty if |
| 730 | // the image is not mounted. |
| 731 | func (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. |