From f8695253467b480087663426f4b97c02c443f08c Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 2 Feb 2012 12:03:21 -0500 Subject: [PATCH] Use LTTNG_KERNEL_SYM_NAME_LEN Signed-off-by: Mathieu Desnoyers --- lttng-abi.c | 10 +++++----- lttng-abi.h | 13 ++++++------- lttng-syscalls.c | 16 ++++++++-------- probes/lttng-kprobes.c | 4 ++-- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/lttng-abi.c b/lttng-abi.c index 2b673776..c4498954 100644 --- a/lttng-abi.c +++ b/lttng-abi.c @@ -175,7 +175,7 @@ long lttng_abi_add_context(struct file *file, case LTTNG_KERNEL_CONTEXT_VPPID: return lttng_add_vppid_to_ctx(ctx); case LTTNG_KERNEL_CONTEXT_PERF_COUNTER: - context_param.u.perf_counter.name[LTTNG_SYM_NAME_LEN - 1] = '\0'; + context_param.u.perf_counter.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; return lttng_add_perf_counter_to_ctx(context_param.u.perf_counter.type, context_param.u.perf_counter.config, context_param.u.perf_counter.name, @@ -500,16 +500,16 @@ int lttng_abi_create_event(struct file *channel_file, if (copy_from_user(&event_param, uevent_param, sizeof(event_param))) return -EFAULT; - event_param.name[LTTNG_SYM_NAME_LEN - 1] = '\0'; + event_param.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; switch (event_param.instrumentation) { case LTTNG_KERNEL_KRETPROBE: - event_param.u.kretprobe.symbol_name[LTTNG_SYM_NAME_LEN - 1] = '\0'; + event_param.u.kretprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; break; case LTTNG_KERNEL_KPROBE: - event_param.u.kprobe.symbol_name[LTTNG_SYM_NAME_LEN - 1] = '\0'; + event_param.u.kprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; break; case LTTNG_KERNEL_FUNCTION: - event_param.u.ftrace.symbol_name[LTTNG_SYM_NAME_LEN - 1] = '\0'; + event_param.u.ftrace.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; break; default: break; diff --git a/lttng-abi.h b/lttng-abi.h index 9c88b9b9..b5410d49 100644 --- a/lttng-abi.h +++ b/lttng-abi.h @@ -13,7 +13,7 @@ #include -#define LTTNG_SYM_NAME_LEN 256 +#define LTTNG_KERNEL_SYM_NAME_LEN 256 enum lttng_kernel_instrumentation { LTTNG_KERNEL_TRACEPOINT = 0, @@ -35,7 +35,6 @@ enum lttng_kernel_output { /* * LTTng DebugFS ABI structures. */ - struct lttng_kernel_channel { int overwrite; /* 1: overwrite, 0: discard */ uint64_t subbuf_size; /* in bytes */ @@ -49,7 +48,7 @@ struct lttng_kernel_kretprobe { uint64_t addr; uint64_t offset; - char symbol_name[LTTNG_SYM_NAME_LEN]; + char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; }; /* @@ -59,18 +58,18 @@ struct lttng_kernel_kprobe { uint64_t addr; uint64_t offset; - char symbol_name[LTTNG_SYM_NAME_LEN]; + char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; }; struct lttng_kernel_function_tracer { - char symbol_name[LTTNG_SYM_NAME_LEN]; + char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; }; /* * For syscall tracing, name = '\0' means "enable all". */ struct lttng_kernel_event { - char name[LTTNG_SYM_NAME_LEN]; /* event name */ + char name[LTTNG_KERNEL_SYM_NAME_LEN]; /* event name */ enum lttng_kernel_instrumentation instrumentation; /* Per instrumentation type configuration */ union { @@ -110,7 +109,7 @@ enum lttng_kernel_context_type { struct lttng_kernel_perf_counter_ctx { uint32_t type; uint64_t config; - char name[LTTNG_SYM_NAME_LEN]; + char name[LTTNG_KERNEL_SYM_NAME_LEN]; }; struct lttng_kernel_context { diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 521531c3..b8a1813c 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -295,8 +295,8 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len, if (chan_table[i]) continue; memset(&ev, 0, sizeof(ev)); - strncpy(ev.name, desc->name, LTTNG_SYM_NAME_LEN); - ev.name[LTTNG_SYM_NAME_LEN - 1] = '\0'; + strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN); + ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; ev.instrumentation = LTTNG_KERNEL_NOOP; chan_table[i] = lttng_event_create(chan, &ev, filter, desc); @@ -342,8 +342,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) &__event_desc___sys_unknown; memset(&ev, 0, sizeof(ev)); - strncpy(ev.name, desc->name, LTTNG_SYM_NAME_LEN); - ev.name[LTTNG_SYM_NAME_LEN - 1] = '\0'; + strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN); + ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; ev.instrumentation = LTTNG_KERNEL_NOOP; chan->sc_unknown = lttng_event_create(chan, &ev, filter, desc); @@ -357,8 +357,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) &__event_desc___compat_sys_unknown; memset(&ev, 0, sizeof(ev)); - strncpy(ev.name, desc->name, LTTNG_SYM_NAME_LEN); - ev.name[LTTNG_SYM_NAME_LEN - 1] = '\0'; + strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN); + ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; ev.instrumentation = LTTNG_KERNEL_NOOP; chan->sc_compat_unknown = lttng_event_create(chan, &ev, filter, desc); @@ -372,8 +372,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) &__event_desc___exit_syscall; memset(&ev, 0, sizeof(ev)); - strncpy(ev.name, desc->name, LTTNG_SYM_NAME_LEN); - ev.name[LTTNG_SYM_NAME_LEN - 1] = '\0'; + strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN); + ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; ev.instrumentation = LTTNG_KERNEL_NOOP; chan->sc_exit = lttng_event_create(chan, &ev, filter, desc); diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c index e9c64960..69aff68f 100644 --- a/probes/lttng-kprobes.c +++ b/probes/lttng-kprobes.c @@ -107,14 +107,14 @@ int lttng_kprobes_register(const char *name, event->u.kprobe.kp.pre_handler = lttng_kprobes_handler_pre; if (symbol_name) { event->u.kprobe.symbol_name = - kzalloc(LTTNG_SYM_NAME_LEN * sizeof(char), + kzalloc(LTTNG_KERNEL_SYM_NAME_LEN * sizeof(char), GFP_KERNEL); if (!event->u.kprobe.symbol_name) { ret = -ENOMEM; goto name_error; } memcpy(event->u.kprobe.symbol_name, symbol_name, - LTTNG_SYM_NAME_LEN * sizeof(char)); + LTTNG_KERNEL_SYM_NAME_LEN * sizeof(char)); event->u.kprobe.kp.symbol_name = event->u.kprobe.symbol_name; } -- 2.34.1