[for-next][PATCH 07/17] tracing/probes: Move fetch function helpers to trace_probe.h

2014-01-02 Thread Steven Rostedt
From: Namhyung Kim 

Move fetch function helper macros/functions to the header file and
make them external.  This is preparation of supporting uprobe fetch
table in next patch.

Acked-by: Masami Hiramatsu 
Acked-by: Oleg Nesterov 
Cc: Srikar Dronamraju 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_probe.c | 74 --
 kernel/trace/trace_probe.h | 65 
 2 files changed, 78 insertions(+), 61 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index d8347b0..c26bc9e 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -35,19 +35,15 @@ const char *reserved_field_names[] = {
FIELD_STRING_FUNC,
 };
 
-/* Printing function type */
-#define PRINT_TYPE_FUNC_NAME(type) print_type_##type
-#define PRINT_TYPE_FMT_NAME(type)  print_type_format_##type
-
 /* Printing  in basic type function template */
 #define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)
\
-static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,   \
+__kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,  \
const char *name,   \
void *data, void *ent)  \
 {  \
return trace_seq_printf(s, " %s=" fmt, name, *(type *)data);\
 }  \
-static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
+const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
 
 DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , "0x%x")
 DEFINE_BASIC_PRINT_TYPE_FUNC(u16, "0x%x")
@@ -58,23 +54,12 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, "%Ld")
 
-static inline void *get_rloc_data(u32 *dl)
-{
-   return (u8 *)dl + get_rloc_offs(*dl);
-}
-
-/* For data_loc conversion */
-static inline void *get_loc_data(u32 *dl, void *ent)
-{
-   return (u8 *)ent + get_rloc_offs(*dl);
-}
-
 /* For defining macros, define string/string_size types */
 typedef u32 string;
 typedef u32 string_size;
 
 /* Print type function for string type */
-static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
+__kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
  const char *name,
  void *data, void *ent)
 {
@@ -87,7 +72,7 @@ static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct 
trace_seq *s,
(const char *)get_loc_data(data, ent));
 }
 
-static const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
+const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
 
 #define FETCH_FUNC_NAME(method, type)  fetch_##method##_##type
 /*
@@ -111,7 +96,7 @@ DEFINE_FETCH_##method(u64)
 
 /* Data fetch function templates */
 #define DEFINE_FETCH_reg(type) \
-static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs, \
+__kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,
\
void *offset, void *dest)   \
 {  \
*(type *)dest = (type)regs_get_register(regs,   \
@@ -123,7 +108,7 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
 #define fetch_reg_string_size  NULL
 
 #define DEFINE_FETCH_stack(type)   \
-static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,  \
  void *offset, void *dest) \
 {  \
*(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
@@ -135,7 +120,7 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
 #define fetch_stack_string_sizeNULL
 
 #define DEFINE_FETCH_retval(type)  \
-static __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs, \
  void *dummy, void *dest)  \
 {  \
*(type *)dest = (type)regs_return_value(regs);  \
@@ -146,7 +131,7 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
 #define fetch_retval_string_size   NULL
 
 #define DEFINE_FETCH_memory(type)  \
-static __kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs, \
  void *addr, void *dest)   \
 {   

[for-next][PATCH 07/17] tracing/probes: Move fetch function helpers to trace_probe.h

2014-01-02 Thread Steven Rostedt
From: Namhyung Kim namhyung@lge.com

Move fetch function helper macros/functions to the header file and
make them external.  This is preparation of supporting uprobe fetch
table in next patch.

Acked-by: Masami Hiramatsu masami.hiramatsu...@hitachi.com
Acked-by: Oleg Nesterov o...@redhat.com
Cc: Srikar Dronamraju sri...@linux.vnet.ibm.com
Cc: zhangwei(Jovi) jovi.zhang...@huawei.com
Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 kernel/trace/trace_probe.c | 74 --
 kernel/trace/trace_probe.h | 65 
 2 files changed, 78 insertions(+), 61 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index d8347b0..c26bc9e 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -35,19 +35,15 @@ const char *reserved_field_names[] = {
FIELD_STRING_FUNC,
 };
 
-/* Printing function type */
-#define PRINT_TYPE_FUNC_NAME(type) print_type_##type
-#define PRINT_TYPE_FMT_NAME(type)  print_type_format_##type
-
 /* Printing  in basic type function template */
 #define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)
\
-static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,   \
+__kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,  \
const char *name,   \
void *data, void *ent)  \
 {  \
return trace_seq_printf(s,  %s= fmt, name, *(type *)data);\
 }  \
-static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
+const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
 
 DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , 0x%x)
 DEFINE_BASIC_PRINT_TYPE_FUNC(u16, 0x%x)
@@ -58,23 +54,12 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, %d)
 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, %d)
 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, %Ld)
 
