Fix kernelversion.h
Add missing pragma once and static inline all functions.
Bug: 202086915
Bug: 157552970
Test: builds
Change-Id: I8aca683e9e60c33bf5a5ac45cc20c2e59c8eecde
diff --git a/staticlibs/native/tcutils/kernelversion.h b/staticlibs/native/tcutils/kernelversion.h
index 59b9e05..3be1ad2 100644
--- a/staticlibs/native/tcutils/kernelversion.h
+++ b/staticlibs/native/tcutils/kernelversion.h
@@ -23,6 +23,8 @@
// In the mean time copying verbatim from:
// frameworks/libs/net/common/native/bpf_headers
+#pragma once
+
#include <stdio.h>
#include <sys/utsname.h>
@@ -30,7 +32,7 @@
namespace android {
-unsigned kernelVersion() {
+static inline unsigned kernelVersion() {
struct utsname buf;
int ret = uname(&buf);
if (ret)
@@ -49,8 +51,9 @@
return KVER(kver_major, kver_minor, kver_sub);
}
-bool isAtLeastKernelVersion(unsigned major, unsigned minor, unsigned sub) {
+static inline bool isAtLeastKernelVersion(unsigned major, unsigned minor,
+ unsigned sub) {
return kernelVersion() >= KVER(major, minor, sub);
}
-}
+} // namespace android