From: JP Ikaheimonen Date: Mon, 4 Nov 2013 14:00:26 +0000 (+0200) Subject: Collate handling of LTTNG_ENABLE_EVENT_WITH_FILTER X-Git-Tag: v2.4.0-rc1~31 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=de2fad4824768bbd5d1ed4f630caae1ee1f842fd;p=lttng-tools.git Collate handling of LTTNG_ENABLE_EVENT_WITH_FILTER Because the handling of LTTNG_ENABLE_EVENT_WITH_EXCLUSION can now handle commands of type LTTNG_ENABLE_EVENT_WITH_FILTER, there's no reason to have the same code appear twice. Remove the code for LTTNG_ENABLE_EVENT_WITH_FILTER and use the same code as is used for LTTNG_ENABLE_EVENT_WITH_EXCLUSION. --- diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index d15effdab..bbbc75588 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -2937,6 +2937,7 @@ skip_domain: } case LTTNG_ENABLE_EVENT: case LTTNG_ENABLE_EVENT_WITH_EXCLUSION: + case LTTNG_ENABLE_EVENT_WITH_FILTER: { struct lttng_event_exclusion *exclusion = NULL; struct lttng_filter_bytecode *bytecode = NULL; @@ -3326,46 +3327,6 @@ skip_domain: cmd_ctx->lsm->u.reg.path, cdata); break; } - case LTTNG_ENABLE_EVENT_WITH_FILTER: - { - struct lttng_filter_bytecode *bytecode; - - if (cmd_ctx->lsm->u.enable.bytecode_len > LTTNG_FILTER_MAX_LEN) { - ret = LTTNG_ERR_FILTER_INVAL; - goto error; - } - if (cmd_ctx->lsm->u.enable.bytecode_len == 0) { - ret = LTTNG_ERR_FILTER_INVAL; - goto error; - } - bytecode = zmalloc(cmd_ctx->lsm->u.enable.bytecode_len); - if (!bytecode) { - ret = LTTNG_ERR_FILTER_NOMEM; - goto error; - } - /* Receive var. len. data */ - DBG("Receiving var len data from client ..."); - ret = lttcomm_recv_unix_sock(sock, bytecode, - cmd_ctx->lsm->u.enable.bytecode_len); - if (ret <= 0) { - DBG("Nothing recv() from client var len data... continuing"); - *sock_error = 1; - ret = LTTNG_ERR_FILTER_INVAL; - goto error; - } - - if (bytecode->len + sizeof(*bytecode) - != cmd_ctx->lsm->u.enable.bytecode_len) { - free(bytecode); - ret = LTTNG_ERR_FILTER_INVAL; - goto error; - } - - ret = cmd_enable_event(cmd_ctx->session, &cmd_ctx->lsm->domain, - cmd_ctx->lsm->u.enable.channel_name, - &cmd_ctx->lsm->u.enable.event, bytecode, NULL, kernel_poll_pipe[1]); - break; - } case LTTNG_DATA_PENDING: { ret = cmd_data_pending(cmd_ctx->session);