blob: b23d17b56c634359f7d1312969f5ef97b47aa781 [file] [log] [blame]
Mohan Srinivasan25cc70f2016-12-14 16:39:51 -08001#if !defined(_TRACE_ANDROID_FS_TEMPLATE_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_ANDROID_FS_TEMPLATE_H
3
4#include <linux/tracepoint.h>
5
6DECLARE_EVENT_CLASS(android_fs_data_start_template,
7 TP_PROTO(struct inode *inode, loff_t offset, int bytes,
Mohan Srinivasan009e6082017-02-10 14:26:23 -08008 pid_t pid, char *pathname, char *command),
9 TP_ARGS(inode, offset, bytes, pid, pathname, command),
Mohan Srinivasan25cc70f2016-12-14 16:39:51 -080010 TP_STRUCT__entry(
Mohan Srinivasan009e6082017-02-10 14:26:23 -080011 __string(pathbuf, pathname);
Mohan Srinivasan25cc70f2016-12-14 16:39:51 -080012 __field(loff_t, offset);
13 __field(int, bytes);
14 __field(loff_t, i_size);
15 __string(cmdline, command);
16 __field(pid_t, pid);
17 __field(ino_t, ino);
18 ),
19 TP_fast_assign(
20 {
Mohan Srinivasana5c4dbb2017-03-10 16:08:30 -080021 /*
22 * Replace the spaces in filenames and cmdlines
23 * because this screws up the tooling that parses
24 * the traces.
25 */
Mohan Srinivasan009e6082017-02-10 14:26:23 -080026 __assign_str(pathbuf, pathname);
Mohan Srinivasana5c4dbb2017-03-10 16:08:30 -080027 (void)strreplace(__get_str(pathbuf), ' ', '_');
Mohan Srinivasan25cc70f2016-12-14 16:39:51 -080028 __entry->offset = offset;
29 __entry->bytes = bytes;
30 __entry->i_size = i_size_read(inode);
31 __assign_str(cmdline, command);
Mohan Srinivasana5c4dbb2017-03-10 16:08:30 -080032 (void)strreplace(__get_str(cmdline), ' ', '_');
Mohan Srinivasan25cc70f2016-12-14 16:39:51 -080033 __entry->pid = pid;
34 __entry->ino = inode->i_ino;
35 }
36 ),
37 TP_printk("entry_name %s, offset %llu, bytes %d, cmdline %s,"
38 " pid %d, i_size %llu, ino %lu",
Mohan Srinivasan009e6082017-02-10 14:26:23 -080039 __get_str(pathbuf), __entry->offset, __entry->bytes,
40 __get_str(cmdline), __entry->pid, __entry->i_size,
Mohan Srinivasan25cc70f2016-12-14 16:39:51 -080041 (unsigned long) __entry->ino)
42);
43
44DECLARE_EVENT_CLASS(android_fs_data_end_template,
45 TP_PROTO(struct inode *inode, loff_t offset, int bytes),
46 TP_ARGS(inode, offset, bytes),
47 TP_STRUCT__entry(
48 __field(ino_t, ino);
49 __field(loff_t, offset);
50 __field(int, bytes);
51 ),
52 TP_fast_assign(
53 {
54 __entry->ino = inode->i_ino;
55 __entry->offset = offset;
56 __entry->bytes = bytes;
57 }
58 ),
59 TP_printk("ino %lu, offset %llu, bytes %d",
60 (unsigned long) __entry->ino,
61 __entry->offset, __entry->bytes)
62);
63
64#endif /* _TRACE_ANDROID_FS_TEMPLATE_H */