github.com/opencontainers/runc@v1.2.0-rc.1.0.20240520010911-492dc558cdd6/libcontainer/configs/mount_linux.go (about) 1 package configs 2 3 import "golang.org/x/sys/unix" 4 5 type MountIDMapping struct { 6 // Recursive indicates if the mapping needs to be recursive. 7 Recursive bool `json:"recursive"` 8 9 // UserNSPath is a path to a user namespace that indicates the necessary 10 // id-mappings for MOUNT_ATTR_IDMAP. If set to non-"", UIDMappings and 11 // GIDMappings must be set to nil. 12 UserNSPath string `json:"userns_path,omitempty"` 13 14 // UIDMappings is the uid mapping set for this mount, to be used with 15 // MOUNT_ATTR_IDMAP. 16 UIDMappings []IDMap `json:"uid_mappings,omitempty"` 17 18 // GIDMappings is the gid mapping set for this mount, to be used with 19 // MOUNT_ATTR_IDMAP. 20 GIDMappings []IDMap `json:"gid_mappings,omitempty"` 21 } 22 23 type Mount struct { 24 // Source path for the mount. 25 Source string `json:"source"` 26 27 // Destination path for the mount inside the container. 28 Destination string `json:"destination"` 29 30 // Device the mount is for. 31 Device string `json:"device"` 32 33 // Mount flags. 34 Flags int `json:"flags"` 35 36 // Mount flags that were explicitly cleared in the configuration (meaning 37 // the user explicitly requested that these flags *not* be set). 38 ClearedFlags int `json:"cleared_flags"` 39 40 // Propagation Flags 41 PropagationFlags []int `json:"propagation_flags"` 42 43 // Mount data applied to the mount. 44 Data string `json:"data"` 45 46 // Relabel source if set, "z" indicates shared, "Z" indicates unshared. 47 Relabel string `json:"relabel"` 48 49 // RecAttr represents mount properties to be applied recursively (AT_RECURSIVE), see mount_setattr(2). 50 RecAttr *unix.MountAttr `json:"rec_attr"` 51 52 // Extensions are additional flags that are specific to runc. 53 Extensions int `json:"extensions"` 54 55 // Mapping is the MOUNT_ATTR_IDMAP configuration for the mount. If non-nil, 56 // the mount is configured to use MOUNT_ATTR_IDMAP-style id mappings. 57 IDMapping *MountIDMapping `json:"id_mapping,omitempty"` 58 } 59 60 func (m *Mount) IsBind() bool { 61 return m.Flags&unix.MS_BIND != 0 62 } 63 64 func (m *Mount) IsIDMapped() bool { 65 return m.IDMapping != nil 66 }