Skip to content

Commit 167d603

Browse files
committed
libcontainer: configs: ensure can build on darwin
Signed-off-by: Eric Ernst <[email protected]>
1 parent da548c1 commit 167d603

File tree

3 files changed

+70
-35
lines changed

3 files changed

+70
-35
lines changed

libcontainer/configs/mount.go

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,7 @@
11
package configs
22

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

libcontainer/configs/mount_linux.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package configs
2+
3+
import "golang.org/x/sys/unix"
4+
5+
type Mount struct {
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"`
26+
27+
// RecAttr represents mount properties to be applied recursively (AT_RECURSIVE), see mount_setattr(2).
28+
RecAttr *unix.MountAttr `json:"rec_attr"`
29+
30+
// Extensions are additional flags that are specific to runc.
31+
Extensions int `json:"extensions"`
32+
}
33+
34+
func (m *Mount) IsBind() bool {
35+
return m.Flags&unix.MS_BIND != 0
36+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//go:build !linux
2+
// +build !linux
3+
4+
package configs
5+
6+
type Mount struct {
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"`
30+
}
31+
32+
func (m *Mount) IsBind() bool {
33+
return false
34+
}

0 commit comments

Comments
 (0)