Collate handling of LTTNG_ENABLE_EVENT_WITH_FILTER
authorJP Ikaheimonen <jp_ikaheimonen@mentor.com>
Mon, 4 Nov 2013 14:00:26 +0000 (16:00 +0200)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 14 Nov 2013 18:40:57 +0000 (13:40 -0500)
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.

src/bin/lttng-sessiond/main.c

index d15effdabfecb70a0c9c739cbe61faf762d6fd4b..bbbc75588c6f044a159f05a9588579f639037ec4 100644 (file)
@@ -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);
This page took 0.041118 seconds and 4 git commands to generate.