+ struct list_head *pos, *tmp;
+
+ list_for_each_safe(pos, tmp, list) {
+ struct dbg_line *line;
+ struct ptldebug_header *hdr;
+
+ line = list_entry(pos, struct dbg_line, chain);
+ list_del(&line->chain);
+
+ hdr = line->hdr;
+ fprintf(out, "%06x:%06x:%u:%u.%06Lu:%u:%u:%u:(%s:%u:%s()) %s",
+ hdr->ph_subsys, hdr->ph_mask, hdr->ph_cpu_id,
+ hdr->ph_sec, (unsigned long long)hdr->ph_usec,
+ hdr->ph_stack, hdr->ph_pid, hdr->ph_extern_pid,
+ line->file, hdr->ph_line_num, line->fn, line->text);
+ free(line->hdr);
+ free(line);
+ }
+}
+
+static int parse_buffer(FILE *in, FILE *out)
+{
+ struct dbg_line *line;
+ struct ptldebug_header *hdr;
+ char buf[4097], *p;
+ int rc;
+ unsigned long dropped = 0, kept = 0;
+ struct list_head chunk_list;
+
+ CFS_INIT_LIST_HEAD(&chunk_list);