Mohan Srinivasan | 25cc70f | 2016-12-14 16:39:51 -0800 | [diff] [blame] | 1 | #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 | |
| 6 | DECLARE_EVENT_CLASS(android_fs_data_start_template, |
| 7 | TP_PROTO(struct inode *inode, loff_t offset, int bytes, |
Mohan Srinivasan | 009e608 | 2017-02-10 14:26:23 -0800 | [diff] [blame] | 8 | pid_t pid, char *pathname, char *command), |
| 9 | TP_ARGS(inode, offset, bytes, pid, pathname, command), |
Mohan Srinivasan | 25cc70f | 2016-12-14 16:39:51 -0800 | [diff] [blame] | 10 | TP_STRUCT__entry( |
Mohan Srinivasan | 009e608 | 2017-02-10 14:26:23 -0800 | [diff] [blame] | 11 | __string(pathbuf, pathname); |
Mohan Srinivasan | 25cc70f | 2016-12-14 16:39:51 -0800 | [diff] [blame] | 12 | __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 Srinivasan | a5c4dbb | 2017-03-10 16:08:30 -0800 | [diff] [blame] | 21 | /* |
| 22 | * Replace the spaces in filenames and cmdlines |
| 23 | * because this screws up the tooling that parses |
| 24 | * the traces. |
| 25 | */ |
Mohan Srinivasan | 009e608 | 2017-02-10 14:26:23 -0800 | [diff] [blame] | 26 | __assign_str(pathbuf, pathname); |
Mohan Srinivasan | a5c4dbb | 2017-03-10 16:08:30 -0800 | [diff] [blame] | 27 | (void)strreplace(__get_str(pathbuf), ' ', '_'); |
Mohan Srinivasan | 25cc70f | 2016-12-14 16:39:51 -0800 | [diff] [blame] | 28 | __entry->offset = offset; |
| 29 | __entry->bytes = bytes; |
| 30 | __entry->i_size = i_size_read(inode); |
| 31 | __assign_str(cmdline, command); |
Mohan Srinivasan | a5c4dbb | 2017-03-10 16:08:30 -0800 | [diff] [blame] | 32 | (void)strreplace(__get_str(cmdline), ' ', '_'); |
Mohan Srinivasan | 25cc70f | 2016-12-14 16:39:51 -0800 | [diff] [blame] | 33 | __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 Srinivasan | 009e608 | 2017-02-10 14:26:23 -0800 | [diff] [blame] | 39 | __get_str(pathbuf), __entry->offset, __entry->bytes, |
| 40 | __get_str(cmdline), __entry->pid, __entry->i_size, |
Mohan Srinivasan | 25cc70f | 2016-12-14 16:39:51 -0800 | [diff] [blame] | 41 | (unsigned long) __entry->ino) |
| 42 | ); |
| 43 | |
| 44 | DECLARE_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 */ |