blob: d02c1e645441b1199447310cd732c7aa1400d724 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 */
|