Skip to content

Commit b4dd3bf

Browse files
Make ReadOnly() available on all platforms
Signed-off-by: Gabriel Adrian Samfira <[email protected]>
1 parent 08d8baf commit b4dd3bf

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

mount/mount.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ func UnmountMounts(mounts []Mount, target string, flags int) error {
6868
return nil
6969
}
7070

71+
// ReadOnly returns a boolean value indicating whether this mount has the "ro"
72+
// option set.
73+
func (m *Mount) ReadOnly() bool {
74+
for _, option := range m.Options {
75+
if option == "ro" {
76+
return true
77+
}
78+
}
79+
return false
80+
}
81+
7182
// Mount to the provided target path.
7283
func (m *Mount) Mount(target string) error {
7384
target, err := fs.RootPath(target, m.Target)

mount/mount_windows.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@ var (
3838
ErrNotImplementOnWindows = errors.New("not implemented under windows")
3939
)
4040

41-
func (m *Mount) ReadOnly() bool {
42-
for _, option := range m.Options {
43-
if option == "ro" {
44-
return true
45-
}
46-
}
47-
return false
48-
}
49-
5041
// Mount to the provided target.
5142
func (m *Mount) mount(target string) (retErr error) {
5243
if m.Type != "windows-layer" {

0 commit comments

Comments
 (0)