]> err.no Git - linux-2.6/blobdiff - fs/proc/nommu.c
/proc/self/maps doesn't display the real file offset
[linux-2.6] / fs / proc / nommu.c
index cff10ab1af630c69aa8d3a9af4f450834f120247..3f87d2632947371b47df580c32d041fb39bb91ba 100644 (file)
 #include "internal.h"
 
 /*
- * display a list of all the VMAs the kernel knows about
- * - nommu kernals have a single flat list
+ * display a single VMA to a sequenced file
  */
-static int nommu_vma_list_show(struct seq_file *m, void *v)
+int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
 {
-       struct vm_area_struct *vma;
        unsigned long ino = 0;
        struct file *file;
        dev_t dev = 0;
        int flags, len;
 
-       vma = rb_entry((struct rb_node *) v, struct vm_area_struct, vm_rb);
-
        flags = vma->vm_flags;
        file = vma->vm_file;
 
        if (file) {
-               struct inode *inode = vma->vm_file->f_dentry->d_inode;
+               struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
                dev = inode->i_sb->s_dev;
                ino = inode->i_ino;
        }
 
        seq_printf(m,
-                  "%08lx-%08lx %c%c%c%c %08lx %02x:%02x %lu %n",
+                  "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
                   vma->vm_start,
                   vma->vm_end,
                   flags & VM_READ ? 'r' : '-',
                   flags & VM_WRITE ? 'w' : '-',
                   flags & VM_EXEC ? 'x' : '-',
                   flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
-                  vma->vm_pgoff << PAGE_SHIFT,
+                  ((loff_t)vma->vm_pgoff) << PAGE_SHIFT,
                   MAJOR(dev), MINOR(dev), ino, &len);
 
        if (file) {
@@ -71,13 +67,25 @@ static int nommu_vma_list_show(struct seq_file *m, void *v)
                if (len < 1)
                        len = 1;
                seq_printf(m, "%*c", len, ' ');
-               seq_path(m, file->f_vfsmnt, file->f_dentry, "");
+               seq_path(m, &file->f_path, "");
        }
 
        seq_putc(m, '\n');
        return 0;
 }
 
+/*
+ * display a list of all the VMAs the kernel knows about
+ * - nommu kernals have a single flat list
+ */
+static int nommu_vma_list_show(struct seq_file *m, void *v)
+{
+       struct vm_area_struct *vma;
+
+       vma = rb_entry((struct rb_node *) v, struct vm_area_struct, vm_rb);
+       return nommu_vma_show(m, vma);
+}
+
 static void *nommu_vma_list_start(struct seq_file *m, loff_t *_pos)
 {
        struct rb_node *_rb;
@@ -108,7 +116,7 @@ static void *nommu_vma_list_next(struct seq_file *m, void *v, loff_t *pos)
        return rb_next((struct rb_node *) v);
 }
 
-static struct seq_operations proc_nommu_vma_list_seqop = {
+static const struct seq_operations proc_nommu_vma_list_seqop = {
        .start  = nommu_vma_list_start,
        .next   = nommu_vma_list_next,
        .stop   = nommu_vma_list_stop,
@@ -120,7 +128,7 @@ static int proc_nommu_vma_list_open(struct inode *inode, struct file *file)
        return seq_open(file, &proc_nommu_vma_list_seqop);
 }
 
-static struct file_operations proc_nommu_vma_list_operations = {
+static const struct file_operations proc_nommu_vma_list_operations = {
        .open    = proc_nommu_vma_list_open,
        .read    = seq_read,
        .llseek  = seq_lseek,
@@ -129,7 +137,7 @@ static struct file_operations proc_nommu_vma_list_operations = {
 
 static int __init proc_nommu_init(void)
 {
-       create_seq_entry("maps", S_IRUGO, &proc_nommu_vma_list_operations);
+       proc_create("maps", S_IRUGO, NULL, &proc_nommu_vma_list_operations);
        return 0;
 }