From: <P@draigBrady.com>

Make smaps output match the maps output, as smaps was not showing info like
which map was heap and stack etc.  The code is smaller also, as show_smap()
now just calls show_map().

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 fs/proc/task_mmu.c |   21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)

diff -puN fs/proc/task_mmu.c~smaps-print-more-fields fs/proc/task_mmu.c
--- devel/fs/proc/task_mmu.c~smaps-print-more-fields	2005-07-12 17:18:17.000000000 -0700
+++ devel-akpm/fs/proc/task_mmu.c	2005-07-12 17:18:17.000000000 -0700
@@ -123,9 +123,9 @@ static int show_map(struct seq_file *m, 
 	 * Print the dentry name for named mappings, and a
 	 * special [heap] marker for the heap:
 	 */
-	if (vma->vm_file) {
+	if (file) {
 		pad_len_spaces(m, len);
-		seq_path(m, file->f_vfsmnt, file->f_dentry, "");
+		seq_path(m, file->f_vfsmnt, file->f_dentry, "\n");
 	} else {
 		if (mm) {
 			if (vma->vm_start <= mm->start_brk &&
@@ -247,32 +247,21 @@ static inline void smaps_pgd_range(struc
 static int show_smap(struct seq_file *m, void *v)
 {
 	struct vm_area_struct *vma = v;
-	struct file *file = vma->vm_file;
-	int flags = vma->vm_flags;
 	struct mm_struct *mm = vma->vm_mm;
 	unsigned long vma_len = (vma->vm_end - vma->vm_start);
 	struct mem_size_stats mss;
 
 	memset(&mss, 0, sizeof mss);
 
+	show_map(m, v);
+
 	if (mm) {
 		spin_lock(&mm->page_table_lock);
 		smaps_pgd_range(vma, vma->vm_start, vma->vm_end, &mss);
 		spin_unlock(&mm->page_table_lock);
 	}
 
-	seq_printf(m, "%08lx-%08lx %c%c%c%c ",
-		   vma->vm_start,
-		   vma->vm_end,
-		   flags & VM_READ ? 'r' : '-',
-		   flags & VM_WRITE ? 'w' : '-',
-		   flags & VM_EXEC ? 'x' : '-',
-		   flags & VM_MAYSHARE ? 's' : 'p');
-
-	if (vma->vm_file)
-		seq_path(m, file->f_vfsmnt, file->f_dentry, " \t\n\\");
-
-	seq_printf(m, "\n"
+	seq_printf(m,
 		   "Size:          %8lu kB\n"
 		   "Rss:           %8lu kB\n"
 		   "Shared_Clean:  %8lu kB\n"
_