Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b92151bab91ef906378d3e0e7128d55dd641e966
Commit:     b92151bab91ef906378d3e0e7128d55dd641e966
Parent:     68e116a3b57d09b220fe38712bebd956b6dbbbc6
Author:     Pavel Emelianov <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 15 23:38:04 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Jul 16 09:05:35 2007 -0700

    Make /proc/slabinfo use seq_list_xxx helpers
    
    This entry prints a header in .start callback.  This is OK, but the more
    elegant solution would be to move this into the .show callback and use
    seq_list_start_head() in .start one.
    
    I have left it as is in order to make the patch just switch to new API and
    noting more.
    
    [EMAIL PROTECTED]: Wrong pointer was used as kmem_cache pointer]
    Signed-off-by: Pavel Emelianov <[EMAIL PROTECTED]>
    Cc: Christoph Lameter <[EMAIL PROTECTED]>
    Cc: Pekka Enberg <[EMAIL PROTECTED]>
    Signed-off-by: Alexey Dobriyan <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/slab.c |   30 ++++++------------------------
 1 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index b344e67..a6a2fcf 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4157,26 +4157,17 @@ static void print_slabinfo_header(struct seq_file *m)
 static void *s_start(struct seq_file *m, loff_t *pos)
 {
        loff_t n = *pos;
-       struct list_head *p;
 
        mutex_lock(&cache_chain_mutex);
        if (!n)
                print_slabinfo_header(m);
-       p = cache_chain.next;
-       while (n--) {
-               p = p->next;
-               if (p == &cache_chain)
-                       return NULL;
-       }
-       return list_entry(p, struct kmem_cache, next);
+
+       return seq_list_start(&cache_chain, *pos);
 }
 
 static void *s_next(struct seq_file *m, void *p, loff_t *pos)
 {
-       struct kmem_cache *cachep = p;
-       ++*pos;
-       return cachep->next.next == &cache_chain ?
-               NULL : list_entry(cachep->next.next, struct kmem_cache, next);
+       return seq_list_next(p, &cache_chain, pos);
 }
 
 static void s_stop(struct seq_file *m, void *p)
@@ -4186,7 +4177,7 @@ static void s_stop(struct seq_file *m, void *p)
 
 static int s_show(struct seq_file *m, void *p)
 {
-       struct kmem_cache *cachep = p;
+       struct kmem_cache *cachep = list_entry(p, struct kmem_cache, next);
        struct slab *slabp;
        unsigned long active_objs;
        unsigned long num_objs;
@@ -4355,17 +4346,8 @@ ssize_t slabinfo_write(struct file *file, const char 
__user * buffer,
 
 static void *leaks_start(struct seq_file *m, loff_t *pos)
 {
-       loff_t n = *pos;
-       struct list_head *p;
-
        mutex_lock(&cache_chain_mutex);
-       p = cache_chain.next;
-       while (n--) {
-               p = p->next;
-               if (p == &cache_chain)
-                       return NULL;
-       }
-       return list_entry(p, struct kmem_cache, next);
+       return seq_list_start(&cache_chain, *pos);
 }
 
 static inline int add_caller(unsigned long *n, unsigned long v)
@@ -4430,7 +4412,7 @@ static void show_symbol(struct seq_file *m, unsigned long 
address)
 
 static int leaks_show(struct seq_file *m, void *p)
 {
-       struct kmem_cache *cachep = p;
+       struct kmem_cache *cachep = list_entry(p, struct kmem_cache, next);
        struct slab *slabp;
        struct kmem_list3 *l3;
        const char *name;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to