From mboxrd@z Thu Jan 1 00:00:00 1970 From: zhaolei@cn.fujitsu.com (Zhaolei) Date: Thu, 23 Oct 2008 18:47:31 +0800 Subject: [ltt-dev] [PATCH 4/4] Define string arguments as const for trace control functions Message-ID: <49005643.6020401@cn.fujitsu.com> Because trace name and trace type should not be modified in function. Signed-off-by: Zhao Lei --- 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