aboutsummaryrefslogtreecommitdiffstats
path: root/trace-input.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-12-15 12:06:22 -0500
committerSteven Rostedt <rostedt@goodmis.org>2009-12-15 12:06:22 -0500
commit0c20bff197ce10fd2e2957324c4c675e2a01f8a3 (patch)
tree7d4a7eb0926c3cf144a84f23783e1a8614a1410e /trace-input.c
parentcec78d30632122d3da5418b8e4b47176e1681044 (diff)
Have get_page() handle size and index
get_page() already manages the size field of cpu_data, it should also reset index. This does not need to be done in get_next_page(). Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'trace-input.c')
-rw-r--r--trace-input.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/trace-input.c b/trace-input.c
index a3a0580..198d596 100644
--- a/trace-input.c
+++ b/trace-input.c
@@ -493,13 +493,6 @@ static int calc_index(struct tracecmd_input *handle,
493 return (unsigned long)ptr - (unsigned long)handle->cpu_data[cpu].page; 493 return (unsigned long)ptr - (unsigned long)handle->cpu_data[cpu].page;
494} 494}
495 495
496static void
497update_cpu_data_index(struct tracecmd_input *handle, int cpu)
498{
499 handle->cpu_data[cpu].size -= handle->page_size;
500 handle->cpu_data[cpu].index = 0;
501}
502
503static void free_page(struct tracecmd_input *handle, int cpu) 496static void free_page(struct tracecmd_input *handle, int cpu)
504{ 497{
505 if (!handle->cpu_data[cpu].page) 498 if (!handle->cpu_data[cpu].page)
@@ -595,6 +588,7 @@ static int get_page(struct tracecmd_input *handle, int cpu,
595 588
596 handle->cpu_data[cpu].offset = offset; 589 handle->cpu_data[cpu].offset = offset;
597 handle->cpu_data[cpu].timestamp = 0; 590 handle->cpu_data[cpu].timestamp = 0;
591 handle->cpu_data[cpu].index = 0;
598 handle->cpu_data[cpu].size = (handle->cpu_data[cpu].file_offset + 592 handle->cpu_data[cpu].size = (handle->cpu_data[cpu].file_offset +
599 handle->cpu_data[cpu].file_size) - 593 handle->cpu_data[cpu].file_size) -
600 offset; 594 offset;
@@ -630,8 +624,6 @@ static int get_next_page(struct tracecmd_input *handle, int cpu)
630 return 0; 624 return 0;
631 } 625 }
632 626
633 update_cpu_data_index(handle, cpu);
634
635 offset = handle->cpu_data[cpu].offset + handle->page_size; 627 offset = handle->cpu_data[cpu].offset + handle->page_size;
636 628
637 return get_page(handle, cpu, offset); 629 return get_page(handle, cpu, offset);