-static inline void *get_rloc_data(u32 *dl)
-{
-   return (u8 *)dl + get_rloc_offs(*dl);
-}
-
-/* For data_loc conversion */
-static inline void *get_loc_data(u32 *dl, void *ent)
-{
-   return (u8 *)ent + get_rloc_offs(*dl);
-}
-
 /* For defining macros, define string/string_size types */
 typedef u32 string;
 typedef u32 string_size;
 
 /* Print type function for string type */
-static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
+__kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
  const char *name,
  void *data, void *ent)
 {
@@ -87,7 +72,7 @@ static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct 
trace_seq *s,
(const char *)get_loc_data(data, ent));
 }
 
-static const char PRINT_TYPE_FMT_NAME(string)[] = \\\%s\\\;
+const char PRINT_TYPE_FMT_NAME(string)[] = \\\%s\\\;
 
 #define FETCH_FUNC_NAME(method, type)  fetch_##method##_##type
 /*
@@ -111,7 +96,7 @@ DEFINE_FETCH_##method(u64)
 
 /* Data fetch function templates */
 #define DEFINE_FETCH_reg(type) \
-static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs, \
+__kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,
\
void *offset, void *dest)   \
 {  \
*(type *)dest = (type)regs_get_register(regs,   \
@@ -123,7 +108,7 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
 #define fetch_reg_string_size  NULL
 
 #define DEFINE_FETCH_stack(type)   \
-static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,  \
  void *offset, void *dest) \
 {  \
*(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
@@ -135,7 +120,7 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
 #define fetch_stack_string_sizeNULL
 
 #define DEFINE_FETCH_retval(type)  \
-static __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs, \
  void *dummy, void *dest)  \
 {  \
*(type *)dest = (type)regs_return_value(regs);  \
@@ -146,7 +131,7 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
 #define fetch_retval_string_size   NULL
 
 #define DEFINE_FETCH_memory(type)  \
-static __kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs,\
+__kprobes void 

[PATCH 07/17] tracing/probes: Move fetch function helpers to trace_probe.h

2013-12-15 Thread Namhyung Kim
From: Namhyung Kim 

Move fetch function helper macros/functions to the header file and
make them external.  This is preparation of supporting uprobe fetch
table in next patch.

Acked-by: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_probe.c | 74 --
 kernel/trace/trace_probe.h | 65 
 2 files changed, 78 insertions(+), 61 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index d8347b01ce89..c26bc9eaa2ac 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -35,19 +35,15 @@ const char *reserved_field_names[] = {
FIELD_STRING_FUNC,
 };
 
-/* Printing function type */
-#define PRINT_TYPE_FUNC_NAME(type) print_type_##type
-#define PRINT_TYPE_FMT_NAME(type)  print_type_format_##type
-
 /* Printing  in basic type function template */
 #define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)
\
-static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,   \
+__kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,  \
const char *name,   \
void *data, void *ent)  \
 {  \
return trace_seq_printf(s, " %s=" fmt, name, *(type *)data);\
 }  \
-static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
+const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
 
 DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , "0x%x")
 DEFINE_BASIC_PRINT_TYPE_FUNC(u16, "0x%x")
@@ -58,23 +54,12 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, "%Ld")
 
-static inline void *get_rloc_data(u32 *dl)
-{
-   return (u8 *)dl + get_rloc_offs(*dl);
-}
-
-/* For data_loc conversion */
-static inline void *get_loc_data(u32 *dl, void *ent)
-{
-   return (u8 *)ent + get_rloc_offs(*dl);
-}
-
 /* For defining macros, define string/string_size types */
 typedef u32 string;
 typedef u32 string_size;
 
 /* Print type function for string type */
-static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
+__kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
  const char *name,
  void *data, void *ent)
 {
@@ -87,7 +72,7 @@ static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct 
trace_seq *s,
(const char *)get_loc_data(data, ent));
 }
 
