Hello Gioh, On 31/12/14 04:14, Gioh Kim wrote: > > Is it ok if the information is too big? > I'm not sure but I remember that seq_printf has 4K limitation.
Thanks for reviewing, excuse me for a long delay. If I understand correctly it is OK, since it's written in comments for seq_has_overflowed(): > * seq_files have a buffer which may overflow. When this happens a larger > * buffer is reallocated and all the data will be printed again. > * The overflow state is true when m->count == m->size. And exactly this happens in traverse(). But I think that it's not important anymore as I intent not to use seq_files in the second version. > > So I made seq_operations with seq_list_start/next functions. > > EX) > > static void *debug_seq_start(struct seq_file *s, loff_t *pos) > { > » mutex_lock(&debug_lock); > » return seq_list_start(&debug_list, *pos); > } > > static void debug_seq_stop(struct seq_file *s, void *data) > { > » struct debug_header *header = data; > > » if (header == NULL || &header->head_list == &debug_list) { > » » seq_printf(s, "end of info"); > » } > > » mutex_unlock(&debug_lock); > } > > static void *debug_seq_next(struct seq_file *s, void *data, loff_t *pos) > { > » return seq_list_next(data, &debug_list, pos); > } > > static int debug_seq_show(struct seq_file *sfile, void *data) > { > » struct debug_header *header; > » char *p; > > » header= list_entry(data, > » » » struct debug_header, > » » » head_list); > > » seq_printf(sfile, "print info"); > » return 0; > } > static const struct seq_operations debug_seq_ops = { > » .start = debug_seq_start, > » .next = debug_seq_next, > » .stop = debug_seq_stop, > » .show = debug_seq_show, > }; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/