From 2e84128e5c7b7a40ede7276c8ada56a56631c5dc Mon Sep 17 00:00:00 2001 From: David Goulet Date: Mon, 25 Nov 2013 15:06:13 -0500 Subject: [PATCH] Fix: implicit conversion of enum types in sessiond Signed-off-by: David Goulet --- src/bin/lttng-sessiond/cmd.c | 18 ++++++++++++++++-- src/bin/lttng-sessiond/ust-app.c | 5 +++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index d00bf1e3b..4343fb114 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -2147,7 +2147,14 @@ int cmd_calibrate(int domain, struct lttng_calibrate *calibrate) { struct lttng_kernel_calibrate kcalibrate; - kcalibrate.type = calibrate->type; + switch (calibrate->type) { + case LTTNG_CALIBRATE_FUNCTION: + default: + /* Default and only possible calibrate option. */ + kcalibrate.type = LTTNG_KERNEL_CALIBRATE_KRETPROBE; + break; + } + ret = kernel_calibrate(kernel_tracer_fd, &kcalibrate); if (ret < 0) { ret = LTTNG_ERR_KERN_ENABLE_FAIL; @@ -2159,7 +2166,14 @@ int cmd_calibrate(int domain, struct lttng_calibrate *calibrate) { struct lttng_ust_calibrate ucalibrate; - ucalibrate.type = calibrate->type; + switch (calibrate->type) { + case LTTNG_CALIBRATE_FUNCTION: + default: + /* Default and only possible calibrate option. */ + ucalibrate.type = LTTNG_UST_CALIBRATE_TRACEPOINT; + break; + } + ret = ust_app_calibrate_glb(&ucalibrate); if (ret < 0) { ret = LTTNG_ERR_UST_CALIBRATE_FAIL; diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 4912ca6c6..41a321f0a 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -3262,12 +3262,13 @@ int ust_app_list_event_fields(struct lttng_event_field **fields) } memcpy(tmp_event[count].field_name, uiter.field_name, LTTNG_UST_SYM_NAME_LEN); - tmp_event[count].type = uiter.type; + /* Mapping between these enums matches 1 to 1. */ + tmp_event[count].type = (enum lttng_event_field_type) uiter.type; tmp_event[count].nowrite = uiter.nowrite; memcpy(tmp_event[count].event.name, uiter.event_name, LTTNG_UST_SYM_NAME_LEN); tmp_event[count].event.loglevel = uiter.loglevel; - tmp_event[count].event.type = LTTNG_UST_TRACEPOINT; + tmp_event[count].event.type = LTTNG_EVENT_TRACEPOINT; tmp_event[count].event.pid = app->pid; tmp_event[count].event.enabled = -1; count++; -- 2.34.1