lkml.org 
[lkml]   [2015]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] mm: cma: introduce /proc/cmainfo
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,
> };



\
 
 \ /
  Last update: 2015-01-23 13:41    [W:0.067 / U:7.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site