-static const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
+const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
 
 #define FETCH_FUNC_NAME(method, type)  fetch_##method##_##type
 /*
@@ -111,7 +96,7 @@ DEFINE_FETCH_##method(u64)
 
 /* Data fetch function templates */
 #define DEFINE_FETCH_reg(type) \
-static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs, \
+__kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,
\
void *offset, void *dest)   \
 {  \
*(type *)dest = (type)regs_get_register(regs,   \
@@ -123,7 +108,7 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
 #define fetch_reg_string_size  NULL
 
 #define DEFINE_FETCH_stack(type)   \
-static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,  \
  void *offset, void *dest) \
 {  \
*(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
@@ -135,7 +120,7 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
 #define fetch_stack_string_sizeNULL
 
 #define DEFINE_FETCH_retval(type)  \
-static __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs, \
  void *dummy, void *dest)  \
 {  \
*(type *)dest = (type)regs_return_value(regs);  \
@@ -146,7 +131,7 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
 #define fetch_retval_string_size   NULL
 
 #define DEFINE_FETCH_memory(type)  \
-static __kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs, \
  void *addr, void *dest)   \
 {   

[PATCH 07/17] tracing/probes: Move fetch function helpers to trace_probe.h

2013-12-15 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Move fetch function helper macros/functions to the header file and
make them external.  This is preparation of supporting uprobe fetch
table in next patch.

Acked-by: Masami Hiramatsu masami.hiramatsu...@hitachi.com
Cc: Srikar Dronamraju sri...@linux.vnet.ibm.com
Cc: Oleg Nesterov o...@redhat.com
Cc: zhangwei(Jovi) jovi.zhang...@huawei.com
Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 kernel/trace/trace_probe.c | 74 --
 kernel/trace/trace_probe.h | 65 
 2 files changed, 78 insertions(+), 61 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index d8347b01ce89..c26bc9eaa2ac 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -35,19 +35,15 @@ const char *reserved_field_names[] = {
FIELD_STRING_FUNC,
 };
 
-/* Printing function type */
-#define PRINT_TYPE_FUNC_NAME(type) print_type_##type
-#define PRINT_TYPE_FMT_NAME(type)  print_type_format_##type
-
 /* Printing  in basic type function template */
 #define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)
\
-static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,   \
+__kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,  \
const char *name,   \
void *data, void *ent)  \
 {  \
return trace_seq_printf(s,  %s= fmt, name, *(type *)data);\
 }  \
-static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
+const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
 
 DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , 0x%x)
 DEFINE_BASIC_PRINT_TYPE_FUNC(u16, 0x%x)
@@ -58,23 +54,12 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, %d)
 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, %d)
 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, %Ld)
 
-static inline void *get_rloc_data(u32 *dl)
-{
-   return (u8 *)dl + get_rloc_offs(*dl);
-}
-
-/* For data_loc conversion */
-static inline void *get_loc_data(u32 *dl, void *ent)
-{
-   return (u8 *)ent + get_rloc_offs(*dl);
-}
-
 /* For defining macros, define string/string_size types */
 typedef u32 string;
 typedef u32 string_size;
 
 /* Print type function for string type */
-static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
+__kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
  const char *name,
  void *data, void *ent)
 {
@@ -87,7 +72,7 @@ static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct 
trace_seq *s,
(const char *)get_loc_data(data, ent));
 }
 
-static const char PRINT_TYPE_FMT_NAME(string)[] = \\\%s\\\;
+const char PRINT_TYPE_FMT_NAME(string)[] = \\\%s\\\;
 
 #define FETCH_FUNC_NAME(method, type)  fetch_##method##_##type
 /*
@@ -111,7 +96,7 @@ DEFINE_FETCH_##method(u64)
 
 /* Data fetch function templates */
 #define DEFINE_FETCH_reg(type) \
