diff options
Diffstat (limited to 'include/linux/ltt-core.h')
-rw-r--r-- | include/linux/ltt-core.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/include/linux/ltt-core.h b/include/linux/ltt-core.h new file mode 100644 index 00000000000..d02c1e64544 --- /dev/null +++ b/include/linux/ltt-core.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2005-2010 Mathieu Desnoyers (mathieu.desnoyers@efficios.com) + * + * This contains the core definitions for the Linux Trace Toolkit. + * + * Dual LGPL v2.1/GPL v2 license. + */ + +#ifndef LTT_CORE_H +#define LTT_CORE_H + +/* Keep track of trap nesting inside LTT */ +DECLARE_PER_CPU(unsigned int, ltt_nesting); + +#ifndef MAYBE_BUILD_BUG_ON +#define MAYBE_BUILD_BUG_ON(cond) \ + do { \ + if (__builtin_constant_p(cond)) \ + BUILD_BUG_ON(cond); \ + } while (0) +#endif + +#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS + +/* + * Calculate the offset needed to align the type. + * size_of_type must be non-zero. + */ +static inline unsigned int ltt_align(size_t align_drift, size_t size_of_type) +{ + return offset_align(align_drift, min(sizeof(void *), size_of_type)); +} +/* Default arch alignment */ +#define LTT_ALIGN + +static inline int ltt_get_alignment(void) +{ + return sizeof(void *); +} + +extern unsigned int ltt_fmt_largest_align(size_t align_drift, const char *fmt); + +#else + +static inline unsigned int ltt_align(size_t align_drift, + size_t size_of_type) +{ + return 0; +} + +#define LTT_ALIGN __attribute__((packed)) + +static inline int ltt_get_alignment(void) +{ + return 0; +} + +static inline unsigned int ltt_fmt_largest_align(size_t align_drift, + const char *fmt) +{ + return 0; +} + +#endif /* HAVE_EFFICIENT_UNALIGNED_ACCESS */ + +#endif /* LTT_CORE_H */ |