X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=include%2Flttng%2Fcondition%2Fcondition-internal.h;h=92bb4de71bd8283877bc579af666ab7e74aee05d;hp=72a8922b0087018baf1d6b527d62ee1d2bc1071f;hb=0de2479d5f5a287d31c69e34ea5202a69019f224;hpb=a58c490f0bff52a73717d31d04d1472629180de2 diff --git a/include/lttng/condition/condition-internal.h b/include/lttng/condition/condition-internal.h index 72a8922b0..92bb4de71 100644 --- a/include/lttng/condition/condition-internal.h +++ b/include/lttng/condition/condition-internal.h @@ -1,18 +1,8 @@ /* - * Copyright (C) 2017 - Jérémie Galarneau + * Copyright (C) 2017 Jérémie Galarneau * - * 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 */ #ifndef LTTNG_CONDITION_INTERNAL_H @@ -20,22 +10,28 @@ #include #include -#include +#include +#include #include #include +#include #include +#include typedef void (*condition_destroy_cb)(struct lttng_condition *condition); typedef bool (*condition_validate_cb)(const struct lttng_condition *condition); -typedef ssize_t (*condition_serialize_cb)( - const struct lttng_condition *condition, char *buf); +typedef int (*condition_serialize_cb)( + const struct lttng_condition *condition, + struct lttng_payload *payload); typedef bool (*condition_equal_cb)(const struct lttng_condition *a, const struct lttng_condition *b); -typedef ssize_t (*condition_create_from_buffer_cb)( - const struct lttng_buffer_view *view, +typedef ssize_t (*condition_create_from_payload_cb)( + struct lttng_payload_view *view, struct lttng_condition **condition); struct lttng_condition { + /* Reference counting is only exposed to internal users. */ + struct urcu_ref ref; enum lttng_condition_type type; condition_validate_cb validate; condition_serialize_cb serialize; @@ -49,6 +45,12 @@ struct lttng_condition_comm { char payload[]; }; +LTTNG_HIDDEN +void lttng_condition_get(struct lttng_condition *condition); + +LTTNG_HIDDEN +void lttng_condition_put(struct lttng_condition *condition); + LTTNG_HIDDEN void lttng_condition_init(struct lttng_condition *condition, enum lttng_condition_type type); @@ -57,16 +59,19 @@ LTTNG_HIDDEN bool lttng_condition_validate(const struct lttng_condition *condition); LTTNG_HIDDEN -ssize_t lttng_condition_create_from_buffer( - const struct lttng_buffer_view *buffer, +ssize_t lttng_condition_create_from_payload( + struct lttng_payload_view *view, struct lttng_condition **condition); LTTNG_HIDDEN -ssize_t lttng_condition_serialize(const struct lttng_condition *condition, - char *buf); +int lttng_condition_serialize(const struct lttng_condition *condition, + struct lttng_payload *payload); LTTNG_HIDDEN bool lttng_condition_is_equal(const struct lttng_condition *a, const struct lttng_condition *b); +LTTNG_HIDDEN +const char *lttng_condition_type_str(enum lttng_condition_type type); + #endif /* LTTNG_CONDITION_INTERNAL_H */