Skip to content

Commit 9ef65dd

Browse files
authored
Merge pull request #4577 from kolyshkin/libct-dev
libct/devices: move config to libct/cg/devices/config
2 parents f1c0e63 + 6c9ddcc commit 9ef65dd

20 files changed

+51
-24
lines changed

libcontainer/cgroups/config_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package cgroups
22

33
import (
44
systemdDbus "github.com/coreos/go-systemd/v22/dbus"
5-
"github.com/opencontainers/runc/libcontainer/devices"
5+
devices "github.com/opencontainers/runc/libcontainer/cgroups/devices/config"
66
)
77

88
type FreezerState string

libcontainer/devices/device.go renamed to libcontainer/cgroups/devices/config/device.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package devices
1+
package config
22

33
import (
44
"fmt"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package config
2+
3+
import (
4+
"errors"
5+
6+
"golang.org/x/sys/unix"
7+
)
8+
9+
func mkDev(d *Rule) (uint64, error) {
10+
if d.Major == Wildcard || d.Minor == Wildcard {
11+
return 0, errors.New("cannot mkdev() device with wildcards")
12+
}
13+
return unix.Mkdev(uint32(d.Major), uint32(d.Minor)), nil
14+
}

libcontainer/cgroups/devices/devicefilter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"strconv"
1414

1515
"github.com/cilium/ebpf/asm"
16-
"github.com/opencontainers/runc/libcontainer/devices"
16+
devices "github.com/opencontainers/runc/libcontainer/cgroups/devices/config"
1717
"golang.org/x/sys/unix"
1818
)
1919

libcontainer/cgroups/devices/devicefilter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"strings"
55
"testing"
66

7-
"github.com/opencontainers/runc/libcontainer/devices"
7+
devices "github.com/opencontainers/runc/libcontainer/cgroups/devices/config"
88
"github.com/opencontainers/runc/libcontainer/specconv"
99
)
1010

libcontainer/cgroups/devices/devices_emulator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"strconv"
2727
"strings"
2828

29-
"github.com/opencontainers/runc/libcontainer/devices"
29+
devices "github.com/opencontainers/runc/libcontainer/cgroups/devices/config"
3030
)
3131

3232
// deviceMeta is a Rule without the Allow or Permissions fields, and no

libcontainer/cgroups/devices/devices_emulator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"strings"
2626
"testing"
2727

28-
"github.com/opencontainers/runc/libcontainer/devices"
28+
devices "github.com/opencontainers/runc/libcontainer/cgroups/devices/config"
2929
)
3030

3131
func TestDeviceEmulatorLoad(t *testing.T) {

libcontainer/cgroups/devices/systemd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/sirupsen/logrus"
1313

1414
"github.com/opencontainers/runc/libcontainer/cgroups"
15-
"github.com/opencontainers/runc/libcontainer/devices"
15+
devices "github.com/opencontainers/runc/libcontainer/cgroups/devices/config"
1616
)
1717

1818
// systemdProperties takes the configured device rules and generates a

libcontainer/cgroups/devices/systemd_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"testing"
1010

1111
"github.com/opencontainers/runc/libcontainer/cgroups"
12+
devices "github.com/opencontainers/runc/libcontainer/cgroups/devices/config"
1213
"github.com/opencontainers/runc/libcontainer/cgroups/systemd"
13-
"github.com/opencontainers/runc/libcontainer/devices"
1414
)
1515

1616
// TestPodSkipDevicesUpdate checks that updating a pod having SkipDevices: true

libcontainer/cgroups/devices/v1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/moby/sys/userns"
99
"github.com/opencontainers/runc/libcontainer/cgroups"
10-
"github.com/opencontainers/runc/libcontainer/devices"
10+
devices "github.com/opencontainers/runc/libcontainer/cgroups/devices/config"
1111
)
1212

1313
var testingSkipFinalCheck bool

0 commit comments

Comments
 (0)