* [ltt-dev] [PATCH 4/4] Define string arguments as const for trace control functions
@ 2008-10-23 10:47 Zhaolei
2008-10-24 14:25 ` Mathieu Desnoyers
0 siblings, 1 reply; 3+ messages in thread
From: Zhaolei @ 2008-10-23 10:47 UTC (permalink / 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ltt-dev] [PATCH 4/4] Define string arguments as const for trace control functions
2008-10-23 10:47 [ltt-dev] [PATCH 4/4] Define string arguments as const for trace control functions Zhaolei
@ 2008-10-24 14:25 ` Mathieu Desnoyers
2008-10-24 14:28 ` Mathieu Desnoyers
0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Desnoyers @ 2008-10-24 14:25 UTC (permalink / raw)
* Zhaolei (zhaolei at cn.fujitsu.com) wrote:
> Because trace name and trace type should not be modified in function.
>
Merged. Thanks !
Mathieu
> 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
>
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ltt-dev] [PATCH 4/4] Define string arguments as const for trace control functions
2008-10-24 14:25 ` Mathieu Desnoyers
@ 2008-10-24 14:28 ` Mathieu Desnoyers
0 siblings, 0 replies; 3+ messages in thread
From: Mathieu Desnoyers @ 2008-10-24 14:28 UTC (permalink / raw)
* Mathieu Desnoyers (compudj at krystal.dyndns.org) wrote:
> * Zhaolei (zhaolei at cn.fujitsu.com) wrote:
[...]
> > @@ -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;
compudj at ok:~/git/morestable/linux-2.6-lttng$ scripts/checkpatch.pl patches/`quilt top`
WARNING: line over 80 characters
#97: FILE: ltt/ltt-tracer.c:698:
+int ltt_control(enum ltt_control_msg msg, const char *trace_name, const char *trace_type,
total: 0 errors, 1 warnings, 82 lines checked
I fixed the patch in my tree. I just email this as a reminder to use
checkpatch ;) (it looks like Andrew Morton eventually converted me to
checkpatch zealotness after all)
Mathieu
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-10-24 14:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-23 10:47 [ltt-dev] [PATCH 4/4] Define string arguments as const for trace control functions Zhaolei
2008-10-24 14:25 ` Mathieu Desnoyers
2008-10-24 14:28 ` Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox