mirror of https://gitee.com/openkylin/linux.git
Make /proc/modules use seq_list_xxx helpers
Here there is not need even in .show callback altering. The original code passes list_head in *v. Signed-off-by: Pavel Emelianov <xemul@openvz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
46c65b71e6
commit
708f4b5223
|
@ -2232,26 +2232,13 @@ unsigned long module_kallsyms_lookup_name(const char *name)
|
||||||
/* Called by the /proc file system to return a list of modules. */
|
/* Called by the /proc file system to return a list of modules. */
|
||||||
static void *m_start(struct seq_file *m, loff_t *pos)
|
static void *m_start(struct seq_file *m, loff_t *pos)
|
||||||
{
|
{
|
||||||
struct list_head *i;
|
|
||||||
loff_t n = 0;
|
|
||||||
|
|
||||||
mutex_lock(&module_mutex);
|
mutex_lock(&module_mutex);
|
||||||
list_for_each(i, &modules) {
|
return seq_list_start(&modules, *pos);
|
||||||
if (n++ == *pos)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == &modules)
|
|
||||||
return NULL;
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *m_next(struct seq_file *m, void *p, loff_t *pos)
|
static void *m_next(struct seq_file *m, void *p, loff_t *pos)
|
||||||
{
|
{
|
||||||
struct list_head *i = p;
|
return seq_list_next(p, &modules, pos);
|
||||||
(*pos)++;
|
|
||||||
if (i->next == &modules)
|
|
||||||
return NULL;
|
|
||||||
return i->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void m_stop(struct seq_file *m, void *p)
|
static void m_stop(struct seq_file *m, void *p)
|
||||||
|
|
Loading…
Reference in New Issue