X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=tests%2Fcompile%2Ftest-app-ctx%2Fhello.c;h=6b1a6bd30251058abc2c20773c39e8cd1b9f2b87;hb=02275a1d8e68c32173b45f5a0e3b27d97007c840;hp=ec51263572090336db394eb90cbef9cef77b438e;hpb=86133cafe8f32497f53f4b469b8d3357470e7080;p=lttng-ust.git diff --git a/tests/compile/test-app-ctx/hello.c b/tests/compile/test-app-ctx/hello.c index ec512635..6b1a6bd3 100644 --- a/tests/compile/test-app-ctx/hello.c +++ b/tests/compile/test-app-ctx/hello.c @@ -1,20 +1,8 @@ /* - * Copyright (C) 2009 Pierre-Marc Fournier - * Copyright (C) 2011 Mathieu Desnoyers + * SPDX-License-Identifier: LGPL-2.1-only * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; version 2.1 of - * the License. - * - * 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 + * Copyright (C) 2009 Pierre-Marc Fournier + * Copyright (C) 2011 Mathieu Desnoyers */ #include @@ -40,10 +28,10 @@ struct mmsghdr; #define TRACEPOINT_DEFINE #include "ust_tests_hello.h" -/* Internal header. */ #include -#include -#include +#include +/* Internal header. */ +#include static __thread unsigned int test_count; @@ -53,7 +41,7 @@ void test_inc_count(void) } static -size_t test_get_size(struct lttng_ctx_field *field, size_t offset) +size_t test_get_size(struct lttng_ust_ctx_field *field, size_t offset) { int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES; size_t size = 0; @@ -114,15 +102,15 @@ size_t test_get_size(struct lttng_ctx_field *field, size_t offset) } static -void test_record(struct lttng_ctx_field *field, +void test_record(struct lttng_ust_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan) + struct lttng_ust_channel_buffer *lttng_chan_buf) { int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES; char sel_char = (char) sel; lib_ring_buffer_align_ctx(ctx, lttng_alignof(char)); - chan->ops->event_write(ctx, &sel_char, sizeof(sel_char)); + lttng_chan_buf->ops->event_write(ctx, &sel_char, sizeof(sel_char)); switch (sel) { case LTTNG_UST_DYNAMIC_TYPE_NONE: break; @@ -131,7 +119,7 @@ void test_record(struct lttng_ctx_field *field, int8_t v = -8; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_S16: @@ -139,7 +127,7 @@ void test_record(struct lttng_ctx_field *field, int16_t v = -16; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_S32: @@ -147,7 +135,7 @@ void test_record(struct lttng_ctx_field *field, int32_t v = -32; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_S64: @@ -155,7 +143,7 @@ void test_record(struct lttng_ctx_field *field, int64_t v = -64; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U8: @@ -163,7 +151,7 @@ void test_record(struct lttng_ctx_field *field, uint8_t v = 8; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U16: @@ -171,7 +159,7 @@ void test_record(struct lttng_ctx_field *field, uint16_t v = 16; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U32: @@ -179,7 +167,7 @@ void test_record(struct lttng_ctx_field *field, uint32_t v = 32; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U64: @@ -187,7 +175,7 @@ void test_record(struct lttng_ctx_field *field, uint64_t v = 64; lib_ring_buffer_align_ctx(ctx, lttng_alignof(v)); - chan->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_FLOAT: @@ -195,7 +183,7 @@ void test_record(struct lttng_ctx_field *field, float f = 22322.0; lib_ring_buffer_align_ctx(ctx, lttng_alignof(f)); - chan->ops->event_write(ctx, &f, sizeof(f)); + lttng_chan_buf->ops->event_write(ctx, &f, sizeof(f)); break; } case LTTNG_UST_DYNAMIC_TYPE_DOUBLE: @@ -203,13 +191,13 @@ void test_record(struct lttng_ctx_field *field, double d = 2.0; lib_ring_buffer_align_ctx(ctx, lttng_alignof(d)); - chan->ops->event_write(ctx, &d, sizeof(d)); + lttng_chan_buf->ops->event_write(ctx, &d, sizeof(d)); break; } case LTTNG_UST_DYNAMIC_TYPE_STRING: { const char *str = "teststr"; - chan->ops->event_write(ctx, str, strlen(str) + 1); + lttng_chan_buf->ops->event_write(ctx, str, strlen(str) + 1); break; } default: @@ -218,8 +206,8 @@ void test_record(struct lttng_ctx_field *field, } static -void test_get_value(struct lttng_ctx_field *field, - struct lttng_ctx_value *value) +void test_get_value(struct lttng_ust_ctx_field *field, + struct lttng_ust_ctx_value *value) { int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES; @@ -266,6 +254,7 @@ void test_get_value(struct lttng_ctx_field *field, } struct lttng_ust_context_provider myprovider = { + .struct_size = sizeof(struct lttng_ust_context_provider), .name = "$app.myprovider", .get_size = test_get_size, .record = test_record,