diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-03 18:34:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-03 18:34:01 +0200 |
commit | 2d9b9e81a30ac46848587414d34955ad4cb991a7 (patch) | |
tree | a9467bc800c4441448873018912de215950d540a /pkg/util/mountOpts_linux.go | |
parent | a89d62ac3a445a5d76bd72d4b8e1bb9262ba74c6 (diff) | |
parent | e0614367ca27c2e47649e08291e0f1d19d42232e (diff) | |
download | podman-2d9b9e81a30ac46848587414d34955ad4cb991a7.tar.gz podman-2d9b9e81a30ac46848587414d34955ad4cb991a7.tar.bz2 podman-2d9b9e81a30ac46848587414d34955ad4cb991a7.zip |
Merge pull request #5676 from kolyshkin/volume-flags-alt
Fix/improve pkg/storage.InitFSMounts
Diffstat (limited to 'pkg/util/mountOpts_linux.go')
-rw-r--r-- | pkg/util/mountOpts_linux.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/util/mountOpts_linux.go b/pkg/util/mountOpts_linux.go new file mode 100644 index 000000000..3eac4dd25 --- /dev/null +++ b/pkg/util/mountOpts_linux.go @@ -0,0 +1,23 @@ +package util + +import ( + "os" + + "golang.org/x/sys/unix" +) + +func getDefaultMountOptions(path string) (defaultMountOptions, error) { + opts := defaultMountOptions{true, true, true} + if path == "" { + return opts, nil + } + var statfs unix.Statfs_t + if e := unix.Statfs(path, &statfs); e != nil { + return opts, &os.PathError{Op: "statfs", Path: path, Err: e} + } + opts.nodev = (statfs.Flags&unix.MS_NODEV == unix.MS_NODEV) + opts.noexec = (statfs.Flags&unix.MS_NOEXEC == unix.MS_NOEXEC) + opts.nosuid = (statfs.Flags&unix.MS_NOSUID == unix.MS_NOSUID) + + return opts, nil +} |