From: David Goulet Date: Mon, 25 Nov 2013 20:06:13 +0000 (-0500) Subject: Fix: implicit conversion of enum types in sessiond X-Git-Tag: v2.2.6~13 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=13d9b82301f2ff8d498ac444ccc72d5e934e13dc;p=lttng-tools.git Fix: implicit conversion of enum types in sessiond Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 5d375a179..372c39916 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1810,7 +1810,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; @@ -1822,7 +1829,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 c9e6bfd13..cc0d23584 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -3176,12 +3176,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++;