Skip to contentSkip to conversation

Add file: lttng-kernel-version.h

PATCH Mathieu Desnoyers 1 participant 1 message Nov 23, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 1 line · * Simon Marchi ([email protected]) wrote:

It contains a macro to help checking for kernel version ranges.

Merged with small cosmetic changes,

Oh damn, I forgot the --author. Sorry, it appears From: me.

Thanks,

Mathieu

Quoted 57 lines
---
 lttng-kernel-version.h |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 lttng-kernel-version.h
lttng-kernel-version.h new file +36 -0
new file mode 100644
index 0000000..cb5c4dd
@@ -0,0 +1,36 @@
+#ifndef _LTTNG_KERNEL_VERSION_H
+#define _LTTNG_KERNEL_VERSION_H
+
+/*
+ * lttng-events.h
+ *
+ * Contains helpers to check more complex kernel version conditions.
+ *
+ * Copyright (C) 2012 Mathieu Desnoyers <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; only
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <linux/version.h>
+
+/*
+ * This macro checks if the kernel version is between the two specified
+ * versions.
+ */
+#define LTTNG_KERNEL_RANGE(a_low, b_low, c_low, a_high, b_high, c_high) \
+	(LINUX_VERSION_CODE >= KERNEL_VERSION(a_low, b_low, c_low) && \
+	 LINUX_VERSION_CODE <= KERNEL_VERSION(a_high, b_high, c_high))
+
+#endif /* _LTTNG_KERNEL_VERSION_H */
Signature · 7 lines
1.7.1


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com