/*
- * Copyright (C) 2014 - Jonathan Rajotte <jonathan.r.julien@gmail.com>
- * - Olivier Cotte <olivier.cotte@polymtl.ca>
- * Copyright (C) 2016 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright (C) 2014 Jonathan Rajotte <jonathan.r.julien@gmail.com>
+ * Copyright (C) 2014 Olivier Cotte <olivier.cotte@polymtl.ca>
+ * Copyright (C) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License, version 2 only, as
- * published by the Free Software Foundation.
+ * SPDX-License-Identifier: GPL-2.0-only
*
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define _LGPL_SOURCE
#include <common/config/session-config.h>
#include <common/defaults.h>
#include <lttng/snapshot-internal.h>
+#include <lttng/tracker-internal.h>
#include <lttng/channel.h>
#include "mi-lttng.h"
LTTNG_HIDDEN
int mi_lttng_id_target(struct mi_writer *writer,
enum lttng_tracker_type tracker_type,
- struct lttng_tracker_id *id,
+ const struct lttng_tracker_id *id,
int is_open)
{
int ret;
const char *element_id_tracker, *element_target_id;
+ enum lttng_tracker_id_status status;
+ int value;
+ const char *string;
ret = get_tracker_elements(
tracker_type, &element_id_tracker, &element_target_id);
return ret;
}
- switch (id->type) {
+ switch (lttng_tracker_id_get_type(id)) {
case LTTNG_ID_ALL:
ret = mi_lttng_writer_open_element(writer, element_target_id);
if (ret) {
if (ret) {
goto end;
}
+
+ status = lttng_tracker_id_get_value(id, &value);
+ if (status != LTTNG_TRACKER_ID_STATUS_OK) {
+ ret = -1;
+ goto end;
+ }
+
ret = mi_lttng_writer_write_element_signed_int(
- writer, config_element_id, id->value);
+ writer, config_element_id, value);
if (ret) {
goto end;
}
if (ret) {
goto end;
}
+
+ status = lttng_tracker_id_get_string(id, &string);
+ if (status != LTTNG_TRACKER_ID_STATUS_OK) {
+ ret = -1;
+ goto end;
+ }
+
ret = mi_lttng_writer_write_element_string(
- writer, config_element_name, id->string);
+ writer, config_element_name, string);
if (ret) {
goto end;
}