From 13b21cd60df2abab292653cead980ef27dbfab08 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sun, 3 Mar 2013 18:22:36 -0500 Subject: [PATCH] Cleanup: remove now unused metadata code from UST Signed-off-by: Mathieu Desnoyers --- include/lttng/ust-events.h | 12 ++-- liblttng-ust/Makefile.am | 2 - liblttng-ust/lttng-events.c | 63 +++++-------------- liblttng-ust/lttng-ust-abi.c | 90 --------------------------- liblttng-ust/probes/lttng-probe-ust.c | 25 -------- liblttng-ust/probes/lttng-probe-ust.h | 47 -------------- 6 files changed, 20 insertions(+), 219 deletions(-) delete mode 100644 liblttng-ust/probes/lttng-probe-ust.c delete mode 100644 liblttng-ust/probes/lttng-probe-ust.h diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index 663ffbe3..05966ff6 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -356,7 +356,7 @@ struct lttng_event { struct cds_list_head node; /* Event list in session */ struct cds_list_head _deprecated2; void *_deprecated3; - unsigned int metadata_dumped:1; + unsigned int _deprecated4:1; /* LTTng-UST 2.1 starts here */ /* list of struct lttng_bytecode_runtime, sorted by seqnum */ @@ -426,7 +426,7 @@ struct lttng_channel { const struct lttng_channel_ops *ops; int header_type; /* 0: unset, 1: compact, 2: large */ struct lttng_ust_shm_handle *handle; /* shared-memory handle */ - unsigned int metadata_dumped:1; + unsigned int _deprecated3:1; /* Channel ID */ unsigned int id; @@ -450,13 +450,13 @@ struct lttng_session { int active; /* Is trace session active ? */ int been_active; /* Been active ? */ int objd; /* Object associated */ - struct lttng_channel *metadata; /* Metadata channel */ + void *_deprecated1; struct cds_list_head chan_head; /* Channel list head */ struct cds_list_head events_head; /* list of events */ - struct cds_list_head _deprecated1; + struct cds_list_head _deprecated2; struct cds_list_head node; /* Session list */ - int _deprecated2; - unsigned int metadata_dumped:1; + int _deprecated3; + unsigned int _deprecated4:1; /* New UST 2.1 */ /* List of enablers */ diff --git a/liblttng-ust/Makefile.am b/liblttng-ust/Makefile.am index 86661c6b..a5076c6e 100644 --- a/liblttng-ust/Makefile.am +++ b/liblttng-ust/Makefile.am @@ -20,8 +20,6 @@ liblttng_ust_runtime_la_SOURCES = \ lttng-ust-comm.c \ lttng-ust-abi.c \ lttng-probes.c \ - probes/lttng-probe-ust.c \ - probes/lttng-probe-ust.h \ lttng-context-vtid.c \ lttng-context-vpid.c \ lttng-context-pthread-id.c \ diff --git a/liblttng-ust/lttng-events.c b/liblttng-ust/lttng-events.c index ec5d78f5..00babd0e 100644 --- a/liblttng-ust/lttng-events.c +++ b/liblttng-ust/lttng-events.c @@ -266,8 +266,6 @@ int lttng_channel_enable(struct lttng_channel *channel) { int old; - if (channel == channel->session->metadata) - return -EPERM; old = uatomic_xchg(&channel->enabled, 1); if (old) return -EEXIST; @@ -278,38 +276,12 @@ int lttng_channel_disable(struct lttng_channel *channel) { int old; - if (channel == channel->session->metadata) - return -EPERM; old = uatomic_xchg(&channel->enabled, 0); if (!old) return -EEXIST; return 0; } -int lttng_event_enable(struct lttng_event *event) -{ - int old; - - if (event->chan == event->chan->session->metadata) - return -EPERM; - old = uatomic_xchg(&event->enabled, 1); - if (old) - return -EEXIST; - return 0; -} - -int lttng_event_disable(struct lttng_event *event) -{ - int old; - - if (event->chan == event->chan->session->metadata) - return -EPERM; - old = uatomic_xchg(&event->enabled, 0); - if (!old) - return -EEXIST; - return 0; -} - /* * Supports event creation while tracing session is active. */ @@ -370,25 +342,20 @@ int lttng_event_create(const struct lttng_event_desc *desc, else uri = NULL; - /* Don't register metadata events */ - if (session->metadata == chan) { - event->id = -1U; - } else { - /* Fetch event ID from sessiond */ - ret = ustcomm_register_event(notify_socket, - session->objd, - chan->objd, - event_name, - loglevel, - desc->signature, - desc->nr_fields, - desc->fields, - uri, - &event->id); - if (ret < 0) { - DBG("Error (%d) registering event to sessiond", ret); - goto sessiond_register_error; - } + /* Fetch event ID from sessiond */ + ret = ustcomm_register_event(notify_socket, + session->objd, + chan->objd, + event_name, + loglevel, + desc->signature, + desc->nr_fields, + desc->fields, + uri, + &event->id); + if (ret < 0) { + DBG("Error (%d) registering event to sessiond", ret); + goto sessiond_register_error; } /* Populate lttng_event structure before tracepoint registration. */ @@ -685,8 +652,6 @@ int lttng_enabler_enable(struct lttng_enabler *enabler) int lttng_enabler_disable(struct lttng_enabler *enabler) { - if (enabler->chan == enabler->chan->session->metadata) - return -EPERM; enabler->enabled = 0; lttng_session_lazy_sync_enablers(enabler->chan->session); return 0; diff --git a/liblttng-ust/lttng-ust-abi.c b/liblttng-ust/lttng-ust-abi.c index 1e146e61..acf3c849 100644 --- a/liblttng-ust/lttng-ust-abi.c +++ b/liblttng-ust/lttng-ust-abi.c @@ -369,39 +369,6 @@ static const struct lttng_ust_objd_ops lttng_ops = { .cmd = lttng_cmd, }; -/* - * We tolerate no failure in this function (if one happens, we print a dmesg - * error, but cannot return any error, because the channel information is - * invariant. - */ -static -void lttng_metadata_create_events(int channel_objd) -{ - struct lttng_channel *chan = objd_private(channel_objd); - struct lttng_enabler *enabler; - static struct lttng_ust_event metadata_params = { - .instrumentation = LTTNG_UST_TRACEPOINT, - .name = "lttng_ust:metadata", - .loglevel_type = LTTNG_UST_LOGLEVEL_ALL, - .loglevel = TRACE_DEFAULT, - }; - - /* - * We tolerate no failure path after event creation. It will stay - * invariant for the rest of the session. - */ - enabler = lttng_enabler_create(LTTNG_ENABLER_EVENT, - &metadata_params, chan); - if (!enabler) { - goto create_error; - } - return; - -create_error: - WARN_ON(1); - return; /* not allowed to return error */ -} - int lttng_abi_map_channel(int session_objd, struct lttng_ust_channel *ust_chan, union ust_args *uargs, @@ -427,7 +394,6 @@ int lttng_abi_map_channel(int session_objd, switch (type) { case LTTNG_UST_CHAN_PER_CPU: - case LTTNG_UST_CHAN_METADATA: break; default: return -EINVAL; @@ -465,15 +431,6 @@ int lttng_abi_map_channel(int session_objd, } chan_name = "channel"; break; - case LTTNG_UST_CHAN_METADATA: - if (config->output == RING_BUFFER_MMAP) { - transport_name = "relay-metadata-mmap"; - } else { - ret = -EINVAL; - goto notransport; - } - chan_name = "metadata"; - break; default: transport_name = ""; chan_name = ""; @@ -506,7 +463,6 @@ int lttng_abi_map_channel(int session_objd, cds_list_add(<tng_chan->node, &session->chan_head); lttng_chan->header_type = 0; lttng_chan->handle = channel_handle; - lttng_chan->metadata_dumped = 0; lttng_chan->type = type; /* @@ -545,8 +501,6 @@ active: * Enables tracing for a session (weak enable) * LTTNG_UST_DISABLE * Disables tracing for a session (strong disable) - * LTTNG_UST_METADATA - * Returns a LTTng metadata object descriptor * * The returned channel will be deleted when its file descriptor is closed. */ @@ -610,12 +564,9 @@ long lttng_tracepoint_list_cmd(int objd, unsigned int cmd, unsigned long arg, switch (cmd) { case LTTNG_UST_TRACEPOINT_LIST_GET: { - retry: iter = lttng_ust_tracepoint_list_get_iter_next(list); if (!iter) return -LTTNG_UST_ERR_NOENT; - if (!strcmp(iter->name, "lttng_ust:metadata")) - goto retry; memcpy(tp, iter, sizeof(*tp)); return 0; } @@ -692,12 +643,9 @@ long lttng_tracepoint_field_list_cmd(int objd, unsigned int cmd, switch (cmd) { case LTTNG_UST_TRACEPOINT_FIELD_LIST_GET: { - retry: iter = lttng_ust_field_list_get_iter_next(list); if (!iter) return -LTTNG_UST_ERR_NOENT; - if (!strcmp(iter->event_name, "lttng_ust:metadata")) - goto retry; memcpy(tp, iter, sizeof(*tp)); return 0; } @@ -824,40 +772,6 @@ objd_error: return ret; } -static -long lttng_metadata_cmd(int objd, unsigned int cmd, unsigned long arg, - union ust_args *uargs, void *owner) -{ - struct lttng_channel *channel = objd_private(objd); - struct lttng_session *session = channel->session; - - switch (cmd) { - case LTTNG_UST_STREAM: - { - struct lttng_ust_stream *stream; - int ret; - - stream = (struct lttng_ust_stream *) arg; - /* stream used as output */ - ret = lttng_abi_map_stream(objd, stream, uargs, owner); - if (ret == 0) { - session->metadata = channel; - lttng_metadata_create_events(objd); - } - return ret; - } - case LTTNG_UST_FLUSH_BUFFER: - { - if (!session->metadata) { - return -ENOENT; - } - return channel->ops->flush_buffer(channel->chan, channel->handle); - } - default: - return -EINVAL; - } -} - /** * lttng_channel_cmd - lttng control through object descriptors * @@ -896,10 +810,6 @@ long lttng_channel_cmd(int objd, unsigned int cmd, unsigned long arg, return -EPERM; } - if (channel->type == LTTNG_UST_CHAN_METADATA) { - return lttng_metadata_cmd(objd, cmd, arg, uargs, owner); - } - switch (cmd) { case LTTNG_UST_STREAM: { diff --git a/liblttng-ust/probes/lttng-probe-ust.c b/liblttng-ust/probes/lttng-probe-ust.c deleted file mode 100644 index 2f83e28c..00000000 --- a/liblttng-ust/probes/lttng-probe-ust.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * probes/lttng-probe-ust.c - * - * LTTng UST core probes. - * - * Copyright 2010-2012 (c) - Mathieu Desnoyers - * - * 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; only - * 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 - */ - -#define TRACEPOINT_DEFINE -#define TRACEPOINT_CREATE_PROBES -#include "lttng-probe-ust.h" diff --git a/liblttng-ust/probes/lttng-probe-ust.h b/liblttng-ust/probes/lttng-probe-ust.h deleted file mode 100644 index 433d5dbf..00000000 --- a/liblttng-ust/probes/lttng-probe-ust.h +++ /dev/null @@ -1,47 +0,0 @@ -#undef TRACEPOINT_PROVIDER -#define TRACEPOINT_PROVIDER lttng_ust - -#if !defined(_TRACEPOINT_LTTNG_UST_H) || defined(TRACEPOINT_HEADER_MULTI_READ) -#define _TRACEPOINT_LTTNG_UST_H - -/* - * Copyright (C) 2011 Mathieu Desnoyers - * - * 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 - */ - -#include - -TRACEPOINT_EVENT(lttng_ust, metadata, - - TP_ARGS(const char *, str), - - /* - * Not exactly a string: more a sequence of bytes (dynamic - * array) without the length. This is a dummy anyway: we only - * use this declaration to generate an event metadata entry. - */ - TP_FIELDS( - ctf_string(str, str) - ) -) - -#undef TRACEPOINT_INCLUDE -#define TRACEPOINT_INCLUDE "./probes/lttng-probe-ust.h" - -#endif /* _TRACEPOINT_LTTNG_UST_H */ - -/* This part must be outside ifdef protection */ -#include -- 2.34.1