sessiond: use `loglevel_value` and `loglevel_type` names
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 2 Sep 2015 01:52:40 +0000 (21:52 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 8 Sep 2015 13:45:48 +0000 (09:45 -0400)
By using the `loglevel_value` and `loglevel_type` names instead
of `loglevel` for one or the other, some unsettling
inconsistencies are exposed.

This patch only changes the names to show the weird stuff, e.g.:

    key.loglevel_type = loglevel_value;

A future patch will fix this.

The only `loglevel` names left untouched are those in public headers
as well as those in the tools<->UST ABI.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
14 files changed:
src/bin/lttng-sessiond/agent.c
src/bin/lttng-sessiond/agent.h
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/event.c
src/bin/lttng-sessiond/lttng-ust-ctl.h
src/bin/lttng-sessiond/save.c
src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/trace-ust.h
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-app.h
src/bin/lttng-sessiond/ust-metadata.c
src/bin/lttng-sessiond/ust-registry.c
src/bin/lttng-sessiond/ust-registry.h
src/common/sessiond-comm/agent.h

index 32c261ca7529dba09e20544e8fd0debbbdfe07ab..8515b005a8d46cad8fdcb8e88d763350d16e252b 100644 (file)
@@ -79,9 +79,10 @@ static int ht_match_event(struct cds_lfht_node *node,
                goto no_match;
        }
 
-       if (event->loglevel != key->loglevel) {
+       if (event->loglevel_value != key->loglevel_value) {
                if (event->loglevel_type == LTTNG_EVENT_LOGLEVEL_ALL &&
-                               key->loglevel == 0 && event->loglevel == -1) {
+                               key->loglevel_value == 0 &&
+                               event->loglevel_value == -1) {
                        goto match;
                }
                goto no_match;
@@ -107,7 +108,7 @@ static void add_unique_agent_event(struct lttng_ht *ht,
        assert(event);
 
        key.name = event->name;
-       key.loglevel = event->loglevel;
+       key.loglevel_value = event->loglevel_value;
 
        node_ptr = cds_lfht_add_unique(ht->ht,
                        ht->hash_fct(event->node.key, lttng_ht_seed),
@@ -338,7 +339,7 @@ static int enable_event(struct agent_app *app, struct agent_event *event)
        }
 
        memset(&msg, 0, sizeof(msg));
-       msg.loglevel = event->loglevel;
+       msg.loglevel_value = event->loglevel_value;
        msg.loglevel_type = event->loglevel_type;
        strncpy(msg.name, event->name, sizeof(msg.name));
        ret = send_payload(app->sock, &msg, sizeof(msg));
@@ -790,7 +791,7 @@ error:
  * Return a new object else NULL on error.
  */
 struct agent_event *agent_create_event(const char *name,
-               int loglevel, enum lttng_loglevel_type loglevel_type,
+               int loglevel_value, enum lttng_loglevel_type loglevel_type,
                struct lttng_filter_bytecode *filter, char *filter_expression)
 {
        struct agent_event *event = NULL;
@@ -811,7 +812,7 @@ struct agent_event *agent_create_event(const char *name,
        event->name[sizeof(event->name) - 1] = '\0';
        lttng_ht_node_init_str(&event->node, event->name);
 
-       event->loglevel = loglevel;
+       event->loglevel_value = loglevel_value;
        event->loglevel_type = loglevel_type;
        event->filter = filter;
        event->filter_expression = filter_expression;
@@ -880,7 +881,7 @@ error:
  *
  * Return object if found else NULL.
  */
-struct agent_event *agent_find_event(const char *name, int loglevel,
+struct agent_event *agent_find_event(const char *name, int loglevel_value,
                struct agent *agt)
 {
        struct lttng_ht_node_str *node;
@@ -894,7 +895,7 @@ struct agent_event *agent_find_event(const char *name, int loglevel,
 
        ht = agt->events;
        key.name = name;
-       key.loglevel = loglevel;
+       key.loglevel_value = loglevel_value;
 
        cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
                        ht_match_event, &key, &iter.iter);
index 293426e0ef783ca5577997a3582e98b62127497a..da51f017630f9c34c22633874065824697a44f60 100644 (file)
@@ -36,7 +36,7 @@ struct lttng_ht *agent_apps_ht_by_sock;
 
 struct agent_ht_key {
        const char *name;
-       int loglevel;
+       int loglevel_value;
 };
 
 /*
@@ -80,7 +80,7 @@ struct agent_app {
 struct agent_event {
        /* Name of the event. */
        char name[LTTNG_SYMBOL_NAME_LEN];
-       int loglevel;
+       int loglevel_value;
        enum lttng_loglevel_type loglevel_type;
 
        /*
index fdc72b834158c1de4082d657affff40e93979e08..00e86a9642952be99d88aa3404a3d13090e442eb 100644 (file)
@@ -236,7 +236,7 @@ static int list_lttng_agent_events(struct agent *agt,
                strncpy(tmp_events[i].name, event->name, sizeof(tmp_events[i].name));
                tmp_events[i].name[sizeof(tmp_events[i].name) - 1] = '\0';
                tmp_events[i].enabled = event->enabled;
-               tmp_events[i].loglevel = event->loglevel;
+               tmp_events[i].loglevel = event->loglevel_value;
                tmp_events[i].loglevel_type = event->loglevel_type;
                i++;
        }
index 223a13d0e92eceff598fd59363fc3c2753deaa6a..cf0b445532d80d1f8fdf6c9546ee5c57d60810ea 100644 (file)
@@ -49,7 +49,7 @@ static void add_unique_ust_event(struct lttng_ht *ht,
 
        key.name = event->attr.name;
        key.filter = (struct lttng_filter_bytecode *) event->filter;
-       key.loglevel = event->attr.loglevel;
+       key.loglevel_type = event->attr.loglevel;
        key.exclusion = event->exclusion;
 
        node_ptr = cds_lfht_add_unique(ht->ht,
index 3d20c38a1541e0766b6216c92704329426f4dae6..b3de5a9ba61846f557ec39b0df4cecd1b486bca1 100644 (file)
@@ -356,7 +356,7 @@ int ustctl_recv_register_event(int sock,
                                         * event name (output,
                                         * size LTTNG_UST_SYM_NAME_LEN)
                                         */
-       int *loglevel,
+       int *loglevel_value,
        char **signature,               /*
                                         * event signature
                                         * (output, dynamically
index 372ccf9bf918e76af609113eebe4966d4f111183..219483a870ef6a9c783ea893751c13a9be3df274 100644 (file)
@@ -768,7 +768,7 @@ int init_ust_event_from_agent_event(struct ltt_ust_event *ust_event,
        }
 
        ust_event->attr.loglevel_type = ust_loglevel_type;
-       ust_event->attr.loglevel = agent_event->loglevel;
+       ust_event->attr.loglevel = agent_event->loglevel_value;
        ust_event->filter_expression = agent_event->filter_expression;
        ust_event->exclusion = agent_event->exclusion;
 end:
index 03fb38180f00d7c81a9fa013d7c1179266b45443..8da942f01c8d9a7bc835804adf57f542edd7b062 100644 (file)
@@ -70,12 +70,14 @@ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key)
 {
        struct ltt_ust_event *event;
        const struct ltt_ust_ht_key *key;
+       int ev_loglevel_value;
 
        assert(node);
        assert(_key);
 
        event = caa_container_of(node, struct ltt_ust_event, node.node);
        key = _key;
+       ev_loglevel_value = event->attr.loglevel;
 
        /* Match the 4 elements of the key: name, filter, loglevel, exclusions. */
 
@@ -85,9 +87,9 @@ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key)
        }
 
        /* Event loglevel. */
-       if (event->attr.loglevel != key->loglevel) {
+       if (ev_loglevel_value != key->loglevel_type) {
                if (event->attr.loglevel_type == LTTNG_UST_LOGLEVEL_ALL
-                               && key->loglevel == 0 && event->attr.loglevel == -1) {
+                               && key->loglevel_type == 0 && ev_loglevel_value == -1) {
                        /*
                         * Match is accepted. This is because on event creation, the
                         * loglevel is set to -1 if the event loglevel type is ALL so 0 and
@@ -170,8 +172,8 @@ error:
  * MUST be acquired before calling this.
  */
 struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
-               char *name, struct lttng_filter_bytecode *filter, int loglevel,
-               struct lttng_event_exclusion *exclusion)
+               char *name, struct lttng_filter_bytecode *filter,
+               int loglevel_value, struct lttng_event_exclusion *exclusion)
 {
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
@@ -182,7 +184,7 @@ struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
 
        key.name = name;
        key.filter = filter;
-       key.loglevel = loglevel;
+       key.loglevel_type = loglevel_value;
        key.exclusion = exclusion;
 
        cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
index 1ad96edaa012be3dcd6e3734e7c0ae79cba78e04..d7f732e158c6543e627752182a4eac76127fe9ee 100644 (file)
@@ -33,7 +33,7 @@
 struct ltt_ust_ht_key {
        const char *name;
        const struct lttng_filter_bytecode *filter;
-       enum lttng_ust_loglevel_type loglevel;
+       enum lttng_ust_loglevel_type loglevel_type;
        const struct lttng_event_exclusion *exclusion;
 };
 
@@ -169,8 +169,8 @@ int trace_ust_ht_match_event_by_name(struct cds_lfht_node *node,
  * Lookup functions. NULL is returned if not found.
  */
 struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
-               char *name, struct lttng_filter_bytecode *filter, int loglevel,
-               struct lttng_event_exclusion *exclusion);
+               char *name, struct lttng_filter_bytecode *filter,
+               int loglevel_value, struct lttng_event_exclusion *exclusion);
 struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
                char *name);
 struct agent *trace_ust_find_agent(struct ltt_ust_session *session,
@@ -276,8 +276,8 @@ int trace_ust_match_context(struct ltt_ust_context *uctx,
        return 0;
 }
 static inline struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
-               char *name, struct lttng_filter_bytecode *filter, int loglevel,
-               struct lttng_event_exclusion *exclusion)
+               char *name, struct lttng_filter_bytecode *filter,
+               int loglevel_value, struct lttng_event_exclusion *exclusion)
 {
        return NULL;
 }
index c4d9fb5a40c6b14a73bac79014396a8710599ede..4066b065c0a0b45185e0f18b18820bde9f344c73 100644 (file)
@@ -101,12 +101,14 @@ static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
 {
        struct ust_app_event *event;
        const struct ust_app_ht_key *key;
+       int ev_loglevel_value;
 
        assert(node);
        assert(_key);
 
        event = caa_container_of(node, struct ust_app_event, node.node);
        key = _key;
+       ev_loglevel_value = event->attr.loglevel;
 
        /* Match the 4 elements of the key: name, filter, loglevel, exclusions */
 
@@ -116,9 +118,10 @@ static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
        }
 
        /* Event loglevel. */
-       if (event->attr.loglevel != key->loglevel) {
+       if (ev_loglevel_value != key->loglevel_type) {
                if (event->attr.loglevel_type == LTTNG_UST_LOGLEVEL_ALL
-                               && key->loglevel == 0 && event->attr.loglevel == -1) {
+                               && key->loglevel_type == 0 &&
+                               ev_loglevel_value == -1) {
                        /*
                         * Match is accepted. This is because on event creation, the
                         * loglevel is set to -1 if the event loglevel type is ALL so 0 and
@@ -184,7 +187,7 @@ static void add_unique_ust_app_event(struct ust_app_channel *ua_chan,
        ht = ua_chan->events;
        key.name = event->attr.name;
        key.filter = event->filter;
-       key.loglevel = event->attr.loglevel;
+       key.loglevel_type = event->attr.loglevel;
        key.exclusion = event->exclusion;
 
        node_ptr = cds_lfht_add_unique(ht->ht,
@@ -1149,7 +1152,8 @@ error:
  * Return an ust_app_event object or NULL on error.
  */
 static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
-               char *name, struct lttng_filter_bytecode *filter, int loglevel,
+               char *name, struct lttng_filter_bytecode *filter,
+               int loglevel_value,
                const struct lttng_event_exclusion *exclusion)
 {
        struct lttng_ht_iter iter;
@@ -1163,7 +1167,7 @@ static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
        /* Setup key for event lookup. */
        key.name = name;
        key.filter = filter;
-       key.loglevel = loglevel;
+       key.loglevel_type = loglevel_value;
        /* lttng_event_exclusion and lttng_ust_event_exclusion structures are similar */
        key.exclusion = exclusion;
 
@@ -5173,8 +5177,8 @@ error_rcu_unlock:
  * On success 0 is returned else a negative value.
  */
 static int add_event_ust_registry(int sock, int sobjd, int cobjd, char *name,
-               char *sig, size_t nr_fields, struct ustctl_field *fields, int loglevel,
-               char *model_emf_uri)
+               char *sig, size_t nr_fields, struct ustctl_field *fields,
+               int loglevel_value, char *model_emf_uri)
 {
        int ret, ret_code;
        uint32_t event_id = 0;
@@ -5229,9 +5233,9 @@ static int add_event_ust_registry(int sock, int sobjd, int cobjd, char *name,
         * three variables MUST NOT be read/write after this.
         */
        ret_code = ust_registry_create_event(registry, chan_reg_key,
-                       sobjd, cobjd, name, sig, nr_fields, fields, loglevel,
-                       model_emf_uri, ua_sess->buffer_type, &event_id,
-                       app);
+                       sobjd, cobjd, name, sig, nr_fields, fields,
+                       loglevel_value, model_emf_uri, ua_sess->buffer_type,
+                       &event_id, app);
 
        /*
         * The return value is returned to ustctl so in case of an error, the
@@ -5287,15 +5291,16 @@ int ust_app_recv_notify(int sock)
        switch (cmd) {
        case USTCTL_NOTIFY_CMD_EVENT:
        {
-               int sobjd, cobjd, loglevel;
+               int sobjd, cobjd, loglevel_value;
                char name[LTTNG_UST_SYM_NAME_LEN], *sig, *model_emf_uri;
                size_t nr_fields;
                struct ustctl_field *fields;
 
                DBG2("UST app ustctl register event received");
 
-               ret = ustctl_recv_register_event(sock, &sobjd, &cobjd, name, &loglevel,
-                               &sig, &nr_fields, &fields, &model_emf_uri);
+               ret = ustctl_recv_register_event(sock, &sobjd, &cobjd, name,
+                               &loglevel_value, &sig, &nr_fields, &fields,
+                               &model_emf_uri);
                if (ret < 0) {
                        if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
                                ERR("UST app recv event failed with ret %d", ret);
@@ -5312,7 +5317,7 @@ int ust_app_recv_notify(int sock)
                 * to the this function.
                 */
                ret = add_event_ust_registry(sock, sobjd, cobjd, name, sig, nr_fields,
-                               fields, loglevel, model_emf_uri);
+                               fields, loglevel_value, model_emf_uri);
                if (ret < 0) {
                        goto error;
                }
index 52631904329f9332186e8ab31619c5b59abbdb23..ff36d5021e2769babc5eab4ddd49c031a0ce160d 100644 (file)
@@ -15,7 +15,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifndef _LTT_UST_APP_H 
+#ifndef _LTT_UST_APP_H
 #define _LTT_UST_APP_H
 
 #include <stdint.h>
@@ -49,7 +49,7 @@ struct ust_app_notify_sock_obj {
 struct ust_app_ht_key {
        const char *name;
        const struct lttng_filter_bytecode *filter;
-       enum lttng_ust_loglevel_type loglevel;
+       enum lttng_ust_loglevel_type loglevel_type;
        const struct lttng_event_exclusion *exclusion;
 };
 
index ea5978888e6fe6705a3590d83ecf324f8e33fd3f..afcb89ddf351eef5386241997bf2ea28be4b9296 100644 (file)
@@ -359,7 +359,7 @@ int ust_metadata_event_statedump(struct ust_registry_session *session,
 
        ret = lttng_metadata_printf(session,
                "       loglevel = %d;\n",
-               event->loglevel);
+               event->loglevel_value);
        if (ret)
                goto end;
 
index 3f1390dc3df1e65449700c12fa502215a9e29426..315aed945b503391e6c1f9de2f21681c6ee34f6b 100644 (file)
@@ -133,8 +133,8 @@ int validate_event_fields(size_t nr_fields, struct ustctl_field *fields,
  */
 static struct ust_registry_event *alloc_event(int session_objd,
                int channel_objd, char *name, char *sig, size_t nr_fields,
-               struct ustctl_field *fields, int loglevel, char *model_emf_uri,
-               struct ust_app *app)
+               struct ustctl_field *fields, int loglevel_value,
+               char *model_emf_uri, struct ust_app *app)
 {
        struct ust_registry_event *event = NULL;
 
@@ -157,7 +157,7 @@ static struct ust_registry_event *alloc_event(int session_objd,
        event->signature = sig;
        event->nr_fields = nr_fields;
        event->fields = fields;
-       event->loglevel = loglevel;
+       event->loglevel_value = loglevel_value;
        event->model_emf_uri = model_emf_uri;
        if (name) {
                /* Copy event name and force NULL byte. */
@@ -248,9 +248,9 @@ end:
  */
 int ust_registry_create_event(struct ust_registry_session *session,
                uint64_t chan_key, int session_objd, int channel_objd, char *name,
-               char *sig, size_t nr_fields, struct ustctl_field *fields, int loglevel,
-               char *model_emf_uri, int buffer_type, uint32_t *event_id_p,
-               struct ust_app *app)
+               char *sig, size_t nr_fields, struct ustctl_field *fields,
+               int loglevel_value, char *model_emf_uri, int buffer_type,
+               uint32_t *event_id_p, struct ust_app *app)
 {
        int ret;
        uint32_t event_id;
@@ -287,7 +287,7 @@ int ust_registry_create_event(struct ust_registry_session *session,
        }
 
        event = alloc_event(session_objd, channel_objd, name, sig, nr_fields,
-                       fields, loglevel, model_emf_uri, app);
+                       fields, loglevel_value, model_emf_uri, app);
        if (!event) {
                ret = -ENOMEM;
                goto error_free;
index 77d4d919518fa1a9cb2eb71eabd4f0ed85e9d108..b51b505f12994b0b8219b4efb846f32e2f5f5523 100644 (file)
@@ -139,7 +139,7 @@ struct ust_registry_event {
        /* Name of the event returned by the tracer. */
        char name[LTTNG_UST_SYM_NAME_LEN];
        char *signature;
-       int loglevel;
+       int loglevel_value;
        size_t nr_fields;
        struct ustctl_field *fields;
        char *model_emf_uri;
@@ -244,9 +244,9 @@ void ust_registry_session_destroy(struct ust_registry_session *session);
 
 int ust_registry_create_event(struct ust_registry_session *session,
                uint64_t chan_key, int session_objd, int channel_objd, char *name,
-               char *sig, size_t nr_fields, struct ustctl_field *fields, int loglevel,
-               char *model_emf_uri, int buffer_type, uint32_t *event_id_p,
-               struct ust_app *app);
+               char *sig, size_t nr_fields, struct ustctl_field *fields,
+               int loglevel_value, char *model_emf_uri, int buffer_type,
+               uint32_t *event_id_p, struct ust_app *app);
 struct ust_registry_event *ust_registry_find_event(
                struct ust_registry_channel *chan, char *name, char *sig);
 void ust_registry_destroy_event(struct ust_registry_channel *chan,
@@ -302,8 +302,9 @@ void ust_registry_session_destroy(struct ust_registry_session *session)
 static inline
 int ust_registry_create_event(struct ust_registry_session *session,
                uint64_t chan_key, int session_objd, int channel_objd, char *name,
-               char *sig, size_t nr_fields, struct ustctl_field *fields, int loglevel,
-               char *model_emf_uri, int buffer_type, uint32_t *event_id_p)
+               char *sig, size_t nr_fields, struct ustctl_field *fields,
+               int loglevel_value, char *model_emf_uri, int buffer_type,
+               uint32_t *event_id_p)
 {
        return 0;
 }
index 93ef7ac093e2fe241b44d31c5a6a4640ca35911c..843b6b66298fff3d19a576ebe695606f3bc543bc 100644 (file)
@@ -55,7 +55,7 @@ struct lttcomm_agent_hdr {
  * Enable event command payload.
  */
 struct lttcomm_agent_enable {
-       uint32_t loglevel;
+       uint32_t loglevel_value;
        uint32_t loglevel_type;
        char name[LTTNG_SYMBOL_NAME_LEN];
 } LTTNG_PACKED;
This page took 0.038625 seconds and 4 git commands to generate.