MCPcopy
hub / github.com/opencontainers/runc / statfsToMountFlags

Function statfsToMountFlags

libcontainer/rootfs_linux.go:505–537  ·  view source on GitHub ↗
(st unix.Statfs_t)

Source from the content-addressed store, hash-verified

503)
504
505func statfsToMountFlags(st unix.Statfs_t) int {
506 // From <linux/statfs.h>.
507 const ST_NOSYMFOLLOW = 0x2000 //nolint:revive
508
509 var flags int
510 for _, f := range []struct {
511 st, ms int
512 }{
513 // See calculate_f_flags() in fs/statfs.c.
514 {unix.ST_RDONLY, unix.MS_RDONLY},
515 {unix.ST_NOSUID, unix.MS_NOSUID},
516 {unix.ST_NODEV, unix.MS_NODEV},
517 {unix.ST_NOEXEC, unix.MS_NOEXEC},
518 {unix.ST_MANDLOCK, unix.MS_MANDLOCK},
519 {unix.ST_SYNCHRONOUS, unix.MS_SYNCHRONOUS},
520 {unix.ST_NOATIME, unix.MS_NOATIME},
521 {unix.ST_NODIRATIME, unix.MS_NODIRATIME},
522 {unix.ST_RELATIME, unix.MS_RELATIME},
523 {ST_NOSYMFOLLOW, unix.MS_NOSYMFOLLOW},
524 // There is no ST_STRICTATIME -- see below.
525 } {
526 if int(st.Flags)&f.st == f.st {
527 flags |= f.ms
528 }
529 }
530 // MS_STRICTATIME is a "fake" MS_* flag. It isn't stored in mnt->mnt_flags,
531 // and so it doesn't show up in statfs(2). If none of the other flags in
532 // atime enum are present, the mount is MS_STRICTATIME.
533 if flags&mntAtimeEnumFlags == 0 {
534 flags |= unix.MS_STRICTATIME
535 }
536 return flags
537}
538
539func (m *mountEntry) createOpenMountpoint(root *os.File) (Err error) {
540 rootfs := root.Name()

Callers 1

mountToRootfsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…