Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: zhaolei@cn.fujitsu.com (Zhaolei)
Subject: [ltt-dev] [PATCH 4/4] Define string arguments as const for trace control functions
Date: Thu, 23 Oct 2008 18:47:31 +0800	[thread overview]
Message-ID: <49005643.6020401@cn.fujitsu.com> (raw)

Because trace name and trace type should not be modified in function.

Signed-off-by: Zhao Lei <zhaolei at cn.fujitsu.com>
---
 include/linux/ltt-tracer.h |    6 +++---
 ltt/ltt-tracer.c           |   16 ++++++++--------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/linux/ltt-tracer.h b/include/linux/ltt-tracer.h
index f7cb1d1..12141f9 100644
--- a/include/linux/ltt-tracer.h
+++ b/include/linux/ltt-tracer.h
@@ -698,8 +698,8 @@ union ltt_control_args {
 	} new_trace;
 };
 
-extern int ltt_control(enum ltt_control_msg msg, char *trace_name,
-		char *trace_type, union ltt_control_args args);
+extern int ltt_control(enum ltt_control_msg msg, const char *trace_name,
+		const char *trace_type, union ltt_control_args args);
 
 enum ltt_filter_control_msg {
 	LTT_FILTER_DEFAULT_ACCEPT,
@@ -707,7 +707,7 @@ enum ltt_filter_control_msg {
 };
 
 extern int ltt_filter_control(enum ltt_filter_control_msg msg,
-		char *trace_name);
+		const char *trace_name);
 
 void ltt_write_trace_header(struct ltt_trace_struct *trace,
 		struct ltt_subbuffer_header *header);
diff --git a/ltt/ltt-tracer.c b/ltt/ltt-tracer.c
index 92677a2..c69c2e9 100644
--- a/ltt/ltt-tracer.c
+++ b/ltt/ltt-tracer.c
@@ -257,7 +257,7 @@ static void async_wakeup(unsigned long data)
  * find a trace by given name.
  *
  * Returns a pointer to the trace structure, NULL if not found. */
-static struct ltt_trace_struct *_ltt_trace_find(char *trace_name)
+static struct ltt_trace_struct *_ltt_trace_find(const char *trace_name)
 {
 	struct ltt_trace_struct *trace;
 
@@ -269,7 +269,7 @@ static struct ltt_trace_struct *_ltt_trace_find(char *trace_name)
 }
 
 /* This function must be called with traces semaphore held. */
-static int _ltt_trace_create(char *trace_name,	enum trace_mode mode,
+static int _ltt_trace_create(const char *trace_name, enum trace_mode mode,
 				struct ltt_trace_struct *new_trace)
 {
 	int err = EPERM;
@@ -334,7 +334,7 @@ static inline void prepare_chan_size_num(unsigned *subbuf_size,
 	WARN_ON(hweight32(*n_subbufs) != 1);
 }
 
-static int ltt_trace_create(char *trace_name, char *trace_type,
+static int ltt_trace_create(const char *trace_name, const char *trace_type,
 		enum trace_mode mode,
 		unsigned subbuf_size_low, unsigned n_subbufs_low,
 		unsigned subbuf_size_med, unsigned n_subbufs_med,
@@ -579,7 +579,7 @@ static void __ltt_trace_destroy(struct ltt_trace_struct	*trace)
 	kref_put(&trace->kref, ltt_release_trace);
 }
 
-static int ltt_trace_destroy(char *trace_name)
+static int ltt_trace_destroy(const char *trace_name)
 {
 	int err = 0;
 	struct ltt_trace_struct *trace;
@@ -627,7 +627,7 @@ traces_error:
 	return err;
 }
 
-static int ltt_trace_start(char *trace_name)
+static int ltt_trace_start(const char *trace_name)
 {
 	int err = 0;
 	struct ltt_trace_struct *trace;
@@ -695,7 +695,7 @@ traces_error:
 	return err;
 }
 
-static int ltt_trace_stop(char *trace_name)
+static int ltt_trace_stop(const char *trace_name)
 {
 	int err = 0;
 	struct ltt_trace_struct *trace;
@@ -714,7 +714,7 @@ static int ltt_trace_stop(char *trace_name)
  * @trace_type : Type of trace (normal, flight, hybrid)
  * @args : Arguments specific to the action
  */
-int ltt_control(enum ltt_control_msg msg, char *trace_name, char *trace_type,
+int ltt_control(enum ltt_control_msg msg, const char *trace_name, const char *trace_type,
 		union ltt_control_args args)
 {
 	int err = EPERM;
@@ -754,7 +754,7 @@ EXPORT_SYMBOL_GPL(ltt_control);
  * @msg : Action to perform on the filter
  * @trace_name : Trace on which the action must be done
  */
-int ltt_filter_control(enum ltt_filter_control_msg msg, char *trace_name)
+int ltt_filter_control(enum ltt_filter_control_msg msg, const char *trace_name)
 {
 	int err;
 	struct ltt_trace_struct *trace;
-- 
1.5.5.3






             reply	other threads:[~2008-10-23 10:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-23 10:47 Zhaolei [this message]
2008-10-24 14:25 ` Mathieu Desnoyers
2008-10-24 14:28   ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49005643.6020401@cn.fujitsu.com \
    --to=zhaolei@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox