From 32ccd2b61dfd05401528b27770ab3cd22b143641 Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Tue, 20 May 2003 06:58:17 -0700 Subject: [PATCH] seq_path(), /proc/mounts and /proc/swaps This adds a new seq_...() helper: seq_path(seq_file, mnt, dentry, escape) It spits the pathname into seq_file, does octal escapes for given set of characters, returns the number of characters it'd produced or -1 in case of error. Long names are handled gracefully - you don't need anything to do, generic seq_file logics will do the right thing. /proc/mounts and /proc/swaps are converted to use of seq_path(), some junk removed. /proc/pid/maps will be converted next. --- fs/namespace.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'fs/namespace.c') diff --git a/fs/namespace.c b/fs/namespace.c index 6c46fbda724d..09238867b43b 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -211,19 +211,10 @@ static int show_vfsmnt(struct seq_file *m, void *v) { 0, NULL } }; struct proc_fs_info *fs_infop; - char *path_buf, *path; - - path_buf = (char *) __get_free_page(GFP_KERNEL); - if (!path_buf) - return -ENOMEM; - path = d_path(mnt->mnt_root, mnt, path_buf, PAGE_SIZE); - if (IS_ERR(path)) - path = " (too long)"; mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none"); seq_putc(m, ' '); - mangle(m, path); - free_page((unsigned long) path_buf); + seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); seq_putc(m, ' '); mangle(m, mnt->mnt_sb->s_type->name); seq_puts(m, mnt->mnt_sb->s_flags & MS_RDONLY ? " ro" : " rw"); -- cgit v1.2.3