Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bf39ab2 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Al Viro
Browse files

vfs: add file_path() helper



Turn
	d_path(&file->f_path, ...);
into
	file_path(file, ...);

Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 4bacc9c9
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -67,15 +67,12 @@ static void print_task_path_n_nm(struct task_struct *tsk, char *buf)
	mmput(mm);

	if (exe_file) {
		path = exe_file->f_path;
		path_get(&exe_file->f_path);
		path_nm = file_path(exe_file, buf, 255);
		fput(exe_file);
		path_nm = d_path(&path, buf, 255);
		path_put(&path);
	}

done:
	pr_info("Path: %s\n", path_nm);
	pr_info("Path: %s\n", !IS_ERR(path_nm) ? path_nm : "?");
}

static void show_faulting_vma(unsigned long address, char *buf)
@@ -99,8 +96,7 @@ static void show_faulting_vma(unsigned long address, char *buf)
	if (vma && (vma->vm_start <= address)) {
		struct file *file = vma->vm_file;
		if (file) {
			struct path *path = &file->f_path;
			nm = d_path(path, buf, PAGE_SIZE - 1);
			nm = file_path(file, buf, PAGE_SIZE - 1);
			inode = file_inode(vma->vm_file);
			dev = inode->i_sb->s_dev;
			ino = inode->i_ino;
+1 −1
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ void decode_address(char *buf, unsigned long address)
				struct file *file = vma->vm_file;

				if (file) {
					char *d_name = d_path(&file->f_path, _tmpbuf,
					char *d_name = file_path(file, _tmpbuf,
						      sizeof(_tmpbuf));
					if (!IS_ERR(d_name))
						name = d_name;
+1 −1
Original line number Diff line number Diff line
@@ -334,7 +334,7 @@ static void describe_addr(struct KBacktraceIterator *kbt,
	}

	if (vma->vm_file) {
		p = d_path(&vma->vm_file->f_path, buf, bufsize);
		p = file_path(vma->vm_file, buf, bufsize);
		if (IS_ERR(p))
			p = "?";
		name = kbasename(p);
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ static int notify_exec(struct mm_struct *mm)
	if (exe_file == NULL)
		goto done_free;

	path = d_path(&exe_file->f_path, buf, PAGE_SIZE);
	path = file_path(exe_file, buf, PAGE_SIZE);
	if (IS_ERR(path))
		goto done_put;

+1 −1
Original line number Diff line number Diff line
@@ -568,7 +568,7 @@ static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf)

	spin_lock_irq(&lo->lo_lock);
	if (lo->lo_backing_file)
		p = d_path(&lo->lo_backing_file->f_path, buf, PAGE_SIZE - 1);
		p = file_path(lo->lo_backing_file, buf, PAGE_SIZE - 1);
	spin_unlock_irq(&lo->lo_lock);

	if (IS_ERR_OR_NULL(p))
Loading