Make ReadOnly() available on all platforms

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2023-04-04 02:04:56 -07:00
parent 7bb2756bc4
commit ba74cdf150
2 changed files with 11 additions and 9 deletions

View File

@ -68,6 +68,17 @@ func UnmountMounts(mounts []Mount, target string, flags int) error {
return nil
}
// ReadOnly returns a boolean value indicating whether this mount has the "ro"
// option set.
func (m *Mount) ReadOnly() bool {
for _, option := range m.Options {
if option == "ro" {
return true
}
}
return false
}
// Mount to the provided target path.
func (m *Mount) Mount(target string) error {
target, err := fs.RootPath(target, m.Target)

View File

@ -38,15 +38,6 @@ var (
ErrNotImplementOnWindows = errors.New("not implemented under windows")
)
func (m *Mount) ReadOnly() bool {
for _, option := range m.Options {
if option == "ro" {
return true
}
}
return false
}
// Mount to the provided target.
func (m *Mount) mount(target string) (retErr error) {
if m.Type != "windows-layer" {