UnmountMounts unmounts all the mounts under a target in the reverse order of the mounts array provided.
(mounts []Mount, target string, flags int)
| 60 | // UnmountMounts unmounts all the mounts under a target in the reverse order of |
| 61 | // the mounts array provided. |
| 62 | func UnmountMounts(mounts []Mount, target string, flags int) error { |
| 63 | for i := len(mounts) - 1; i >= 0; i-- { |
| 64 | mountpoint, err := fs.RootPath(target, mounts[i].Target) |
| 65 | if err != nil { |
| 66 | return err |
| 67 | } |
| 68 | |
| 69 | if err := UnmountAll(mountpoint, flags); err != nil { |
| 70 | if i == len(mounts)-1 { // last mount |
| 71 | return err |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | return nil |
| 76 | } |
| 77 | |
| 78 | // CanonicalizePath makes path absolute and resolves symlinks in it. |
| 79 | // Path must exist. |
searching dependent graphs…