Custom branch: stable-2.12-urcu-dep-rev-3
[lttng-ust.git] / liblttng-ust / lttng-filter.c
index b7f058a8dac27d680d82786ef9f9337a7b5b6410..947ed843917579fcee828f6e9aba95a88504e238 100644 (file)
@@ -170,6 +170,8 @@ static const char *opnames[] = {
        [ FILTER_OP_LOAD_FIELD_DOUBLE ] = "LOAD_FIELD_DOUBLE",
 
        [ FILTER_OP_UNARY_BIT_NOT ] = "UNARY_BIT_NOT",
+
+       [ FILTER_OP_RETURN_S64 ] = "RETURN_S64",
 };
 
 const char *print_op(enum filter_op op)
@@ -252,9 +254,23 @@ int apply_field_reloc(struct lttng_event *event,
                        op->op = FILTER_OP_LOAD_FIELD_REF_S64;
                        break;
                case atype_array:
+               {
+                       const struct lttng_basic_type *elem_type = &field->type.u.array.elem_type;
+
+                       if (elem_type->atype != atype_integer || elem_type->u.basic.integer.encoding == lttng_encode_none)
+                               return -EINVAL;
+                       op->op = FILTER_OP_LOAD_FIELD_REF_SEQUENCE;
+                       break;
+               }
                case atype_sequence:
+               {
+                       const struct lttng_basic_type *elem_type = &field->type.u.sequence.elem_type;
+
+                       if (elem_type->atype != atype_integer || elem_type->u.basic.integer.encoding == lttng_encode_none)
+                               return -EINVAL;
                        op->op = FILTER_OP_LOAD_FIELD_REF_SEQUENCE;
                        break;
+               }
                case atype_string:
                        op->op = FILTER_OP_LOAD_FIELD_REF_STRING;
                        break;
@@ -327,9 +343,25 @@ int apply_context_reloc(struct lttng_event *event,
                        op->op = FILTER_OP_GET_CONTEXT_REF_S64;
                        break;
                        /* Sequence and array supported as string */
-               case atype_string:
                case atype_array:
+               {
+                       const struct lttng_basic_type *elem_type = &ctx_field->event_field.type.u.array.elem_type;
+
+                       if (elem_type->atype != atype_integer || elem_type->u.basic.integer.encoding == lttng_encode_none)
+                               return -EINVAL;
+                       op->op = FILTER_OP_GET_CONTEXT_REF_STRING;
+                       break;
+               }
                case atype_sequence:
+               {
+                       const struct lttng_basic_type *elem_type = &ctx_field->event_field.type.u.sequence.elem_type;
+
+                       if (elem_type->atype != atype_integer || elem_type->u.basic.integer.encoding == lttng_encode_none)
+                               return -EINVAL;
+                       op->op = FILTER_OP_GET_CONTEXT_REF_STRING;
+                       break;
+               }
+               case atype_string:
                        op->op = FILTER_OP_GET_CONTEXT_REF_STRING;
                        break;
                case atype_float:
This page took 0.026152 seconds and 5 git commands to generate.