-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathvdisk-trace.h
90 lines (68 loc) · 1.81 KB
/
vdisk-trace.h
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#if !defined(_TRACE_VDISK_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_VDISK_H
#include <linux/tracepoint.h>
#undef TRACE_SYSTEM
#define TRACE_SYSTEM vdisk
#define VDISK_MSG_CHARS 256
TRACE_EVENT(printf,
TP_PROTO(const char *fmt, va_list args),
TP_ARGS(fmt, args),
TP_STRUCT__entry(
__dynamic_array(char, message, VDISK_MSG_CHARS)
),
TP_fast_assign(
vsnprintf((char *)__get_str(message),
VDISK_MSG_CHARS - 1, fmt, args);
((char *)__get_str(message))[VDISK_MSG_CHARS - 1] = '\0';
),
TP_printk("%s", __get_str(message))
);
TRACE_EVENT(error,
TP_PROTO(int err, const char *fmt, va_list args),
TP_ARGS(err, fmt, args),
TP_STRUCT__entry(
__dynamic_array(char, message, VDISK_MSG_CHARS)
__field(int, err)
),
TP_fast_assign(
vsnprintf((char *)__get_str(message),
VDISK_MSG_CHARS - 1, fmt, args);
((char *)__get_str(message))[VDISK_MSG_CHARS - 1] = '\0';
__entry->err = err;
),
TP_printk("%d: %s", __entry->err, __get_str(message))
);
TRACE_EVENT(disk_create,
TP_PROTO(void *disk, const char *name),
TP_ARGS(disk, name),
TP_STRUCT__entry(
__dynamic_array(char, name, VDISK_MSG_CHARS)
__field(void *, disk)
),
TP_fast_assign(
snprintf((char *)__get_str(name),
VDISK_MSG_CHARS - 1, "%s", name);
((char *)__get_str(name))[VDISK_MSG_CHARS - 1] = '\0';
__entry->disk = disk;
),
TP_printk("disk 0x%p name %s",
__entry->disk, __get_str(name))
);
TRACE_EVENT(disk_destroy,
TP_PROTO(void *disk),
TP_ARGS(disk),
TP_STRUCT__entry(
__field(void *, disk)
),
TP_fast_assign(
__entry->disk = disk;
),
TP_printk("disk 0x%p", __entry->disk)
);
#endif /* _TRACE_VDISK_H */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE vdisk-trace
/* This part must be outside protection */
#include <trace/define_trace.h>