MCPcopy Index your code
hub / github.com/containerd/containerd / parseRelease

Function parseRelease

pkg/kernelversion/kernel_linux.go:66–76  ·  view source on GitHub ↗

parseRelease parses a string and creates a KernelVersion based on it.

(release string)

Source from the content-addressed store, hash-verified

64
65// parseRelease parses a string and creates a KernelVersion based on it.
66func parseRelease(release string) (*KernelVersion, error) {
67 var version = KernelVersion{}
68
69 // We're only make sure we get the "kernel" and "major revision". Sometimes we have
70 // 3.12.25-gentoo, but sometimes we just have 3.12-1-amd64.
71 _, err := fmt.Sscanf(release, "%d.%d", &version.Kernel, &version.Major)
72 if err != nil {
73 return nil, fmt.Errorf("failed to parse kernel version %q: %w", release, err)
74 }
75 return &version, nil
76}
77
78// GreaterEqualThan checks if the host's kernel version is greater than, or
79// equal to the given kernel version v. Only "kernel version" and "major revision"

Callers 2

getKernelVersionFunction · 0.85
TestParseReleaseFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestParseReleaseFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…