Skip to content

Commit 45cc9f8

Browse files
committed
Fix blkio major/minor json marshaling
Currently ffjson does not support embedded structs so we can just remove that. Its only saving us ~2 lines of code to have this embeded struct so we can just remove it. Signed-off-by: Michael Crosby <[email protected]>
1 parent cf8ebc9 commit 45cc9f8

2 files changed

Lines changed: 180 additions & 220 deletions

File tree

specs-go/config.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ type Spec struct {
2222
Hooks Hooks `json:"hooks"`
2323
// Annotations is an unstructured key value map that may be set by external tools to store and retrieve arbitrary metadata.
2424
Annotations map[string]string `json:"annotations,omitempty"`
25-
2625
// Linux is platform specific configuration for Linux based containers.
2726
Linux Linux `json:"linux" platform:"linux"`
2827
}
@@ -46,7 +45,6 @@ type Process struct {
4645
Rlimits []Rlimit `json:"rlimits,omitempty"`
4746
// NoNewPrivileges controls whether additional privileges could be gained by processes in the container.
4847
NoNewPrivileges bool `json:"noNewPrivileges,omitempty"`
49-
5048
// ApparmorProfile specified the apparmor profile for the container. (this field is platform dependent)
5149
ApparmorProfile string `json:"apparmorProfile,omitempty" platform:"linux"`
5250
// SelinuxProcessLabel specifies the selinux context that the container process is run as. (this field is platform dependent)
@@ -201,17 +199,12 @@ type InterfacePriority struct {
201199
Priority uint32 `json:"priority"`
202200
}
203201

204-
// blockIODevice holds major:minor format supported in blkio cgroup
205-
type blockIODevice struct {
202+
// WeightDevice struct holds a `major:minor weight` pair for blkioWeightDevice
203+
type WeightDevice struct {
206204
// Major is the device's major number.
207205
Major int64 `json:"major"`
208206
// Minor is the device's minor number.
209207
Minor int64 `json:"minor"`
210-
}
211-
212-
// WeightDevice struct holds a `major:minor weight` pair for blkioWeightDevice
213-
type WeightDevice struct {
214-
blockIODevice
215208
// Weight is the bandwidth rate for the device, range is from 10 to 1000
216209
Weight *uint16 `json:"weight,omitempty"`
217210
// LeafWeight is the bandwidth rate for the device while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only
@@ -220,7 +213,10 @@ type WeightDevice struct {
220213

221214
// ThrottleDevice struct holds a `major:minor rate_per_second` pair
222215
type ThrottleDevice struct {
223-
blockIODevice
216+
// Major is the device's major number.
217+
Major int64 `json:"major"`
218+
// Minor is the device's minor number.
219+
Minor int64 `json:"minor"`
224220
// Rate is the IO rate limit per cgroup per device
225221
Rate *uint64 `json:"rate,omitempty"`
226222
}

0 commit comments

Comments
 (0)