FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Crash Utility

 
 
LinkBack Thread Tools
 
Old 01-24-2011, 08:35 AM
Lai Jiangshan
 
Default crash-trace-command: add ftrace_init_event_fields()

Current ftrace_init_event_type() has two steps:
1) get the double-linked-list head address of the field,
2) init the fields

This patch separates it, and the second step is wrapped in
a new function: ftrace_init_event_fields().

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/extensions/trace.c b/extensions/trace.c
index 484c872..34f1be2 100755
--- a/extensions/trace.c
+++ b/extensions/trace.c
@@ -785,20 +785,19 @@ work:
return -1;
}

-static int ftrace_init_event_type(ulong call, struct event_type *aevent_type)
+static int ftrace_init_event_fields(ulong fields_head, int *pnfields,
+ struct ftrace_field **pfields)
{
- ulong fields_addr, pos;
+ ulong pos;

int nfields = 0, max_fields = 16;
struct ftrace_field *fields = NULL;

- if (ftrace_get_event_type_fields(call, &fields_addr) < 0)
- return -1;
- read_value(pos, fields_addr, list_head, next);
+ read_value(pos, fields_head, list_head, next);

if (pos == 0) {
if (verbose)
- fprintf(fp, "no field %lu
", call);
+ fprintf(fp, "no field, head: %lu
", fields_head);
return 0;
}

@@ -806,7 +805,7 @@ static int ftrace_init_event_type(ulong call, struct event_type *aevent_type)
if (fields == NULL)
return -1;

- while (pos != fields_addr) {
+ while (pos != fields_head) {
ulong field;
ulong name_addr, type_addr;
char field_name[128], field_type[128];
@@ -860,8 +859,8 @@ static int ftrace_init_event_type(ulong call, struct event_type *aevent_type)
read_value(pos, pos, list_head, next);
}

- aevent_type->nfields = nfields;
- aevent_type->fields = fields;
+ *pnfields = nfields;
+ *pfields = fields;

return 0;

@@ -875,6 +874,17 @@ out_fail:
return -1;
}

+static int ftrace_init_event_type(ulong call, struct event_type *aevent_type)
+{
+ ulong fields_head;
+
+ if (ftrace_get_event_type_fields(call, &fields_head) < 0)
+ return -1;
+
+ return ftrace_init_event_fields(fields_head, &aevent_type->nfields,
+ &aevent_type->fields);
+}
+
static void ftrace_destroy_event_types(void)
{
int i, j;

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 

Thread Tools




All times are GMT. The time now is 09:49 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org