-static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs, \
+__kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,
\
void *offset, void *dest)   \
 {  \
*(type *)dest = (type)regs_get_register(regs,   \
@@ -123,7 +108,7 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
 #define fetch_reg_string_size  NULL
 
 #define DEFINE_FETCH_stack(type)   \
-static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,  \
  void *offset, void *dest) \
 {  \
*(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
@@ -135,7 +120,7 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
 #define fetch_stack_string_sizeNULL
 
 #define DEFINE_FETCH_retval(type)  \
-static __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs, \
  void *dummy, void *dest)  \
 {  \
*(type *)dest = (type)regs_return_value(regs);  \
@@ -146,7 +131,7 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
 #define fetch_retval_string_size   NULL
 
 #define DEFINE_FETCH_memory(type)  \
-static __kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs,\
+__kprobes void 

Re: [PATCH 07/17] tracing/probes: Move fetch function helpers to trace_probe.h

2013-12-09 Thread Masami Hiramatsu
(2013/12/09 15:19), Namhyung Kim wrote:
> From: Namhyung Kim 
> 
> Move fetch function helper macros/functions to the header file and
> make them external.  This is preparation of supporting uprobe fetch
> table in next patch.
> 
> Cc: Masami Hiramatsu 
> Cc: Srikar Dronamraju 
> Cc: Oleg Nesterov 
> Cc: zhangwei(Jovi) 
> Cc: Arnaldo Carvalho de Melo 
> Signed-off-by: Namhyung Kim 

This looks OK for me.

Acked-by: Masami Hiramatsu 

Thanks!

> ---
>  kernel/trace/trace_probe.c | 74 
> --
>  kernel/trace/trace_probe.h | 64 +++
>  2 files changed, 77 insertions(+), 61 deletions(-)
> 
> diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> index d8347b01ce89..c26bc9eaa2ac 100644
> --- a/kernel/trace/trace_probe.c
> +++ b/kernel/trace/trace_probe.c
> @@ -35,19 +35,15 @@ const char *reserved_field_names[] = {
>   FIELD_STRING_FUNC,
>  };
>  
> -/* Printing function type */
> -#define PRINT_TYPE_FUNC_NAME(type)   print_type_##type
> -#define PRINT_TYPE_FMT_NAME(type)print_type_format_##type
> -
>  /* Printing  in basic type function template */
>  #define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)  
> \
> -static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s, \
> +__kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,\
>   const char *name,   \
>   void *data, void *ent)  \
>  {\
>   return trace_seq_printf(s, " %s=" fmt, name, *(type *)data);\
>  }\
> -static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
> +const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
>  
>  DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , "0x%x")
>  DEFINE_BASIC_PRINT_TYPE_FUNC(u16, "0x%x")
> @@ -58,23 +54,12 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, "%d")
>  DEFINE_BASIC_PRINT_TYPE_FUNC(s32, "%d")
>  DEFINE_BASIC_PRINT_TYPE_FUNC(s64, "%Ld")
>  
> -static inline void *get_rloc_data(u32 *dl)
> -{
> - return (u8 *)dl + get_rloc_offs(*dl);
> -}
> -
> -/* For data_loc conversion */
> -static inline void *get_loc_data(u32 *dl, void *ent)
> -{
> - return (u8 *)ent + get_rloc_offs(*dl);
> -}
> -
>  /* For defining macros, define string/string_size types */
>  typedef u32 string;
>  typedef u32 string_size;
>  
>  /* Print type function for string type */
> -static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
> +__kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
> const char *name,
> void *data, void *ent)
>  {
> @@ -87,7 +72,7 @@ static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct 
> trace_seq *s,
>   (const char *)get_loc_data(data, ent));
>  }
>  
> -static const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
> +const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
>  
>  #define FETCH_FUNC_NAME(method, type)fetch_##method##_##type
>  /*
> @@ -111,7 +96,7 @@ DEFINE_FETCH_##method(u64)
>  
>  /* Data fetch function templates */
>  #define DEFINE_FETCH_reg(type)   
> \
> -static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,   
> \
> +__kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,  
> \
>   void *offset, void *dest)   \
>  {\
>   *(type *)dest = (type)regs_get_register(regs,   \
> @@ -123,7 +108,7 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
>  #define fetch_reg_string_sizeNULL
>  
>  #define DEFINE_FETCH_stack(type) \
> -static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
> +__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
> void *offset, void *dest) \
>  {\
>   *(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
> @@ -135,7 +120,7 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
>  #define fetch_stack_string_size  NULL
>  
>  #define DEFINE_FETCH_retval(type)\
> -static __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,\
> +__kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,   \
> void *dummy, void *dest)  \
>  {\
>   *(type *)dest = (type)regs_return_value(regs);  \
> @@ -146,7 +131,7 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
>  #define fetch_retval_string_size NULL
>  
>  #define 

Re: [PATCH 07/17] tracing/probes: Move fetch function helpers to trace_probe.h

2013-12-09 Thread Masami Hiramatsu
(2013/12/09 15:19), Namhyung Kim wrote:
 From: Namhyung Kim namhyung@lge.com
 
 Move fetch function helper macros/functions to the header file and
 make them external.  This is preparation of supporting uprobe fetch
 table in next patch.
 
 Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
 Cc: Srikar Dronamraju sri...@linux.vnet.ibm.com
 Cc: Oleg Nesterov o...@redhat.com
 Cc: zhangwei(Jovi) jovi.zhang...@huawei.com
 Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net
 Signed-off-by: Namhyung Kim namhy...@kernel.org

This looks OK for me.

Acked-by: Masami Hiramatsu masami.hiramatsu...@hitachi.com

Thanks!

 ---
  kernel/trace/trace_probe.c | 74 
 --
  kernel/trace/trace_probe.h | 64 +++
  2 files changed, 77 insertions(+), 61 deletions(-)
 
 diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
 index d8347b01ce89..c26bc9eaa2ac 100644
 --- a/kernel/trace/trace_probe.c
 +++ b/kernel/trace/trace_probe.c
 @@ -35,19 +35,15 @@ const char *reserved_field_names[] = {
   FIELD_STRING_FUNC,
  };
  
 -/* Printing function type */
 -#define PRINT_TYPE_FUNC_NAME(type)   print_type_##type
 -#define PRINT_TYPE_FMT_NAME(type)print_type_format_##type
 -
  /* Printing  in basic type function template */
  #define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)  
 \
 -static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s, \
 +__kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,\
   const char *name,   \
   void *data, void *ent)  \
  {\
   return trace_seq_printf(s,  %s= fmt, name, *(type *)data);\
  }\
 -static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
 +const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
  
  DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , 0x%x)
  DEFINE_BASIC_PRINT_TYPE_FUNC(u16, 0x%x)
 @@ -58,23 +54,12 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, %d)
  DEFINE_BASIC_PRINT_TYPE_FUNC(s32, %d)
  DEFINE_BASIC_PRINT_TYPE_FUNC(s64, %Ld)
  
 -static inline void *get_rloc_data(u32 *dl)
 -{
 - return (u8 *)dl + get_rloc_offs(*dl);
 -}
 -
 -/* For data_loc conversion */
 -static inline void *get_loc_data(u32 *dl, void *ent)
 -{
 - return (u8 *)ent + get_rloc_offs(*dl);
 -}
 -
  /* For defining macros, define string/string_size types */
  typedef u32 string;
  typedef u32 string_size;
  
  /* Print type function for string type */
 -static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
 +__kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
 const char *name,
 void *data, void *ent)
  {
 @@ -87,7 +72,7 @@ static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct 
 trace_seq *s,
   (const char *)get_loc_data(data, ent));
  }
  
 -static const char PRINT_TYPE_FMT_NAME(string)[] = \\\%s\\\;
 +const char PRINT_TYPE_FMT_NAME(string)[] = \\\%s\\\;
  
  #define FETCH_FUNC_NAME(method, type)fetch_##method##_##type
  /*
 @@ -111,7 +96,7 @@ DEFINE_FETCH_##method(u64)
  
  /* Data fetch function templates */
  #define DEFINE_FETCH_reg(type)   
 \
 -static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,   
 \
 +__kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,  
 \
   void *offset, void *dest)   \
  {\
   *(type *)dest = (type)regs_get_register(regs,   \
 @@ -123,7 +108,7 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
  #define fetch_reg_string_sizeNULL
  
  #define DEFINE_FETCH_stack(type) \
 -static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
 +__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
 void *offset, void *dest) \
  {\
   *(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
 @@ -135,7 +120,7 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
  #define fetch_stack_string_size  NULL
  
  #define DEFINE_FETCH_retval(type)\
 -static __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,\
 +__kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,   \
 void *dummy, void *dest)  \
  {\
   *(type *)dest = (type)regs_return_value(regs);  \
 @@ -146,7 +131,7 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
  

[PATCH 07/17] tracing/probes: Move fetch function helpers to trace_probe.h

2013-12-08 Thread Namhyung Kim
From: Namhyung Kim 

Move fetch function helper macros/functions to the header file and
make them external.  This is preparation of supporting uprobe fetch
table in next patch.

Cc: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_probe.c | 74 --
 kernel/trace/trace_probe.h | 64 +++
 2 files changed, 77 insertions(+), 61 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index d8347b01ce89..c26bc9eaa2ac 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -35,19 +35,15 @@ const char *reserved_field_names[] = {
FIELD_STRING_FUNC,
 };
 
-/* Printing function type */
-#define PRINT_TYPE_FUNC_NAME(type) print_type_##type
-#define PRINT_TYPE_FMT_NAME(type)  print_type_format_##type
-
 /* Printing  in basic type function template */
 #define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)
\
-static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,   \
+__kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,  \
const char *name,   \
void *data, void *ent)  \
 {  \
return trace_seq_printf(s, " %s=" fmt, name, *(type *)data);\
 }  \
-static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
+const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
 
 DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , "0x%x")
 DEFINE_BASIC_PRINT_TYPE_FUNC(u16, "0x%x")
@@ -58,23 +54,12 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, "%Ld")
 
