From 6b0e60f149100b0b83b4a813689f75b04b3acb8f Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 31 Jan 2012 17:17:48 -0500 Subject: [PATCH] Update loglevel selection ABI Signed-off-by: Mathieu Desnoyers --- include/lttng/ust-abi.h | 12 +++++++-- liblttng-ust/ltt-events.c | 3 --- liblttng-ust/ltt-probes.c | 1 + liblttng-ust/lttng-ust-abi.c | 50 +++--------------------------------- 4 files changed, 15 insertions(+), 51 deletions(-) diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index 470645e6..c03a4da1 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -29,7 +29,11 @@ enum lttng_ust_instrumentation { LTTNG_UST_TRACEPOINT = 0, LTTNG_UST_PROBE = 1, LTTNG_UST_FUNCTION = 2, - LTTNG_UST_TRACEPOINT_LOGLEVEL = 3, +}; + +enum lttng_ust_loglevel_type { + LTTNG_UST_LOGLEVEL = 0, + LTTNG_UST_LOGLEVEL_ONLY = 1, }; enum lttng_ust_output { @@ -55,8 +59,12 @@ struct lttng_ust_stream { }; struct lttng_ust_event { - char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */ enum lttng_ust_instrumentation instrumentation; + char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */ + + enum lttng_ust_loglevel_type loglevel_type; + char loglevel[LTTNG_UST_SYM_NAME_LEN]; /* loglevel name */ + /* Per instrumentation type configuration */ union { } u; diff --git a/liblttng-ust/ltt-events.c b/liblttng-ust/ltt-events.c index 85afc1ba..2f94d8c9 100644 --- a/liblttng-ust/ltt-events.c +++ b/liblttng-ust/ltt-events.c @@ -548,9 +548,6 @@ int ltt_event_create(struct ltt_channel *chan, goto add_pending_error; } break; - case LTTNG_UST_TRACEPOINT_LOGLEVEL: - assert(0); - break; default: WARN_ON_ONCE(1); } diff --git a/liblttng-ust/ltt-probes.c b/liblttng-ust/ltt-probes.c index 12ddb479..98928cf3 100644 --- a/liblttng-ust/ltt-probes.c +++ b/liblttng-ust/ltt-probes.c @@ -315,6 +315,7 @@ void _probes_create_loglevel_events(struct loglevel_entry *entry, /* * Add the loglevel to the loglevel hash table. Must be called with * ust lock held. + * TODO: should be integrated with events and wildcards. */ struct session_loglevel *add_loglevel(const char *name, struct ltt_channel *chan, diff --git a/liblttng-ust/lttng-ust-abi.c b/liblttng-ust/lttng-ust-abi.c index b3db6fd7..baea8885 100644 --- a/liblttng-ust/lttng-ust-abi.c +++ b/liblttng-ust/lttng-ust-abi.c @@ -669,44 +669,6 @@ objd_error: return ret; } -static -int lttng_abi_create_loglevel(int channel_objd, - struct lttng_ust_event *event_param) -{ - struct ltt_channel *channel = objd_private(channel_objd); - struct session_loglevel *loglevel; - int loglevel_objd, ret; - - event_param->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0'; - loglevel_objd = objd_alloc(NULL, <tng_loglevel_ops); - if (loglevel_objd < 0) { - ret = loglevel_objd; - goto objd_error; - } - /* - * We tolerate no failure path after loglevel creation. It will - * stay invariant for the rest of the session. - */ - ret = ltt_loglevel_create(channel, event_param, &loglevel); - if (ret < 0) { - goto loglevel_error; - } - objd_set_private(loglevel_objd, loglevel); - /* The loglevel holds a reference on the channel */ - objd_ref(channel_objd); - return loglevel_objd; - -loglevel_error: - { - int err; - - err = lttng_ust_objd_unref(loglevel_objd); - assert(!err); - } -objd_error: - return ret; -} - static int lttng_abi_create_wildcard(int channel_objd, struct lttng_ust_event *event_param) @@ -787,15 +749,11 @@ long lttng_channel_cmd(int objd, unsigned int cmd, unsigned long arg, { struct lttng_ust_event *event_param = (struct lttng_ust_event *) arg; - if (event_param->instrumentation == LTTNG_UST_TRACEPOINT_LOGLEVEL) { - return lttng_abi_create_loglevel(objd, event_param); + if (event_param->name[strlen(event_param->name) - 1] == '*') { + /* If ends with wildcard, create wildcard. */ + return lttng_abi_create_wildcard(objd, event_param); } else { - if (event_param->name[strlen(event_param->name) - 1] == '*') { - /* If ends with wildcard, create wildcard. */ - return lttng_abi_create_wildcard(objd, event_param); - } else { - return lttng_abi_create_event(objd, event_param); - } + return lttng_abi_create_event(objd, event_param); } } case LTTNG_UST_CONTEXT: -- 2.34.1