* [ltt-dev] [PATCH take2 02/13] get name and fmt from permanent eID
@ 2009-02-05 3:31 Lai Jiangshan
2009-02-23 16:37 ` Mathieu Desnoyers
0 siblings, 1 reply; 2+ messages in thread
From: Lai Jiangshan @ 2009-02-05 3:31 UTC (permalink / raw)
struct marker_entry is permanent, we introduce two APIs for
getting name and fmt from eIDs.
Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
diff --git a/include/linux/marker.h b/include/linux/marker.h
index 32387e8..2fe8977 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -238,6 +238,9 @@ extern int marker_probe_unregister_private_data(marker_probe_func *probe,
extern void *marker_get_private_data(const char *channel, const char *name,
marker_probe_func *probe, int num);
+const char *marker_get_name_form_id(u16 channel_id, u16 event_id);
+const char *marker_get_fmt_form_id(u16 channel_id, u16 event_id);
+
/*
* marker_synchronize_unregister must be called between the last marker probe
* unregistration and the end of module exit to make sure there is no caller
diff --git a/kernel/marker.c b/kernel/marker.c
index b11a82a..6a918e2 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -997,6 +1010,40 @@ void *marker_get_private_data(const char *channel, const char *name,
}
EXPORT_SYMBOL_GPL(marker_get_private_data);
+static struct marker_entry *get_entry_from_id(u16 channel_id, u16 event_id)
+{
+ struct hlist_head *head;
+ struct hlist_node *node;
+ struct marker_entry *e, *found = NULL;
+ u32 hash = hash_32((channel_id << 16) | event_id, MARKER_HASH_BITS);
+
+ mutex_lock(&markers_mutex);
+ head = id_table + hash;
+ hlist_for_each_entry(e, node, head, id_list) {
+ if (e->channel_id == channel_id && e->event_id == event_id) {
+ found = e;
+ break;
+ }
+ }
+ mutex_unlock(&markers_mutex);
+ return found;
+}
+
+/* must call when ids/marker_entry are kept alive */
+const char *marker_get_name_form_id(u16 channel_id, u16 event_id)
+{
+ struct marker_entry *e = get_entry_from_id(channel_id, event_id);
+ return e ? e->name : NULL;
+}
+EXPORT_SYMBOL_GPL(marker_get_name_form_id);
+
+const char *marker_get_fmt_form_id(u16 channel_id, u16 event_id)
+{
+ struct marker_entry *e = get_entry_from_id(channel_id, event_id);
+ return e ? e->format : NULL;
+}
+EXPORT_SYMBOL_GPL(marker_get_fmt_form_id);
+
/**
* markers_compact_event_ids: Compact markers event IDs and reassign channels
*
^ permalink raw reply [flat|nested] 2+ messages in thread
* [ltt-dev] [PATCH take2 02/13] get name and fmt from permanent eID
2009-02-05 3:31 [ltt-dev] [PATCH take2 02/13] get name and fmt from permanent eID Lai Jiangshan
@ 2009-02-23 16:37 ` Mathieu Desnoyers
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2009-02-23 16:37 UTC (permalink / raw)
* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> struct marker_entry is permanent, we introduce two APIs for
> getting name and fmt from eIDs.
Please change the description of this patch and of patch 01 for
something which includes :
struct marker_entry is permanent for the duration of active tracing
sessions. That means : as long as a struct marker_entry channel and
event IDs can be seen by an active tracing session, it stays valid until
all tracing sessions end.
Otherwise just saying that "struct marker_entry is permanent" is
misleading.
Mathieu
>
> Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
> ---
> diff --git a/include/linux/marker.h b/include/linux/marker.h
> index 32387e8..2fe8977 100644
> --- a/include/linux/marker.h
> +++ b/include/linux/marker.h
> @@ -238,6 +238,9 @@ extern int marker_probe_unregister_private_data(marker_probe_func *probe,
> extern void *marker_get_private_data(const char *channel, const char *name,
> marker_probe_func *probe, int num);
>
> +const char *marker_get_name_form_id(u16 channel_id, u16 event_id);
> +const char *marker_get_fmt_form_id(u16 channel_id, u16 event_id);
> +
> /*
> * marker_synchronize_unregister must be called between the last marker probe
> * unregistration and the end of module exit to make sure there is no caller
> diff --git a/kernel/marker.c b/kernel/marker.c
> index b11a82a..6a918e2 100644
> --- a/kernel/marker.c
> +++ b/kernel/marker.c
> @@ -997,6 +1010,40 @@ void *marker_get_private_data(const char *channel, const char *name,
> }
> EXPORT_SYMBOL_GPL(marker_get_private_data);
>
> +static struct marker_entry *get_entry_from_id(u16 channel_id, u16 event_id)
> +{
> + struct hlist_head *head;
> + struct hlist_node *node;
> + struct marker_entry *e, *found = NULL;
> + u32 hash = hash_32((channel_id << 16) | event_id, MARKER_HASH_BITS);
> +
> + mutex_lock(&markers_mutex);
> + head = id_table + hash;
> + hlist_for_each_entry(e, node, head, id_list) {
> + if (e->channel_id == channel_id && e->event_id == event_id) {
> + found = e;
> + break;
> + }
> + }
> + mutex_unlock(&markers_mutex);
> + return found;
> +}
> +
> +/* must call when ids/marker_entry are kept alive */
> +const char *marker_get_name_form_id(u16 channel_id, u16 event_id)
> +{
> + struct marker_entry *e = get_entry_from_id(channel_id, event_id);
> + return e ? e->name : NULL;
> +}
> +EXPORT_SYMBOL_GPL(marker_get_name_form_id);
> +
> +const char *marker_get_fmt_form_id(u16 channel_id, u16 event_id)
> +{
> + struct marker_entry *e = get_entry_from_id(channel_id, event_id);
> + return e ? e->format : NULL;
> +}
> +EXPORT_SYMBOL_GPL(marker_get_fmt_form_id);
> +
> /**
> * markers_compact_event_ids: Compact markers event IDs and reassign channels
> *
>
>
>
> _______________________________________________
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-23 16:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-05 3:31 [ltt-dev] [PATCH take2 02/13] get name and fmt from permanent eID Lai Jiangshan
2009-02-23 16:37 ` Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox