* [PATCH] libtraceevent: Have sizeof() parsing handle u8/s8 through u64/s64
@ 2024-10-11 19:48 Steven Rostedt
2024-10-17 15:27 ` Sean Anderson
0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2024-10-11 19:48 UTC (permalink / raw)
To: Linux Trace Devel
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
The sizeof() may be used for common types like:
__u8, __s8, u8, s8,
__u16, __s16, u16, s16,
__u32, __s32, u32, s32,
__u64, __s64, u64, s64
Handle them.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
src/event-parse.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/event-parse.c b/src/event-parse.c
index ddeb3b9909c0..73563c8e9dea 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -3571,6 +3571,23 @@ process_sizeof(struct tep_event *event, struct tep_print_arg *arg, char **tok)
/* The token is the next token */
token_has_paren = true;
}
+
+ } else if (strcmp(token, "__u64") == 0 || strcmp(token, "u64") == 0 ||
+ strcmp(token, "__s64") == 0 || strcmp(token, "s64") == 0) {
+ arg->atom.atom = strdup("8");
+
+ } else if (strcmp(token, "__u32") == 0 || strcmp(token, "u32") == 0 ||
+ strcmp(token, "__s32") == 0 || strcmp(token, "s32") == 0) {
+ arg->atom.atom = strdup("4");
+
+ } else if (strcmp(token, "__u16") == 0 || strcmp(token, "u16") == 0 ||
+ strcmp(token, "__s16") == 0 || strcmp(token, "s16") == 0) {
+ arg->atom.atom = strdup("2");
+
+ } else if (strcmp(token, "__u8") == 0 || strcmp(token, "u8") == 0 ||
+ strcmp(token, "__8") == 0 || strcmp(token, "s8") == 0) {
+ arg->atom.atom = strdup("1");
+
} else if (strcmp(token, "REC") == 0) {
free_token(token);
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] libtraceevent: Have sizeof() parsing handle u8/s8 through u64/s64
2024-10-11 19:48 [PATCH] libtraceevent: Have sizeof() parsing handle u8/s8 through u64/s64 Steven Rostedt
@ 2024-10-17 15:27 ` Sean Anderson
0 siblings, 0 replies; 2+ messages in thread
From: Sean Anderson @ 2024-10-17 15:27 UTC (permalink / raw)
To: Steven Rostedt, Linux Trace Devel
On 10/11/24 15:48, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
>
> The sizeof() may be used for common types like:
>
> __u8, __s8, u8, s8,
> __u16, __s16, u16, s16,
> __u32, __s32, u32, s32,
> __u64, __s64, u64, s64
>
> Handle them.
>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> src/event-parse.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/src/event-parse.c b/src/event-parse.c
> index ddeb3b9909c0..73563c8e9dea 100644
> --- a/src/event-parse.c
> +++ b/src/event-parse.c
> @@ -3571,6 +3571,23 @@ process_sizeof(struct tep_event *event, struct tep_print_arg *arg, char **tok)
> /* The token is the next token */
> token_has_paren = true;
> }
> +
> + } else if (strcmp(token, "__u64") == 0 || strcmp(token, "u64") == 0 ||
> + strcmp(token, "__s64") == 0 || strcmp(token, "s64") == 0) {
> + arg->atom.atom = strdup("8");
> +
> + } else if (strcmp(token, "__u32") == 0 || strcmp(token, "u32") == 0 ||
> + strcmp(token, "__s32") == 0 || strcmp(token, "s32") == 0) {
> + arg->atom.atom = strdup("4");
> +
> + } else if (strcmp(token, "__u16") == 0 || strcmp(token, "u16") == 0 ||
> + strcmp(token, "__s16") == 0 || strcmp(token, "s16") == 0) {
> + arg->atom.atom = strdup("2");
> +
> + } else if (strcmp(token, "__u8") == 0 || strcmp(token, "u8") == 0 ||
> + strcmp(token, "__8") == 0 || strcmp(token, "s8") == 0) {
> + arg->atom.atom = strdup("1");
> +
> } else if (strcmp(token, "REC") == 0) {
>
> free_token(token);
Reviewed-by: Sean Anderson <sean.anderson@linux.dev>
Tested-by: Sean Anderson <sean.anderson@linux.dev>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-17 15:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-11 19:48 [PATCH] libtraceevent: Have sizeof() parsing handle u8/s8 through u64/s64 Steven Rostedt
2024-10-17 15:27 ` Sean Anderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).