TRACE_EVENT(sys_swapoff,
TP_PROTO(const char * specialfile),
TP_ARGS(specialfile),
- TP_STRUCT__entry(__field_hex(const char *, specialfile)),
- TP_fast_assign(tp_assign(specialfile, specialfile)),
+ TP_STRUCT__entry(__string(specialfile, specialfile)),
+ TP_fast_assign(tp_copy_string_from_user(specialfile, specialfile)),
TP_printk()
)
#endif
TRACE_EVENT(sys_mq_unlink,
TP_PROTO(const char * u_name),
TP_ARGS(u_name),
- TP_STRUCT__entry(__field_hex(const char *, u_name)),
- TP_fast_assign(tp_assign(u_name, u_name)),
+ TP_STRUCT__entry(__string(u_name, u_name)),
+ TP_fast_assign(tp_copy_string_from_user(u_name, u_name)),
TP_printk()
)
#endif
TRACE_EVENT(sys_truncate,
TP_PROTO(const char * path, long length),
TP_ARGS(path, length),
- TP_STRUCT__entry(__field_hex(const char *, path) __field(long, length)),
- TP_fast_assign(tp_assign(path, path) tp_assign(length, length)),
+ TP_STRUCT__entry(__string(path, path) __field(long, length)),
+ TP_fast_assign(tp_copy_string_from_user(path, path) tp_assign(length, length)),
TP_printk()
)
#endif
TRACE_EVENT(sys_rename,
TP_PROTO(const char * oldname, const char * newname),
TP_ARGS(oldname, newname),
- TP_STRUCT__entry(__field_hex(const char *, oldname) __field_hex(const char *, newname)),
- TP_fast_assign(tp_assign(oldname, oldname) tp_assign(newname, newname)),
+ TP_STRUCT__entry(__string(oldname, oldname) __string(newname, newname)),
+ TP_fast_assign(tp_copy_string_from_user(oldname, oldname) tp_copy_string_from_user(newname, newname)),
TP_printk()
)
#endif
TRACE_EVENT(sys_link,
TP_PROTO(const char * oldname, const char * newname),
TP_ARGS(oldname, newname),
- TP_STRUCT__entry(__field_hex(const char *, oldname) __field_hex(const char *, newname)),
- TP_fast_assign(tp_assign(oldname, oldname) tp_assign(newname, newname)),
+ TP_STRUCT__entry(__string(oldname, oldname) __string(newname, newname)),
+ TP_fast_assign(tp_copy_string_from_user(oldname, oldname) tp_copy_string_from_user(newname, newname)),
TP_printk()
)
#endif
TRACE_EVENT(sys_symlink,
TP_PROTO(const char * oldname, const char * newname),
TP_ARGS(oldname, newname),
- TP_STRUCT__entry(__field_hex(const char *, oldname) __field_hex(const char *, newname)),
- TP_fast_assign(tp_assign(oldname, oldname) tp_assign(newname, newname)),
+ TP_STRUCT__entry(__string(oldname, oldname) __string(newname, newname)),
+ TP_fast_assign(tp_copy_string_from_user(oldname, oldname) tp_copy_string_from_user(newname, newname)),
TP_printk()
)
#endif
TRACE_EVENT(sys_pivot_root,
TP_PROTO(const char * new_root, const char * put_old),
TP_ARGS(new_root, put_old),
- TP_STRUCT__entry(__field_hex(const char *, new_root) __field_hex(const char *, put_old)),
- TP_fast_assign(tp_assign(new_root, new_root) tp_assign(put_old, put_old)),
+ TP_STRUCT__entry(__string(new_root, new_root) __string(put_old, put_old)),
+ TP_fast_assign(tp_copy_string_from_user(new_root, new_root) tp_copy_string_from_user(put_old, put_old)),
TP_printk()
)
#endif
TRACE_EVENT(sys_umount,
TP_PROTO(char * name, int flags),
TP_ARGS(name, flags),
- TP_STRUCT__entry(__field_hex(char *, name) __field(int, flags)),
- TP_fast_assign(tp_assign(name, name) tp_assign(flags, flags)),
+ TP_STRUCT__entry(__string(name, name) __field(int, flags)),
+ TP_fast_assign(tp_copy_string_from_user(name, name) tp_assign(flags, flags)),
TP_printk()
)
#endif
TRACE_EVENT(sys_swapon,
TP_PROTO(const char * specialfile, int swap_flags),
TP_ARGS(specialfile, swap_flags),
- TP_STRUCT__entry(__field_hex(const char *, specialfile) __field(int, swap_flags)),
- TP_fast_assign(tp_assign(specialfile, specialfile) tp_assign(swap_flags, swap_flags)),
+ TP_STRUCT__entry(__string(specialfile, specialfile) __field(int, swap_flags)),
+ TP_fast_assign(tp_copy_string_from_user(specialfile, specialfile) tp_assign(swap_flags, swap_flags)),
TP_printk()
)
#endif
TRACE_EVENT(sys_sethostname,
TP_PROTO(char * name, int len),
TP_ARGS(name, len),
- TP_STRUCT__entry(__field_hex(char *, name) __field(int, len)),
- TP_fast_assign(tp_assign(name, name) tp_assign(len, len)),
+ TP_STRUCT__entry(__string(name, name) __field(int, len)),
+ TP_fast_assign(tp_copy_string_from_user(name, name) tp_assign(len, len)),
TP_printk()
)
#endif
TRACE_EVENT(sys_setdomainname,
TP_PROTO(char * name, int len),
TP_ARGS(name, len),
- TP_STRUCT__entry(__field_hex(char *, name) __field(int, len)),
- TP_fast_assign(tp_assign(name, name) tp_assign(len, len)),
+ TP_STRUCT__entry(__string(name, name) __field(int, len)),
+ TP_fast_assign(tp_copy_string_from_user(name, name) tp_assign(len, len)),
TP_printk()
)
#endif
TRACE_EVENT(sys_delete_module,
TP_PROTO(const char * name_user, unsigned int flags),
TP_ARGS(name_user, flags),
- TP_STRUCT__entry(__field_hex(const char *, name_user) __field(unsigned int, flags)),
- TP_fast_assign(tp_assign(name_user, name_user) tp_assign(flags, flags)),
+ TP_STRUCT__entry(__string(name_user, name_user) __field(unsigned int, flags)),
+ TP_fast_assign(tp_copy_string_from_user(name_user, name_user) tp_assign(flags, flags)),
TP_printk()
)
#endif
TRACE_EVENT(sys_removexattr,
TP_PROTO(const char * pathname, const char * name),
TP_ARGS(pathname, name),
- TP_STRUCT__entry(__string(pathname, pathname) __field_hex(const char *, name)),
- TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_assign(name, name)),
+ TP_STRUCT__entry(__string(pathname, pathname) __string(name, name)),
+ TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_copy_string_from_user(name, name)),
TP_printk()
)
#endif
TRACE_EVENT(sys_lremovexattr,
TP_PROTO(const char * pathname, const char * name),
TP_ARGS(pathname, name),
- TP_STRUCT__entry(__string(pathname, pathname) __field_hex(const char *, name)),
- TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_assign(name, name)),
+ TP_STRUCT__entry(__string(pathname, pathname) __string(name, name)),
+ TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_copy_string_from_user(name, name)),
TP_printk()
)
#endif
TRACE_EVENT(sys_fremovexattr,
TP_PROTO(int fd, const char * name),
TP_ARGS(fd, name),
- TP_STRUCT__entry(__field(int, fd) __field_hex(const char *, name)),
- TP_fast_assign(tp_assign(fd, fd) tp_assign(name, name)),
+ TP_STRUCT__entry(__field(int, fd) __string(name, name)),
+ TP_fast_assign(tp_assign(fd, fd) tp_copy_string_from_user(name, name)),
TP_printk()
)
#endif
TRACE_EVENT(sys_readlink,
TP_PROTO(const char * path, char * buf, int bufsiz),
TP_ARGS(path, buf, bufsiz),
- TP_STRUCT__entry(__field_hex(const char *, path) __field_hex(char *, buf) __field(int, bufsiz)),
- TP_fast_assign(tp_assign(path, path) tp_assign(buf, buf) tp_assign(bufsiz, bufsiz)),
+ TP_STRUCT__entry(__string(path, path) __field_hex(char *, buf) __field(int, bufsiz)),
+ TP_fast_assign(tp_copy_string_from_user(path, path) tp_assign(buf, buf) tp_assign(bufsiz, bufsiz)),
TP_printk()
)
#endif
TRACE_EVENT(sys_symlinkat,
TP_PROTO(const char * oldname, int newdfd, const char * newname),
TP_ARGS(oldname, newdfd, newname),
- TP_STRUCT__entry(__field_hex(const char *, oldname) __field(int, newdfd) __field_hex(const char *, newname)),
- TP_fast_assign(tp_assign(oldname, oldname) tp_assign(newdfd, newdfd) tp_assign(newname, newname)),
+ TP_STRUCT__entry(__string(oldname, oldname) __field(int, newdfd) __string(newname, newname)),
+ TP_fast_assign(tp_copy_string_from_user(oldname, oldname) tp_assign(newdfd, newdfd) tp_copy_string_from_user(newname, newname)),
TP_printk()
)
#endif
TRACE_EVENT(sys_getxattr,
TP_PROTO(const char * pathname, const char * name, void * value, size_t size),
TP_ARGS(pathname, name, value, size),
- TP_STRUCT__entry(__string(pathname, pathname) __field_hex(const char *, name) __field_hex(void *, value) __field(size_t, size)),
- TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_assign(name, name) tp_assign(value, value) tp_assign(size, size)),
+ TP_STRUCT__entry(__string(pathname, pathname) __string(name, name) __field_hex(void *, value) __field(size_t, size)),
+ TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_copy_string_from_user(name, name) tp_assign(value, value) tp_assign(size, size)),
TP_printk()
)
#endif
TRACE_EVENT(sys_lgetxattr,
TP_PROTO(const char * pathname, const char * name, void * value, size_t size),
TP_ARGS(pathname, name, value, size),
- TP_STRUCT__entry(__string(pathname, pathname) __field_hex(const char *, name) __field_hex(void *, value) __field(size_t, size)),
- TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_assign(name, name) tp_assign(value, value) tp_assign(size, size)),
+ TP_STRUCT__entry(__string(pathname, pathname) __string(name, name) __field_hex(void *, value) __field(size_t, size)),
+ TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_copy_string_from_user(name, name) tp_assign(value, value) tp_assign(size, size)),
TP_printk()
)
#endif
TRACE_EVENT(sys_fgetxattr,
TP_PROTO(int fd, const char * name, void * value, size_t size),
TP_ARGS(fd, name, value, size),
- TP_STRUCT__entry(__field(int, fd) __field_hex(const char *, name) __field_hex(void *, value) __field(size_t, size)),
- TP_fast_assign(tp_assign(fd, fd) tp_assign(name, name) tp_assign(value, value) tp_assign(size, size)),
+ TP_STRUCT__entry(__field(int, fd) __string(name, name) __field_hex(void *, value) __field(size_t, size)),
+ TP_fast_assign(tp_assign(fd, fd) tp_copy_string_from_user(name, name) tp_assign(value, value) tp_assign(size, size)),
TP_printk()
)
#endif
TRACE_EVENT(sys_mq_open,
TP_PROTO(const char * u_name, int oflag, mode_t mode, struct mq_attr * u_attr),
TP_ARGS(u_name, oflag, mode, u_attr),
- TP_STRUCT__entry(__field_hex(const char *, u_name) __field(int, oflag) __field(mode_t, mode) __field_hex(struct mq_attr *, u_attr)),
- TP_fast_assign(tp_assign(u_name, u_name) tp_assign(oflag, oflag) tp_assign(mode, mode) tp_assign(u_attr, u_attr)),
+ TP_STRUCT__entry(__string(u_name, u_name) __field(int, oflag) __field(mode_t, mode) __field_hex(struct mq_attr *, u_attr)),
+ TP_fast_assign(tp_copy_string_from_user(u_name, u_name) tp_assign(oflag, oflag) tp_assign(mode, mode) tp_assign(u_attr, u_attr)),
TP_printk()
)
#endif
TRACE_EVENT(sys_renameat,
TP_PROTO(int olddfd, const char * oldname, int newdfd, const char * newname),
TP_ARGS(olddfd, oldname, newdfd, newname),
- TP_STRUCT__entry(__field(int, olddfd) __field_hex(const char *, oldname) __field(int, newdfd) __field_hex(const char *, newname)),
- TP_fast_assign(tp_assign(olddfd, olddfd) tp_assign(oldname, oldname) tp_assign(newdfd, newdfd) tp_assign(newname, newname)),
+ TP_STRUCT__entry(__field(int, olddfd) __string(oldname, oldname) __field(int, newdfd) __string(newname, newname)),
+ TP_fast_assign(tp_assign(olddfd, olddfd) tp_copy_string_from_user(oldname, oldname) tp_assign(newdfd, newdfd) tp_copy_string_from_user(newname, newname)),
TP_printk()
)
#endif
TRACE_EVENT(sys_mount,
TP_PROTO(char * dev_name, char * dir_name, char * type, unsigned long flags, void * data),
TP_ARGS(dev_name, dir_name, type, flags, data),
- TP_STRUCT__entry(__field_hex(char *, dev_name) __field_hex(char *, dir_name) __field_hex(char *, type) __field(unsigned long, flags) __field_hex(void *, data)),
- TP_fast_assign(tp_assign(dev_name, dev_name) tp_assign(dir_name, dir_name) tp_assign(type, type) tp_assign(flags, flags) tp_assign(data, data)),
+ TP_STRUCT__entry(__string(dev_name, dev_name) __string(dir_name, dir_name) __field_hex(char *, type) __field(unsigned long, flags) __field_hex(void *, data)),
+ TP_fast_assign(tp_copy_string_from_user(dev_name, dev_name) tp_copy_string_from_user(dir_name, dir_name) tp_assign(type, type) tp_assign(flags, flags) tp_assign(data, data)),
TP_printk()
)
#endif
TRACE_EVENT(sys_setxattr,
TP_PROTO(const char * pathname, const char * name, const void * value, size_t size, int flags),
TP_ARGS(pathname, name, value, size, flags),
- TP_STRUCT__entry(__string(pathname, pathname) __field_hex(const char *, name) __field_hex(const void *, value) __field(size_t, size) __field(int, flags)),
- TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_assign(name, name) tp_assign(value, value) tp_assign(size, size) tp_assign(flags, flags)),
+ TP_STRUCT__entry(__string(pathname, pathname) __string(name, name) __field_hex(const void *, value) __field(size_t, size) __field(int, flags)),
+ TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_copy_string_from_user(name, name) tp_assign(value, value) tp_assign(size, size) tp_assign(flags, flags)),
TP_printk()
)
#endif
TRACE_EVENT(sys_lsetxattr,
TP_PROTO(const char * pathname, const char * name, const void * value, size_t size, int flags),
TP_ARGS(pathname, name, value, size, flags),
- TP_STRUCT__entry(__string(pathname, pathname) __field_hex(const char *, name) __field_hex(const void *, value) __field(size_t, size) __field(int, flags)),
- TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_assign(name, name) tp_assign(value, value) tp_assign(size, size) tp_assign(flags, flags)),
+ TP_STRUCT__entry(__string(pathname, pathname) __string(name, name) __field_hex(const void *, value) __field(size_t, size) __field(int, flags)),
+ TP_fast_assign(tp_copy_string_from_user(pathname, pathname) tp_copy_string_from_user(name, name) tp_assign(value, value) tp_assign(size, size) tp_assign(flags, flags)),
TP_printk()
)
#endif
TRACE_EVENT(sys_fsetxattr,
TP_PROTO(int fd, const char * name, const void * value, size_t size, int flags),
TP_ARGS(fd, name, value, size, flags),
- TP_STRUCT__entry(__field(int, fd) __field_hex(const char *, name) __field_hex(const void *, value) __field(size_t, size) __field(int, flags)),
- TP_fast_assign(tp_assign(fd, fd) tp_assign(name, name) tp_assign(value, value) tp_assign(size, size) tp_assign(flags, flags)),
+ TP_STRUCT__entry(__field(int, fd) __string(name, name) __field_hex(const void *, value) __field(size_t, size) __field(int, flags)),
+ TP_fast_assign(tp_assign(fd, fd) tp_copy_string_from_user(name, name) tp_assign(value, value) tp_assign(size, size) tp_assign(flags, flags)),
TP_printk()
)
#endif
TRACE_EVENT(sys_linkat,
TP_PROTO(int olddfd, const char * oldname, int newdfd, const char * newname, int flags),
TP_ARGS(olddfd, oldname, newdfd, newname, flags),
- TP_STRUCT__entry(__field(int, olddfd) __field_hex(const char *, oldname) __field(int, newdfd) __field_hex(const char *, newname) __field(int, flags)),
- TP_fast_assign(tp_assign(olddfd, olddfd) tp_assign(oldname, oldname) tp_assign(newdfd, newdfd) tp_assign(newname, newname) tp_assign(flags, flags)),
+ TP_STRUCT__entry(__field(int, olddfd) __string(oldname, oldname) __field(int, newdfd) __string(newname, newname) __field(int, flags)),
+ TP_fast_assign(tp_assign(olddfd, olddfd) tp_copy_string_from_user(oldname, oldname) tp_assign(newdfd, newdfd) tp_copy_string_from_user(newname, newname) tp_assign(flags, flags)),
TP_printk()
)
#endif
' TP_PROTO($4 $5),\n'\
' TP_ARGS($5),\n'\
' TP_STRUCT__entry(__field($4, $5)),\n'\
-' TP_fast_assign(tp_assign($5, $5)),\n'\
+' TP_fast_assign(tp_assign($4, $5, $5)),\n'\
' TP_printk()\n'\
')\n'\
'#endif/g'\
' TP_PROTO($4 $6, $5 $7),\n'\
' TP_ARGS($6, $7),\n'\
' TP_STRUCT__entry(__field($4, $6) __field($5, $7)),\n'\
-' TP_fast_assign(tp_assign($6, $6) tp_assign($7, $7)),\n'\
+' TP_fast_assign(tp_assign($4, $6, $6) tp_assign($5, $7, $7)),\n'\
' TP_printk()\n'\
')\n'\
'#endif/g'\
' TP_PROTO($4 $7, $5 $8, $6 $9),\n'\
' TP_ARGS($7, $8, $9),\n'\
' TP_STRUCT__entry(__field($4, $7) __field($5, $8) __field($6, $9)),\n'\
-' TP_fast_assign(tp_assign($7, $7) tp_assign($8, $8) tp_assign($9, $9)),\n'\
+' TP_fast_assign(tp_assign($4, $7, $7) tp_assign($5, $8, $8) tp_assign($6, $9, $9)),\n'\
' TP_printk()\n'\
')\n'\
'#endif/g'\
' TP_PROTO($4 $8, $5 $9, $6 $10, $7 $11),\n'\
' TP_ARGS($8, $9, $10, $11),\n'\
' TP_STRUCT__entry(__field($4, $8) __field($5, $9) __field($6, $10) __field($7, $11)),\n'\
-' TP_fast_assign(tp_assign($8, $8) tp_assign($9, $9) tp_assign($10, $10) tp_assign($11, $11)),\n'\
+' TP_fast_assign(tp_assign($4, $8, $8) tp_assign($5, $9, $9) tp_assign($6, $10, $10) tp_assign($7, $11, $11)),\n'\
' TP_printk()\n'\
')\n'\
'#endif/g'\
' TP_PROTO($4 $9, $5 $10, $6 $11, $7 $12, $8 $13),\n'\
' TP_ARGS($9, $10, $11, $12, $13),\n'\
' TP_STRUCT__entry(__field($4, $9) __field($5, $10) __field($6, $11) __field($7, $12) __field($8, $13)),\n'\
-' TP_fast_assign(tp_assign($9, $9) tp_assign($10, $10) tp_assign($11, $11) tp_assign($12, $12) tp_assign($13, $13)),\n'\
+' TP_fast_assign(tp_assign($4, $9, $9) tp_assign($5, $10, $10) tp_assign($6, $11, $11) tp_assign($7, $12, $12) tp_assign($8, $13, $13)),\n'\
' TP_printk()\n'\
')\n'\
'#endif/g'\
' TP_PROTO($4 $10, $5 $11, $6 $12, $7 $13, $8 $14, $9 $15),\n'\
' TP_ARGS($10, $11, $12, $13, $14, $15),\n'\
' TP_STRUCT__entry(__field($4, $10) __field($5, $11) __field($6, $12) __field($7, $13) __field($8, $14) __field($9, $15)),\n'\
-' TP_fast_assign(tp_assign($10, $10) tp_assign($11, $11) tp_assign($12, $12) tp_assign($13, $13) tp_assign($14, $14) tp_assign($15, $15)),\n'\
+' TP_fast_assign(tp_assign($4, $10, $10) tp_assign($5, $11, $11) tp_assign($6, $12, $12) tp_assign($7, $13, $13) tp_assign($8, $14, $14) tp_assign($9, $15, $15)),\n'\
' TP_printk()\n'\
')\n'\
'#endif/g'\
#endif /* CREATE_SYSCALL_TABLE */
" >> ${HEADER}
-#prettify addresses heuristics.
+#fields names: ...char * type with *name* or *file* or *path* or *root* or *put_old*
cp -f ${HEADER} ${TMPFILE}
rm -f ${HEADER}
-
-#field names with addr or ptr
-perl -p -e 's/__field\(([^,)]*), ([^a,)]*addr|[^p,)]*ptr)([^),]*)\)/__field_hex($1, $2$3)/g'\
+perl -p -e 's/__field\(([^,)]*char \*), ([^\)]*)(name|file|path|root|put_old)([^\)]*)\)/__string($2$3$4, $2$3$4)/g'\
${TMPFILE} >> ${HEADER}
-
-#fields names: filename or pathname
cp -f ${HEADER} ${TMPFILE}
rm -f ${HEADER}
-perl -p -e 's/__field\(([^,)]*), (filename|pathname)\)/__string($2, $2)/g'\
+perl -p -e 's/tp_assign\(([^,)]*char \*), ([^,]*)(name|file|path|root|put_old)([^,]*), ([^\)]*)\)/tp_copy_string_from_user($2$3$4, $5)/g'\
${TMPFILE} >> ${HEADER}
+
+#prettify addresses heuristics.
+#field names with addr or ptr
cp -f ${HEADER} ${TMPFILE}
rm -f ${HEADER}
-perl -p -e 's/tp_assign\((filename|pathname), (filename|pathname)\)/tp_copy_string_from_user($1, $2)/g'\
+perl -p -e 's/__field\(([^,)]*), ([^,)]*addr|[^,)]*ptr)([^),]*)\)/__field_hex($1, $2$3)/g'\
${TMPFILE} >> ${HEADER}
+#field types ending with '*'
cp -f ${HEADER} ${TMPFILE}
rm -f ${HEADER}
-
-#field types ending with '*'
perl -p -e 's/__field\(([^,)]*\*), ([^),]*)\)/__field_hex($1, $2)/g'\
${TMPFILE} >> ${HEADER}
+#strip the extra type information from tp_assign.
+cp -f ${HEADER} ${TMPFILE}
+rm -f ${HEADER}
+perl -p -e 's/tp_assign\(([^,)]*), ([^,]*), ([^\)]*)\)/tp_assign($2, $3)/g'\
+ ${TMPFILE} >> ${HEADER}
rm -f ${INPUTFILE}.tmp
rm -f ${TMPFILE}