From: Vasiliy Ulyanov Date: Tue, 15 Jan 2013 09:46:39 +0000 (+0400) Subject: Added pack_task_event_info function X-Git-Tag: Tizen_SDK_2.3~722 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=932119aaf174fe4f0724e9915d2633f1c8805e7b;p=kernel%2Fswap-modules.git Added pack_task_event_info function --- diff --git a/driver/storage.c b/driver/storage.c index 92699c5..8d42da5 100644 --- a/driver/storage.c +++ b/driver/storage.c @@ -1105,15 +1105,16 @@ u_int32_t get_probe_func_addr(const char *fmt, va_list args) return va_arg(args, u_int32_t); } -void pack_event_info (probe_id_t probe_id, record_type_t record_type, const char *fmt, ...) +void pack_task_event_info(struct task_struct *task, probe_id_t probe_id, + record_type_t record_type, const char *fmt, ...) { unsigned long spinlock_flags = 0L; static char buf[EVENT_MAX_SIZE] = ""; TYPEOF_EVENT_LENGTH event_len = 0L; struct timeval tv = { 0, 0 }; - TYPEOF_THREAD_ID current_pid = current->pid; - TYPEOF_PROCESS_ID current_tgid = current->tgid; - unsigned current_cpu = task_cpu(current); + TYPEOF_THREAD_ID current_pid = task->pid; + TYPEOF_PROCESS_ID current_tgid = task->tgid; + unsigned current_cpu = task_cpu(task); va_list args; unsigned long addr = 0; struct cond *p_cond; @@ -1158,7 +1159,7 @@ void pack_event_info (probe_id_t probe_id, record_type_t record_type, const char (!ET_FIELD_ISSET(p_tmpl->flags, ET_MATCH_CPU_NUM) || (current_cpu == p_tmpl->cpu_num)) && (!ET_FIELD_ISSET(p_tmpl->flags, ET_MATCH_BIN_NAME) || - (strcmp(current->comm, p_tmpl->bin_name) == 0)) && + (strcmp(task->comm, p_tmpl->bin_name) == 0)) && (!ET_FIELD_ISSET(p_tmpl->flags, ET_MATCH_TIME) || (tv.tv_sec > last_attach_time.tv_sec + p_tmpl->sec) || (tv.tv_sec == last_attach_time.tv_sec + p_tmpl->sec && @@ -1182,7 +1183,7 @@ void pack_event_info (probe_id_t probe_id, record_type_t record_type, const char (!ET_FIELD_ISSET(p_tmpl->flags, ET_MATCH_CPU_NUM) || (current_cpu == p_tmpl->cpu_num)) && (!ET_FIELD_ISSET(p_tmpl->flags, ET_MATCH_BIN_NAME) || - (strcmp(current->comm, p_tmpl->bin_name) == 0))) { + (strcmp(task->comm, p_tmpl->bin_name) == 0))) { spin_lock_irqsave(&ec_spinlock, spinlock_flags); ec_info.ignored_events_count++; spin_unlock_irqrestore(&ec_spinlock, spinlock_flags); @@ -1237,7 +1238,7 @@ void pack_event_info (probe_id_t probe_id, record_type_t record_type, const char (!ET_FIELD_ISSET(p_tmpl->flags, ET_MATCH_CPU_NUM) || (current_cpu == p_tmpl->cpu_num)) && (!ET_FIELD_ISSET(p_tmpl->flags, ET_MATCH_BIN_NAME) || - (strcmp(current->comm, p_tmpl->bin_name) == 0)) && + (strcmp(task->comm, p_tmpl->bin_name) == 0)) && (!ET_FIELD_ISSET(p_tmpl->flags, ET_MATCH_TIME) || (tv.tv_sec > last_attach_time.tv_sec + p_tmpl->sec) || (tv.tv_sec == last_attach_time.tv_sec + p_tmpl->sec && @@ -1252,7 +1253,7 @@ void pack_event_info (probe_id_t probe_id, record_type_t record_type, const char } } } -EXPORT_SYMBOL_GPL(pack_event_info); +EXPORT_SYMBOL_GPL(pack_task_event_info); kernel_probe_t* find_probe (unsigned long addr) { diff --git a/driver/storage.h b/driver/storage.h index baa8fb9..821ef3b 100644 --- a/driver/storage.h +++ b/driver/storage.h @@ -57,7 +57,10 @@ extern void storage_down (void); Function "pack_event_info()" saves information about event into buffer. It is used in 'probes' to pack and save event data. */ -extern void pack_event_info (probe_id_t probe_id, record_type_t record_type, const char *fmt, ...); +extern void pack_task_event_info (struct task_struct *task, probe_id_t probe_id, + record_type_t record_type, const char *fmt, ...); +#define pack_event_info(probe_id, record_type, fmt, ...) \ + pack_task_event_info(current, probe_id, record_type, fmt, __VA_ARGS__) /* Set most links from us_proc_info to data in the bundle */ int link_bundle(void);