-static inline void *get_rloc_data(u32 *dl)
-{
-   return (u8 *)dl + get_rloc_offs(*dl);
-}
-
-/* For data_loc conversion */
-static inline void *get_loc_data(u32 *dl, void *ent)
-{
-   return (u8 *)ent + get_rloc_offs(*dl);
-}
-
 /* For defining macros, define string/string_size types */
 typedef u32 string;
 typedef u32 string_size;
 
 /* Print type function for string type */
-static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
+__kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
  const char *name,
  void *data, void *ent)
 {
@@ -87,7 +72,7 @@ static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct 
trace_seq *s,
(const char *)get_loc_data(data, ent));
 }
 
-static const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
+const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
 
 #define FETCH_FUNC_NAME(method, type)  fetch_##method##_##type
 /*
@@ -111,7 +96,7 @@ DEFINE_FETCH_##method(u64)
 
 /* Data fetch function templates */
 #define DEFINE_FETCH_reg(type) \
-static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs, \
+__kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,
\
void *offset, void *dest)   \
 {  \
*(type *)dest = (type)regs_get_register(regs,   \
@@ -123,7 +108,7 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
 #define fetch_reg_string_size  NULL
 
 #define DEFINE_FETCH_stack(type)   \
-static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,  \
  void *offset, void *dest) \
 {  \
*(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
@@ -135,7 +120,7 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
 #define fetch_stack_string_sizeNULL
 
 #define DEFINE_FETCH_retval(type)  \
-static __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs, \
  void *dummy, void *dest)  \
 {  \
*(type *)dest = (type)regs_return_value(regs);  \
@@ -146,7 +131,7 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
 #define fetch_retval_string_size   NULL
 
 #define DEFINE_FETCH_memory(type)  \
-static __kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs, \
  void *addr, void *dest)   \
 {  

[PATCH 07/17] tracing/probes: Move fetch function helpers to trace_probe.h

2013-12-08 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Move fetch function helper macros/functions to the header file and
make them external.  This is preparation of supporting uprobe fetch
table in next patch.

Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
Cc: Srikar Dronamraju sri...@linux.vnet.ibm.com
Cc: Oleg Nesterov o...@redhat.com
Cc: zhangwei(Jovi) jovi.zhang...@huawei.com
Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 kernel/trace/trace_probe.c | 74 --
 kernel/trace/trace_probe.h | 64 +++
 2 files changed, 77 insertions(+), 61 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index d8347b01ce89..c26bc9eaa2ac 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -35,19 +35,15 @@ const char *reserved_field_names[] = {
FIELD_STRING_FUNC,
 };
 
-/* Printing function type */
-#define PRINT_TYPE_FUNC_NAME(type) print_type_##type
-#define PRINT_TYPE_FMT_NAME(type)  print_type_format_##type
-
 /* Printing  in basic type function template */
 #define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)
\
-static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,   \
+__kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,  \
const char *name,   \
void *data, void *ent)  \
 {  \
return trace_seq_printf(s,  %s= fmt, name, *(type *)data);\
 }  \
-static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
+const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
 
 DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , 0x%x)
 DEFINE_BASIC_PRINT_TYPE_FUNC(u16, 0x%x)
@@ -58,23 +54,12 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, %d)
 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, %d)
 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, %Ld)
 
