mount.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package configs
  2. import "golang.org/x/sys/unix"
  3. const (
  4. // EXT_COPYUP is a directive to copy up the contents of a directory when
  5. // a tmpfs is mounted over it.
  6. EXT_COPYUP = 1 << iota //nolint:golint // ignore "don't use ALL_CAPS" warning
  7. )
  8. type Mount struct {
  9. // Source path for the mount.
  10. Source string `json:"source"`
  11. // Destination path for the mount inside the container.
  12. Destination string `json:"destination"`
  13. // Device the mount is for.
  14. Device string `json:"device"`
  15. // Mount flags.
  16. Flags int `json:"flags"`
  17. // Propagation Flags
  18. PropagationFlags []int `json:"propagation_flags"`
  19. // Mount data applied to the mount.
  20. Data string `json:"data"`
  21. // Relabel source if set, "z" indicates shared, "Z" indicates unshared.
  22. Relabel string `json:"relabel"`
  23. // RecAttr represents mount properties to be applied recursively (AT_RECURSIVE), see mount_setattr(2).
  24. RecAttr *unix.MountAttr `json:"rec_attr"`
  25. // Extensions are additional flags that are specific to runc.
  26. Extensions int `json:"extensions"`
  27. // Optional Command to be run before Source is mounted.
  28. PremountCmds []Command `json:"premount_cmds"`
  29. // Optional Command to be run after Source is mounted.
  30. PostmountCmds []Command `json:"postmount_cmds"`
  31. }
  32. func (m *Mount) IsBind() bool {
  33. return m.Flags&unix.MS_BIND != 0
  34. }