• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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,
8 		 pid_t pid, char *pathname, char *command),
9 	TP_ARGS(inode, offset, bytes, pid, pathname, command),
10 	TP_STRUCT__entry(
11 		__string(pathbuf, pathname);
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 		{
21 			/*
22 			 * Replace the spaces in filenames and cmdlines
23 			 * because this screws up the tooling that parses
24 			 * the traces.
25 			 */
26 			__assign_str(pathbuf, pathname);
27 			(void)strreplace(__get_str(pathbuf), ' ', '_');
28 			__entry->offset		= offset;
29 			__entry->bytes		= bytes;
30 			__entry->i_size		= i_size_read(inode);
31 			__assign_str(cmdline, command);
32 			(void)strreplace(__get_str(cmdline), ' ', '_');
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",
39 		  __get_str(pathbuf), __entry->offset, __entry->bytes,
40 		  __get_str(cmdline), __entry->pid, __entry->i_size,
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 */
65