-static inline void *get_rloc_data(u32 *dl)
-{
-   return (u8 *)dl + get_rloc_offs(*dl);
-}
-
-/* For data_loc conversion */
-static inline void *get_loc_data(u32 *dl, void *ent)
-{
-   return (u8 *)ent + get_rloc_offs(*dl);
-}
-
 /* For defining macros, define string/string_size types */
 typedef u32 string;
 typedef u32 string_size;
 
 /* Print type function for string type */
-static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
+__kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
  const char *name,
  void *data, void *ent)
 {
@@ -87,7 +72,7 @@ static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct 
trace_seq *s,
(const char *)get_loc_data(data, ent));
 }
 
-static const char PRINT_TYPE_FMT_NAME(string)[] = \\\%s\\\;
+const char PRINT_TYPE_FMT_NAME(string)[] = \\\%s\\\;
 
 #define FETCH_FUNC_NAME(method, type)  fetch_##method##_##type
 /*
@@ -111,7 +96,7 @@ DEFINE_FETCH_##method(u64)
 
 /* Data fetch function templates */
 #define DEFINE_FETCH_reg(type) \
-static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs, \
+__kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,
\
void *offset, void *dest)   \
 {  \
*(type *)dest = (type)regs_get_register(regs,   \
@@ -123,7 +108,7 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
 #define fetch_reg_string_size  NULL
 
 #define DEFINE_FETCH_stack(type)   \
-static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,  \
  void *offset, void *dest) \
 {  \
*(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
@@ -135,7 +120,7 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
 #define fetch_stack_string_sizeNULL
 
 #define DEFINE_FETCH_retval(type)  \
-static __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs, \
  void *dummy, void *dest)  \
 {  \
*(type *)dest = (type)regs_return_value(regs);  \
@@ -146,7 +131,7 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
 #define fetch_retval_string_size   NULL
 
 #define DEFINE_FETCH_memory(type)  \
-static __kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs,\
+__kprobes void 

[PATCH 07/17] tracing/probes: Move fetch function helpers to trace_probe.h

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Move fetch function helper macros/functions to the header file and
make them external.  This is preparation of supporting uprobe fetch
table in next patch.

Cc: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_probe.c | 74 --
 kernel/trace/trace_probe.h | 64 +++
 2 files changed, 77 insertions(+), 61 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 7de2f58d2acb..a34e3fca4071 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -35,19 +35,15 @@ const char *reserved_field_names[] = {
FIELD_STRING_FUNC,
 };
 
-/* Printing function type */
-#define PRINT_TYPE_FUNC_NAME(type) print_type_##type
-#define PRINT_TYPE_FMT_NAME(type)  print_type_format_##type
-
 /* Printing  in basic type function template */
 #define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)
\
-static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,   \
+__kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,  \
const char *name,   \
void *data, void *ent)  \
 {  \
return trace_seq_printf(s, " %s=" fmt, name, *(type *)data);\
 }  \
-static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
+const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
 
 DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , "%#x")
 DEFINE_BASIC_PRINT_TYPE_FUNC(u16, "%#x")
@@ -58,23 +54,12 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, "%Ld")
 
