2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
// Copyright CM4all GmbH
|
|
|
|
// author: Max Kellermann <mk@cm4all.com>
|
2020-05-05 14:30:22 +02:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class KernelVersionCode {
|
|
|
|
unsigned value = 0;
|
|
|
|
|
|
|
|
public:
|
|
|
|
constexpr KernelVersionCode() noexcept = default;
|
|
|
|
|
|
|
|
constexpr KernelVersionCode(unsigned major,
|
|
|
|
unsigned minor=0,
|
|
|
|
unsigned patch=0) noexcept
|
|
|
|
:value((major << 16) | (minor << 8) | patch) {}
|
|
|
|
|
|
|
|
constexpr bool operator>=(KernelVersionCode other) const noexcept {
|
|
|
|
return value >= other.value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is the currently running Linux kernel at least the given version?
|
|
|
|
*/
|
2021-02-08 14:59:40 +01:00
|
|
|
[[gnu::const]]
|
2020-05-05 14:30:22 +02:00
|
|
|
bool
|
|
|
|
IsKernelVersionOrNewer(KernelVersionCode v) noexcept;
|