From: compudj@krystal.dyndns.org (Mathieu Desnoyers)
Subject: [ltt-dev] [PATCH take2 05/13] read basic type from ltt-relay buffer
Date: Mon, 23 Feb 2009 13:58:05 -0500 [thread overview]
Message-ID: <20090223185805.GF31815@Krystal> (raw)
In-Reply-To: <498A5D90.8020004@cn.fujitsu.com>
* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> we need function read the base type from ltt-relay buffer
> in the kernel for text output
>
Looks good, will merge. Thanks !
Mathieu
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at polymtl.ca>
> Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
> ---
> diff --git a/ltt/ltt-serialize.c b/ltt/ltt-serialize.c
> index 5c34899..0ca6683 100644
> --- a/ltt/ltt-serialize.c
> +++ b/ltt/ltt-serialize.c
> @@ -531,6 +531,48 @@ notrace size_t ltt_serialize_data(struct rchan_buf *buf, size_t buf_offset,
> }
> EXPORT_SYMBOL_GPL(ltt_serialize_data);
>
> +static inline uint64_t unserialize_base_type(struct rchan_buf *buf,
> + size_t *ppos, char trace_size, enum ltt_type trace_type)
> +{
> + uint64_t tmp;
> +
> + *ppos += ltt_align(*ppos, trace_size);
> + ltt_relay_read(buf, *ppos, &tmp, trace_size);
> + *ppos += trace_size;
> +
> + switch (trace_type) {
> + case LTT_TYPE_SIGNED_INT:
> + switch (trace_size) {
> + case 1:
> + return (uint64_t)*(int8_t *)&tmp;
> + case 2:
> + return (uint64_t)*(int16_t *)&tmp;
> + case 4:
> + return (uint64_t)*(int32_t *)&tmp;
> + case 8:
> + return tmp;
> + }
> + break;
> + case LTT_TYPE_UNSIGNED_INT:
> + switch (trace_size) {
> + case 1:
> + return (uint64_t)*(uint8_t *)&tmp;
> + case 2:
> + return (uint64_t)*(uint16_t *)&tmp;
> + case 4:
> + return (uint64_t)*(uint32_t *)&tmp;
> + case 8:
> + return tmp;
> + }
> + break;
> + default:
> + break;
> + }
> +
> + BUG();
> + return 0;
> +}
> +
> /*
> * Calculate data size
> * Assume that the padding for alignment starts at a sizeof(void *) address.
>
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
prev parent reply other threads:[~2009-02-23 18:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 3:31 Lai Jiangshan
2009-02-23 18:58 ` Mathieu Desnoyers [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090223185805.GF31815@Krystal \
--to=compudj@krystal.dyndns.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox