[lttng-dev] [PATCH lttng-modules] Add file: lttng-kernel-version.h
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Fri Nov 23 15:06:55 EST 2012
* Simon Marchi (simon.marchi at polymtl.ca) 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
>
> Signed-off-by: Simon Marchi <simon.marchi at polymtl.ca>
> ---
> lttng-kernel-version.h | 36 ++++++++++++++++++++++++++++++++++++
> 1 files changed, 36 insertions(+), 0 deletions(-)
> create mode 100644 lttng-kernel-version.h
>
> diff --git a/lttng-kernel-version.h b/lttng-kernel-version.h
> new file mode 100644
> index 0000000..cb5c4dd
> --- /dev/null
> +++ b/lttng-kernel-version.h
> @@ -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 <mathieu.desnoyers at efficios.com>
> + *
> + * 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 */
> --
> 1.7.1
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list