-static inline void *get_rloc_data(u32 *dl)
-{
-   return (u8 *)dl + get_rloc_offs(*dl);
-}
-
-/* For data_loc conversion */
-static inline void *get_loc_data(u32 *dl, void *ent)
-{
-   return (u8 *)ent + get_rloc_offs(*dl);
-}
-
 /* For defining macros, define string/string_size types */
 typedef u32 string;
 typedef u32 string_size;
 
 /* Print type function for string type */
-static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
+__kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
  const char *name,
  void *data, void *ent)
 {
@@ -87,7 +72,7 @@ static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct 
trace_seq *s,
(const char *)get_loc_data(data, ent));
 }
 
-static const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
+const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
 
 #define FETCH_FUNC_NAME(method, type)  fetch_##method##_##type
 /*
@@ -111,7 +96,7 @@ DEFINE_FETCH_##method(u64)
 
 /* Data fetch function templates */
 #define DEFINE_FETCH_reg(type) \
-static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs, \
+__kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,
\
void *offset, void *dest)   \
 {  \
*(type *)dest = (type)regs_get_register(regs,   \
@@ -123,7 +108,7 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
 #define fetch_reg_string_size  NULL
 
 #define DEFINE_FETCH_stack(type)   \
-static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,  \
  void *offset, void *dest) \
 {  \
*(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
@@ -135,7 +120,7 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
 #define fetch_stack_string_sizeNULL
 
 #define DEFINE_FETCH_retval(type)  \
-static __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs, \
  void *dummy, void *dest)  \
 {  \
*(type *)dest = (type)regs_return_value(regs);  \
@@ -146,7 +131,7 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
 #define fetch_retval_string_size   NULL
 
 #define DEFINE_FETCH_memory(type)  \
-static __kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs, \
  void *addr, void *dest)   \
 {

[PATCH 07/17] tracing/probes: Move fetch function helpers to trace_probe.h

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Move fetch function helper macros/functions to the header file and
make them external.  This is preparation of supporting uprobe fetch
table in next patch.

Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
Cc: Srikar Dronamraju sri...@linux.vnet.ibm.com
Cc: Oleg Nesterov o...@redhat.com
Cc: zhangwei(Jovi) jovi.zhang...@huawei.com
Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 kernel/trace/trace_probe.c | 74 --
 kernel/trace/trace_probe.h | 64 +++
 2 files changed, 77 insertions(+), 61 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 7de2f58d2acb..a34e3fca4071 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -35,19 +35,15 @@ const char *reserved_field_names[] = {
FIELD_STRING_FUNC,
 };
 
-/* Printing function type */
-#define PRINT_TYPE_FUNC_NAME(type) print_type_##type
-#define PRINT_TYPE_FMT_NAME(type)  print_type_format_##type
-
 /* Printing  in basic type function template */
 #define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)
\
-static __kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,   \
+__kprobes int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s,  \
const char *name,   \
void *data, void *ent)  \
 {  \
return trace_seq_printf(s,  %s= fmt, name, *(type *)data);\
 }  \
-static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
+const char PRINT_TYPE_FMT_NAME(type)[] = fmt;
 
 DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , %#x)
 DEFINE_BASIC_PRINT_TYPE_FUNC(u16, %#x)
@@ -58,23 +54,12 @@ DEFINE_BASIC_PRINT_TYPE_FUNC(s16, %d)
 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, %d)
 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, %Ld)
 
-static inline void *get_rloc_data(u32 *dl)
-{
-   return (u8 *)dl + get_rloc_offs(*dl);
-}
-
-/* For data_loc conversion */
-static inline void *get_loc_data(u32 *dl, void *ent)
-{
-   return (u8 *)ent + get_rloc_offs(*dl);
-}
-
 /* For defining macros, define string/string_size types */
 typedef u32 string;
 typedef u32 string_size;
 
 /* Print type function for string type */
-static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
+__kprobes int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s,
  const char *name,
  void *data, void *ent)
 {
@@ -87,7 +72,7 @@ static __kprobes int PRINT_TYPE_FUNC_NAME(string)(struct 
trace_seq *s,
(const char *)get_loc_data(data, ent));
 }
 
