[PATCH 2/7] autofs - make struct path const in autofs4_dir_open()

From: Ian Kent
Date: Sun Nov 27 2016 - 21:12:13 EST


From: Ian Kent <ikent@xxxxxxxxxx>

There's no reason to copy the file->f_path in autofs4_dir_open() and
f_path is not modified so change it to a "const struct path *".

Signed-off-by: Ian Kent <raven@xxxxxxxxxx>
Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
Cc: Omar Sandoval <osandov@xxxxxxxxxxx>
---
fs/autofs4/root.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index dd2ea5d..3e33f00 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -107,14 +107,14 @@ static int autofs4_dir_open(struct inode *inode, struct file *file)
{
struct dentry *dentry = file->f_path.dentry;
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
- struct path path;
+ const struct path *path;

pr_debug("file=%p dentry=%p %pd\n", file, dentry, dentry);

if (autofs4_oz_mode(sbi))
goto out;

- path = file->f_path;
+ path = &file->f_path;

/*
* An empty directory in an autofs file system is always a
@@ -126,7 +126,7 @@ static int autofs4_dir_open(struct inode *inode, struct file *file)
* it.
*/
spin_lock(&sbi->lookup_lock);
- if (!path_is_mountpoint(&path) && simple_empty(dentry)) {
+ if (!path_is_mountpoint(path) && simple_empty(dentry)) {
spin_unlock(&sbi->lookup_lock);
return -ENOENT;
}