Skip to content

Commit 5a27166

Browse files
committed
libcontainer: configs: don't use embedded struct
Composing a struct with embedded fields has terrible UX - let's just live with the duplicated fields. Signed-off-by: Eric Ernst <[email protected]>
1 parent d4261b6 commit 5a27166

File tree

3 files changed

+46
-28
lines changed

3 files changed

+46
-28
lines changed

libcontainer/configs/mount.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,3 @@ const (
55
// a tmpfs is mounted over it.
66
EXT_COPYUP = 1 << iota //nolint:golint // ignore "don't use ALL_CAPS" warning
77
)
8-
9-
type mountBase struct {
10-
// Source path for the mount.
11-
Source string `json:"source"`
12-
13-
// Destination path for the mount inside the container.
14-
Destination string `json:"destination"`
15-
16-
// Device the mount is for.
17-
Device string `json:"device"`
18-
19-
// Mount flags.
20-
Flags int `json:"flags"`
21-
22-
// Propagation Flags
23-
PropagationFlags []int `json:"propagation_flags"`
24-
25-
// Mount data applied to the mount.
26-
Data string `json:"data"`
27-
28-
// Relabel source if set, "z" indicates shared, "Z" indicates unshared.
29-
Relabel string `json:"relabel"`
30-
31-
// Extensions are additional flags that are specific to runc.
32-
Extensions int `json:"extensions"`
33-
}

libcontainer/configs/mount_linux.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,32 @@ package configs
33
import "golang.org/x/sys/unix"
44

55
type Mount struct {
6-
mountBase
6+
// Source path for the mount.
7+
Source string `json:"source"`
8+
9+
// Destination path for the mount inside the container.
10+
Destination string `json:"destination"`
11+
12+
// Device the mount is for.
13+
Device string `json:"device"`
14+
15+
// Mount flags.
16+
Flags int `json:"flags"`
17+
18+
// Propagation Flags
19+
PropagationFlags []int `json:"propagation_flags"`
20+
21+
// Mount data applied to the mount.
22+
Data string `json:"data"`
23+
24+
// Relabel source if set, "z" indicates shared, "Z" indicates unshared.
25+
Relabel string `json:"relabel"`
726

827
// RecAttr represents mount properties to be applied recursively (AT_RECURSIVE), see mount_setattr(2).
928
RecAttr *unix.MountAttr `json:"rec_attr"`
29+
30+
// Extensions are additional flags that are specific to runc.
31+
Extensions int `json:"extensions"`
1032
}
1133

1234
func (m *Mount) IsBind() bool {

libcontainer/configs/mount_unsupported.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,29 @@
44
package configs
55

66
type Mount struct {
7-
mountBase
7+
// Source path for the mount.
8+
Source string `json:"source"`
9+
10+
// Destination path for the mount inside the container.
11+
Destination string `json:"destination"`
12+
13+
// Device the mount is for.
14+
Device string `json:"device"`
15+
16+
// Mount flags.
17+
Flags int `json:"flags"`
18+
19+
// Propagation Flags
20+
PropagationFlags []int `json:"propagation_flags"`
21+
22+
// Mount data applied to the mount.
23+
Data string `json:"data"`
24+
25+
// Relabel source if set, "z" indicates shared, "Z" indicates unshared.
26+
Relabel string `json:"relabel"`
27+
28+
// Extensions are additional flags that are specific to runc.
29+
Extensions int `json:"extensions"`
830
}
931

1032
func (m *Mount) IsBind() bool {

0 commit comments

Comments
 (0)