From: gbastien+lttng@versatic.net (Geneviève Bastien)
Subject: [lttng-dev] [RFC Patch Tools 2/3] Statedump the metadata for the CTF global structures
Date: Wed, 26 Mar 2014 10:55:11 -0400 [thread overview]
Message-ID: <1395845712-18498-3-git-send-email-gbastien+lttng@versatic.net> (raw)
In-Reply-To: <1395845712-18498-1-git-send-email-gbastien+lttng@versatic.net>
It reuses the event field's statedump functions to statedump the fields of
the structure.
Signed-off-by: Genevi?ve Bastien <gbastien+lttng at versatic.net>
---
src/bin/lttng-sessiond/ust-metadata.c | 41 ++++++++++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/src/bin/lttng-sessiond/ust-metadata.c b/src/bin/lttng-sessiond/ust-metadata.c
index 1a482f2..3eb131c 100644
--- a/src/bin/lttng-sessiond/ust-metadata.c
+++ b/src/bin/lttng-sessiond/ust-metadata.c
@@ -270,6 +270,14 @@ int _lttng_field_statedump(struct ust_registry_session *session,
" { encoding = ASCII; }" : "",
field->name);
break;
+ case ustctl_atype_structure:
+ {
+ ret = lttng_metadata_printf(session,
+ " struct __ust_struct__%s _%s;\n",
+ field->type.u.structure.name,
+ field->name);
+ break;
+ }
default:
return -EINVAL;
}
@@ -339,6 +347,12 @@ int _lttng_one_global_type_statedump(struct ust_registry_session *session,
strncpy(global_type->name, global_type_decl->u.ctf_enum.name, LTTNG_UST_SYM_NAME_LEN);
global_type->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
break;
+ case ustctl_mtype_structure:
+ strncpy(global_type->name,
+ global_type_decl->u.ctf_structure.name,
+ LTTNG_UST_SYM_NAME_LEN);
+ global_type->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+ break;
default:
return -EINVAL;
}
@@ -356,7 +370,8 @@ int _lttng_one_global_type_statedump(struct ust_registry_session *session,
cds_lfht_node_init(&global_type->node.node);
rcu_read_unlock();
-
+ DBG("adding global type %s of type %d to metadata",
+ global_type->name, global_type_decl->mtype);
switch (global_type_decl->mtype) {
case ustctl_mtype_enum:
{
@@ -440,6 +455,30 @@ int _lttng_one_global_type_statedump(struct ust_registry_session *session,
return ret;
break;
}
+ case ustctl_mtype_structure:
+ {
+ const struct ustctl_structure *ustruct;
+
+ ustruct = &global_type_decl->u.ctf_structure;
+ ret = lttng_metadata_printf(session,
+ "struct __ust_struct__%s {\n",
+ ustruct->name);
+ if (ret)
+ return ret;
+ /* Dump the fields */
+ for (i = 0; i < ustruct->nr_fields; i++) {
+ struct ustctl_field field;
+
+ field = ustruct->fields[i];
+ ret = _lttng_field_statedump(session, &field);
+ if (ret)
+ return ret;
+ }
+ ret = lttng_metadata_printf(session, "};\n\n");
+ if (ret)
+ return ret;
+ break;
+ }
default:
return -EINVAL;
}
--
1.9.1
next prev parent reply other threads:[~2014-03-26 14:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-26 14:55 [lttng-dev] Add support of CTF structure global type Geneviève Bastien
2014-03-26 14:55 ` [lttng-dev] [RFC Patch Tools 1/3] Update data structures to support CTF global structures Geneviève Bastien
2014-03-26 14:55 ` Geneviève Bastien [this message]
2014-03-26 14:55 ` [lttng-dev] [RFC Patch Tools 3/3] Update regression tests for UST global structure declarations Geneviève Bastien
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=1395845712-18498-3-git-send-email-gbastien+lttng@versatic.net \
--to=gbastien+lttng@versatic.net \
/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