Move to kernel style SPDX license identifiers
[lttng-tools.git] / src / common / evaluation.c
index f07c81b18cf9747250bc3284ff04cf713d4ebbb7..efd2129217e8829816808901ecf3351baa173d38 100644 (file)
@@ -1,30 +1,28 @@
 /*
- * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License, version 2.1 only,
- * as published by the Free Software Foundation.
+ * SPDX-License-Identifier: LGPL-2.1-only
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <lttng/condition/evaluation-internal.h>
 #include <lttng/condition/buffer-usage-internal.h>
 #include <lttng/condition/session-consumed-size-internal.h>
+#include <lttng/condition/session-rotation-internal.h>
 #include <common/macros.h>
 #include <common/error.h>
 #include <stdbool.h>
 #include <assert.h>
 
 LTTNG_HIDDEN
-int lttng_evaluation_serialize(struct lttng_evaluation *evaluation,
+void lttng_evaluation_init(struct lttng_evaluation *evaluation,
+               enum lttng_condition_type type)
+{
+       evaluation->type = type;
+}
+
+LTTNG_HIDDEN
+int lttng_evaluation_serialize(const struct lttng_evaluation *evaluation,
                struct lttng_dynamic_buffer *buf)
 {
        int ret;
@@ -92,6 +90,22 @@ ssize_t lttng_evaluation_create_from_buffer(
                }
                evaluation_size += ret;
                break;
+       case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING:
+               ret = lttng_evaluation_session_rotation_ongoing_create_from_buffer(
+                               &evaluation_view, evaluation);
+               if (ret < 0) {
+                       goto end;
+               }
+               evaluation_size += ret;
+               break;
+       case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED:
+               ret = lttng_evaluation_session_rotation_completed_create_from_buffer(
+                               &evaluation_view, evaluation);
+               if (ret < 0) {
+                       goto end;
+               }
+               evaluation_size += ret;
+               break;
        default:
                ERR("Attempted to create evaluation of unknown type (%i)",
                                (int) evaluation_comm->type);
This page took 0.026208 seconds and 5 git commands to generate.