Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cgroup1/ to make cgroup1 and cgroup2 symmmetric #255

Merged
merged 3 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ cgutil:
proto:
protobuild --quiet ${PACKAGES}
# Keep them Go-idiomatic and backward-compatible with the gogo/protobuf era.
go-fix-acronym -w -a '(Cpu|Tcp|Rss)' $(shell find stats/v1/ cgroup2/stats/ -name '*.pb.go')
go-fix-acronym -w -a '(Cpu|Tcp|Rss)' $(shell find cgroup1/stats/ cgroup2/stats/ -name '*.pb.go')
4 changes: 2 additions & 2 deletions Protobuild.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ generators = ["go"]

# Aggregrate the API descriptors to lock down API changes.
[[descriptors]]
prefix = "github.com/containerd/cgroups/stats/v1"
target = "stats/v1/metrics.pb.txt"
prefix = "github.com/containerd/cgroups/cgroup1/stats"
target = "cgroup1/stats/metrics.pb.txt"
ignore_files = [
"google/protobuf/descriptor.proto",
]
Expand Down
5 changes: 3 additions & 2 deletions blkio.go → cgroup1/blkio.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"bufio"
Expand All @@ -25,7 +25,8 @@ import (
"strconv"
"strings"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"

specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
4 changes: 2 additions & 2 deletions blkio_test.go → cgroup1/blkio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"os"
"strings"
"testing"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"
)

const data = `major minor #blocks name
Expand Down
4 changes: 2 additions & 2 deletions cgroup.go → cgroup1/cgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"errors"
Expand All @@ -28,7 +28,7 @@ import (
"syscall"
"time"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"

"github.com/opencontainers/runtime-spec/specs-go"
)
Expand Down
2 changes: 1 addition & 1 deletion cgroup_test.go → cgroup1/cgroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"fmt"
Expand Down
4 changes: 2 additions & 2 deletions control.go → cgroup1/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"os"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
4 changes: 2 additions & 2 deletions cpu.go → cgroup1/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"bufio"
"os"
"path/filepath"
"strconv"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
4 changes: 2 additions & 2 deletions cpuacct.go → cgroup1/cpuacct.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"bufio"
Expand All @@ -24,7 +24,7 @@ import (
"strconv"
"strings"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"
)

const nanosecondsInSecond = 1000000000
Expand Down
2 changes: 1 addition & 1 deletion cpuacct_test.go → cgroup1/cpuacct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion cpuset.go → cgroup1/cpuset.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion devices.go → cgroup1/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion errors.go → cgroup1/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion freezer.go → cgroup1/freezer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion hierarchy.go → cgroup1/hierarchy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

// Hierarchy enables both unified and split hierarchy for cgroups
type Hierarchy func() ([]Subsystem, error)
4 changes: 2 additions & 2 deletions hugetlb.go → cgroup1/hugetlb.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"os"
"path/filepath"
"strconv"
"strings"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
4 changes: 2 additions & 2 deletions memory.go → cgroup1/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"bufio"
Expand All @@ -25,7 +25,7 @@ import (
"strconv"
"strings"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"
specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/sys/unix"
)
Expand Down
4 changes: 2 additions & 2 deletions memory_test.go → cgroup1/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"fmt"
Expand All @@ -23,7 +23,7 @@ import (
"strings"
"testing"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"
)

const memoryData = `cache 1
Expand Down
2 changes: 1 addition & 1 deletion mock_test.go → cgroup1/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion named.go → cgroup1/named.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import "path/filepath"

Expand Down
2 changes: 1 addition & 1 deletion named_test.go → cgroup1/named_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import "testing"

Expand Down
2 changes: 1 addition & 1 deletion net_cls.go → cgroup1/net_cls.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion net_prio.go → cgroup1/net_prio.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion opts.go → cgroup1/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion paths.go → cgroup1/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion paths_test.go → cgroup1/paths_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion perf_event.go → cgroup1/perf_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import "path/filepath"

Expand Down
4 changes: 2 additions & 2 deletions pids.go → cgroup1/pids.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"os"
"path/filepath"
"strconv"
"strings"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
4 changes: 2 additions & 2 deletions pids_test.go → cgroup1/pids_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"encoding/hex"
Expand All @@ -23,7 +23,7 @@ import (
"strconv"
"testing"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"
"github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
4 changes: 2 additions & 2 deletions rdma.go → cgroup1/rdma.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

import (
"math"
Expand All @@ -23,7 +23,7 @@ import (
"strconv"
"strings"

v1 "github.com/containerd/cgroups/v2/stats/v1"
v1 "github.com/containerd/cgroups/v2/cgroup1/stats"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down
2 changes: 1 addition & 1 deletion state.go → cgroup1/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

package cgroups
package cgroup1

// State is a type that represents the state of the current cgroup
type State string
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to share types like State between cgroup1 and cgroup2?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary to share

Expand Down
2 changes: 1 addition & 1 deletion stats/v1/doc.go → cgroup1/stats/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
limitations under the License.
*/

package v1
package stats
Loading