-static const char PRINT_TYPE_FMT_NAME(string)[] = \\\%s\\\;
+const char PRINT_TYPE_FMT_NAME(string)[] = \\\%s\\\;
 
 #define FETCH_FUNC_NAME(method, type)  fetch_##method##_##type
 /*
@@ -111,7 +96,7 @@ DEFINE_FETCH_##method(u64)
 
 /* Data fetch function templates */
 #define DEFINE_FETCH_reg(type) \
-static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs, \
+__kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs,
\
void *offset, void *dest)   \
 {  \
*(type *)dest = (type)regs_get_register(regs,   \
@@ -123,7 +108,7 @@ DEFINE_BASIC_FETCH_FUNCS(reg)
 #define fetch_reg_string_size  NULL
 
 #define DEFINE_FETCH_stack(type)   \
-static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,  \
  void *offset, void *dest) \
 {  \
*(type *)dest = (type)regs_get_kernel_stack_nth(regs,   \
@@ -135,7 +120,7 @@ DEFINE_BASIC_FETCH_FUNCS(stack)
 #define fetch_stack_string_sizeNULL
 
 #define DEFINE_FETCH_retval(type)  \
-static __kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs,\
+__kprobes void FETCH_FUNC_NAME(retval, type)(struct pt_regs *regs, \
  void *dummy, void *dest)  \
 {  \
*(type *)dest = (type)regs_return_value(regs);  \
@@ -146,7 +131,7 @@ DEFINE_BASIC_FETCH_FUNCS(retval)
 #define fetch_retval_string_size   NULL
 
 #define DEFINE_FETCH_memory(type)  \
-static __kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs,\
+__kprobes void