From 4771f025b27e92983c1c0816c4cf5760d229c287 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 29 Nov 2011 14:31:28 -0500 Subject: [PATCH] Rename kernel-ctl.c/.h to kernel.c/.h Just to follow the function call standard and since kernelctl exist out of the code tree. Also remove ust-ctl.c which is not used and not compiled at all. Signed-off-by: David Goulet --- lttng-sessiond/Makefile.am | 2 +- lttng-sessiond/channel.c | 2 +- lttng-sessiond/context.c | 2 +- lttng-sessiond/event.c | 2 +- lttng-sessiond/{kernel-ctl.c => kernel.c} | 2 +- lttng-sessiond/{kernel-ctl.h => kernel.h} | 0 lttng-sessiond/main.c | 2 +- lttng-sessiond/ust-ctl.c | 226 ---------------------- 8 files changed, 6 insertions(+), 232 deletions(-) rename lttng-sessiond/{kernel-ctl.c => kernel.c} (99%) rename lttng-sessiond/{kernel-ctl.h => kernel.h} (100%) delete mode 100644 lttng-sessiond/ust-ctl.c diff --git a/lttng-sessiond/Makefile.am b/lttng-sessiond/Makefile.am index 755bee4fb..7f97d9d2f 100644 --- a/lttng-sessiond/Makefile.am +++ b/lttng-sessiond/Makefile.am @@ -16,7 +16,7 @@ lttng_sessiond_SOURCES = utils.c utils.h \ hashtable.c hashtable.h \ compat/poll.h $(COMPAT) \ trace-kernel.c trace-kernel.h \ - kernel-ctl.c kernel-ctl.h \ + kernel.c kernel.h \ ust-ctl.h ust-app.h trace-ust.h \ context.c context.h \ channel.c channel.h \ diff --git a/lttng-sessiond/channel.c b/lttng-sessiond/channel.c index 6b3329edd..fb46b4ad6 100644 --- a/lttng-sessiond/channel.c +++ b/lttng-sessiond/channel.c @@ -24,7 +24,7 @@ #include "channel.h" #include "hashtable.h" -#include "kernel-ctl.h" +#include "kernel.h" #include "ust-ctl.h" #include "utils.h" diff --git a/lttng-sessiond/context.c b/lttng-sessiond/context.c index d36b3de80..c7c902197 100644 --- a/lttng-sessiond/context.c +++ b/lttng-sessiond/context.c @@ -27,7 +27,7 @@ #include "context.h" #include "hashtable.h" -#include "kernel-ctl.h" +#include "kernel.h" /* * Add kernel context to an event of a specific channel. diff --git a/lttng-sessiond/event.c b/lttng-sessiond/event.c index 31f7872b6..2d1fb6e68 100644 --- a/lttng-sessiond/event.c +++ b/lttng-sessiond/event.c @@ -26,7 +26,7 @@ #include "channel.h" #include "event.h" #include "hashtable.h" -#include "kernel-ctl.h" +#include "kernel.h" #include "ust-ctl.h" /* diff --git a/lttng-sessiond/kernel-ctl.c b/lttng-sessiond/kernel.c similarity index 99% rename from lttng-sessiond/kernel-ctl.c rename to lttng-sessiond/kernel.c index 52d60f004..c734e889b 100644 --- a/lttng-sessiond/kernel-ctl.c +++ b/lttng-sessiond/kernel.c @@ -27,7 +27,7 @@ #include #include -#include "kernel-ctl.h" +#include "kernel.h" /* * Add context on a kernel channel. diff --git a/lttng-sessiond/kernel-ctl.h b/lttng-sessiond/kernel.h similarity index 100% rename from lttng-sessiond/kernel-ctl.h rename to lttng-sessiond/kernel.h diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index 996349f3f..6bb471a9d 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -50,7 +50,7 @@ #include "event.h" #include "futex.h" #include "hashtable.h" -#include "kernel-ctl.h" +#include "kernel.h" #include "lttng-sessiond.h" #include "shm.h" #include "ust-app.h" diff --git a/lttng-sessiond/ust-ctl.c b/lttng-sessiond/ust-ctl.c deleted file mode 100644 index 6f73bfc66..000000000 --- a/lttng-sessiond/ust-ctl.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (C) 2011 - David Goulet - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; only version 2 - * of the License. - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#define _GNU_SOURCE -#include -#include -#include -#include - -#include -#include - -#include "ust-comm.h" -#include "ust-ctl.h" -#include "../hashtable/hash.h" - -/* - * Init command for tracer with cmd type and correct handle. - */ -static void init_command(int cmd, int handle, struct lttcomm_ust_msg *command) -{ - memset(command, 0, sizeof(struct lttcomm_ust_msg)); - - command->cmd = cmd; - command->handle = handle; -} - -/* - * Generic send command to ust tracer. Caller must free reply. - */ -static struct lttcomm_ust_reply *send_command(int sock, - struct lttcomm_ust_msg *command) -{ - struct lttcomm_ust_reply *reply; - - reply = ustcomm_send_command(sock, command); - if (reply == NULL) { - goto error; - } - - if (reply->ret_code != LTTCOMM_OK) { - ERR("Return code (%d): %s", reply->ret_code, - lttcomm_get_readable_code(reply->ret_code)); - goto error; - } - - return reply; - -error: - return NULL; -} - -/* - * Send registration done packet to the application. - */ -int ustctl_register_done(int sock) -{ - struct lttcomm_ust_msg command; - struct lttcomm_ust_reply *reply; - - DBG("Sending register done command to %d", sock); - - command.cmd = LTTNG_UST_REGISTER_DONE; - command.handle = LTTNG_UST_ROOT_HANDLE; - - reply = ustcomm_send_command(sock, &command); - if (reply == NULL) { - goto error; - } - - if (reply->ret_code != LTTCOMM_OK) { - DBG("Return code: %s", lttcomm_get_readable_code(reply->ret_code)); - goto error; - } - - return 0; - -error: - return -1; -} - -/* - * Create an UST session on the tracer. - * - * Return handle if success else negative value. - */ -int ustctl_create_session(int sock, struct ltt_ust_session *session) -{ - int ret; - struct lttcomm_ust_msg command; - struct lttcomm_ust_reply *reply = NULL; - - command.cmd = LTTNG_UST_SESSION; - command.handle = LTTNG_UST_ROOT_HANDLE; - - reply = ustcomm_send_command(sock, &command); - if (reply == NULL) { - goto error; - } - - /* Save session handle */ - ret = reply->ret_val; - free(reply); - - DBG2("ustctl create session command successful with handle %d", ret); - - return ret; - -error: - free(reply); - return -1; -} - -/* - * Create UST channel to the tracer. - * - * Return handle if success else negative value. - */ -int ustctl_create_channel(int sock, struct ltt_ust_session *session, - struct lttng_ust_channel *channel) -{ - int ret; - struct lttcomm_ust_msg command; - struct lttcomm_ust_reply *reply = NULL; - - init_command(LTTNG_UST_CHANNEL, session->handle, &command); - /* Copy channel attributes to command */ - memcpy(&command.u.channel, channel, sizeof(command.u.channel)); - - /* Send command to tracer */ - reply = send_command(sock, &command); - if (reply == NULL) { - goto error; - } - - ret = reply->ret_val; - free(reply); - - return ret; - -error: - free(reply); - return -1; -} - -/* - * Enable UST channel. - */ -int ustctl_enable_channel(int sock, struct ltt_ust_session *session, - struct ltt_ust_channel *chan) -{ - struct lttcomm_ust_msg command; - struct lttcomm_ust_reply *reply = NULL; - - init_command(LTTNG_UST_ENABLE, chan->handle, &command); - - reply = ustcomm_send_command(sock, &command); - if (reply == NULL) { - goto error; - } - - if (reply->handle != chan->handle) { - ERR("Receive wrong handle from UST reply on enable channel"); - goto error; - } - - chan->enabled = 1; - free(reply); - - DBG2("ustctl enable channel successful for sock %d", sock); - return 0; - -error: - free(reply); - return -1; -} - -/* - * Disable UST channel. - */ -int ustctl_disable_channel(int sock, struct ltt_ust_session *session, - struct ltt_ust_channel *chan) -{ - struct lttcomm_ust_msg command; - struct lttcomm_ust_reply *reply = NULL; - - memset(&command, 0, sizeof(command)); - - command.cmd = LTTNG_UST_DISABLE; - command.handle = chan->handle; - - reply = ustcomm_send_command(sock, &command); - if (reply == NULL) { - goto error; - } - - if (reply->handle != chan->handle) { - ERR("Receive wrong handle from UST reply on enable channel"); - goto error; - } - - chan->enabled = 1; - free(reply); - - DBG2("ustctl disable channel successful for sock %d", sock); - return 0; - -error: - free(reply); - return -1; -} -- 2.34.1